.customization-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

.customization-title {
  text-align: center;
  font-family: "Cinzel", serif;
  color: var(--text);
  margin-bottom: 20px;
}

.customization-title i {
  margin-right: 8px;
  color: #c8960c;
}

.customization-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.customization-preview {
  flex: 0 0 220px;
  background: var(--surface-subtle);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.customization-preview h3 {
  margin: 0 0 12px;
  font-family: "Cinzel", serif;
  color: var(--text);
  font-size: 1rem;
}

.customization-preview-castle {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  min-height: 160px;
}

.preview-image-container {
  position: relative;
  width: 120px;
}

.preview-image-container img.preview-castle-img {
  width: 100%;
  display: block;
}

.preview-wall-container {
  width: 30px;
  height: 120px;
  position: relative;
  display: flex;
  align-items: flex-end;
}

.preview-wall-texture {
  width: 100%;
  background-size: cover;
  background-repeat: no-repeat;
  border-radius: 2px;
}

.preview-image-container {
  overflow: visible;
}

.preview-label {
  font-size: 0.8rem;
  color: #c8960c;
  margin-top: 10px;
  font-style: italic;
}

.preview-reset-btn {
  margin-top: 8px;
  font-size: 0.75rem;
}

#customization-content {
  flex: 1;
  min-width: 0;
}

.customization-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.customization-tab {
  flex: 1;
  padding: 10px 16px;
  background: var(--surface-subtle);
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-family: "Cinzel", serif;
  font-size: 0.85rem;
  transition: background 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.customization-tab:hover {
  background: var(--surface-hover);
  border-color: var(--surface-border-hover);
}

.customization-tab.active {
  background: #c8960c;
  border-color: #c8960c;
  color: #fff;
}

.customization-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.customization-item {
  background: var(--surface-subtle);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  transition: border-color 0.2s;
}

.customization-item.equipped {
  border-color: #c8960c;
  box-shadow: 0 0 8px rgba(200, 150, 12, 0.3);
}

.customization-item-preview {
  width: 100%;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.customization-item-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.customization-item-info {
  margin-bottom: 8px;
}

.customization-item-name {
  display: block;
  font-family: "Cinzel", serif;
  font-size: 0.85rem;
  color: var(--text);
}

.customization-item-slot {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--number);
  text-transform: uppercase;
  margin-top: 2px;
}

.customization-item-actions {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.customization-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: "Comfortaa", sans-serif;
  transition: background 0.2s;
}

.customization-btn-buy {
  background: #c8960c;
  color: #fff;
}

.customization-btn-buy:hover {
  background: #a87d0a;
}

.customization-btn-promo {
  background: #e63946;
  animation: promoPulse 2s ease-in-out infinite;
}

.customization-btn-promo:hover {
  background: #c5303c;
}

@keyframes promoPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(230, 57, 70, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(230, 57, 70, 0); }
}

.customization-btn-equip {
  background: #28a745;
  color: #fff;
}

.customization-btn-equip:hover {
  background: #1e7e34;
}

.customization-btn-unequip {
  background: #6c757d;
  color: #fff;
}

.customization-btn-unequip:hover {
  background: #545b62;
}

.customization-equipped-label {
  font-size: 0.75rem;
  color: #c8960c;
  font-style: italic;
}

.customization-locked-label {
  font-size: 0.75rem;
  color: var(--number);
}

.customization-locked-label i {
  margin-right: 4px;
}

/* Premium-gated renderer (e.g. Mage Tower): gold, button-like, links to /premium */
a.customization-premium-lock {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
  color: #1a0a00;
  background: linear-gradient(to bottom, #ffe88a 0%, #f0b400 48%, #c8960c 100%);
  border: 1px solid #8a6508;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

a.customization-premium-lock:hover {
  filter: brightness(1.08);
}

.customization-coming-soon {
  text-align: center;
  padding: 40px 20px;
  color: var(--number);
}

.customization-coming-soon i {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

.customization-coming-soon p {
  font-family: "Cinzel", serif;
  font-size: 1.2rem;
  color: var(--text);
  margin: 0 0 8px;
}

.customization-coming-soon span {
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .customization-page {
    padding: 12px 8px;
  }

  .customization-layout {
    flex-direction: column;
  }

  .customization-preview {
    flex: none;
    width: 100%;
  }

  .customization-tabs {
    gap: 4px;
  }

  .customization-tab {
    padding: 8px 6px;
    font-size: 0.75rem;
    gap: 4px;
  }

  .customization-tab span {
    display: none;
  }

  .customization-tab i {
    font-size: 1.1rem;
  }

  .customization-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

@media (max-width: 380px) {
  .customization-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}

/* ── Special items ─────────────────────────────────────────────────────────
   Specials change how a match feels rather than how it looks, so they have no
   artwork — an icon stands in for the preview image, and they carry a sentence
   of description instead of a one-word slot name. */
.customization-item-icon {
  font-size: 3rem;
  color: #c8960c;
  opacity: 0.9;
}

/* Frame-per-strike sprite. Both frames are stacked and only one is shown, so
   swapping costs a class toggle and never re-decodes an image mid-beat. */
.cwl-drum-sprite {
  position: relative;
  height: 100%;
  aspect-ratio: 180 / 320;
}

.cwl-drum-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
}

.cwl-drum-frame.on {
  opacity: 1;
}

/* A full-body character needs more room than a castle part or a wall swatch. */
.customization-item-preview:has(.cwl-drum-sprite) {
  height: 150px;
}

.customization-item-desc {
  display: block;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--number);
  margin-top: 3px;
}

/* A special can show an audition button alongside buy/equip. */
.customization-item-actions {
  flex-wrap: wrap;
  gap: 6px;
}

.customization-btn-preview {
  background: #3a3350;
  color: #e8dfd0;
  border: 1px solid #5b5175;
}

.customization-btn-preview:hover {
  background: #4a4166;
}

.customization-btn-compose {
  background: #6d5a2a;
  color: #f0e6d2;
  border: 1px solid #8d7434;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.customization-btn-compose:hover {
  background: #8d7434;
}

/* Between the phone layout and wide desktops the six tabs did not fit beside
   the preview and pushed the page wider than the screen (641–1024px). Let
   the content column shrink and the tabs wrap onto a second row. */
#customization-content { flex: 1; min-width: 0; }
.customization-tabs { flex-wrap: wrap; }
.customization-tab { white-space: nowrap; }
