/* Dial It In. Night-sky palette, big touch targets, one thumb friendly. */
:root {
  --bg-1: #1c1448; --bg-2: #0d0826;
  --ink: #f6f2ff; --ink-dim: #b9b0e0;
  --glass: rgba(255,255,255,.07); --line: rgba(255,255,255,.16);
  --amber: #ffb74a; --amber-hi: #ffe08a; --coral: #ff6b81; --teal: #38d6c4;
  --good: #7ee2a0; --bad: #ff8f84;
  --font: "Avenir Next", "Trebuchet MS", Inter, ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg-2); overscroll-behavior: none; }
body { font-family: var(--font); color: var(--ink); -webkit-font-smoothing: antialiased; touch-action: manipulation; }
button, input { font-family: inherit; }
.hidden { display: none !important; }
.app { position: fixed; inset: 0; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; overflow: hidden; padding-top: env(safe-area-inset-top); }
.sky {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff8, transparent), radial-gradient(1.5px 1.5px at 80% 12%, #fff9, transparent),
    radial-gradient(1px 1px at 34% 40%, #fff7, transparent), radial-gradient(1.5px 1.5px at 66% 33%, #fff6, transparent),
    radial-gradient(1px 1px at 90% 60%, #fff7, transparent), radial-gradient(1px 1px at 20% 74%, #fff6, transparent),
    radial-gradient(120% 70% at 50% 0%, var(--bg-1), var(--bg-2) 70%);
}

/* top bar */
.top { display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px; }
.icon-btn { flex: none; width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass); color: var(--ink); font-size: 18px; font-weight: 800; cursor: pointer; }
.icon-btn:active { transform: scale(.94); }
.scores { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; min-width: 0; }
.team { position: relative; padding: 7px 10px 10px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); display: flex; align-items: baseline; justify-content: space-between; gap: 6px; opacity: .65; transition: opacity .2s, transform .2s, box-shadow .2s; min-width: 0; }
.team.on { opacity: 1; border-color: var(--c); box-shadow: 0 0 18px -4px var(--c); }
.team .tn { font-size: 12px; font-weight: 800; letter-spacing: .04em; color: var(--c); text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team b { font-size: 22px; line-height: 1; }
.team .bar { position: absolute; left: 10px; right: 10px; bottom: 4px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.team .bar u { display: block; height: 100%; background: var(--c); transition: width .6s cubic-bezier(.2,.8,.2,1); }

/* stage + views */
.stage { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 18px calc(18px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.view { min-height: 100%; display: flex; flex-direction: column; gap: 14px; animation: rise .35s cubic-bezier(.2,.8,.2,1); }
.center .view { justify-content: center; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.eyebrow { text-align: center; font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-dim); }
.h { margin: 4px 0 0; font-size: 26px; text-align: center; }
.big { margin: 0; font-size: clamp(34px, 11vw, 54px); line-height: 1.05; text-align: center; letter-spacing: -.01em; }
.big.win { animation: pop .6s cubic-bezier(.3,1.6,.5,1); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.tag { color: var(--c); }
.fine { margin: 0; text-align: center; color: var(--ink-dim); font-size: 13px; line-height: 1.45; }
.tip { margin-top: -4px; }
.col { display: flex; flex-direction: column; gap: 10px; margin-top: auto; padding-top: 6px; }
.col.two { flex-direction: row; }
.col.two > * { flex: 1; }
.card { padding: 16px; border-radius: 20px; background: var(--glass); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.hint p { margin: 0; line-height: 1.5; color: var(--ink); }

/* buttons */
.btn { display: block; width: 100%; min-height: 54px; padding: 14px 18px; border-radius: 18px; border: 1px solid var(--line); background: var(--glass); color: var(--ink); font-size: 16px; font-weight: 800; text-align: center; text-decoration: none; cursor: pointer; transition: transform .08s, box-shadow .08s, filter .15s; }
.btn:active { transform: translateY(2px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { color: #3a2200; border: 0; background: linear-gradient(#ffe08a, #ffb74a 60%, #f08e1f); box-shadow: inset 0 1px 0 #fff9, 0 5px 0 #a8590a, 0 12px 22px rgba(0,0,0,.35); font-size: 18px; }
.btn.primary:active { transform: translateY(4px); box-shadow: inset 0 1px 0 #fff9, 0 1px 0 #a8590a, 0 4px 8px rgba(0,0,0,.35); }
.btn.primary:disabled { filter: grayscale(.9) brightness(.7); box-shadow: 0 5px 0 #555; }
.btn.side { font-size: 20px; min-height: 64px; }
.btn.side.l { border-color: var(--teal); box-shadow: inset 0 0 0 1px rgba(56,214,196,.25); }
.btn.side.r { border-color: var(--coral); box-shadow: inset 0 0 0 1px rgba(255,107,129,.25); }
.btn.side span { opacity: .8; }
.btn.peek { min-height: 64px; border: 2px dashed var(--amber); color: var(--amber-hi); background: rgba(255,183,74,.08); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.btn.peek.down { background: rgba(255,183,74,.28); border-style: solid; transform: scale(.98); }
.hub { color: var(--ink-dim); text-align: center; font-size: 14px; text-decoration: none; padding: 8px; }

/* forms */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--c, var(--ink-dim)); }
.field > span em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--ink-dim); }
.field input { width: 100%; min-height: 52px; padding: 0 16px; border-radius: 16px; border: 2px solid var(--line); background: rgba(0,0,0,.28); color: var(--ink); font-size: 18px; font-weight: 700; outline: none; user-select: text; -webkit-user-select: text; }
.field input:focus { border-color: var(--c, var(--amber)); }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1; min-height: 50px; border-radius: 14px; border: 2px solid var(--line); background: transparent; color: var(--ink); font-size: 20px; font-weight: 800; cursor: pointer; }
.seg button.on { background: var(--amber); border-color: var(--amber); color: #3a2200; }
.err { min-height: 1.2em; margin: -6px 0 0; text-align: center; color: var(--bad); font-weight: 700; font-size: 14px; }

/* title */
.hero { text-align: center; }
.logo-dial { width: min(74vw, 300px); margin: 0 auto -4px; }
.hero h1 { margin: 6px 0 0; font-size: clamp(40px, 13vw, 62px); line-height: 1; letter-spacing: -.02em; background: linear-gradient(90deg, var(--teal), #b79cff 50%, var(--coral)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero small { display: block; margin-top: 10px; font-size: 16px; font-weight: 600; letter-spacing: 0; color: var(--ink-dim); -webkit-text-fill-color: var(--ink-dim); }
.center .col { margin-top: 0; }

/* spectrum labels */
.spec { display: flex; justify-content: space-between; gap: 10px; }
.end { flex: 1; max-width: 50%; padding: 9px 12px; border-radius: 14px; font-weight: 800; font-size: clamp(14px, 4.2vw, 18px); line-height: 1.15; text-align: center; color: #07201d; display: flex; align-items: center; justify-content: center; }
.end.l { background: var(--teal); }
.end.r { background: var(--coral); color: #2d0710; }

/* dial */
.dial { display: block; width: 100%; max-width: 480px; margin: 0 auto; overflow: visible; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; outline: none; filter: drop-shadow(0 16px 24px rgba(0,0,0,.4)); }
.dial.grab { cursor: grabbing; }
.dial:focus-visible { filter: drop-shadow(0 0 10px var(--amber)); }
.dial.locked, .dial.demo { cursor: default; pointer-events: none; }
.tick { stroke: rgba(255,255,255,.45); stroke-width: 2; stroke-linecap: round; }
.q { font: 800 86px var(--font); fill: rgba(255,255,255,.12); }
.dial .target { opacity: 0; transition: opacity .12s; pointer-events: none; }
.dial.show-target .target { opacity: 1; }
.dial.show-target .mystery { opacity: 0; }
.needle { transform-origin: 200px 215px; transition: transform .06s linear; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
.dial.locked .needle, .dial.revealing .needle { transition: transform .9s cubic-bezier(.3,1.3,.5,1); }
.band-n { font: 800 15px var(--font); fill: #1d1030; pointer-events: none; }
.revealing .band { animation: bandIn .5s cubic-bezier(.3,1.4,.5,1) both; transform-origin: 200px 215px; }
@keyframes bandIn { from { opacity: 0; transform: scale(.55); } }
.demo .band { animation: none; }

/* guess: clue card */
.clue-card { margin: 0; padding: 18px 20px; border-radius: 22px; text-align: center; font-size: clamp(24px, 7.5vw, 34px); font-weight: 800; line-height: 1.15; background: linear-gradient(160deg, rgba(255,183,74,.22), rgba(255,107,129,.14)); border: 1px solid rgba(255,183,74,.5); overflow-wrap: anywhere; }
.clue-card small { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--amber-hi); }
.clue-card.slim { font-size: 22px; padding: 12px 16px; }

/* result */
.result { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-radius: 22px; border: 1px solid var(--line); background: var(--glass); animation: rise .5s .6s cubic-bezier(.2,.8,.2,1) both; }
.result .pts { flex: none; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; font-size: 34px; font-weight: 900; background: rgba(255,255,255,.08); }
.result.p4 .pts { background: #ff5d73; box-shadow: 0 0 30px #ff5d73aa; }
.result.p3 .pts { background: #ffd36e; color: #3a2200; box-shadow: 0 0 24px #ffd36e88; }
.result.p2 .pts { background: #5aa9ff; color: #06203d; }
.why { display: flex; flex-direction: column; gap: 4px; }
.why b { font-size: 24px; }
.why span { color: var(--ink-dim); font-size: 15px; }
.bonus { margin: 0; text-align: center; font-size: 15px; color: var(--ink-dim); animation: rise .5s .8s both; }
.bonus.yes { color: var(--good); font-weight: 800; }
.finals { flex-direction: row; }
.finals > div { flex: 1; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.finals span { font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--c); }
.finals b { font-size: 44px; }

/* sheets */
.sheet { position: fixed; inset: 0; z-index: 10; background: rgba(5,3,16,.7); backdrop-filter: blur(4px); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet-body { width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto; background: linear-gradient(#241a5a, #170f3d); border-radius: 26px 26px 0 0; border: 1px solid var(--line); padding: 18px 18px calc(22px + env(safe-area-inset-bottom)); animation: rise .28s cubic-bezier(.2,.8,.2,1); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; font-size: 22px; }
.steps { margin: 0 0 12px; padding-left: 22px; display: flex; flex-direction: column; gap: 12px; line-height: 1.45; }
.steps li::marker { color: var(--amber); font-weight: 800; }
.tw-chips { margin-top: 18px; }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

@media (max-height: 620px) { .view { gap: 10px; } .btn { min-height: 48px; } .logo-dial { width: 180px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* friends mode */
.code { text-align: center; font-size: clamp(44px, 16vw, 72px); font-weight: 900; letter-spacing: .14em; padding-left: .14em; line-height: 1; background: linear-gradient(90deg, var(--teal), #b79cff 50%, var(--coral)); -webkit-background-clip: text; background-clip: text; color: transparent; user-select: text; -webkit-user-select: text; }
.btn.small { min-height: 44px; padding: 10px 14px; font-size: 14px; width: auto; align-self: center; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tcol { padding: 12px; border-radius: 18px; background: var(--glass); border: 1px solid var(--c); display: flex; flex-direction: column; gap: 8px; min-height: 110px; }
.tcol h3 { margin: 0 0 2px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--c); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl em { font-style: normal; font-weight: 600; font-size: 12px; color: var(--ink-dim); }
.pl .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--good); }
.pl.off { opacity: .5; } .pl.off .dot { background: #888; }
.pl.empty { color: var(--ink-dim); font-weight: 600; }
.two-in { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.two-in input { font-size: 16px; }
.join { display: flex; gap: 8px; }
.join input { flex: 1; min-width: 0; min-height: 54px; border-radius: 16px; border: 2px solid var(--line); background: rgba(0,0,0,.28); color: var(--ink); font-size: 20px; font-weight: 800; letter-spacing: .12em; text-align: center; text-transform: uppercase; outline: none; }
.join input:focus { border-color: var(--amber); }
.join .btn { width: auto; padding: 0 22px; }
.role { align-self: center; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 800; color: var(--c); border: 1px solid var(--c); background: rgba(0,0,0,.25); }
.small-big { font-size: clamp(26px, 8vw, 38px); }
.link-btn { align-self: center; background: none; border: 0; color: var(--ink-dim); font-size: 13px; text-decoration: underline; padding: 10px; cursor: pointer; }
.btn.side.picked { background: rgba(255,255,255,.2); border-width: 3px; }
.btn.locked { background: rgba(126,226,160,.2); border-color: var(--good); }
.btn.primary.locked { color: var(--ink); border: 2px solid var(--good); box-shadow: none; background: rgba(126,226,160,.2); }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; padding: 12px 18px; border-radius: 14px; background: #2d2368; border: 1px solid var(--line); font-weight: 700; font-size: 14px; pointer-events: none; transition: .25s; z-index: 30; max-width: 90vw; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
