/* Scallywag's Tune-A-Rama: the players' page (tunearama.com). Plain CSS, no build.
   The look matches the big-screen view (../static/game.html): navy night sky with a gold
   glow, gold Pirata One headings, and every song chip a scrap of old pirate map.
   Everything is sized in rem / em, so the "Aa" text size (js/textSize.js sets the root
   font size) scales the whole page. */

/* ---- fonts: files in fonts/ (SIL Open Font License), latin only ---- */
@font-face { font-family: "Pirata One"; src: url("../fonts/pirata-one-latin.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IM Fell English"; src: url("../fonts/im-fell-english-latin.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-latin.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }

:root {
  --font-pirata: "Pirata One", Georgia, serif;
  --font-fell: "IM Fell English", Georgia, "Times New Roman", serif;
  --font-inter: "Inter";
  --gold: #ffbe2e;
  --gold-light: #ffd166;
  --muted: #9fb0d0;
  --ink: #0b0f19;
  --navy: #1d2b4a;
  --panel: #0d1424;
  --deep: #070a12;
  --heading-shadow: 0 2px 0 #8a5200, 0 6px 18px rgba(0, 0, 0, .55);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, .1), 0 1px 2px -1px rgba(0, 0, 0, .1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -4px rgba(0, 0, 0, .1);
}

/* ---- a small reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { line-height: 1.5; -webkit-tap-highlight-color: transparent; }
body { margin: 0; min-height: 100dvh; }
h1, h2, p, ol, ul { margin: 0; }
ol, ul { list-style: none; padding: 0; }
button, input { font: inherit; color: inherit; margin: 0; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
img { display: block; max-width: 100%; }
strong { font-weight: 700; }
.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; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .5; } }

/* Honor the phone's text size. Everything on this page is sized in rem (or em),
   which already follows the browser / Android font-size setting. iPhone Safari only
   applies the iOS Text Size (Dynamic Type) setting to pages that use its system body
   font, so on Apple devices the root size comes from -apple-system-body (17px at the
   default setting, larger or smaller as the user chooses). :has() scopes this to the
   /stm page only. */
@supports (font: -apple-system-body) {
  html:has(.stm-stage) { font: -apple-system-body; }
}

.stm-stage {
  color: #f4f1e8;
  background-color: #070a12;
  background-image:
    radial-gradient(ellipse 80% 45% at 50% -10%, rgba(255, 190, 46, .18), transparent 70%),
    radial-gradient(ellipse at 50% 0%, #1d2b4a 0%, #0d1424 55%, #070a12 100%);
  background-attachment: fixed;
  font-family: var(--font-inter), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* gold headings, like the view's title */
.stm-title {
  font-family: var(--font-pirata), Georgia, serif;
  color: #ffbe2e;
  text-shadow: 0 3px 0 #8a5200, 0 8px 24px rgba(0, 0, 0, .6);
}
.stm-heading { text-shadow: 0 2px 0 #8a5200, 0 6px 18px rgba(0, 0, 0, .55); }
.stm-gold-number {
  color: #ffbe2e;
  text-shadow: 0 4px 0 #8a5200, 0 10px 28px rgba(0, 0, 0, .6);
}

/* plain parchment (code digits, QR card, leaderboard card) */
.stm-parchment {
  color: #3a230c;
  background:
    radial-gradient(ellipse at 22% 18%, rgba(255, 250, 230, .45), transparent 50%),
    radial-gradient(ellipse at 85% 90%, rgba(140, 85, 25, .28), transparent 55%),
    #ead3a0;
  box-shadow: inset 0 0 14px 3px rgba(105, 55, 10, .55), 0 6px 18px rgba(0, 0, 0, .5);
}

/* ---- song chips: a scrap of old map ------------------------------------- */
.stm-chip {
  position: relative;
  color: #3a230c;
  border-radius: .45em .8em .5em .85em / .7em .45em .8em .5em; /* slightly uneven, like torn paper */
  background:
    radial-gradient(ellipse at 22% 18%, rgba(255, 250, 230, .45), transparent 50%),
    radial-gradient(ellipse at 85% 90%, rgba(140, 85, 25, .28), transparent 55%),
    repeating-linear-gradient(0deg, transparent 0 .85em, rgba(110, 70, 25, .08) .85em calc(.85em + 1px)),
    repeating-linear-gradient(90deg, transparent 0 .85em, rgba(110, 70, 25, .08) .85em calc(.85em + 1px)),
    #ead3a0;
  box-shadow:
    inset 0 0 .45em .08em rgba(105, 55, 10, .6),   /* scorched edge */
    inset 0 0 1.4em rgba(150, 95, 30, .35),
    0 .15em .35em rgba(0, 0, 0, .5);
  transition: transform .15s, opacity .4s, filter .4s, box-shadow .3s, outline-color .3s;
}
.stm-chip::after { /* X marks the spot */
  content: "✕";
  position: absolute; right: .55em; bottom: .3em;
  font-size: .55em; font-weight: 800; line-height: 1;
  color: rgba(165, 35, 20, .55);
}
.stm-chip.has-badge::after { display: none; } /* the badge takes the X's place */
.stm-chip-title { font-family: var(--font-fell), Georgia, "Times New Roman", serif; font-weight: 700; font-size: 1.08em; line-height: 1.15; }
.stm-chip-artist { font-weight: 700; font-size: .8em; line-height: 1.2; margin-top: .1em; color: #4a2c0f; }

/* picked: lit up in gold, like a revealed song on the big screen */
.stm-chip.is-picked {
  outline: .16em solid #ffbe2e; outline-offset: .08em;
  box-shadow:
    inset 0 0 .45em .08em rgba(105, 55, 10, .6), inset 0 0 1.4em rgba(150, 95, 30, .35),
    0 0 .8em rgba(255, 190, 46, .65), 0 .15em .35em rgba(0, 0, 0, .5);
}
.stm-chip.is-picked::after { color: rgba(165, 35, 20, .9); }

/* read-only board (picks closed): the songs you didn't pick drop back */
.stm-chip.is-idle { opacity: .55; filter: saturate(.5); }

/* results */
.stm-chip.is-hit {          /* picked & played */
  outline: .16em solid #ffbe2e; outline-offset: .08em;
  animation: stm-pulse 2.2s ease-in-out infinite;
}
.stm-chip.is-wrong {        /* picked, not played */
  outline: .16em solid rgba(229, 72, 77, .9); outline-offset: .08em;
  opacity: .75; filter: saturate(.6);
}
.stm-chip.is-missed {       /* played, not picked */
  outline: .14em dashed rgba(255, 190, 46, .85); outline-offset: .1em;
}
.stm-chip.is-decoy { opacity: .3; filter: grayscale(.9); } /* not played, not picked */
@keyframes stm-pulse {
  0%, 100% { box-shadow: inset 0 0 .45em .08em rgba(105, 55, 10, .6), inset 0 0 1.4em rgba(150, 95, 30, .35), 0 0 .7em .1em rgba(255, 190, 46, .6); }
  50%      { box-shadow: inset 0 0 .45em .08em rgba(105, 55, 10, .6), inset 0 0 1.4em rgba(150, 95, 30, .35), 0 0 1.4em .35em rgba(255, 190, 46, .95); }
}
/* the winner pop-up over the results */
@keyframes stm-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes stm-winner-in {
  from { opacity: 0; transform: scale(.7) rotate(-4deg); }
  70%  { opacity: 1; transform: scale(1.04) rotate(.5deg); }
  to   { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes stm-trophy { 0%, 100% { transform: translateY(0) rotate(-5deg); } 50% { transform: translateY(-.12em) rotate(5deg); } }
.stm-winner-backdrop { animation: stm-fade-in .3s ease-out both; }
.stm-winner-card { animation: stm-winner-in .55s cubic-bezier(.2, .9, .3, 1.2) .1s both; }
.stm-trophy { display: inline-block; animation: stm-trophy 2.4s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .stm-chip.is-hit { animation: none; }
  .stm-winner-backdrop, .stm-winner-card, .stm-trophy { animation: none; }
}

/* ---- text input (player name): always light text on a dark fill, including
   when the browser autofills it (Chrome/Safari repaint autofilled fields). ---- */
.stm-input {
  background-color: rgba(13, 20, 36, .9);
  color: #f4f1e8;
  -webkit-text-fill-color: #f4f1e8;
  caret-color: #ffbe2e;
  border: 1px solid rgba(255, 255, 255, .18);
}
.stm-input::placeholder { color: rgba(159, 176, 208, .6); -webkit-text-fill-color: rgba(159, 176, 208, .6); }
.stm-input:focus { outline: none; border-color: #ffbe2e; box-shadow: 0 0 0 3px rgba(255, 190, 46, .35); }
.stm-input:-webkit-autofill,
.stm-input:-webkit-autofill:hover,
.stm-input:-webkit-autofill:focus {
  -webkit-text-fill-color: #f4f1e8;
  -webkit-box-shadow: 0 0 0 1000px #0d1424 inset;
  caret-color: #ffbe2e;
  transition: background-color 9999s ease-out 0s;
}
.parchment { /* same as .stm-parchment */
  color: #3a230c;
  background:
    radial-gradient(ellipse at 22% 18%, rgba(255, 250, 230, .45), transparent 50%),
    radial-gradient(ellipse at 85% 90%, rgba(140, 85, 25, .28), transparent 55%),
    #ead3a0;
  box-shadow: inset 0 0 14px 3px rgba(105, 55, 10, .55), 0 6px 18px rgba(0, 0, 0, .5);
}

/* ======================================================== page */
.page { display: flex; flex-direction: column; max-width: 36rem; min-height: 100dvh; margin: 0 auto; padding: 1.25rem 1rem 1.5rem; }
.top-left { display: flex; justify-content: flex-start; margin: -.5rem 0 .5rem; }
.page-title { text-align: center; font-size: 2.25rem; line-height: 1; font-weight: 400; }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.mt-4 { margin-top: 1rem; }
.link { font-size: .875rem; color: var(--muted); text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .3); }
.link:hover { color: #fff; }
.btn-gold { border-radius: .75rem; background: var(--gold); font-weight: 700; color: var(--ink); box-shadow: var(--shadow-lg); transition: background-color .15s, opacity .15s; }
.btn-gold:hover:not(:disabled) { background: var(--gold-light); }
.btn-gold:disabled { opacity: .4; }
.card { border: 1px solid rgba(255, 255, 255, .1); background: rgba(13, 20, 36, .6); }

/* "Aa" text size button */
.aa { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 2.75rem; min-height: 2.75rem; padding: 0 .5rem; border-radius: .5rem; border: 1px solid rgba(255, 255, 255, .15); background: rgba(13, 20, 36, .7); color: #fff; touch-action: manipulation; transition: border-color .15s, transform .15s; }
.aa:hover { border-color: rgba(255, 190, 46, .6); }
.aa:active { transform: scale(.95); }
.aa-letters { font-weight: 800; line-height: 1; }
.aa-small { font-size: .8em; }
.aa-big { font-size: 1.15em; }
.aa-dots { display: flex; gap: 3px; margin-top: .25rem; }
.aa-dots span { width: .25rem; height: .25rem; border-radius: 50%; background: rgba(255, 255, 255, .25); }
.aa-dots span.is-on { background: var(--gold); }

/* ======================================================== join */
.join { display: flex; flex-direction: column; align-items: center; gap: 1.25rem; margin-top: 2rem; }
.join-intro { text-align: center; font-size: 1.125rem; line-height: 1.75rem; color: rgba(255, 255, 255, .8); }
.code-digits { display: flex; justify-content: center; gap: .625rem; width: 100%; max-width: 18rem; }
.code-digit {
  display: flex; align-items: center; justify-content: center; flex: 1; min-width: 0; max-width: 4rem; aspect-ratio: 4 / 5;
  border-radius: 1rem; border: 2px solid rgba(255, 190, 46, .4);
  font-family: var(--font-inter), sans-serif; font-weight: 700; font-size: min(2.75rem, 11vw); font-variant-numeric: tabular-nums;
}
.code-digit.is-next { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(255, 190, 46, .3), inset 0 0 14px 3px rgba(105, 55, 10, .55), 0 6px 18px rgba(0, 0, 0, .5); }
.join-error { max-width: 20rem; text-align: center; font-size: .875rem; font-weight: 500; color: #fca5a5; }
.pad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .625rem; width: 100%; max-width: 16rem; }
.pad-key {
  min-height: 3.5rem; padding: .5rem 0; border-radius: .75rem; border: 1px solid rgba(255, 255, 255, .1); background: rgba(13, 20, 36, .8);
  font-size: 1.5rem; line-height: 2rem; font-weight: 700; color: #fff;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; transition: background-color .15s, transform .15s;
}
.pad-key:hover { background: var(--navy); }
.pad-key:active { transform: scale(.95); background: #26385e; }
.pad-key.is-clear { font-size: 1rem; line-height: 1.5rem; color: rgba(255, 255, 255, .7); }
.join-btn { width: 100%; max-width: 16rem; padding: .875rem 0; font-size: 1.125rem; line-height: 1.75rem; }

.joining { display: flex; flex-direction: column; align-items: center; gap: 1rem; margin-top: 4rem; text-align: center; }
.spinner { width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 4px solid rgba(255, 190, 46, .3); border-top-color: var(--gold); animation: spin 1s linear infinite; }
.joining-text { font-size: 1.125rem; color: rgba(255, 255, 255, .8); }
.joining-offline { max-width: 20rem; font-size: .875rem; color: #fcd34d; }

/* ======================================================== game */
.game { display: flex; flex: 1; flex-direction: column; margin-top: .75rem; }
.game.has-picks-bar { padding-bottom: 9rem; }
.game-bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; font-size: .875rem; line-height: 1.25rem; color: var(--muted); }
.game-bar-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-name { color: rgba(255, 255, 255, .85); }
.round-pill { margin: .75rem auto 0; width: fit-content; padding: .3rem .9rem; border-radius: 999px; border: 1px solid rgba(255, 190, 46, .5); background: rgba(255, 190, 46, .12); color: var(--gold); font-weight: 700; font-size: .9em; letter-spacing: .02em; }
.game-bar-tools { display: flex; flex-shrink: 0; align-items: center; gap: .75rem; }
.conn { display: flex; align-items: center; gap: .375rem; }
.conn-dot { width: .5rem; height: .5rem; border-radius: 50%; }
.conn-dot.is-live { background: #34d399; }
.conn-dot.is-connecting { background: #fbbf24; animation: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; }
.conn-dot.is-offline { background: #f87171; animation: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; }
.conn-label { font-size: .75rem; line-height: 1rem; }

.banner { margin-top: 1rem; padding: .75rem 1rem; border-radius: 1rem; border: 1px solid; }
.banner-info { border-color: rgba(255, 255, 255, .15); background: rgba(13, 20, 36, .7); color: rgba(255, 255, 255, .85); }
.banner-live { border-color: rgba(255, 190, 46, .5); background: rgba(255, 190, 46, .1); color: #fff; }
.banner-warn { border-color: rgba(251, 191, 36, .5); background: rgba(245, 158, 11, .15); color: #fef3c7; }
.banner-title { font-family: var(--font-pirata); font-size: 1.5rem; line-height: 1.25; color: var(--gold); text-shadow: var(--heading-shadow); }
.banner-text { font-size: .9375rem; line-height: 1.375; }
.timer { display: block; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer-results { margin-top: .5rem; font-size: 1.25rem; line-height: 1.75rem; color: var(--gold); }

/* pregame countdown */
.countdown { margin-top: 1.25rem; padding: 1.5rem 1rem; border-radius: 1rem; border-color: rgba(255, 190, 46, .3); text-align: center; }
.cd-ready { font-family: var(--font-pirata); font-size: 2.25rem; line-height: 1.25; color: var(--gold); text-shadow: var(--heading-shadow); }
.cd-ready-note { margin-top: .25rem; color: rgba(255, 255, 255, .7); }
.cd-soon { font-family: var(--font-pirata); font-size: 3.75rem; line-height: 1; color: var(--gold); text-shadow: 0 4px 0 #8a5200, 0 10px 28px rgba(0, 0, 0, .6); animation: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; }
.cd-label { font-size: .75rem; line-height: 1rem; font-weight: 600; letter-spacing: .35em; text-transform: uppercase; color: var(--muted); }
.cd-time { margin-top: .25rem; font-size: 4.5rem; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--gold); text-shadow: 0 4px 0 #8a5200, 0 10px 28px rgba(0, 0, 0, .6); }
.cd-note { margin-top: 1rem; font-size: .875rem; color: var(--muted); }

/* name */
.name-card { margin-top: 1rem; padding: .625rem 1rem; border-radius: .75rem; color: rgba(255, 255, 255, .7); }
.name-card.is-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.name-card .link { flex-shrink: 0; }
.name-as { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-form { margin-top: 1rem; }
.name-label { display: block; margin-bottom: .25rem; font-size: .75rem; line-height: 1rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.name-row { display: flex; gap: .5rem; }
.name-input { flex: 1; min-width: 0; padding: .75rem 1rem; border-radius: .75rem; font-size: 1.125rem; }
.name-btn { flex-shrink: 0; padding: 0 1.25rem; font-size: 1.125rem; box-shadow: none; }
.name-cancel { margin-top: .375rem; }
.name-error { margin-top: .375rem; font-size: .875rem; font-weight: 500; color: #fca5a5; }

/* how to play */
.how { margin-top: 1rem; padding: 1rem; border-radius: .75rem; }
.how-title { font-family: var(--font-pirata); font-weight: 400; font-size: 1.5rem; line-height: 1; color: var(--gold); text-shadow: var(--heading-shadow); }
.how-steps { margin-top: .75rem; }
.how-steps li { display: flex; gap: .75rem; line-height: 1.375; color: rgba(255, 255, 255, .8); }
.how-steps li + li { margin-top: .625rem; }
.how-steps strong { color: #fff; }
.how-num { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--gold); color: #000; font-size: .875rem; font-weight: 800; }
.how-num.is-done { background: #10b981; color: #fff; }

/* share */
.share { display: flex; flex-direction: column; align-items: center; margin-top: 1.25rem; padding: 1.25rem 1rem; border-radius: 1rem; background: rgba(13, 20, 36, .4); text-align: center; }
.share-title { font-family: var(--font-pirata); font-size: 1.5rem; line-height: 2rem; color: var(--gold); text-shadow: var(--heading-shadow); }
.share-sub { margin-top: .125rem; font-size: .875rem; color: var(--muted); }
.share-qr { margin-top: .75rem; padding: .625rem; border-radius: .75rem; }
.share-qr img, .share-qr-wait { width: 200px; height: 200px; border-radius: .375rem; }
.share-qr-wait { background: rgba(255, 250, 240, .6); animation: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; }
.share-btn { margin-top: 1rem; padding: .625rem 1.5rem; }
.share-url { margin-top: .5rem; word-break: break-all; font-size: .75rem; color: rgba(255, 255, 255, .4); }

/* ======================================================== song board */
.board { display: grid; margin-top: 1rem; font-size: 1.0625rem; }
.board-xs, .board-s { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.board-m { grid-template-columns: minmax(0, 1fr); gap: .625rem; }
.board-l, .board-xl { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
@media (min-width: 640px) {
  .board-xs, .board-s { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .board-m { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* every chip the same height for its text size; the titles are sized to fit (js/board.js) */
.board-chip { display: flex; align-items: stretch; width: 100%; height: 4.6rem; padding: .5rem .75rem; text-align: center; }
.board-xs .board-chip { height: 4rem; padding: .375rem .5rem; }
.board-s .board-chip { height: 4.4rem; padding: .5rem .625rem; }
.board-l .board-chip { height: 5.4rem; }
.board-xl .board-chip { height: 6.4rem; }
.board-chip:not(.is-tappable) { cursor: default; }
.board-chip.is-tappable:active { transform: scale(.98); }
.fit { display: flex; flex: 1; flex-direction: column; justify-content: center; min-width: 0; overflow: hidden; }
.fit-inner { display: block; min-width: 0; }
.chip-title { display: block; text-transform: uppercase; }
.chip-artist { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* badge: pinned over the chip's corner like a seal, so the title keeps the full width */
.badge { position: absolute; top: -.4em; right: -.3em; z-index: 10; display: flex; pointer-events: none; }
.badge-played { padding: .25em .6em; border-radius: 9999px; background: var(--gold); color: var(--ink); font-size: .6em; font-weight: 800; letter-spacing: .025em; text-transform: uppercase; box-shadow: var(--shadow); }
.badge-wrong, .badge-coin { display: flex; align-items: center; justify-content: center; width: 2.05em; height: 2.05em; border-radius: 50%; font-size: .8em; font-weight: 900; }
.badge-wrong { background: #c4302b; color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35); }
.badge-coin { /* a little gold doubloon, like the big screen's coins */
  background: radial-gradient(circle at 34% 28%, #fff7c8 0%, #ffe066 18%, #f2b623 48%, #c98410 76%, #8f5703 100%);
  color: #5a3300; box-shadow: inset 0 0 0 2px #b97a0c, 0 0 10px rgba(255, 200, 60, .65);
}

/* picks bar (live, once joined) */
.picks-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: .75rem 1rem max(1rem, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, .1); background: rgba(7, 10, 18, .95);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.picks-bar-inner { display: flex; align-items: center; gap: 1rem; max-width: 36rem; margin: 0 auto; }
.picks-count { flex-shrink: 0; text-align: center; }
.picks-num { font-size: 1.875rem; line-height: 2.25rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--gold); }
.picks-label { font-size: .6875rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.picks-status { flex: 1; min-width: 0; font-size: .875rem; line-height: 1.375; color: rgba(255, 255, 255, .7); }
.picks-status.is-error { color: #fca5a5; }
.picks-status.is-notice { color: #fde68a; }

/* ======================================================== results */
.results > * + * { margin-top: 1.5rem; }
.next-game { padding: .75rem 1rem; border-radius: 1rem; border: 1px solid rgba(255, 190, 46, .4); background: rgba(7, 10, 18, .8); text-align: center; }
.timer-next { font-size: 1.25em; color: var(--gold); }
.next-game-note { margin-top: .125rem; font-size: .875em; color: var(--muted); }
.score { padding: 1.25rem; border-radius: 1rem; border-color: rgba(255, 190, 46, .4); background: rgba(13, 20, 36, .7); text-align: center; }
.score-label { font-size: .875em; font-weight: 600; letter-spacing: .25em; text-transform: uppercase; color: var(--muted); }
.score-big { margin-top: .25rem; font-family: var(--font-pirata); font-size: 3em; line-height: 1.25; color: var(--gold); text-shadow: var(--heading-shadow); }
.score-line { margin-top: .25rem; color: rgba(255, 255, 255, .8); }
.score-points { margin-top: .5rem; font-size: .875em; color: rgba(255, 255, 255, .7); }
.score-points strong { color: var(--gold); }
.score-voyage { margin-top: .5rem; padding-top: .5rem; border-top: 1px dashed rgba(255, 255, 255, .2); font-size: .875em; color: rgba(255, 255, 255, .7); }
.score-voyage strong { color: var(--gold); }
.section-title { margin-bottom: .75rem; font-family: var(--font-pirata); font-weight: 400; font-size: 1.5em; color: var(--gold); text-shadow: var(--heading-shadow); }
.section-sub { margin: -.5rem 0 .75rem; font-size: .8em; color: var(--muted); }
.playlist > li + li { margin-top: .5rem; }
.pl-row { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; }
.pl-order { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 2.3em; height: 2.3em; border-radius: 50%; background: rgba(7, 10, 18, .85); color: var(--gold); font-size: .875em; font-weight: 700; }
.pl-text { flex: 1; min-width: 0; }
.pl-title, .pl-artist { display: block; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrap { overflow-wrap: break-word; }
.pl-tag { flex-shrink: 0; padding: .125rem .5rem; border-radius: 9999px; background: rgba(0, 0, 0, .1); color: rgba(0, 0, 0, .6); font-size: .75em; font-weight: 700; }
.pl-tag.is-hit { background: var(--gold); color: var(--ink); box-shadow: 0 0 8px rgba(255, 200, 60, .7); }
.leaders { overflow: hidden; border-radius: 1rem; border: 1px solid rgba(255, 255, 255, .1); }
.leader { display: flex; align-items: center; gap: .75rem; padding: .625rem 1rem; border-bottom: 1px solid rgba(255, 255, 255, .1); background: rgba(13, 20, 36, .6); }
.leader:last-child { border-bottom: 0; }
.leader.is-me { background: rgba(255, 190, 46, .2); }
.leader-rank { width: 1.75em; text-align: right; font-weight: 700; color: var(--muted); }
.leader-rank.is-top { color: var(--gold); }
.leader-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: #fff; }
.leader-you { margin-left: .5rem; font-size: .75em; font-weight: 600; color: var(--gold); }
.leader-score { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--gold); }
.leader-of { font-size: .8em; font-weight: 400; color: var(--muted); }
.leaders-gap { padding: .25rem 1rem; background: rgba(13, 20, 36, .6); text-align: center; color: rgba(255, 255, 255, .4); }

/* the winner pop-up */
.winner-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1.25rem; background: rgba(0, 0, 0, .75); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.winner-card { width: 100%; max-width: 24rem; padding: 1.75rem 1.5rem; border-radius: 1.5rem; text-align: center; }
.winner-trophy { font-size: 3.75rem; line-height: 1; }
.winner-label { margin-top: .75rem; font-size: .75rem; line-height: 1rem; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; color: #6b1d0f; }
.winner-names { margin-top: .5rem; }
.winner-names li { overflow-wrap: break-word; font-family: var(--font-pirata); font-size: 3rem; line-height: 1.25; color: #6b1d0f; }
.winner-names li + li { margin-top: .25rem; }
.winner-score { margin-top: .75rem; font-size: 1.125rem; font-weight: 700; color: #3a230c; }
.winner-you { margin-top: .75rem; padding: .5rem .75rem; border-radius: .75rem; background: var(--gold); color: var(--ink); font-weight: 700; box-shadow: var(--shadow); }
.timer-winner { margin-top: 1rem; font-size: 1rem; color: #6b1d0f; }
.winner-btn { width: 100%; margin-top: 1.5rem; padding: .75rem 0; border-radius: .75rem; background: #3a230c; color: #ead3a0; font-size: 1.125rem; font-weight: 700; box-shadow: var(--shadow-lg); transition: background-color .15s, transform .15s; }
.winner-btn:hover { background: #4a2c0f; }
.winner-btn:active { transform: scale(.95); }

/* ======================================================== intro page (no game code yet) */
.intro { display: flex; flex-direction: column; gap: 1.5rem; }

.intro-hero { position: relative; isolation: isolate; padding: 1.25rem 0 .25rem; text-align: center; }
.intro-hero::before { /* lantern glow behind the title */
  content: ""; position: absolute; inset: -1rem -2rem 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 55% 60% at 50% 45%, rgba(255, 190, 46, .22), transparent 70%);
}
.intro-flag { display: inline-block; font-size: 3.5rem; line-height: 1; transform-origin: 20% 90%; animation: flag-wave 3.2s ease-in-out infinite; filter: drop-shadow(0 .3rem .6rem rgba(0, 0, 0, .6)); }
@keyframes flag-wave { 0%, 100% { transform: rotate(-6deg) skewY(-2deg); } 50% { transform: rotate(5deg) skewY(2deg); } }
.intro-kicker { margin-top: .75rem; font-size: .8125rem; font-weight: 800; letter-spacing: .4em; text-transform: uppercase; color: #ffd166; }
.intro-title { margin-top: .35rem; font-size: 3.4rem; line-height: .95; font-weight: 400; }
.intro-tagline { margin-top: .9rem; font-family: var(--font-fell); font-style: italic; font-size: 1.2rem; line-height: 1.35; color: rgba(244, 241, 232, .85); }

/* the join card: a game on shows a glowing beacon and the big button */
.join-card { display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: 1.25rem 1rem; border-radius: 1.25rem; border: 1px solid rgba(255, 255, 255, .12); background: rgba(13, 20, 36, .72); text-align: center; }
.join-card.is-checking { flex-direction: row; justify-content: center; gap: .75rem; color: var(--muted); }
.join-card.is-checking .spinner { width: 1.5rem; height: 1.5rem; border-width: 3px; }
.join-card.is-on { border-color: rgba(255, 190, 46, .6); background: linear-gradient(180deg, rgba(255, 190, 46, .14), rgba(13, 20, 36, .8)); animation: card-glow 2.6s ease-in-out infinite; }
@keyframes card-glow { 0%, 100% { box-shadow: 0 0 .8rem rgba(255, 190, 46, .2); } 50% { box-shadow: 0 0 1.8rem rgba(255, 190, 46, .45); } }
.join-card-status { display: flex; align-items: center; gap: .6rem; font-family: var(--font-pirata); font-size: 1.75rem; line-height: 1.15; color: var(--gold); text-shadow: var(--heading-shadow); }
.join-card.is-off .join-card-status { color: #f4e6c4; }
.beacon { flex-shrink: 0; width: .8rem; height: .8rem; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0 rgba(52, 211, 153, .7); animation: beacon 1.6s ease-out infinite; }
@keyframes beacon { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .7); } 80%, 100% { box-shadow: 0 0 0 .7rem rgba(52, 211, 153, 0); } }
.join-card-time { color: rgba(255, 255, 255, .8); }
.join-card-time strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; color: var(--gold); }
.join-card-note { max-width: 22rem; font-size: .875rem; line-height: 1.4; color: var(--muted); }
.join-card-note strong { color: #f4e6c4; }
.join-game-btn {
  position: relative; overflow: hidden; width: 100%; max-width: 18rem; margin-top: .25rem; padding: 1rem 0;
  font-family: var(--font-pirata); font-weight: 400; font-size: 2rem; line-height: 1; letter-spacing: .02em;
  background: linear-gradient(180deg, #ffd166, #ffbe2e 55%, #e9a514); color: #2a1604;
  box-shadow: 0 .35rem 0 #8a5200, 0 .8rem 1.6rem rgba(0, 0, 0, .5);
}
.join-game-btn:active { transform: translateY(.2rem); box-shadow: 0 .15rem 0 #8a5200, 0 .5rem 1rem rgba(0, 0, 0, .5); }
.join-game-btn::after { /* a glint sweeping across the gold */
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: skewX(-20deg); animation: glint 3.2s ease-in-out infinite;
}
@keyframes glint { 0%, 55% { left: -60%; } 85%, 100% { left: 130%; } }
.join-anyway { margin-top: .25rem; }

/* the rules on a parchment scroll, with wooden rollers top and bottom */
.scroll {
  position: relative; margin: .9rem .35rem; padding: 1.6rem 1.25rem 1.4rem; color: #3a230c;
  border-radius: .3rem;
  background:
    radial-gradient(ellipse at 20% 15%, rgba(255, 250, 230, .5), transparent 50%),
    radial-gradient(ellipse at 85% 90%, rgba(140, 85, 25, .3), transparent 55%),
    radial-gradient(ellipse at 50% 50%, transparent 60%, rgba(120, 70, 20, .25)),
    #ead3a0;
  box-shadow: inset 0 0 1.6rem .3rem rgba(105, 55, 10, .5), 0 .6rem 1.6rem rgba(0, 0, 0, .55);
}
.scroll::before, .scroll::after { /* the rollers */
  content: ""; position: absolute; left: -.7rem; right: -.7rem; height: 1.1rem; border-radius: .55rem;
  background: linear-gradient(180deg, #a8692a, #6b3b12 55%, #3e200a);
  box-shadow: 0 .2rem .5rem rgba(0, 0, 0, .55), inset 0 .15rem .1rem rgba(255, 220, 160, .35);
}
.scroll::before { top: -.55rem; }
.scroll::after { bottom: -.55rem; }
.scroll-title { text-align: center; font-family: var(--font-pirata); font-weight: 400; font-size: 2.2rem; line-height: 1.05; color: #6b1d0f; text-shadow: 0 1px 0 rgba(255, 245, 220, .6); }
.scroll-sub { text-align: center; font-family: var(--font-fell); font-style: italic; font-size: 1.05rem; color: #5a3a17; }
.rules { margin-top: 1rem; }
.rules li { display: flex; gap: .8rem; align-items: flex-start; line-height: 1.45; }
.rules li + li { margin-top: .9rem; padding-top: .9rem; border-top: 1px dashed rgba(107, 59, 18, .35); }
.rules strong { color: #6b1d0f; }
.rules em { font-style: normal; font-weight: 700; }
.rule-icon {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  font-size: 1.3rem; background: radial-gradient(circle at 35% 30%, #fff3cf, #e6c27a 70%, #b88a3e); box-shadow: inset 0 0 0 2px rgba(107, 59, 18, .45), 0 .15rem .3rem rgba(0, 0, 0, .25);
}
.scroll-tips { margin-top: 1.1rem; padding: .8rem .9rem; border-radius: .6rem; background: rgba(107, 59, 18, .1); font-family: var(--font-fell); font-size: 1.02rem; line-height: 1.4; color: #4a2c0f; }
.scroll-tips p + p { margin-top: .4rem; }
.scroll-tips span { margin-right: .35rem; }

/* waves rolling along the bottom of the intro */
.intro-foot {
  position: relative; margin: .5rem -1rem -1.5rem; padding: 1.25rem 1rem 3.6rem; text-align: center;
  font-family: var(--font-fell); font-style: italic; font-size: 1.05rem; color: rgba(244, 241, 232, .75);
}
.intro-foot::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2.8rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 28'%3E%3Cpath d='M0 14 Q15 2 30 14 T60 14 T90 14 T120 14 V28 H0Z' fill='%231d2b4a'/%3E%3Cpath d='M0 20 Q15 10 30 20 T60 20 T90 20 T120 20 V28 H0Z' fill='%230d1424'/%3E%3C/svg%3E") repeat-x;
  background-size: 7.5rem 2.8rem; animation: waves 6s linear infinite;
}
@keyframes waves { to { background-position-x: 7.5rem; } }

@media (prefers-reduced-motion: reduce) {
  .intro-flag, .join-card.is-on, .beacon, .join-game-btn::after, .intro-foot::after { animation: none; }
}

/* Results pop-up, after a voyage's last round: the voyage champion under the round's winner */
.winner-voyage { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed rgba(42, 26, 8, .35); }
