/* ============================================================
   One Song — Mock B palette (violet on deep navy, Inter heavy).
   Cyan as secondary accent for section labels. Mock D editorial
   warm-on-warm is loadable behind ?theme=editorial (TODO).
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0a0a14;
  --surface:   #15152a;
  --surface-2: #1c1c38;
  --border:    rgba(168, 85, 247, 0.15);
  --border-strong: rgba(168, 85, 247, 0.35);
  --text:      #fafafa;
  --text-dim:  #b0b0c8;
  --text-mute: #7a7a98;
  --accent:    #a855f7;          /* violet */
  --accent-2:  #06b6d4;          /* cyan — secondary, for section labels */
  --accent-bg: rgba(168, 85, 247, 0.10);
  --danger:    #f87171;
  --radius:    14px;
  --radius-sm: 10px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(168, 85, 247, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(6, 182, 212, 0.10) 0%, transparent 50%);
  background-attachment: fixed;
}

a { color: var(--accent); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

input {
  font: inherit;
  color: inherit;
}

/* ============================================================
   App layout
   ============================================================ */

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 32px;
}

/* Footer — present on every screen. Attribution + Trevor Project donation.
   See memory: project_attribution_and_donation. */
.app-footer {
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--text-mute);
  line-height: 1.7;
}
.app-footer .footer-switcher {
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-mute);
}
.app-footer .footer-select {
  font: inherit;
  font-weight: 700;
  color: var(--text-dim);
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 2px 4px;
  font-family: inherit;
}
.app-footer .footer-select:hover { color: var(--accent); }
.app-footer .footer-select:focus { outline: none; color: var(--accent); }
.app-footer .footer-attribution {
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.app-footer .footer-donation a {
  color: var(--text-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.app-footer .footer-donation a:hover {
  color: var(--accent);
}

.app-header {
  padding: 16px 0 28px;
  text-align: center;
}
.app-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.app-tag {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 8px;
}

/* ============================================================
   Screens
   ============================================================ */

.screen { display: none; }
.screen.active { display: block; }

/* Landing / search */

.search-box {
  margin-top: 32px;
}
.search-box input {
  width: 100%;
  padding: 16px 18px;
  font-size: 17px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s;
}
.search-box input:focus { border-color: var(--border-strong); }

.lede {
  margin-top: 20px;
  font-size: 15px;
  color: var(--text-dim);
  text-align: center;
}

.resume-banner {
  margin-top: 24px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}
.resume-banner span { font-size: 14px; }
.resume-banner .actions { display: flex; gap: 8px; }

/* Search results */

.results-list {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.result-row {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background 0.15s, border-color 0.15s;
}
.result-row:hover { background: var(--surface-2); border-color: var(--border-strong); }
.result-row .name { font-weight: 600; font-size: 16px; }
.result-row .meta { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.result-row .tags { font-size: 12px; color: var(--text-mute); margin-top: 4px; }

.status-msg {
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-dim);
  text-align: center;
}
.status-msg.error { color: var(--danger); }

/* Album overview */

.overview-intro {
  margin-bottom: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-dim);
}

.bulk-toggle-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}
.btn-link {
  font: inherit;
  background: none;
  border: 0;
  color: var(--text-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 4px 6px;
  font-size: 13px;
}
.btn-link:hover { color: var(--text); }
.btn-link:disabled { opacity: 0.4; cursor: default; }

.album-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 560px) {
  .album-grid { grid-template-columns: repeat(3, 1fr); }
}

.album-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  cursor: pointer;
  transition: border-color 0.15s, opacity 0.15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.album-card.excluded {
  opacity: 0.4;
}
.album-card .cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mute);
  font-size: 12px;
  text-align: center;
  padding: 12px;
}
.album-card .cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.album-card .title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  /* clamp to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.album-card .meta {
  font-size: 11px;
  color: var(--text-mute);
}
.album-card .include-mark {
  position: absolute;
  top: 8px; right: 8px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
}
.album-card.excluded .include-mark {
  background: var(--surface-2);
  color: var(--text-mute);
}

/* Loading block (track-list fetch progress) */

.loading-block {
  padding: 24px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.loading-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
}
.loading-meta {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 14px;
  min-height: 1.2em;
}
.loading-bar {
  height: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0;
  transition: width 0.25s ease-out;
}

/* Per-album bracket header */

.bracket-header {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.bracket-header .cover-sm {
  width: 56px; height: 56px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
  flex-shrink: 0;
}
.bracket-header .cover-sm img { width: 100%; height: 100%; object-fit: cover; }
.bracket-header .title { font-weight: 700; font-size: 16px; line-height: 1.2; }
.bracket-header .meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.bracket-header .progress { margin-left: auto; font-size: 12px; color: var(--text-mute); text-align: right; }

/* Matchup UI — mobile-first stacked cards */

.matchup {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.vs-divider {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--text-mute);
  text-transform: uppercase;
}

/* Matchup card — two stacked tap zones:
   - Top (.song-listen-zone): tap to open YouTube in a new tab. Equal-weight
     primary action per the kid's observed behavior (listen and pick are
     roughly co-equal during a real bracket).
   - Bottom (.song-pick-zone): tap to pick this song as the winner.
   A solid divider + distinct background separates them to prevent misclicks. */
.song-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
}
.song-card:hover { border-color: var(--border-strong); }
.song-card.picked { border-color: var(--accent); }

.song-listen-zone {
  display: block;
  padding: 22px 20px 18px;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
.song-listen-zone:hover { background: var(--accent-bg); }

.song-card .song-title {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.25;
  /* Some prog-rock titles are absurdly long (Hemispheres side A is 220 chars). */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.song-listen-label {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.song-pick-zone {
  display: block;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--border-strong);
  padding: 14px 18px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--surface-2);
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.song-pick-zone:hover {
  background: var(--accent-bg);
  color: var(--text);
}
.song-card.picked .song-pick-zone {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
}

.yt-link {
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.yt-link:hover { color: var(--text); }

/* Stage card — shown at album start when byes apply, replacing the
   per-bye walkover banners with a single upfront explainer. */
.stage-card {
  margin-top: 8px;
  padding: 22px 20px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}
.stage-card .stage-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}
.stage-card .stage-meta {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.stage-card .stage-section {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.stage-card .bye-list {
  margin-top: 8px;
  padding-left: 0;
  list-style: none;
}
.stage-card .bye-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text);
}
.stage-card .bye-list li:last-child { border-bottom: 0; }
.stage-card .stage-actions { margin-top: 22px; text-align: center; }

.bracket-complete {
  margin-top: 20px;
  padding: 22px 20px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
}
.bracket-complete .label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 8px;
}
.bracket-complete .winner {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}
.bracket-complete .yt-link { margin-bottom: 22px; }

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  min-height: 44px;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.4);
}
.btn.primary:hover { box-shadow: 0 4px 28px rgba(168, 85, 247, 0.6); }
.btn.ghost { background: transparent; border-color: var(--border); }

.bottom-bar {
  margin-top: 28px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* ============================================================
   Results page (the shareable artifact)
   ============================================================ */

.results-page {
  padding-top: 8px;
}

.hero {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 18px;
  margin-bottom: 22px;
}
@media (min-width: 560px) {
  .hero {
    grid-template-columns: 200px 1fr;
    align-items: center;
  }
}
.hero-cover {
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-mute);
  padding: 12px;
  font-size: 13px;
  box-shadow: 0 10px 40px rgba(168, 85, 247, 0.25);
}
.hero-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* On phones the stacked hero needs a cap on the cover or it fills the screen
   and pushes everything below the screenshot fold. */
@media (max-width: 559px) {
  .hero-cover { max-width: 180px; margin: 0 auto; }
  .hero-text { text-align: center; }
  .hero-text .listen-btn { align-self: center; }
}

.hero-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 8px;
}
.hero-song {
  font-size: clamp(28px, 5.5vw, 40px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff, #c8b5ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-album {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.listen-btn {
  align-self: flex-start;
  text-decoration: none;
}

.hero-watermark {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-mute);
  opacity: 0.5;
  pointer-events: none;
}

.results-section {
  margin-bottom: 22px;
}
.section-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 14px;
}

.per-album-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.per-album-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: center;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.row-cover {
  width: 56px; height: 56px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--text-mute);
  text-align: center;
  padding: 4px;
  line-height: 1.15;
}
.row-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row-album { font-size: 12px; color: var(--text-dim); margin-bottom: 2px; }
.row-song { font-size: 15px; font-weight: 600; line-height: 1.2; margin-bottom: 4px; }
.row-text .listen-chip,
.row-text .listen-chips { margin-top: 6px; }

.listen-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.listen-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.listen-chip:hover {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--text);
}

.share-section { text-align: center; margin-bottom: 22px; }
.share-primary {
  min-width: 200px;
  max-width: 320px;
  padding: 14px 22px;
  font-size: 15px;
}
.share-secondaries {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}
.btn-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  min-height: 32px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-chip:hover {
  background: var(--accent-bg);
  color: var(--text);
  border-color: var(--accent);
}

/* Name prompt card — shown after the final bracket, before the results. */
.name-prompt-card {
  margin-top: 8px;
  padding: 28px 22px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
}
.name-prompt-card .name-prompt-label {
  font-size: 15px;
  color: var(--text-dim);
  margin-bottom: 18px;
}
.name-prompt-input {
  width: 100%;
  max-width: 320px;
  padding: 12px 16px;
  font-size: 16px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  text-align: center;
  color: var(--text);
  font-family: inherit;
  margin-bottom: 18px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.name-prompt-input::placeholder { color: var(--text-mute); }
.name-prompt-input:focus { border-color: var(--accent); }

.donation-callout {
  padding: 18px 20px;
  margin-bottom: 24px;
  text-align: center;
  background: var(--accent-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-dim);
}
.donation-callout a {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.donation-callout a:hover { color: var(--accent); }

.cta-row {
  text-align: center;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* Dev mode chip */

.dev-chip {
  position: fixed;
  top: 8px; right: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--accent);
  padding: 4px 8px;
  border-radius: 4px;
  z-index: 1000;
}
