/* ==========================================================================
   SongVote — shared design system (theme.css)
   Loaded in the <head> of every guest-facing page BEFORE the page's own
   inline <style>, so pages can layer layout-specific rules on top.
   Palette, typography, motion, icons and reusable components live here —
   edit once, the whole site updates.

   RHYTHM: spacing on an 8pt grid (4 / 8 / 12 / 16 / 24 / 32 / 48).
   RADII:  cards 16px (--radius) · controls 12px (--radius-sm) · pills 999px.
   MOTION: 150–220ms, cubic-bezier(.2,.7,.2,1) (--ease); honors
           prefers-reduced-motion globally at the bottom of this file.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  /* Surfaces */
  --bg: #0b0b0d;
  --bg-2: #16161c;
  --card: #18181c;
  --card-2: #232328;
  --hairline: rgba(255, 255, 255, .07);
  --hairline-2: rgba(255, 255, 255, .13);
  /* Text */
  --text: #ffffff;
  --dim: #a7a7ad;
  /* Brand */
  --accent: #1DB954;
  --accent-hover: #1ed760;
  --accent-soft: rgba(29, 185, 84, .12);
  --gold: #F5C451;
  --gold-soft: rgba(245, 196, 81, .12);
  --danger: #ff5c5c;
  --volume-blue: #3daee9;
  /* Legacy aliases — older inline styles still reference these names */
  --icon-gold: var(--gold);
  --text-dim: var(--dim);
  --nav-bg: rgba(10, 10, 13, .92);
  /* Shape & elevation */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .30);
  --shadow-2: 0 24px 60px rgba(0, 0, 0, .5);
  /* Motion */
  --speed: .18s;
  --speed-fast: .15s;
  --speed-slow: .22s;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ----- Base ----- */
* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .22) transparent;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* Ambient app background — soft accent glow up top, fading to near-black.
   Painted on a FIXED pseudo-element so it stays rock-solid on iOS Safari. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 480px at 50% -120px, rgba(29, 185, 84, .10), transparent 65%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 480px);
}

h1, h2, h3, h4 { letter-spacing: -0.02em; font-weight: 800; line-height: 1.2; }
a { color: var(--accent); }
::selection { background: var(--accent); color: #00210d; }

/* ----- Inline SVG icon system -----------------------------------------
   Convention: rounded line icons on a 24px grid, 1.5px stroke, drawn in
   currentColor so they inherit text color. Author them as:
     <svg class="sv-i" viewBox="0 0 24 24" fill="none" stroke="currentColor"
          stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"
          aria-hidden="true">…</svg>
   Core set used across the app: home, music/queue, plus (request),
   headphones (listen), screen, share/users, sliders (host), chevron,
   key, broadcast, volume, trending (vote).
------------------------------------------------------------------------ */
.sv-i { width: 24px; height: 24px; flex: 0 0 auto; display: block; }
.sv-i--sm { width: 18px; height: 18px; }
.sv-i--xs { width: 16px; height: 16px; }
.sv-i--lg { width: 28px; height: 28px; }

/* ----- Buttons: pill-shaped, bold, tactile ----- */
button {
  font-family: inherit;
  border: none;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  padding: 14px 22px;
  cursor: pointer;
  color: var(--text);
  background: var(--card-2);
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--speed) var(--ease), filter var(--speed) var(--ease),
              background var(--speed) var(--ease), box-shadow var(--speed) var(--ease),
              border-color var(--speed) var(--ease), opacity var(--speed) var(--ease),
              color var(--speed) var(--ease);
}
button:hover:not(:disabled) { filter: brightness(1.1); }
button:active:not(:disabled) { transform: scale(.97); }
button:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #04130a; box-shadow: 0 6px 20px rgba(29, 185, 84, .28); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); transform: scale(1.02); filter: none; }
.btn-primary:active:not(:disabled) { transform: scale(.98); }
.btn-gold { background: var(--gold); color: #221703; box-shadow: 0 6px 20px rgba(245, 196, 81, .22); }
.btn-gold:hover:not(:disabled) { transform: scale(1.02); filter: brightness(1.05); }
.btn-gold:active:not(:disabled) { transform: scale(.98); }
.btn-secondary, .btn-vol { background: rgba(255, 255, 255, .08); color: var(--text); border: 1px solid var(--hairline); }
.btn-secondary:hover:not(:disabled), .btn-vol:hover:not(:disabled) { background: rgba(255, 255, 255, .13); filter: none; }
.btn-outline { background: transparent; border: 1px solid var(--hairline-2); color: var(--text); }
.btn-outline:hover:not(:disabled) { background: rgba(255, 255, 255, .06); filter: none; }

/* ----- Inputs ----- */
input, select, textarea {
  font-family: inherit;
  width: 100%;
  padding: 14px 16px;
  font-size: 16px; /* 16px+ stops iOS zoom-on-focus */
  color: var(--text);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--hairline-2);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease), background var(--speed) var(--ease);
}
input::placeholder, textarea::placeholder { color: rgba(255, 255, 255, .35); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: rgba(255, 255, 255, .07);
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%23a7a7ad' stroke-width='2' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
textarea { resize: vertical; }

/* Accessible focus rings (inputs already get their own glow above) */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

/* ----- Cards & pills ----- */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, 0) 55%), var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow-1);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--dim);
}

/* ----- Empty states -----
   .empty       — legacy one-liner (kept for older pages / inline strings)
   .empty-state — designed empty state: icon tile + title + subline       */
.empty { color: var(--dim); text-align: center; font-size: 14px; line-height: 1.7; padding: 18px 8px; }
.empty-state { text-align: center; padding: 32px 16px; color: var(--dim); }
.empty-state .es-ico {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--hairline);
  color: var(--dim);
}
.empty-state .es-ico .sv-i { width: 26px; height: 26px; }
.empty-state .es-title { color: var(--text); font-weight: 700; font-size: 16px; letter-spacing: -0.01em; margin: 0 0 4px; }
.empty-state .es-sub { font-size: 13.5px; line-height: 1.65; margin: 0 auto; max-width: 320px; }

/* ----- Skeleton loaders -----
   Shimmering placeholders shown while lists load.
   Compose: <div class="skel-row"><div class="skel skel-avatar"></div>
            <div class="skel-lines"><div class="skel skel-line" style="width:55%">
            </div><div class="skel skel-line skel-line--sub" style="width:35%"></div></div></div> */
.skel {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, .06);
  border-radius: 8px;
}
.skel::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .08), transparent);
  animation: sv-shimmer 1.6s var(--ease) infinite;
}
@keyframes sv-shimmer { to { transform: translateX(100%); } }
.skel-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.skel-avatar { width: 44px; height: 44px; border-radius: 12px; flex: 0 0 auto; }
.skel-lines { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.skel-line { height: 12px; border-radius: 6px; }
.skel-line--sub { height: 10px; opacity: .7; }
.skel-btn { width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto; }

/* ----- Track rows (vote queue & event lists) ----- */
.song-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease);
}
.song-card:hover { background: var(--card-2); border-color: var(--hairline-2); }
.song-info { min-width: 0; }
.song-info h3 { margin: 0 0 3px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.song-info p { margin: 0; font-size: 13.5px; color: var(--dim); font-weight: 500; }
.vote-box { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.vote-btn {
  width: 44px; height: 44px; padding: 0; margin: 0;
  border-radius: 50%; border: none; cursor: pointer;
  font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--speed) var(--ease), filter var(--speed) var(--ease);
}
.vote-btn:hover:not(:disabled) { transform: scale(1.08); filter: brightness(1.15); }
.vote-btn:active:not(:disabled) { transform: scale(.88); }
.vote-score { min-width: 30px; text-align: center; font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.my-req-badge {
  background: var(--accent-soft);
  color: var(--accent-hover);
  border: 1px solid rgba(29, 185, 84, .35);
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  padding: 3px 8px; border-radius: 999px; margin-left: 8px;
  vertical-align: middle; white-space: nowrap;
}

/* ----- Loading spinners ----- */
.spinner, .ai-spinner {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .12);
  border-top-color: var(--accent);
  animation: spin .9s linear infinite;
  margin: 14px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- Modals ----- */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  justify-content: center; align-items: center;
  padding: 16px;
}
.modal-box {
  background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, 0) 50%), var(--card);
  border: 1px solid var(--hairline-2);
  border-radius: 20px;
  padding: 28px 22px;
  width: 100%; max-width: 440px;
  text-align: center;
  max-height: 90vh; overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-2);
}

/* ----- Custom scrollbars (WebKit) ----- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .16);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, .28); }

/* ----- Shared app shell (injected by nav.js) -----
   nav.js carries its own complete styles so every page — with or without
   theme.css — renders the same frosted top bar + menu. Nothing needed here. */

/* ==========================================================================
   ACCESSIBILITY ADD-ONS (additive only — premium look unchanged by default)
   ========================================================================== */

/* ----- "Larger text" preference -----
   Toggled by the "Aa Larger text" item in the nav menu (nav.js), persisted in
   localStorage and re-applied before paint by config.js (class on <html>).
   Default OFF: with no class present, nothing below applies and the UI looks
   identical. When ON, scale the base font ~118% so the whole app — which is
   built largely on relative (px-on-body / em) and flexible layouts — grows
   together. Kept conservative so layouts still hold on small phones. */
html.sv-bigtext body { font-size: 18.5px; }            /* base 15.5 → ~118% */
html.sv-bigtext .tab-title { font-size: 27px; }
html.sv-bigtext .song-info h3 { font-size: 17.5px; }
html.sv-bigtext .song-info p { font-size: 15px; }
html.sv-bigtext .hint { font-size: 13.5px; }
html.sv-bigtext .pill,
html.sv-bigtext .empty,
html.sv-bigtext .empty-state .es-sub { font-size: 14.5px; }
/* App bottom-dock labels stay legible without overflowing the dock. */
html.sv-bigtext .tab { font-size: 12px; }

/* ----- Tap targets: guarantee ≥44×44px on the small round/segmented controls.
   These are min-sizes only — they never shrink anything and match the existing
   visual footprint, so default users see no change. ----- */
.vote-btn { min-width: 44px; min-height: 44px; }
/* Reaction emojis live in a slim pill bar; pad the touch area generously
   without inflating the bar's height (the bar centers them). */
.reaction-btn { min-width: 40px; min-height: 40px; padding: 6px 8px; }
.tip-chip { min-height: 44px; }
.toggle-btn { min-height: 44px; }

/* ----- Accessibility & print ----- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
@media print {
  body::before { display: none; }
}
