:root {
  --sky-1: #1c0f45;
  --sky-2: #57288a;
  --sky-3: #e5526f;
  --sky-4: #ffa156;
  --sky-5: #ffd57e;
  --sea-1: #1ccbcc;
  --sea-2: #0b93a6;
  --sea-3: #065373;
  --sand: #f6d9a0;
  --sand-dark: #dfb46e;
  --palm: #2a1236;

  --ink: #1d1838;
  --ink-soft: #5a537e;
  --p1: #00b3c4;
  --p1-deep: #007b8f;
  --p2: #ff4f7e;
  --p2-deep: #c42957;
  --gold: #ffc83d;
  --ok: #17b978;
  --bad: #ef3f4f;

  --glass: rgba(255, 255, 255, 0.84);
  --radius: 24px;
  --shadow: 0 20px 50px -18px rgba(25, 8, 60, 0.6);
  --horizon: 63%;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
[hidden] { display: none !important; }

body {
  font-family: 'Baloo 2', system-ui, sans-serif;
  color: var(--ink);
  overflow: hidden;
  background: linear-gradient(180deg,
    var(--sky-1) 0%, var(--sky-2) 22%, var(--sky-3) 44%,
    var(--sky-4) 56%, var(--sky-5) var(--horizon));
}

code, kbd {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.85em;
}

/* ------------------------------------------------------------------ scenery */
.scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.stars {
  position: absolute; inset: 0 0 60% 0;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff9, transparent),
    radial-gradient(1px 1px at 28% 8%, #fff8, transparent),
    radial-gradient(1.5px 1.5px at 47% 14%, #fff7, transparent),
    radial-gradient(1px 1px at 66% 6%, #fff9, transparent),
    radial-gradient(1.5px 1.5px at 81% 20%, #fff8, transparent),
    radial-gradient(1px 1px at 92% 9%, #fff7, transparent);
  animation: twinkle 5s ease-in-out infinite alternate;
}

.sun {
  position: absolute; left: 50%; top: var(--horizon);
  width: min(42vw, 460px); aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, #fff7cf 0%, #ffd86b 42%, #ff9a45 68%, rgba(255, 140, 60, 0) 71%);
  filter: drop-shadow(0 0 60px rgba(255, 170, 80, 0.7));
}

.boat {
  position: absolute; top: calc(var(--horizon) - 2.3rem); left: -6vw;
  font-size: 2rem;
  animation: sail 110s linear infinite;
}

.sea {
  position: absolute; left: 0; right: 0; top: var(--horizon); bottom: 0;
  background: linear-gradient(180deg, var(--sea-1), var(--sea-2) 45%, var(--sea-3));
  overflow: hidden;
}
.glitter {
  position: absolute; left: 50%; top: 0; width: min(36vw, 400px); height: 100%;
  transform: translateX(-50%);
  background: repeating-linear-gradient(180deg, rgba(255, 228, 150, 0.65) 0 3px, transparent 3px 13px);
  clip-path: polygon(30% 0, 70% 0, 95% 100%, 5% 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 75%);
  mask-image: linear-gradient(to bottom, #000, transparent 75%);
  animation: shimmer 2.8s ease-in-out infinite alternate;
}
.wave {
  position: absolute; left: 0; width: calc(100% + 400px); height: 60px;
  background-repeat: repeat-x; background-size: 400px 60px;
  animation: wave 14s linear infinite;
}
.w1 { bottom: 30%; opacity: 0.5; animation-duration: 18s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='60'%3E%3Cpath d='M0 30 Q50 14 100 30 T200 30 T300 30 T400 30 V60 H0Z' fill='%2337d6d3'/%3E%3C/svg%3E"); }
.w2 { bottom: 14%; opacity: 0.6; animation-duration: 12s; animation-direction: reverse;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='60'%3E%3Cpath d='M0 30 Q50 10 100 30 T200 30 T300 30 T400 30 V60 H0Z' fill='%230aa3b5'/%3E%3C/svg%3E"); }
.w3 { bottom: -12px; opacity: 0.9; animation-duration: 9s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='60'%3E%3Cpath d='M0 30 Q50 8 100 30 T200 30 T300 30 T400 30 V60 H0Z' fill='%23e9fbff'/%3E%3C/svg%3E"); }

.beach {
  position: absolute; bottom: -14vh; height: 30vh; width: 42vw;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 25%, var(--sand), var(--sand-dark));
}
.beach.left { left: -12vw; }
.beach.right { right: -14vw; }

.palm {
  position: absolute; bottom: -2vh;
  height: min(72vh, 600px); aspect-ratio: 220 / 420;
  color: var(--palm);
  transform-origin: 45% 100%;
  animation: sway 6s ease-in-out infinite alternate;
}
.palm-l1 { left: -3vw; }
.palm-l2 { left: 7vw; height: min(52vh, 440px); animation-delay: -2s; opacity: 0.9; }
.palm-r1 { right: -2vw; scale: -1 1; animation-delay: -4s; }

@keyframes sway { from { rotate: -1.6deg; } to { rotate: 1.6deg; } }
@keyframes wave { to { transform: translateX(-400px); } }
@keyframes sail { to { transform: translateX(115vw); } }
@keyframes shimmer { from { opacity: 0.45; } to { opacity: 0.9; } }
@keyframes twinkle { from { opacity: 0.4; } to { opacity: 1; } }

/* ------------------------------------------------------------------ layout */
main { position: relative; z-index: 1; height: 100%; overflow: auto; }
.screen {
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 28px 16px;
}

.card {
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  width: min(780px, 100%);
}

/* ------------------------------------------------------------------ logo */
.logo { text-align: center; color: #fff; margin-bottom: 18px; }
.logo-sub { font-weight: 700; letter-spacing: 0.25em; text-transform: uppercase; font-size: 0.9rem; opacity: 0.9; }
.logo h1 {
  margin: 0; line-height: 1.05;
  font-family: 'Pacifico', cursive; font-weight: 400;
  font-size: clamp(3.2rem, 9vw, 6rem);
  text-shadow: 0 4px 0 var(--sky-3), 0 10px 30px rgba(40, 0, 60, 0.5);
}
.logo h1 span, .mini-logo span {
  display: block;
  font-family: 'Baloo 2', sans-serif; font-weight: 800;
  font-size: 0.42em; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 3px 0 #b5521f;
}
.tagline { margin: 6px 0 0; font-size: 1.2rem; font-weight: 600; }

/* ------------------------------------------------------------------ setup */
.setup { display: grid; gap: 20px; }
.step h2 { margin: 0 0 8px; font-size: 1.3rem; display: flex; align-items: center; gap: 10px; }
.num {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--sky-3), var(--sky-4));
  color: #fff; font-size: 1rem;
}
.field { display: grid; gap: 4px; font-weight: 700; font-size: 0.95rem; }
input:not([type]), input[type=number], select, textarea {
  font: inherit; font-weight: 600; color: var(--ink);
  border: 2px solid #e4dcef; border-radius: 14px;
  padding: 0.5em 0.8em; background: #fff;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sea-2); box-shadow: 0 0 0 4px rgba(11, 147, 166, 0.18); }
textarea { resize: vertical; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.9rem; }
.hint { margin: 6px 0 10px; color: var(--ink-soft); font-size: 0.92rem; }
.hint code { background: #f1ebfa; padding: 2px 6px; border-radius: 6px; user-select: all; }
.connected { margin: 0 0 4px; font-size: 1.05rem; }
.warn { color: var(--bad); font-weight: 700; }

.players-setup { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pl { display: flex; align-items: center; gap: 10px; }
.pl input { font-size: 1.1rem; }
.pl.p1 input { border-color: color-mix(in srgb, var(--p1) 45%, white); }
.pl.p2 input { border-color: color-mix(in srgb, var(--p2) 45%, white); }

.rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.score-note { grid-column: 1 / -1; margin: 0; }
.check { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--sea-2); }
.pass-rule { flex-wrap: wrap; gap: 6px 10px; cursor: default; }
.pass-rule select { width: auto; padding: 0.25em 0.6em; }
.pass-rule .hint { margin: 0; }

/* ------------------------------------------------------------------ buttons */
.btn {
  font: inherit; font-weight: 800; cursor: pointer;
  border: 0; border-radius: 999px;
  padding: 0.6em 1.4em;
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { color: #fff; background: linear-gradient(135deg, var(--sky-3), var(--sky-4)); box-shadow: 0 6px 0 #b8394f; }
.btn.big { font-size: 1.5rem; padding: 0.5em 1.4em; justify-self: center; }
.btn.spotify { color: #fff; background: #1db954; box-shadow: 0 5px 0 #138a3d; }
.btn.ghost { color: var(--ink); background: rgba(255, 255, 255, 0.75); box-shadow: 0 4px 0 rgba(30, 10, 60, 0.25); }
.btn.small { font-size: 0.9rem; padding: 0.35em 1em; }
.btn.ok { color: #fff; background: var(--ok); box-shadow: 0 6px 0 #0e7c50; font-size: 1.25rem; }
.btn.bad { color: #fff; background: var(--bad); box-shadow: 0 6px 0 #a5202d; font-size: 1.25rem; }
.btn.next { color: #fff; background: linear-gradient(135deg, var(--sea-2), var(--sea-1)); box-shadow: 0 6px 0 var(--sea-3); font-size: 1.25rem; }
.btn kbd { background: rgba(0, 0, 0, 0.18); border-radius: 6px; padding: 0 6px; font-weight: 600; }
.btn.ghost kbd { background: rgba(0, 0, 0, 0.08); }
.link { font: inherit; background: none; border: 0; padding: 0; color: var(--ink-soft); text-decoration: underline; cursor: pointer; }

.keycap {
  display: inline-grid; place-items: center; flex: none;
  width: 46px; height: 46px; border-radius: 12px;
  background: #fff; color: var(--pc, var(--ink));
  font-weight: 800; font-size: 1.5rem;
  box-shadow: 0 5px 0 var(--pc-deep, #999), 0 6px 14px rgba(0, 0, 0, 0.18);
}
.p1 { --pc: var(--p1); --pc-deep: var(--p1-deep); }
.p2 { --pc: var(--p2); --pc-deep: var(--p2-deep); }

/* ------------------------------------------------------------------ phone controllers */
.phones-setup { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.phones-setup .hint { grid-column: 1 / -1; margin: 0; }
.pq {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: 16px; padding: 10px;
  border: 3px solid color-mix(in srgb, var(--pc) 40%, white);
  transition: border-color 0.3s;
}
.pq .qr { width: 118px; flex: none; }
.pq .qr svg, .phone-qr .qr svg { display: block; width: 100%; height: auto; }
.pq-title { font-weight: 600; line-height: 1.25; }
.pq-status { font-weight: 800; font-size: 0.9rem; color: var(--ink-soft); }
.pq.connected { border-color: var(--ok); }
.pq.connected .pq-status { color: var(--ok); }
.pq.tested { animation: tested 0.7s ease-out; }
@keyframes tested { from { box-shadow: 0 0 0 10px color-mix(in srgb, var(--pc) 60%, transparent); } }

.phone-qr { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 4px; }
.phone-qr .qr { width: clamp(78px, 8vw, 112px); background: #fff; border-radius: 10px; padding: 3px; }
.phone-qr .pq-status { font-size: 0.85rem; }
.phone-qr.connected .qr { display: none; }
.phone-qr.connected .pq-status { color: var(--ok); }

/* ------------------------------------------------------------------ loading */
.loading-card { text-align: center; width: min(560px, 100%); }
.spinner { font-size: 4rem; display: inline-block; animation: spin 3s linear infinite; }
.loading-card h2 { margin: 6px 0 12px; }
.load-log { list-style: none; padding: 0; margin: 0 0 14px; text-align: left; display: grid; gap: 6px; }
.load-log li { padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.7); font-weight: 600; }
.load-log li.ok { background: #e3f8ef; }
.load-log li.bad { background: #fde6e8; color: #8d1822; }

/* ------------------------------------------------------------------ game */
#screen-game {
  display: grid; grid-template-rows: auto 1fr auto;
  height: 100%; min-height: 0;
  align-items: stretch; justify-content: stretch;
  padding: 14px 24px;
}
#screen-game[hidden] { display: none !important; }

.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.pill {
  justify-self: start;
  background: rgba(255, 255, 255, 0.85); border-radius: 999px;
  padding: 4px 16px; font-weight: 800;
  box-shadow: 0 4px 0 rgba(30, 10, 60, 0.25);
}
.mini-logo { font-family: 'Pacifico', cursive; color: #fff; font-size: 2rem; line-height: 1; text-align: center; text-shadow: 0 3px 0 var(--sky-3); }
.mini-logo span { display: inline; font-size: 0.5em; margin-left: 6px; }
.top-right { justify-self: end; display: flex; align-items: center; gap: 12px; }
.vol { display: flex; align-items: center; gap: 6px; color: #fff; font-size: 1.2rem; }
.vol input { width: 110px; accent-color: var(--gold); }

.arena {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(320px, 1.35fr) minmax(200px, 1fr);
  gap: clamp(14px, 3vw, 40px);
  align-items: center;
  min-height: 0;
}

.player {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-radius: 32px;
  border: 5px solid transparent;
  box-shadow: var(--shadow);
  padding: 26px 18px 22px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
  cursor: pointer; user-select: none;
  transition: transform 0.25s, filter 0.3s, opacity 0.3s, border-color 0.25s, box-shadow 0.25s;
}
.player .keycap { width: 66px; height: 66px; font-size: 2.3rem; border-radius: 16px; }
.pname { font-size: clamp(1.2rem, 2.3vw, 2rem); font-weight: 800; line-height: 1.1; word-break: break-word; }
.score {
  font-size: clamp(4.5rem, 11vw, 9rem); font-weight: 800; line-height: 0.95;
  color: var(--pc); font-variant-numeric: tabular-nums;
  text-shadow: 0 5px 0 color-mix(in srgb, var(--pc-deep) 35%, transparent);
}
.pbar { width: 80%; height: 10px; border-radius: 99px; background: rgba(0, 0, 0, 0.08); overflow: hidden; }
.pbar i { display: block; height: 100%; width: 0; background: var(--pc); border-radius: 99px; transition: width 0.6s cubic-bezier(.2, 1.4, .4, 1); }
.pstatus { min-height: 1.6em; font-weight: 800; color: var(--ink-soft); font-size: 1.1rem; }

.pass {
  font: inherit; font-weight: 700; font-size: 0.9rem; color: var(--ink-soft);
  background: rgba(0, 0, 0, 0.06); border: 0; border-radius: 99px;
  padding: 3px 12px; cursor: pointer;
}
.pass:hover { background: rgba(0, 0, 0, 0.12); }
.pass kbd { background: #fff; border-radius: 5px; padding: 0 6px; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2); }
.player:not(.can-pass) .pass { visibility: hidden; }
.player.passed { filter: saturate(0.4); }
.player.passed .pstatus { color: var(--ink-soft); }

.player.buzzed {
  transform: scale(1.07);
  border-color: var(--pc);
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--pc) 30%, transparent), 0 0 90px var(--pc);
  animation: buzzpulse 0.7s ease-in-out infinite alternate;
}
.player.buzzed .pstatus { color: var(--pc-deep); }
.player.locked { filter: grayscale(0.95); opacity: 0.5; transform: scale(0.95); }
.player.locked .pstatus { color: var(--bad); }
.player.scored { border-color: var(--gold); }
.player.scored .score { animation: pop 0.7s cubic-bezier(.2, 1.6, .4, 1); }
.player.scored .pstatus { color: #b57a00; }

@keyframes buzzpulse { to { box-shadow: 0 0 0 18px color-mix(in srgb, var(--pc) 15%, transparent), 0 0 120px var(--pc); } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.35) rotate(-4deg); } 100% { transform: scale(1); } }

.stage { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; position: relative; }
.disc-wrap { position: relative; width: min(34vh, 28vw, 320px); aspect-ratio: 1; margin: 14px; }
.disc-wrap::after { /* fixed shine on top of the spinning record */
  content: ''; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: conic-gradient(from 20deg, transparent 0 8%, rgba(255, 255, 255, 0.14) 12%, transparent 17% 55%, rgba(255, 255, 255, 0.1) 60%, transparent 65%);
}
.ring { position: absolute; inset: -16px; width: calc(100% + 32px); height: calc(100% + 32px); rotate: -90deg; overflow: visible; }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.35); stroke-width: 5; }
.ring-fg { fill: none; stroke: var(--gold); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 351.86; stroke-dashoffset: 0; transition: stroke 0.3s; }
.ring-fg.warn { stroke: var(--bad); animation: blink 0.5s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

.disc {
  width: 100%; height: 100%; border-radius: 50%;
  display: grid; place-items: center;
  background: repeating-radial-gradient(circle at center, #141414 0 2px, #222 2px 4px);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.45), inset 0 0 0 7px #0b0b0b;
}
.disc.spin { animation: spin 2.6s linear infinite; }
.disc.spin.paused { animation-play-state: paused; }
@keyframes spin { to { transform: rotate(360deg); } }

.disc-label {
  position: relative; width: 42%; aspect-ratio: 1; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--sky-3), var(--sky-4) 50%, var(--sea-1));
  box-shadow: 0 0 0 4px #0b0b0b;
}
.disc-label::after { content: ''; position: absolute; width: 9%; aspect-ratio: 1; border-radius: 50%; background: #111; }
.qmark { font-family: 'Pacifico', cursive; color: #fff; font-size: clamp(2rem, 5vh, 3.2rem); text-shadow: 0 3px 8px rgba(0, 0, 0, 0.35); }
.disc-label img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.6s; }
.disc-wrap.revealed .disc-label img[src] { opacity: 1; }

.clock {
  font-size: clamp(2.2rem, 5vh, 3.4rem); font-weight: 800; line-height: 1;
  color: #fff; font-variant-numeric: tabular-nums;
  text-shadow: 0 3px 0 rgba(120, 30, 60, 0.6), 0 6px 20px rgba(0, 0, 0, 0.35);
}
.worth {
  margin-top: -6px; font-weight: 800; font-size: 1.1rem; color: var(--gold);
  text-shadow: 0 2px 0 rgba(120, 30, 60, 0.6);
}
.worth:empty { display: none; }
.status {
  background: rgba(255, 255, 255, 0.88); border-radius: 18px;
  padding: 8px 20px; font-size: clamp(1.05rem, 1.8vw, 1.35rem); font-weight: 800;
  text-align: center; box-shadow: var(--shadow); max-width: 100%;
}
.answer {
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 24px; text-align: center; max-width: 100%;
  animation: rise 0.45s cubic-bezier(.2, 1.4, .4, 1);
}
.a-title { font-size: clamp(1.5rem, 3vw, 2.3rem); font-weight: 800; line-height: 1.1; }
.a-orig { color: var(--ink-soft); font-size: 0.95rem; }
.a-orig:empty { display: none; }
.a-artist { font-size: clamp(1.1rem, 2vw, 1.4rem); font-weight: 700; color: var(--sky-3); }
.a-meta { color: var(--ink-soft); font-size: 0.9rem; }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(0.96); } }

.actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; min-height: 52px; align-items: center; }
.peek {
  position: absolute; bottom: -10px; left: 50%; translate: -50% 100%;
  background: var(--ink); color: #fff; border-radius: 12px;
  padding: 6px 14px; font-weight: 700; white-space: nowrap; max-width: 90vw; overflow: hidden; text-overflow: ellipsis;
}

.keys-hint {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px;
  justify-self: center;
  color: #fff; font-weight: 600; font-size: 0.95rem;
  background: rgba(20, 10, 50, 0.55); border-radius: 999px;
  padding: 6px 22px; margin-top: 8px;
}
.keys-hint kbd { background: rgba(255, 255, 255, 0.9); color: var(--ink); border-radius: 6px; padding: 1px 7px; text-shadow: none; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3); }

/* ------------------------------------------------------------------ game over */
.over-card { text-align: center; width: min(680px, 100%); }
.trophy { font-size: 5rem; line-height: 1; animation: bounce 1.2s ease-in-out infinite alternate; }
@keyframes bounce { to { transform: translateY(-12px) rotate(4deg); } }
#winner-title { font-family: 'Pacifico', cursive; font-weight: 400; font-size: clamp(2rem, 6vw, 3.2rem); margin: 4px 0 12px; color: var(--sky-3); }
.final-scores { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.final-scores > div { border-radius: 18px; padding: 10px; background: rgba(255, 255, 255, 0.7); border: 4px solid transparent; }
.final-scores > div.win { border-color: var(--gold); }
.final-scores .fs-name { font-weight: 800; font-size: 1.2rem; }
.final-scores .fs-score { font-weight: 800; font-size: 3rem; line-height: 1; color: var(--pc); }
.over-card h3 { margin: 0 0 6px; text-align: left; }
.history { list-style: none; margin: 0 0 18px; padding: 0; max-height: 32vh; overflow: auto; text-align: left; display: grid; gap: 6px; }
.history li { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; background: rgba(255, 255, 255, 0.7); padding: 6px 10px; border-radius: 12px; }
.history img, .history .noimg { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--sky-4); }
.history .h-title { font-weight: 700; line-height: 1.15; }
.history .h-artist { color: var(--ink-soft); font-size: 0.9rem; }
.history .badge { font-weight: 800; font-size: 0.9rem; border-radius: 99px; padding: 2px 10px; background: #eee; white-space: nowrap; }
.history .badge.p1, .history .badge.p2 { background: var(--pc); color: #fff; }
.over-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ------------------------------------------------------------------ overlays */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(30, 10, 60, 0.35);
}
.overlay span {
  font-family: 'Pacifico', cursive; color: #fff;
  font-size: clamp(5rem, 22vh, 14rem);
  text-shadow: 0 8px 0 var(--sky-3), 0 20px 50px rgba(0, 0, 0, 0.45);
  animation: zoom 0.75s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes zoom { from { transform: scale(2.4); opacity: 0; } }

.flash { position: fixed; inset: 0; z-index: 40; pointer-events: none; opacity: 0; }
.flash.go { animation: flash 0.55s ease-out; }
@keyframes flash { from { opacity: 0.55; } to { opacity: 0; } }

#confetti { position: fixed; inset: 0; z-index: 60; pointer-events: none; width: 100%; height: 100%; }

.toasts { position: fixed; z-index: 70; left: 50%; bottom: 20px; translate: -50% 0; display: grid; gap: 8px; width: min(560px, calc(100% - 32px)); }
.toast {
  background: rgba(255, 255, 255, 0.95); border-radius: 14px; padding: 10px 16px;
  font-weight: 700; box-shadow: var(--shadow); border-left: 6px solid var(--sea-2);
  animation: rise 0.3s ease-out; transition: opacity 0.4s;
}
.toast.error { border-left-color: var(--bad); }
.toast.out { opacity: 0; }

/* ------------------------------------------------------------------ small screens */
@media (max-width: 820px) {
  body { overflow: auto; }
  .rules { grid-template-columns: 1fr; }
  .players-setup, .phones-setup { grid-template-columns: 1fr; }
  .mini-logo { display: none; }
  .topbar { grid-template-columns: 1fr auto; }
  .arena { grid-template-columns: 1fr 1fr; align-content: start; padding: 12px 0; }
  .stage { grid-column: 1 / -1; order: -1; }
  .disc-wrap { width: min(42vw, 260px); }
  .player { padding: 14px 10px; }
  .keys-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
