/*
VOICE   Big-night darts on TV, played for laughs among friends: loud, warm, quick.
IDEA    The stage of the Ally Pally at night: black arena, yellow light, a scoreboard like on TV.
PICTURE The parcel, the gift, the Ally Pally show and the board itself fill each screen.
COLOUR  Kugi's jacket and darts: black, signal yellow #FFCB05, white; one night palette in both themes.
TYPE    Anton for names and scores, Inter for text. LAYOUT one column, board as large as the phone allows.
*/
:root { color-scheme: dark; --bg: #0b0b0c; --ink: #f4f2ec; --mute: #a9a6a0; --y: #FFCB05; --panel: #161518; --line: #2a282e; }
* { box-sizing: border-box; min-width: 0; }
html, body { height: 100%; }
body { margin: 0; background: radial-gradient(120% 80% at 50% 0%, #1d1a22 0%, var(--bg) 60%) fixed, var(--bg); color: var(--ink);
  font: 16px/1.5 Inter, system-ui, -apple-system, sans-serif; overflow-x: clip; -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
h1, h2, .code, .brand h1 { font-family: Anton, Impact, sans-serif; font-weight: 400; letter-spacing: .01em; line-height: 1.05; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(34px, 6vw, 52px); }
h2 { font-size: 26px; }
button { font: inherit; }
[hidden] { display: none !important; }

.screen { min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 28px max(5vw, 16px); animation: rise .5s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.intro { text-align: center; }
.intro-pic { width: min(420px, 86vw); position: relative; }
.intro-pic svg { width: 100%; height: auto; display: block; }
.intro-text { max-width: 640px; display: grid; gap: 18px; justify-items: center; }
.kicker { margin: 0; color: var(--y); font-weight: 700; font-size: 15px; }
.lead { margin: 0; color: var(--mute); font-size: 17px; }
.small { margin: 0; color: var(--mute); font-size: 13px; overflow-wrap: anywhere; text-align: center; }

.btn { min-height: 48px; padding: 0 26px; border-radius: 999px; border: 2px solid var(--y); background: var(--y); color: #111; font-weight: 700; font-size: 17px; cursor: pointer; transition: transform .12s, background .2s; }
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: var(--ink); border-color: #4a4750; }
.btn:focus-visible, .link:focus-visible, input:focus-visible, .seg button:focus-visible, .gift:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.btn:disabled { opacity: .45; cursor: default; }
.link { background: none; border: 0; color: var(--mute); text-decoration: underline; cursor: pointer; min-height: 44px; padding: 0 10px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.center { justify-content: center; }

/* parcel and gift */
.parcel { animation: wobble 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-1.5deg); } }
.zzz text { animation: zz 2.4s ease-in-out infinite; }
.zzz text:nth-child(2) { animation-delay: .3s; } .zzz text:nth-child(3) { animation-delay: .6s; }
@keyframes zz { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
.gift { background: none; border: 0; padding: 0; width: 100%; cursor: pointer; display: block; animation: shake 1.6s ease-in-out infinite; }
@keyframes shake { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-4deg); } 85% { transform: rotate(4deg); } }
.gift .lid { transition: transform .6s cubic-bezier(.3, 1.6, .5, 1); transform-origin: 50% 50%; }
.gift.open { animation: none; }
.gift.open .lid { transform: translate(40px, -120px) rotate(24deg); opacity: 0; transition: transform .6s cubic-bezier(.3, 1.6, .5, 1), opacity .3s .35s; }
.gift.open .box { transition: opacity .4s .3s; opacity: 0; }
.darts { position: absolute; inset: 0 0 auto; opacity: 0; transform: translateY(60px) scale(.8); transition: all .7s cubic-bezier(.2, 1.4, .4, 1) .35s; pointer-events: none; }
.darts.show { opacity: 1; transform: none; }

/* show */
.show { gap: 16px; }
.stage { width: min(1200px, 100%); aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.stage canvas { width: 100%; height: 100%; display: block; }
.rotate { display: none; }
@media (max-width: 600px) and (orientation: portrait) { .rotate { display: block; } }

/* menu and lobby */
.brand { text-align: center; display: grid; gap: 8px; }
.brand h1 { font-size: clamp(56px, 14vw, 104px); color: var(--y); }
.panel { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; display: grid; gap: 14px; }
label { font-weight: 600; font-size: 15px; }
input { width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid #3a3840; background: #0f0e11; color: var(--ink); font-size: 17px; padding: 0 14px; }
.join { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
#codeIn { text-transform: uppercase; letter-spacing: .2em; font-weight: 700; }
.msg { margin: 0; min-height: 1.5em; color: var(--y); font-size: 15px; }
.code { font-size: clamp(72px, 22vw, 120px); color: var(--y); margin: -8px 0 0; letter-spacing: .08em; }
.players { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.players li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 12px; background: #0f0e11; font-weight: 600; }
.players li span { color: var(--mute); font-weight: 400; font-size: 14px; }
.seg { display: flex; gap: 6px; background: #0f0e11; border-radius: 12px; padding: 4px; }
.seg button { flex: 1; min-height: 42px; border: 0; border-radius: 9px; background: none; color: var(--mute); font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--y); color: #111; }

/* game */
.game { justify-content: flex-start; gap: 10px; padding-top: 14px; padding-bottom: 14px; }
.scores { width: min(720px, 100%); display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 2px; }
.pcard { flex: 1 0 140px; scroll-snap-align: start; background: var(--panel); border: 2px solid var(--line); border-radius: 14px; padding: 8px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 0 8px; }
.pcard.on { border-color: var(--y); box-shadow: 0 0 0 3px rgba(255, 203, 5, .18); }
.pcard .n { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .s { font-family: Anton, Impact, sans-serif; font-size: 40px; line-height: 1; grid-row: span 2; }
.pcard .m { color: var(--mute); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .s { padding-left: 6px; }
.pcard.left { opacity: .5; }
.boardwrap { position: relative; width: min(720px, 100%, calc(100svh - 250px)); aspect-ratio: 1; touch-action: none; user-select: none; -webkit-user-select: none; }
.boardwrap canvas { width: 100%; height: 100%; display: block; cursor: crosshair; }
.callout { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; text-align: center; font-family: Anton, Impact, sans-serif; font-size: clamp(64px, 20vw, 150px); color: var(--y); -webkit-text-stroke: 3px #000; text-shadow: 0 6px 30px rgba(0, 0, 0, .7); opacity: 0; transform: scale(.6); transition: opacity .2s, transform .35s cubic-bezier(.2, 1.6, .4, 1); line-height: .95; }
.callout small { display: block; font: 700 clamp(18px, 4vw, 26px) Inter, system-ui, sans-serif; color: #fff; -webkit-text-stroke: 0; margin-top: 8px; }
.callout.on { opacity: 1; transform: none; }
.hud { width: min(720px, 100%); display: grid; gap: 4px; text-align: center; }
.visit { display: flex; justify-content: center; gap: 8px; min-height: 40px; }
.visit span { min-width: 64px; padding: 6px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-weight: 700; }
.visit span.t { color: #111; background: var(--y); border-color: var(--y); }
.status { margin: 0; font-weight: 600; }
.finish { margin: 0; color: var(--y); font-weight: 700; min-height: 1.5em; }
.end { position: fixed; inset: auto 12px 12px; margin: 0 auto; max-width: 520px; background: var(--panel); border: 2px solid var(--y); border-radius: 18px; padding: 20px; text-align: center; display: grid; gap: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, .7); z-index: 5; }

@media (max-width: 600px) {
  .screen { gap: 18px; }
  .stage { border-radius: 10px; }
  .boardwrap { width: min(100%, calc(100svh - 230px)); }
  .pcard { flex-basis: 150px; padding: 8px 10px; }
  .pcard .s { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
