:root {
  --bg: #000; --panel: #111113; --panel-2: #1c1c1f; --line: rgba(255,255,255,.12);
  --text: #f5f5f7; --dim: #86868b; --blue: #2997ff; --red: #ff453a; --green: #30d158;
  --spectrum: #0a84ff, #bf5af2, #ff375f, #ff9f0a, #30d158, #0a84ff;
  --gold: linear-gradient(145deg, #fff3b0, #f5c518 45%, #a97c00);
  --silver: linear-gradient(145deg, #ffffff, #c7c7cc 50%, #6e6e73);
  --bronze: linear-gradient(145deg, #ffd9b3, #cd7f32 50%, #6e3f12);
  --ease: cubic-bezier(.2,.8,.2,1);
}
@property --a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.4 "Inter Tight", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; min-height: 100vh; overflow-x: hidden; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

/* Pills */
.pill { border: 0; border-radius: 980px; padding: 16px 34px; font-size: 19px; font-weight: 600; cursor: pointer; background: var(--text); color: #000; transition: transform .25s var(--ease), background .25s, opacity .25s; }
.pill:hover { transform: scale(1.03); }
.pill:active { transform: scale(.97); }
.pill:disabled { opacity: .35; cursor: default; transform: none; }
.pill.glass { background: rgba(255,255,255,.1); color: var(--text); backdrop-filter: blur(20px); }
.pill.glass:hover { background: rgba(255,255,255,.17); }
.pill.on { box-shadow: 0 0 0 2px var(--text); }
.pill.blue { background: var(--blue); color: #fff; }
.pill.small { padding: 10px 20px; font-size: 15px; }
.input { width: 100%; background: rgba(255,255,255,.08); border: 0; border-radius: 14px; padding: 16px 18px; font-size: 19px; color: var(--text); outline: 0; transition: background .2s, box-shadow .2s; text-align: center; }
.input:focus { background: rgba(255,255,255,.12); box-shadow: 0 0 0 2px var(--blue); }
.input::placeholder { color: var(--dim); }
.err { color: var(--red); font-size: 15px; min-height: 21px; text-align: center; }

.spectrum-text { background: linear-gradient(100deg, #0a84ff, #bf5af2 30%, #ff375f 60%, #ff9f0a 90%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: flow 7s linear infinite alternate; }
@keyframes flow { to { background-position: 100% 0; } }

/* Home */
.hero { min-height: 82svh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 20px; position: relative; overflow: hidden; }
.aurora { position: absolute; left: 50%; top: 42%; width: min(1100px, 150vw); aspect-ratio: 1.6; transform: translate(-50%, -50%); background: conic-gradient(from var(--a), var(--spectrum)); filter: blur(110px); opacity: .2; border-radius: 50%; animation: spin 16s linear infinite; pointer-events: none; }
@keyframes spin { to { --a: 360deg; } }
.hero > *:not(.aurora) { position: relative; }
.hero h1 { font-size: clamp(50px, 9.5vw, 128px); font-weight: 700; letter-spacing: -.035em; line-height: 1; }
.hero .sub { font-size: clamp(19px, 2.4vw, 28px); color: #a1a1a6; max-width: 26em; margin: 22px 0 38px; letter-spacing: -.012em; line-height: 1.25; font-weight: 500; }
.cta { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.panel-form { width: min(440px, 92vw); display: grid; gap: 12px; animation: rise .45s var(--ease); text-align: center; }
.panel-form h2 { font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.back { background: none; border: 0; color: var(--dim); cursor: pointer; font-size: 15px; padding: 4px; }
.back:hover { color: var(--text); }
.dd { position: relative; text-align: left; }
.dd-btn, .dd-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 16px; font-size: 17px; font-weight: 500; }
.dd-btn { background: rgba(255,255,255,.08); border: 0; border-radius: 14px; cursor: pointer; transition: background .2s; }
.dd-btn:hover { background: rgba(255,255,255,.13); }
.caret { margin-left: 4px; color: var(--dim); transform: translateY(-3px); }
.dd-list { position: absolute; z-index: 6; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: rgba(28,28,31,.92); backdrop-filter: blur(30px); border-radius: 16px; box-shadow: 0 24px 70px rgba(0,0,0,.7), 0 0 0 1px var(--line); animation: rise .22s var(--ease); }
.dd-opt { border-radius: 11px; cursor: pointer; }
.dd-opt:hover, .dd-opt:focus { background: rgba(255,255,255,.1); outline: 0; }
.dd-opt.on { background: rgba(41,151,255,.18); }
.logo { width: 22px; height: 22px; flex: none; }
.m-name { flex: 1; white-space: nowrap; text-align: left; order: 1; }
.logo { order: 0; }
.dd-opt .lock { order: 2; }
.brains { order: 3; }
.caret { order: 4; }
.brains { display: inline-flex; gap: 1px; font-size: 15px; line-height: 1; }
.brains span { opacity: .18; filter: grayscale(1); }
.brains span.lit { opacity: 1; filter: none; }
.lock { color: #ffd60a; font-size: 12px; font-weight: 600; }
.step-page { min-height: 100svh; display: flex; align-items: center; justify-content: center; padding: 30px 20px; position: relative; overflow: hidden; }
.step-page > .panel-form { position: relative; }
.seg-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.seg-label { color: var(--dim); font-size: 15px; font-weight: 500; }
.seg { display: inline-flex; gap: 2px; background: rgba(255,255,255,.08); border-radius: 12px; padding: 3px; }
.seg button { background: none; border: 0; border-radius: 9px; min-width: 44px; padding: 8px 11px; font-size: 15px; font-weight: 500; cursor: pointer; transition: background .2s, color .2s; font-variant-numeric: tabular-nums; }
.seg button:hover { background: rgba(255,255,255,.08); }
.seg button.on { background: var(--text); color: #000; }

/* Home: demo */
.demo-wrap { padding: 20px 20px 90px; display: flex; flex-direction: column; align-items: center; }
.device { width: min(1040px, 100%); aspect-ratio: 16 / 9.6; background: #0b0b0d; border-radius: 22px; border: 1px solid var(--line); position: relative; overflow: hidden; box-shadow: 0 40px 120px rgba(100,80,255,.2); }
.dscene { position: absolute; inset: 0; opacity: 0; transition: opacity .5s; padding: 3.2%; display: flex; gap: 2.4%; pointer-events: none; }
.dscene.on { opacity: 1; }
.dscene.play .dimg { flex: 1.8; border-radius: 10px; overflow: hidden; align-self: center; }
.dscene img { display: block; width: 100%; }
.dside { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.dclock { font-size: clamp(26px, 6cqw, 58px); font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.device { container-type: inline-size; }
.dtype { flex: 1; background: rgba(255,255,255,.07); border-radius: 12px; padding: 3%; font-size: clamp(9px, 1.5cqw, 15px); line-height: 1.4; overflow: hidden; color: #d1d1d6; }
.dtype i { display: inline-block; width: 2px; height: 1em; background: var(--blue); vertical-align: text-bottom; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.dscene.build { align-items: center; justify-content: center; }
.dscene.rev { flex-direction: column; justify-content: center; gap: 3%; }
.drow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.6%; width: 100%; }
.dcard { position: relative; text-align: center; }
.dcard .dpage { border-radius: 8px; overflow: hidden; clip-path: inset(0 0 100% 0); transition: clip-path 1.2s var(--ease); }
.dcard.in .dpage { clip-path: inset(0); }
.dcard .dn { font-size: clamp(10px, 1.6cqw, 16px); color: var(--dim); margin-top: 6px; }
.dcard .ds { font-size: clamp(20px, 4.4cqw, 44px); font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.dcard .medal { position: absolute; top: -8px; right: -4px; }
.dtarget { width: 36%; margin: 0 auto; border-radius: 8px; overflow: hidden; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: min(1040px, 100%); margin-top: 18px; }
.tile { background: var(--panel); border-radius: 22px; padding: 30px 26px; }
.tile h3 { font-size: 30px; font-weight: 700; letter-spacing: -.025em; }
.tile p { color: var(--dim); margin-top: 6px; font-size: 18px; }

/* Lobby */
.center { min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 20px; text-align: center; gap: 22px; }
.code { font-size: clamp(64px, 13vw, 140px); font-weight: 700; letter-spacing: .03em; line-height: 1; background: linear-gradient(180deg, #fff, #8e8e93); -webkit-background-clip: text; background-clip: text; color: transparent; }
.seats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px; width: min(640px, 100%); }
.seat { background: var(--panel); border-radius: 20px; padding: 20px 8px 16px; display: grid; justify-items: center; gap: 8px; min-height: 124px; align-content: center; font-weight: 500; font-size: 16px; }
.seat.join { animation: pop .5s var(--ease); }
.seat.empty { color: #48484a; border: 1px dashed #2c2c2e; background: none; }
.avatar { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 20px; color: #fff; background: var(--c, #48484a); position: relative; flex: none; }
.avatar.tiny { width: 30px; height: 30px; font-size: 13px; }
.avatar.done::after { content: "✓"; position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #000; font-size: 15px; font-weight: 700; animation: pop .4s var(--ease); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.note { color: var(--dim); font-size: 15px; }

/* Countdown */
.count-n { font-size: min(52vw, 60vh); font-weight: 700; letter-spacing: -.05em; line-height: 1; animation: countpop 1s var(--ease); }
@keyframes countpop { from { transform: scale(1.5); opacity: 0; filter: blur(18px); } }

/* Glow border, Apple Intelligence style */
.glow { position: relative; isolation: isolate; }
.glow::before, .glow::after { content: ""; position: absolute; inset: -2px; border-radius: inherit; background: conic-gradient(from var(--a), var(--spectrum)); z-index: -1; animation: spin 4s linear infinite; }
.glow::after { filter: blur(22px); opacity: .55; }
.edge { position: fixed; inset: 0; pointer-events: none; z-index: 2; filter: blur(26px); opacity: .85; transition: opacity 1s; }
.edge.off { opacity: 0; }
.edge::before { content: ""; position: absolute; inset: -30px; background: conic-gradient(from var(--a), var(--spectrum)); animation: spin 5s linear infinite; -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; padding: 54px; }

/* Round */
.round { height: 100svh; display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 22px; padding: 22px; align-items: center; }
.searching { font-size: clamp(38px, 7vw, 76px); font-weight: 700; letter-spacing: -.03em; line-height: 1.05; }
.clock.small { font-size: 44px; color: var(--dim); }
.frame { border-radius: 14px; overflow: hidden; background: #111; aspect-ratio: 1280 / 800; width: 100%; max-height: calc(100svh - 44px); object-fit: contain; box-shadow: 0 30px 100px rgba(0,0,0,.6), 0 0 0 1px var(--line); animation: rise .6s var(--ease); display: block; }
@keyframes rise { from { transform: translateY(20px) scale(.98); opacity: 0; } }
.composer { display: flex; flex-direction: column; gap: 14px; height: min(100%, 720px); }
.clock { font-size: 92px; font-weight: 700; letter-spacing: -.04em; line-height: .95; font-variant-numeric: tabular-nums; }
.clock.low { color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.promptbox { flex: 1; border-radius: 18px; min-height: 160px; display: flex; }
.promptbox textarea { flex: 1; width: 100%; resize: none; border: 0; border-radius: 16px; background: #0d0d0f; padding: 18px; font-size: 17px; line-height: 1.45; outline: 0; }
.promptbox textarea:disabled { color: var(--dim); }
.foes { display: flex; gap: 8px; align-items: center; }
.composer .pill { width: 100%; }
.progress { font-size: 13px; color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; }

.skeleton { position: absolute; inset: 0; border-radius: 18px; background: #050506; padding: 6%; display: grid; grid-template-columns: 1fr 3fr; grid-template-rows: 12% 1fr 1fr; gap: 4%; overflow: hidden; }
.skeleton i { background: linear-gradient(100deg, #1c1c1f 30%, #3a3a3e 50%, #1c1c1f 70%); background-size: 220% 100%; border-radius: 8px; animation: blockin 3.2s var(--ease) infinite, shimmer 1.4s linear infinite; }
.skeleton i:nth-child(1) { grid-column: 1 / 3; animation-delay: 0s, 0s; }
.skeleton i:nth-child(2) { grid-row: 2 / 4; animation-delay: .3s, .1s; }
.skeleton i:nth-child(3) { animation-delay: .6s, .2s; }
.skeleton i:nth-child(4) { animation-delay: .9s, .3s; }
@keyframes blockin { 0% { opacity: 0; transform: translateY(10px) scale(.97); } 18%, 82% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes shimmer { to { background-position: -220% 0; } }
/* Reveal */
.reveal { min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 18px 22px; }
.rv-head { font-size: 15px; color: var(--dim); font-weight: 500; display: flex; gap: 10px; }
.rv-target { border: 0; padding: 0; background: none; width: min(46vw, 62vh); border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); position: relative; cursor: zoom-in; animation: rise .6s var(--ease); }
.rv-target img { display: block; width: 100%; }
.rv-target span { position: absolute; left: 10px; top: 10px; background: rgba(0,0,0,.72); backdrop-filter: blur(10px); padding: 3px 11px; border-radius: 980px; font-size: 13px; font-weight: 500; }
.rv-row { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 14px; width: min(1500px, 100%); }
.rv-card { position: relative; text-align: center; background: none; border: 0; padding: 0; cursor: zoom-in; transition: transform .4s var(--ease), opacity .4s; display: block; }
.rv-page { border-radius: 12px; aspect-ratio: 1280 / 800; background: #0d0d0f; box-shadow: 0 0 0 1px var(--line); position: relative; }
.rv-page:not(.glow) { overflow: hidden; }
.rv-page.glow::before, .rv-page.glow::after { animation-duration: 3s; }
.rv-page img { display: block; width: 100%; height: 100%; object-fit: cover; clip-path: inset(0 0 100% 0); }
.rv-page.loading img { clip-path: inset(0); transition: clip-path 1.3s cubic-bezier(.3,.6,.2,1); }
.rv-page:not(.glow)::after { content: ""; position: absolute; left: 0; right: 0; height: 2px; top: 0; background: linear-gradient(90deg, transparent, #fff, transparent); box-shadow: 0 0 22px 5px rgba(120,170,255,.8); opacity: 0; }
.rv-page.loading::after { animation: scan 1.3s cubic-bezier(.3,.6,.2,1); }
@keyframes scan { 0% { top: 0; opacity: 1; } 95% { opacity: 1; } 100% { top: 100%; opacity: 0; } }
.rv-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); font-size: 14px; }
.rv-name { margin-top: 10px; font-size: 16px; color: #d1d1d6; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-score { font-size: clamp(38px, 5.4vw, 68px); font-weight: 700; letter-spacing: -.04em; line-height: 1.05; font-variant-numeric: tabular-nums; color: #3a3a3c; transition: color .3s, transform .3s var(--ease); }
.rv-card.counting .rv-score { color: #fff; transform: scale(1.14); }
.rv-card.scored .rv-score { color: #fff; }
.rv-card.lose { opacity: .55; }
.rv-card.win .rv-page { box-shadow: 0 0 0 2px #f5c518, 0 0 50px rgba(245,197,24,.45); }
.rv-total { font-size: 14px; color: var(--dim); opacity: 0; transition: opacity .4s; font-variant-numeric: tabular-nums; }
.rv-card.done .rv-total { opacity: 1; }
.rv-next { font-size: 15px; color: var(--dim); min-height: 21px; font-variant-numeric: tabular-nums; }
.rv-you .rv-name { color: var(--blue); }

/* Medals */
.medal { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-size: 25px; font-weight: 700; color: rgba(0,0,0,.72); position: relative; box-shadow: 0 8px 24px rgba(0,0,0,.6), inset 0 2px 3px rgba(255,255,255,.75); animation: medal .8s cubic-bezier(.2,1.6,.4,1); overflow: hidden; }
.medal::after { content: ""; position: absolute; inset: -40%; background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,.8) 50%, transparent 58%); animation: shine 1.3s .5s both; }
.medal.m0 { background: var(--gold); } .medal.m1 { background: var(--silver); } .medal.m2 { background: var(--bronze); }
.medal.big { width: 86px; height: 86px; font-size: 38px; }
.rv-card .medal { position: absolute; top: -14px; right: -6px; z-index: 2; }
@keyframes medal { from { transform: scale(3) rotate(-30deg); opacity: 0; } }
@keyframes shine { from { transform: translateX(-70%); } to { transform: translateX(70%); } }

/* Final */
.final { min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 30px; padding: 30px 20px; text-align: center; position: relative; overflow: hidden; }
.final h2 { font-size: clamp(44px, 8vw, 96px); font-weight: 700; letter-spacing: -.035em; line-height: 1; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 14px; width: min(760px, 100%); }
.step { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.block { width: 100%; border-radius: 18px 18px 0 0; background: linear-gradient(180deg, #2c2c2e, #111113); display: flex; flex-direction: column; justify-content: flex-start; align-items: center; padding-top: 16px; animation: growup .9s var(--ease) both; transform-origin: bottom; font-size: clamp(26px, 5vw, 46px); font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
@keyframes growup { from { transform: scaleY(0); } }
.step .who { font-weight: 600; font-size: 18px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step.me .who { color: var(--blue); }
.rest { color: var(--dim); font-size: 16px; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 15px; border-radius: 2px; animation: fall var(--t) linear var(--d) both; }
@keyframes fall { to { transform: translateY(110vh) rotate(var(--r)); } }

/* Modal + mute */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.8); backdrop-filter: blur(24px); z-index: 10; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .25s; overflow-y: auto; }
@keyframes fade { from { opacity: 0; } }
.sheet { background: var(--panel); border-radius: 26px; padding: 34px; width: min(480px, 100%); text-align: center; display: grid; gap: 14px; }
.sheet h2 { font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1.05; }
.sheet .prices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.zoom { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: min(1500px, 100%); }
.zoom figure { margin: 0; }
.zoom img { display: block; width: 100%; border-radius: 12px; }
.zoom figcaption { color: var(--dim); font-size: 14px; margin-top: 6px; text-align: left; }
.zoom .said { grid-column: 1 / -1; color: #d1d1d6; font-size: 16px; text-align: left; max-height: 22vh; overflow: auto; }
.mute { position: fixed; top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255,255,255,.1); backdrop-filter: blur(20px); cursor: pointer; z-index: 5; font-size: 15px; display: grid; place-items: center; }

@media (max-width: 900px) {
  .round { height: auto; min-height: 100svh; grid-template-columns: 1fr; align-items: start; padding: 14px; }
  .clock { font-size: 56px; }
  .composer { height: auto; }
  .promptbox { min-height: 180px; }
  .rv-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rv-target { width: min(78vw, 480px); }
  .tiles { grid-template-columns: 1fr; }
  .zoom { grid-template-columns: 1fr; }
  .medal { width: 46px; height: 46px; font-size: 20px; }
  .medal.big { width: 64px; height: 64px; font-size: 28px; }
  .pill { padding: 14px 26px; font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
