/* ============================================================
   AnthemForge — "Stadium Glass" design system
   Apple-clean glassmorphism on a night-match backdrop:
   frosted translucent cards, floodlight glows, volt + cyan
   sport accents, minimal type, big rounded geometry.
   ============================================================ */

:root {
  --bg-0: #04060d;
  --bg-1: #0a1122;
  --glass: rgba(255, 255, 255, 0.2);
  --glass-strong: rgba(255, 255, 255, 0.28);
  --stroke: rgba(255, 255, 255, 0.1);
  --stroke-strong: rgba(255, 255, 255, 0.18);
  --text: #f4f7ff;
  --muted: rgba(214, 224, 248, 0.62);
  --accent: #a3ff3c;      /* volt — pitch-line green */
  --accent-2: #2fd9ff;    /* floodlight cyan */
  --accent-3: #ff4d8d;    /* flare magenta */
  --error: #ff8089;
  --radius-xl: 26px;
  --radius-md: 15px;
  --shadow-card: 0 20px 50px rgba(0, 0, 0, 0.45);
  --glow-accent: 0 8px 34px rgba(163, 255, 60, 0.35);
  --bg-veil: rgba(4, 6, 13, 0.74);
  /* Translucent so the video stays full-bleed across the whole hero (no solid
     black panels around the letters); the letters are clear windows that read
     brighter than the dimmed surroundings. */
  --hero-veil: rgba(5, 7, 14, 0.5);
  --hero-outline: rgba(255, 255, 255, 0.95);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--text);
  min-height: 100vh;
  background: var(--bg-0);
  background-image:
    radial-gradient(900px 520px at 12% -6%, rgba(47, 217, 255, 0.16), transparent 62%),
    radial-gradient(820px 540px at 88% 4%, rgba(163, 255, 60, 0.13), transparent 60%),
    radial-gradient(900px 700px at 50% 110%, rgba(255, 77, 141, 0.1), transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0) 45%);
  background-attachment: fixed;
}

/* Pinned crowd photo behind everything, softly blurred, with a frosted-glass
   veil over it so menus, headers and cards stay readable. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: url("/assets/bg-crowd.jpg") center / cover no-repeat;
  filter: url(#glass-ripple) blur(3px) saturate(1.08);
  transform: scale(1.14); /* hide displaced/blurred edges */
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg-veil);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

::selection { background: rgba(163, 255, 60, 0.35); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  /* Mobile-first height; dvh tracks the mobile address-bar so it never jumps. */
  min-height: clamp(420px, 80vh, 620px);
  min-height: clamp(420px, 80dvh, 620px);
}
.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  transform: scale(1.16); /* headroom so parallax translate never shows edges */
  will-change: transform;
}
/* Giant ROAR/OAR/OAR: a veil covers everything except the letters (masked out
   in the SVG), so the video plays inside the glyphs; outlined text adds
   contrast. .hero-knockout is oversized so parallax can't reveal its edges. */
/* Frosted, rippled glass over the video — covers the hero except the ROAR
   letters (mask with letter holes is generated + kept in sync by JS). The
   backdrop-filter blurs + ripples the footage so it reads as real glass. */
.hero-glass {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 24%),
    var(--hero-veil);
  -webkit-backdrop-filter: blur(8px) saturate(125%) url(#hero-glass-ripple);
  backdrop-filter: blur(8px) saturate(125%) url(#hero-glass-ripple);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  animation: roarReveal 1.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.hero-knockout {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  will-change: transform;
  animation: roarReveal 1.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.hero-knockout text {
  font-family: "Arial Black", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  font-weight: 900;
  font-size: 360px;
  text-anchor: middle;
}
.hero-roar-outlines { animation: roarPulse 3.6s ease-in-out infinite; }
.hero-roar-outline {
  fill: none;
  stroke: var(--hero-outline);
  stroke-width: 3;
  paint-order: stroke;
  opacity: 0.95;
}
/* Cinematic depth: a vignette + a top-down darkening so the wall of letters
   reads against the footage and the tagline stays legible at the base. */
.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% 38%, transparent 52%, rgba(2, 4, 10, 0.55) 100%),
    linear-gradient(to bottom, rgba(2, 4, 10, 0.25) 0%, transparent 22%, transparent 62%, rgba(2, 4, 10, 0.6) 100%);
}
[data-theme="light"] .hero-overlay {
  background:
    radial-gradient(120% 80% at 50% 38%, transparent 54%, rgba(220, 228, 244, 0.55) 100%),
    linear-gradient(to bottom, rgba(220, 228, 244, 0.3) 0%, transparent 24%, transparent 60%, rgba(220, 228, 244, 0.66) 100%);
}
@keyframes roarReveal {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes roarPulse {
  0%, 100% { opacity: 0.78; }
  50% { opacity: 1; }
}
/* Stadium LED perimeter board: a full-bleed pixel-LED ticker under the hero,
   like the advertising hoardings that scroll along the side of a pitch. */
.led-board {
  position: relative;
  overflow: hidden;
  margin: 0 0 1.5rem;
  padding: 0.6rem 0;
  background: linear-gradient(180deg, #070a13, #0b1020 55%, #070a13);
  border-top: 1px solid var(--stroke-strong);
  border-bottom: 1px solid var(--stroke-strong);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.7), 0 12px 30px rgba(0, 0, 0, 0.35);
}
.led-track {
  display: flex;
  width: max-content;
  animation: ledScroll 32s linear infinite;
  will-change: transform;
}
.led-group { display: flex; align-items: center; flex: none; }
.led-msg {
  flex: none;
  padding: 0 1.4rem;
  white-space: nowrap;
  font-family: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", system-ui, sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: clamp(0.92rem, 2.5vw, 1.35rem);
  color: #b8ff5a;
  text-shadow: 0 0 5px rgba(163, 255, 60, 0.85), 0 0 16px rgba(163, 255, 60, 0.45);
}
.led-sep {
  flex: none;
  font-size: 0.95em;
  color: var(--accent-2);
  text-shadow: 0 0 8px rgba(47, 217, 255, 0.8);
}
/* LED dot-matrix grid over the text (multiply) → the pixelated look. */
.led-board::after {
  content: "";
  position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.6) 1px, transparent 1.6px);
  background-size: 3px 3px;
  mix-blend-mode: multiply;
  opacity: 0.55;
}
/* Dark fade on both ends, like the board curving away down the touchline. */
.led-board::before {
  content: "";
  position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: linear-gradient(90deg, #070a13, transparent 7%, transparent 93%, #070a13);
}
@keyframes ledScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) { .led-track { animation: none; } }
.pitch-note { text-align: center; }

/* ---------- Guided stages (1 → 4) ---------- */
.form-title { margin-bottom: 0.2rem; }
.stages { list-style: none; margin: 1.3rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 1.6rem; }
.stage { position: relative; animation: stageIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both; }
.stage:nth-child(2) { animation-delay: 0.07s; }
.stage:nth-child(3) { animation-delay: 0.14s; }
.stage:nth-child(4) { animation-delay: 0.21s; }
/* Connector line linking the step numbers into a clear 1→4 path. */
.stage:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 16px; top: 38px; bottom: -1.6rem; width: 2px;
  background: linear-gradient(var(--stroke-strong), rgba(255, 255, 255, 0.04));
}
.stage-head { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 0.7rem; }
.stage-num {
  flex: none; width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 999px; font-weight: 800; font-size: 1rem;
  color: #06210a; background: var(--accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 20%, transparent);
}
.stage-titles { display: flex; flex-direction: column; gap: 0.12rem; padding-top: 0.1rem; }
.stage-title { font-weight: 700; font-size: 1.04rem; color: var(--text); line-height: 1.2; }
.stage-hint { font-size: 0.85rem; color: var(--muted); line-height: 1.4; }
.stage-body { padding-left: calc(32px + 0.75rem); }
.stage-go .stage-body { padding-left: 0; }
@keyframes stageIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (max-width: 480px) {
  .stage-body { padding-left: 0; }
  .stage:not(:last-child)::before { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .led-track,
  .hero-glass,
  .hero-knockout,
  .hero-roar-outlines,
  .stage { animation: none; }
}

/* Mobile-first scale-up. The SVG text auto-fits via "meet", so we only grow the
   hero's height per device class — taller screens let the letter block fill more.
   Fold phones (~280px) and portrait phones already get the full-width fit. */
@media (min-width: 600px) {            /* large phones landscape / small tablets */
  .hero { min-height: clamp(480px, 78dvh, 720px); }
}
@media (min-width: 768px) {            /* tablets */
  .hero { min-height: clamp(560px, 80dvh, 820px); }
  .hero-roar-outline { stroke-width: 3.5; }
}
@media (min-width: 1024px) {           /* desktop */
  .hero { min-height: clamp(620px, 88vh, 940px); }
}

.mock-badge {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.35rem 0.95rem;
  border: 1px solid var(--stroke-strong);
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--accent) !important;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

main {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 1.1rem 4rem;
}

/* ---------- Glass cards ---------- */

.card {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: blur(34px) saturate(185%);
  backdrop-filter: blur(34px) saturate(185%);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius-xl);
  padding: 1.7rem 1.6rem;
  margin-bottom: 1.6rem;
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06);
}

.card h2 {
  margin: 1.9rem 0 0.9rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card h2::before {
  content: "";
  width: 1.4rem;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  flex-shrink: 0;
}

.card h2:first-child { margin-top: 0; }

.muted {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.86rem;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.45;
}

/* ---------- Form ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--muted);
}

label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  align-self: end;
  padding-bottom: 0.7rem;
  color: var(--text);
}

input[type="checkbox"] { accent-color: var(--accent); width: 17px; height: 17px; }
input[type="email"] { min-width: 220px; }

input[type="text"], input[type="email"], input[type="search"], input:not([type]), select, textarea {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  color: var(--text);
  padding: 0.72rem 0.85rem;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.1rem;
}

select option { background: #0c1326; color: var(--text); }

textarea {
  width: 100%;
  resize: vertical;
  margin-top: 0.7rem;
  line-height: 1.55;
}

input::placeholder, textarea::placeholder { color: rgba(214, 224, 248, 0.35); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(163, 255, 60, 0.65);
  box-shadow: 0 0 0 3px rgba(163, 255, 60, 0.16);
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- Advanced options accordion ---------- */
details.advanced {
  margin-top: 1.6rem;
  border-top: 1px solid var(--stroke);
}
details.advanced > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.95rem 0 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  user-select: none;
}
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::before {
  content: "+";
  display: inline-block;
  width: 1.1em;
  color: var(--accent);
  font-weight: 800;
}
details.advanced[open] > summary::before { content: "–"; }
details.advanced[open] > summary { color: var(--text); }

/* The lyrics-options accordion tucks directly under the lyrics box. */
#lyricsOptions { margin-top: 0.5rem; border-top: none; }
#lyricsOptions > summary { padding-top: 0.4rem; }


.lyrics-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

/* ---------- Buttons ---------- */

button {
  cursor: pointer;
  border: none;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.68rem 1.3rem;
  font-family: inherit;
  transition: transform 0.16s ease, box-shadow 0.2s ease, background 0.2s ease,
    border-color 0.2s ease, color 0.2s ease;
}

button:active:not(:disabled) { transform: scale(0.97); }

button.primary {
  width: 100%;
  margin-top: 1.5rem;
  padding: 1rem;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #071200;
  background: linear-gradient(115deg, var(--accent), #d3ff44 50%, var(--accent-2) 130%);
  box-shadow: var(--glow-accent);
}

button.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 44px rgba(163, 255, 60, 0.5);
}

button.primary:disabled { opacity: 0.55; cursor: wait; box-shadow: none; }

button.secondary {
  background: var(--glass-strong);
  border: 1px solid var(--stroke);
  color: var(--text);
  font-size: 0.87rem;
  padding: 0.52rem 1.05rem;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

button.secondary:hover:not(:disabled) {
  border-color: rgba(163, 255, 60, 0.55);
  color: var(--accent);
}

/* Funny-mode pill: same secondary shape, with an obvious accent "on" state. */
.funny-toggle[aria-pressed="true"],
.funny-toggle[aria-pressed="true"]:hover:not(:disabled) {
  background: linear-gradient(115deg, rgba(163, 255, 60, 0.92), rgba(47, 217, 255, 0.85));
  border-color: transparent;
  color: #071200;
  font-weight: 700;
}

/* ---------- Progress ---------- */

.progress {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--muted);
}

.spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  background: conic-gradient(from 0deg, transparent 12%, var(--accent), var(--accent-2));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px));
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Tracks / anthem wall ---------- */

.results { display: grid; gap: 1rem; }

/* Anthem-wall controls (filters / search / sort) + pagination. */
.gallery-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}
.gallery-controls input[type="search"] { flex: 1 1 170px; min-width: 130px; }
.gallery-controls select { flex: 0 1 auto; font-size: 0.88rem; padding-top: 0.5rem; padding-bottom: 0.5rem; }
.gallery-mine {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.gallery-mine input { width: auto; margin: 0; }
.gallery-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.1rem;
}
.gallery-pagination #galleryStatus { font-size: 0.82rem; }
.gallery-pagination button.secondary { padding: 0.4rem 0.95rem; }
.gallery-pagination button.secondary:disabled { opacity: 0.4; cursor: default; transform: none; }

.track {
  display: flex;
  gap: 1rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--stroke);
  border-radius: 20px;
  padding: 1rem 1.05rem;
  flex-wrap: wrap;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.track:hover { border-color: var(--stroke-strong); transform: translateY(-1px); }

.track img {
  width: 76px;
  height: 76px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
}

/* Cover photo links through to the anthem's own page. */
.track a.track-photo { flex: none; display: inline-flex; border-radius: 14px; transition: transform 0.2s ease; }
.track a.track-photo:hover { transform: translateY(-2px); }
.track a.track-photo:hover img { box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55); }

.track .info { flex: 1; min-width: 200px; }
.track .info strong {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 1rem;
  letter-spacing: -0.01em;
}
.track .info > span.muted { display: block; margin-bottom: 0.5rem; font-size: 0.78rem; }

/* ---------- Custom compact anthem player ---------- */
.afp {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  margin: 0.15rem 0 0.1rem;
  padding: 0.45rem 0.7rem 0.45rem 0.45rem;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  border: 1px solid var(--stroke);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: border-color 0.2s ease, box-shadow 0.3s ease;
}
.afp.is-playing {
  border-color: rgba(163, 255, 60, 0.42);
  box-shadow: 0 6px 28px rgba(163, 255, 60, 0.16);
}
.afp audio { display: none; }

.afp-play {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  color: #052407;
  background: radial-gradient(125% 125% at 30% 18%, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px rgba(163, 255, 60, 0.42);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.afp-play:hover { transform: scale(1.07); box-shadow: 0 8px 24px rgba(163, 255, 60, 0.55); }
.afp-play:active { transform: scale(0.93); }
.afp-play svg { width: 19px; height: 19px; fill: currentColor; }

.afp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.34rem; }

.afp-bar {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  cursor: pointer;
  touch-action: none;
}
.afp-bar:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 4px; }
.afp-fill {
  position: relative;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}
.afp-thumb {
  position: absolute;
  right: -6px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transform: translateY(-50%) scale(0);
  transition: transform 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}
.afp:hover .afp-thumb,
.afp-bar:focus-visible .afp-thumb,
.afp.is-playing .afp-thumb { transform: translateY(-50%) scale(1); }

.afp-time {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.afp-eq {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 18px;
  height: 22px;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.afp.is-playing .afp-eq { opacity: 0.95; }
.afp-eq i {
  flex: 1;
  height: 30%;
  border-radius: 2px;
  background: linear-gradient(var(--accent), var(--accent-2));
}
.afp.is-playing .afp-eq i { animation: afp-eq 0.9s ease-in-out infinite; }
.afp-eq i:nth-child(2) { animation-delay: 0.18s; }
.afp-eq i:nth-child(3) { animation-delay: 0.36s; }
.afp-eq i:nth-child(4) { animation-delay: 0.54s; }
@keyframes afp-eq {
  0%, 100% { height: 22%; }
  50% { height: 95%; }
}
@media (prefers-reduced-motion: reduce) {
  .afp.is-playing .afp-eq i { animation: none; height: 55%; }
}

.track a.download {
  display: inline-block;
  margin-top: 0.55rem;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
}
.track a.download:hover { color: var(--accent-2); }

/* ---------- TikTok-branded button (official black + glitch note logo) ---------- */
.tiktok-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #000;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 0.62rem 1.05rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.tiktok-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5); border-color: rgba(255, 255, 255, 0.28); }
.tiktok-btn:active { transform: translateY(0); }
.tiktok-btn .tt-logo { width: 20px; height: 20px; flex: none; }
.tiktok-btn.tiktok-btn--sm { padding: 0.42rem 0.82rem; font-size: 0.82rem; border-radius: 9px; }
.tiktok-btn.tiktok-btn--sm .tt-logo { width: 17px; height: 17px; }
.track a.anthem-page-link {
  display: inline-block;
  margin-top: 0.55rem;
  margin-left: 0.9rem;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
}
.track a.anthem-page-link:hover { color: var(--accent-2); }
.seo-latest-list { list-style: none; padding: 0; margin: 0.6rem 0 0; }
.seo-latest-list li { padding: 0.4rem 0; border-bottom: 1px solid rgba(127,127,127,.15); }
.seo-latest-list a { color: var(--accent); text-decoration: none; font-weight: 600; }
.seo-latest-list a:hover { color: var(--accent-2); }

.error { color: var(--error); font-size: 0.9rem; }
.hidden { display: none !important; }

/* ---------- Team search combobox ---------- */

.combobox { position: relative; display: block; }
.combobox input { width: 100%; }
/* When the team dropdown is open, lift its whole stage above the following
   steps so the list can never render behind later content. */
.stage:has(.combobox-list:not(.hidden)) { z-index: 40; }

.combobox-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  /* Near-opaque so lower steps never bleed through the dropdown. */
  background: rgba(11, 16, 33, 0.985);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  backdrop-filter: blur(28px) saturate(170%);
  border: 1px solid var(--stroke-strong);
  border-radius: 16px;
  max-height: 290px;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.combobox-list li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.92rem;
}

.combobox-list .team-icon {
  flex: none;
  width: 1.6em;
  text-align: center;
  font-size: 1.05rem;
}
.combobox-list .team-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
  min-width: 0;
}
.combobox-list .team-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combobox-list li:hover,
.combobox-list li.active { background: rgba(163, 255, 60, 0.12); }

.combobox-list .team-meta {
  color: var(--muted);
  font-size: 0.74rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Chips (chants + styles) ---------- */

.chant-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.chant-chip {
  background: var(--glass);
  border: 1px solid var(--stroke);
  color: var(--text);
  font-size: 0.83rem;
  font-weight: 500;
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.chant-chip:hover { border-color: rgba(163, 255, 60, 0.55); }

.chant-chip.selected {
  background: linear-gradient(115deg, rgba(163, 255, 60, 0.92), rgba(47, 217, 255, 0.85));
  border-color: transparent;
  color: #071200;
  font-weight: 700;
  box-shadow: 0 4px 18px rgba(163, 255, 60, 0.3);
}

/* ---------- Grouped, searchable style dropdown ---------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.style-field { display: flex; flex-direction: column; gap: 0.4rem; }
.style-field .field-label { font-size: 0.84rem; font-weight: 500; color: var(--muted); }
.style-select { position: relative; }

.style-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  width: 100%; text-align: left; cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--stroke); border-radius: var(--radius-md);
  color: var(--text); padding: 0.72rem 0.85rem; font: inherit; font-size: 0.95rem;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.style-trigger:hover { border-color: rgba(163, 255, 60, 0.55); }
.style-trigger:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(163, 255, 60, 0.25);
}
.style-trigger-text {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted);
}
.style-select.has-selection .style-trigger-text { color: var(--text); font-weight: 600; }
.style-trigger-caret { color: var(--muted); transition: transform 0.2s ease; }
.style-trigger[aria-expanded="true"] .style-trigger-caret { transform: rotate(180deg); }

.style-panel {
  box-sizing: border-box; inset: auto; margin: 0;
  max-height: min(60vh, 430px); overflow-y: auto;
  padding: 0; border: 1px solid var(--stroke); border-radius: var(--radius-md);
  background: rgba(10, 17, 34, 0.97);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.55);
  color: var(--text);
  opacity: 0; transform: translateY(-6px);
  transition: opacity 0.16s ease, transform 0.16s ease,
    overlay 0.16s allow-discrete, display 0.16s allow-discrete;
}
.style-panel:popover-open, .style-panel.is-open { opacity: 1; transform: none; }
@starting-style { .style-panel:popover-open { opacity: 0; transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .style-panel { transition: none; } }

.style-search-row {
  position: sticky; top: 0; z-index: 3; padding: 0.6rem;
  background: rgba(10, 17, 34, 0.98); border-bottom: 1px solid var(--stroke);
}
.style-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.style-panel-title {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted);
}
.style-panel-count {
  flex: none; font-size: 0.72rem; font-weight: 700;
  font-variant-numeric: tabular-nums; color: #071200;
  padding: 0.16rem 0.5rem; border-radius: 999px;
  background: linear-gradient(115deg, var(--accent), var(--accent-2));
}
.style-panel-actions { display: flex; align-items: center; gap: 0.5rem; flex: none; }
.style-close {
  flex: none; padding: 0.3rem 0.85rem;
  font-size: 0.78rem; font-weight: 700;
  border: none; border-radius: 999px; cursor: pointer;
  color: #071200;
  background: linear-gradient(115deg, var(--accent), var(--accent-2));
}
.style-close:hover { filter: brightness(1.06); }
.style-close:active { transform: scale(0.97); }
.style-search { width: 100%; font-size: 0.9rem; }

.style-group-h {
  position: sticky; top: 3.1rem; z-index: 1;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); padding: 0.55rem 0.85rem 0.3rem;
  background: rgba(10, 17, 34, 0.97);
}
.style-option {
  display: flex; align-items: center; gap: 0.6rem; cursor: pointer;
  padding: 0.5rem 0.85rem; font-size: 0.9rem; color: var(--text);
  transition: background 0.12s ease;
}
.style-option-name { flex: 1; }
.style-check { opacity: 0; color: var(--accent); font-weight: 800; }
.style-option[aria-selected="true"] { background: rgba(163, 255, 60, 0.10); }
.style-option[aria-selected="true"] .style-check { opacity: 1; }
.style-option:hover { background: rgba(255, 255, 255, 0.06); }
.style-option.active { background: rgba(163, 255, 60, 0.18); }
.style-option.is-hidden, .style-group.is-hidden { display: none; }
.style-option.is-disabled {
  opacity: 0.4; cursor: not-allowed; pointer-events: none;
}
.style-empty { padding: 1.1rem 0.85rem; color: var(--muted); text-align: center; }
.style-empty.hidden { display: none; }

/* "Create your own style" — footer action in the style dropdown. */
.style-panel-foot {
  position: sticky;
  bottom: 0;
  padding: 0.55rem 0.7rem;
  border-top: 1px solid var(--stroke);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.style-custom-btn {
  width: 100%;
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(163, 255, 60, 0.1);
  border: 1px solid rgba(163, 255, 60, 0.45);
  border-radius: 999px;
}
.style-custom-btn:hover { background: rgba(163, 255, 60, 0.18); }

/* The manual-style box that the button reveals. */
.custom-style {
  margin-top: 0.7rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid rgba(163, 255, 60, 0.4);
  border-radius: var(--radius-md);
  background: rgba(163, 255, 60, 0.06);
}
.custom-style[hidden] { display: none; }
.custom-style-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}
.custom-style-title { font-weight: 800; font-size: 0.92rem; }
.custom-style-clear {
  background: none;
  border: 1px solid var(--stroke);
  color: var(--muted);
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
}
.custom-style-clear[hidden] { display: none; }
.custom-style textarea { margin-top: 0; }
.custom-style-note { margin: 0.45rem 0 0; font-size: 0.78rem; }

/* Selected styles as removable chips below the trigger. */
.style-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.style-chips[hidden] { display: none; }

/* Editable per-style music prompts (Advanced) */
#stylePromptsWrap[hidden] { display: none; }
.style-prompts { display: flex; flex-direction: column; gap: 0.7rem; }
.style-prompt {
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  background: var(--glass);
  padding: 0.6rem 0.7rem;
}
.style-prompt-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.style-prompt-name {
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.02em; color: var(--accent);
}
.style-prompt-reset {
  flex: none; cursor: pointer; font: inherit; font-size: 0.74rem;
  color: var(--muted); background: transparent; border: 1px solid var(--stroke);
  border-radius: 999px; padding: 0.2rem 0.6rem;
}
.style-prompt-reset:hover { color: var(--text); border-color: var(--stroke-strong); }
.style-prompt-actions { display: inline-flex; align-items: center; gap: 0.3rem; flex: none; }
/* Copy / paste / clear icon buttons */
.prompt-btn {
  display: grid; place-items: center; width: 30px; height: 30px; flex: none;
  cursor: pointer; padding: 0; border-radius: 9px;
  color: var(--muted); background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--stroke);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease,
    transform 0.12s ease, box-shadow 0.18s ease;
}
.prompt-btn svg { width: 16px; height: 16px; }
.prompt-btn:hover { color: var(--text); border-color: var(--stroke-strong); transform: translateY(-1px); }
.prompt-btn:active { transform: translateY(0) scale(0.94); }
.prompt-btn.is-ok {
  color: #06210a; background: var(--accent); border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 28%, transparent);
}
.style-prompt-input {
  margin-top: 0.5rem; min-height: 3.4rem; font-size: 0.86rem; line-height: 1.5;
}
.style-chip {
  display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer;
  padding: 0.34rem 0.4rem 0.34rem 0.7rem; font: inherit; font-size: 0.82rem;
  color: var(--text); background: rgba(163, 255, 60, 0.10);
  border: 1px solid rgba(163, 255, 60, 0.45); border-radius: 999px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.style-chip:hover, .style-chip:focus-visible {
  outline: none; border-color: var(--accent); background: rgba(163, 255, 60, 0.18);
}
.style-chip-name { white-space: nowrap; }
.style-chip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.05rem; height: 1.05rem; border-radius: 50%; font-size: 0.7rem; line-height: 1;
  color: var(--accent); background: rgba(163, 255, 60, 0.16); transition: background 0.15s ease, color 0.15s ease;
}
.style-chip:hover .style-chip-x, .style-chip:focus-visible .style-chip-x {
  background: var(--accent); color: #0a1122;
}

/* Mobile: render the panel as a bottom sheet. */
@media (max-width: 640px) {
  .style-panel {
    position: fixed; inset: auto 0 0 0; width: 100%; max-width: 100%;
    max-height: 78vh; border-radius: 18px 18px 0 0; transform: translateY(100%);
  }
  .style-panel:popover-open { transform: none; }
  @starting-style { .style-panel:popover-open { transform: translateY(100%); } }
}

/* ---------- Footer & misc ---------- */

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0 1.25rem 2.5rem;
  line-height: 1.5;
}

/* Heading above each style's tracks when several styles are queued. */
.style-head {
  margin: 1.4rem 0 0.3rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.style-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(163, 255, 60, 0.4), transparent);
}

/* Subtle, modern scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media (max-width: 480px) {
  .card { padding: 1.25rem 1.05rem; border-radius: 22px; }
  .hero { padding-top: 2.8rem; }
}

/* Interface language picker — frosted pill pinned to the top corner. */
.ui-lang {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 50;
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

/* Light / dark mode toggle — a round button matching the language pill height. */
.theme-toggle {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 0;
  flex: none;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  border-radius: 999px;
  color: var(--text);
  background: var(--glass-strong);
  border: 1px solid var(--stroke);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: border-color 0.18s ease, transform 0.12s ease;
}
.theme-toggle:hover { border-color: var(--stroke-strong); transform: translateY(-1px); }
.theme-toggle:active { transform: translateY(0); }

/* Sound control — matches the theme toggle; the panel slides out on click. */
.audio-toggle {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 0;
  flex: none;
  cursor: pointer;
  border-radius: 999px;
  color: var(--text);
  background: var(--glass-strong);
  border: 1px solid var(--stroke);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: border-color 0.18s ease, transform 0.12s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.audio-toggle svg { width: 1.05rem; height: 1.05rem; fill: currentColor; }
.audio-toggle:hover { border-color: var(--stroke-strong); transform: translateY(-1px); }
.audio-toggle:active { transform: translateY(0); }
/* Muted: stays lit in the sticky header as a persistent reminder. */
.audio-toggle.is-muted {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
}
.audio-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border-radius: 14px;
  background: var(--glass-strong);
  border: 1px solid var(--stroke);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  z-index: 60;
}
/* The explicit display above would otherwise defeat the hidden attribute, so
   the panel only appears when JS opens it (click the speaker; click again or
   anywhere else to close). */
.audio-panel[hidden] { display: none; }
[dir="rtl"] .audio-panel { right: auto; left: 0; }
.audio-mute {
  flex: none;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--stroke);
}
.audio-mute:hover { border-color: var(--stroke-strong); }
.audio-vol { width: 96px; accent-color: var(--accent); cursor: pointer; }
/* ---------- Auth + credits ---------- */
.auth-btn {
  flex: none; cursor: pointer; font: inherit; font-size: 0.82rem; font-weight: 600;
  padding: 0.4rem 0.9rem; border-radius: 999px; color: var(--text);
  background: var(--glass-strong); border: 1px solid var(--stroke);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  transition: border-color 0.18s ease, transform 0.12s ease;
}
.auth-btn:hover { border-color: var(--stroke-strong); transform: translateY(-1px); }
/* Signed-in: the button shrinks to a round avatar (profile photo or icon). */
.auth-btn.has-avatar {
  width: 38px; height: 38px; padding: 0; overflow: hidden;
  display: inline-grid; place-items: center;
}
.auth-avatar {
  width: 100%; height: 100%; display: block;
  object-fit: cover; border-radius: 50%;
}
.auth-avatar--default { display: grid; place-items: center; background: var(--glass-strong); }
.auth-avatar--default svg { width: 22px; height: 22px; fill: var(--text); opacity: 0.85; }
.credit-chip {
  flex: none; display: inline-flex; align-items: center; gap: 0.2rem;
  font-size: 0.8rem; font-weight: 700; color: #06210a;
  padding: 0.34rem 0.7rem; border-radius: 999px;
  background: var(--accent); border: 1px solid var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.auth-fab { position: fixed; top: 14px; left: 14px; z-index: 50; display: flex; gap: 0.5rem; }
.auth-modal {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  padding: 1.1rem; background: rgba(4, 6, 13, 0.62);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.auth-modal[hidden] { display: none; }
.auth-card {
  position: relative; width: 100%; max-width: 380px; text-align: center;
  padding: 1.6rem 1.4rem 1.4rem; border-radius: var(--radius-xl);
  background: var(--glass-strong); border: 1px solid var(--stroke-strong);
  -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
  box-shadow: var(--shadow-card);
}
.auth-card h3 { margin: 0 0 0.3rem; font-size: 1.25rem; }
.auth-sub { margin: 0 0 1rem; color: var(--muted); font-size: 0.9rem; }
.auth-card input[type="email"] { width: 100%; margin-bottom: 0.7rem; }
.auth-card .primary, .auth-card .secondary { width: 100%; }
.oauth-list { display: flex; flex-direction: column; gap: 0.5rem; }
.oauth-btn {
  width: 100%; cursor: pointer; font: inherit; font-size: 0.92rem; font-weight: 600;
  padding: 0.7rem 0.9rem; border-radius: 12px; color: var(--text);
  background: var(--glass-strong); border: 1px solid var(--stroke);
  transition: border-color 0.15s ease, transform 0.12s ease;
}
.oauth-btn:hover { border-color: var(--stroke-strong); transform: translateY(-1px); }
.oauth-apple { background: #000; color: #fff; border-color: #000; }
.oauth-google { background: #fff; color: #1a1a1a; border-color: #dadce0; }
.auth-or {
  display: flex; align-items: center; gap: 0.6rem; margin: 0.9rem 0 0.7rem; color: var(--muted); font-size: 0.78rem;
}
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--stroke); }
.auth-status { min-height: 1.1rem; margin: 0.6rem 0 0; font-size: 0.85rem; color: var(--accent-2); }
.auth-email { margin: 0 0 0.8rem; font-weight: 600; }
.auth-x {
  position: absolute; top: 0.5rem; right: 0.6rem; cursor: pointer; line-height: 1;
  font-size: 1.5rem; color: var(--muted); background: none; border: 0; padding: 0.2rem 0.4rem;
}
.auth-x:hover { color: var(--text); }
[data-theme="light"] .credit-chip { color: #06210a; }

.audio-fab { position: fixed; top: 14px; right: 14px; z-index: 50; }
/* On SSR pages there's no .ui-lang flex row to stretch the speaker to a pill
   height, so give the FAB toggle a concrete tappable size, and keep its panel
   anchored to the FAB (right:0 is relative to the FAB box, which is at the
   screen edge — clamp it on so it never opens off-screen). */
.audio-fab .audio-toggle { width: 40px; height: 40px; aspect-ratio: auto; }
.audio-fab .audio-panel { right: 0; max-width: calc(100vw - 28px); }
[dir="rtl"] .audio-fab { right: auto; left: 14px; }
[dir="rtl"] .audio-fab .audio-panel { right: auto; left: 0; }
[dir="rtl"] .ui-lang { right: auto; left: 14px; }
.ui-lang select {
  background: var(--glass-strong);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.82rem;
  padding: 0.4rem 2rem 0.4rem 0.9rem;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

/* ============================================================
   Light mode — overrides the dark palette + the few components
   that hardcode dark surfaces. Toggled via <html data-theme="light">.
   ============================================================ */
[data-theme="light"] {
  --bg-0: #eef1f8;
  --bg-1: #ffffff;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --stroke: rgba(12, 20, 48, 0.12);
  --stroke-strong: rgba(12, 20, 48, 0.22);
  --text: #0c1430;
  --muted: rgba(20, 30, 65, 0.62);
  --error: #d12f4a;
  --shadow-card: 0 18px 45px rgba(20, 35, 80, 0.12);
  --glow-accent: 0 8px 30px rgba(163, 255, 60, 0.28);
  --bg-veil: rgba(239, 242, 250, 0.82);
  --hero-veil: rgba(238, 242, 250, 0.55);
  --hero-outline: rgba(12, 20, 48, 0.9);
}

[data-theme="light"] body {
  background: var(--bg-0);
  background-image:
    radial-gradient(900px 520px at 12% -6%, rgba(47, 217, 255, 0.14), transparent 62%),
    radial-gradient(820px 540px at 88% 4%, rgba(120, 210, 40, 0.14), transparent 60%),
    radial-gradient(900px 700px at 50% 110%, rgba(255, 77, 141, 0.08), transparent 55%),
    linear-gradient(180deg, #ffffff, #eef1f8 45%);
}

/* Hero title gradient starts white in dark mode — invisible on light, so flip it. */
/* Form fields: the dark theme uses near-white translucency that vanishes on a
   light background — give them a solid frosted-white fill instead. */
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="email"],
[data-theme="light"] input:not([type]),
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: rgba(255, 255, 255, 0.85);
}
[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus {
  background: #ffffff;
  border-color: rgba(31, 154, 60, 0.7);
  box-shadow: 0 0 0 3px rgba(31, 154, 60, 0.16);
}
[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder { color: rgba(20, 30, 65, 0.4); }
[data-theme="light"] select option { background: #ffffff; color: var(--text); }

/* Dropdown / combobox panels hardcode a dark navy fill. */
[data-theme="light"] .combobox-list,
[data-theme="light"] .style-panel,
[data-theme="light"] .style-search-row,
[data-theme="light"] .style-group-h {
  background: rgba(255, 255, 255, 0.98);
}
[data-theme="light"] .style-trigger { background: rgba(255, 255, 255, 0.85); }
[data-theme="light"] .combobox-list li:hover,
[data-theme="light"] .combobox-list li.active,
[data-theme="light"] .style-option[aria-selected="true"] { background: rgba(31, 154, 60, 0.12); }
[data-theme="light"] .style-option:hover { background: rgba(12, 20, 48, 0.05); }

/* Accent-colored text needs a deeper shade to stay legible on white. */
[data-theme="light"] .style-group-h { color: #1f9a3c; }
[data-theme="light"] .track a.download { color: #127a93; }

/* Compact audio player surfaces are tuned for dark; soften for light. */
[data-theme="light"] .afp { background: linear-gradient(180deg, rgba(12, 20, 48, 0.05), rgba(12, 20, 48, 0.02)); }
[data-theme="light"] .afp-bar { background: rgba(12, 20, 48, 0.13); }
[data-theme="light"] .afp-thumb { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }
