:root {
  color-scheme: light;
  --ink: #17152b;
  --muted: #65627c;
  --paper: #fffdf8;
  --panel: rgba(255,255,255,.88);
  --line: #dedbea;
  --purple: #6657ef;
  --purple-dark: #4938cf;
  --coral: #f2675b;
  --yellow: #f7c948;
  --mint: #55c89b;
  --sky: #4ca3dd;
  --shadow: 0 18px 55px rgba(44, 35, 106, .14);
  --radius: 26px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #f5f1ff; }
body {
  min-height: 100vh; margin: 0; color: var(--ink); background:
    radial-gradient(circle at 10% 0%, #fff4c8 0, transparent 28rem),
    radial-gradient(circle at 95% 90%, #d8fff1 0, transparent 30rem),
    linear-gradient(145deg, #faf7ff, #fffdf7);
  font-family: ui-rounded, "Arial Rounded MT Bold", "Avenir Next", Avenir, system-ui, sans-serif;
  line-height: 1.45;
  overflow-x: hidden;
}
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 99; background: var(--ink); color: white; padding: .75rem 1rem; border-radius: 12px; }
.skip-link:focus { top: 1rem; }
.ambient { position: fixed; width: 19rem; height: 19rem; border-radius: 50%; filter: blur(1px); pointer-events: none; opacity: .35; z-index: -1; }
.ambient-one { top: 11rem; left: -13rem; background: repeating-radial-gradient(circle, var(--coral) 0 12px, transparent 13px 26px); }
.ambient-two { right: -12rem; bottom: 2rem; background: repeating-radial-gradient(circle, var(--purple) 0 11px, transparent 12px 24px); }
.topbar { height: 72px; max-width: 1120px; margin: auto; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; font-size: 1.35rem; font-weight: 900; letter-spacing: -.04em; }
.brand-mark { display: flex; align-items: center; gap: 2px; height: 28px; }
.brand-mark i { display: block; width: 7px; border-radius: 9px; background: var(--purple); transform-origin: bottom; }
.brand-mark i:nth-child(1) { height: 12px; animation: bob 1.5s ease-in-out infinite; }
.brand-mark i:nth-child(2) { height: 23px; background: var(--coral); animation: bob 1.5s .12s ease-in-out infinite; }
.brand-mark i:nth-child(3) { height: 17px; background: var(--yellow); animation: bob 1.5s .24s ease-in-out infinite; }
.icon-button { width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--line); background: rgba(255,255,255,.75); color: var(--muted); font-weight: 900; cursor: pointer; }
.icon-button[aria-pressed="true"] { color: white; background: var(--purple); border-color: var(--purple); }
.account-chip { display: flex; align-items: center; gap: 7px; max-width: 180px; padding: 4px 5px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.82); font-size: .78rem; font-weight: 850; }
.account-chip .avatar { width: 30px; height: 30px; flex-basis: 30px; border-radius: 50%; }
.account-chip .account-name { width: auto; max-width: 95px; padding: 4px 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; background: transparent; }
.account-chip button { width: 25px; height: 25px; border: 0; border-radius: 50%; color: var(--muted); background: #f0eef7; cursor: pointer; font-weight: 900; }
#app { width: min(calc(100% - 32px), 1080px); min-height: calc(100vh - 72px); margin: 0 auto; padding: 18px 0 48px; }
.screen { animation: enter .42s cubic-bezier(.2,.8,.2,1) both; }
.hero { text-align: center; max-width: 760px; margin: 4vh auto 28px; }
.eyebrow { display: inline-flex; gap: 7px; align-items: center; color: var(--purple-dark); background: #ece9ff; border-radius: 999px; padding: 7px 12px; font-weight: 800; font-size: .77rem; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(3rem, 13vw, 6rem); line-height: .92; margin: 20px 0 18px; letter-spacing: -.08em; }
h1 .highlight, .highlight { color: var(--purple); position: relative; }
.hero-copy { max-width: 590px; margin: 0 auto; color: var(--muted); font-size: clamp(1.05rem, 3vw, 1.25rem); }
.action-grid { max-width: 760px; margin: 30px auto 0; display: grid; grid-template-columns: 1fr; gap: 14px; }
.panel, .game-card { background: var(--panel); border: 1px solid rgba(222,219,234,.9); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.panel { padding: clamp(20px, 5vw, 34px); }
.choice-button { min-height: 88px; border: 0; border-radius: 22px; padding: 18px 20px; cursor: pointer; text-align: left; display: flex; align-items: center; gap: 16px; color: white; background: var(--purple); box-shadow: 0 10px 0 #4938cf; transform: translateY(-4px); transition: transform .15s, box-shadow .15s; }
.choice-button.secondary { color: var(--ink); background: white; box-shadow: 0 10px 0 #ddd8ef; border: 2px solid var(--line); }
.choice-button:active { transform: translateY(4px); box-shadow: 0 2px 0 #4938cf; }
.choice-icon { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: rgba(255,255,255,.18); font-size: 1.5rem; }
.choice-button.secondary .choice-icon { background: #f2efff; }
.choice-title { display: block; font-weight: 900; font-size: 1.05rem; }
.choice-sub { display: block; opacity: .76; font-size: .84rem; margin-top: 2px; }
.demo-link { display: inline-flex; margin-top: 26px; border: 0; color: var(--purple-dark); background: transparent; font-weight: 850; cursor: pointer; padding: 10px; text-decoration: underline; text-underline-offset: 4px; }
.how { display: flex; justify-content: center; gap: 12px; margin: 34px auto 0; max-width: 700px; }
.how-step { flex: 1; min-width: 0; padding: 14px 8px; color: var(--muted); font-size: .78rem; }
.how-step b { display: grid; place-items: center; width: 30px; height: 30px; margin: 0 auto 7px; border-radius: 50%; background: var(--yellow); color: var(--ink); }
.form-screen { max-width: 540px; margin: 2vh auto; }
.back { border: 0; background: transparent; color: var(--muted); padding: 8px 0; margin-bottom: 14px; cursor: pointer; font-weight: 800; }
.panel-title { font-size: clamp(1.9rem, 8vw, 2.7rem); letter-spacing: -.055em; margin-bottom: 8px; }
.panel-sub { color: var(--muted); margin-bottom: 26px; }
.field { display: block; margin-bottom: 20px; }
.field-label, legend { font-weight: 850; font-size: .9rem; margin-bottom: 8px; display: block; }
input[type="text"], input[type="email"], input[type="password"] { width: 100%; height: 56px; border: 2px solid var(--line); border-radius: 16px; background: white; color: var(--ink); padding: 0 16px; font-size: 1.1rem; outline: none; text-transform: none; }
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus { border-color: var(--purple); box-shadow: 0 0 0 4px #e7e3ff; }
#roomCode { text-transform: uppercase; letter-spacing: .22em; font-weight: 900; }
fieldset { border: 0; padding: 0; margin: 0 0 24px; }
.swatches { display: flex; flex-wrap: wrap; gap: 11px; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--avatar); border: 3px solid white; box-shadow: 0 0 0 2px transparent; cursor: pointer; color: white; font-weight: 900; }
.swatch input:focus-visible + span, .swatch input:checked + span { box-shadow: 0 0 0 3px var(--ink); }
.swatch input:checked + span::after { content: '✓'; }
.btn { width: 100%; min-height: 56px; border: 0; border-radius: 17px; padding: 14px 20px; color: white; background: var(--purple); font-weight: 900; cursor: pointer; box-shadow: 0 7px 0 var(--purple-dark); transform: translateY(-3px); transition: .15s; }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--purple-dark); }
.btn:disabled { cursor: not-allowed; opacity: .5; filter: grayscale(.4); }
.btn.secondary { color: var(--ink); background: white; border: 2px solid var(--line); box-shadow: none; transform: none; }
.btn.coral { background: var(--coral); box-shadow: 0 7px 0 #c7463e; }
.room-layout { display: grid; gap: 18px; max-width: 980px; margin: 0 auto; }
.room-header { text-align: center; }
.room-code { font-size: clamp(2.5rem, 12vw, 4.6rem); letter-spacing: .12em; line-height: 1; margin: 7px 0 10px; font-weight: 950; }
.room-code button { font: inherit; letter-spacing: inherit; border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0; }
.room-hint { color: var(--muted); font-size: .9rem; }
.qr-wrap { width: 160px; height: 160px; padding: 10px; border-radius: 22px; background: white; margin: 18px auto 0; box-shadow: 0 10px 35px rgba(44,35,106,.12); }
.qr-wrap img { display: block; width: 100%; height: 100%; }
.players-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.players-title h2 { font-size: 1.15rem; margin: 0; }
.count-pill { background: #eeeaff; color: var(--purple-dark); border-radius: 999px; padding: 5px 10px; font-size: .8rem; font-weight: 900; }
.player-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.player { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 15px; background: #f7f5fb; min-width: 0; }
.avatar { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 13px; display: grid; place-items: center; color: white; background: var(--avatar); font-weight: 950; border: 2px solid rgba(23,21,43,.25); }
.player-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 850; font-size: .9rem; }
.player-meta { color: var(--muted); font-size: .72rem; }
.player-details { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.player-controls { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.player-controls button, .host-round-controls button, .disconnect-card button { min-height: 28px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--purple-dark); background: white; cursor: pointer; font-size: .68rem; font-weight: 850; }
.offline { opacity: .52; }
.settings h2 { font-size: 1.15rem; }
.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; padding: 5px; background: #f0eef7; border-radius: 15px; margin-bottom: 8px; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: grid; place-items: center; padding: 11px 4px; border-radius: 11px; color: var(--muted); font-weight: 900; }
.segmented input:checked + span { color: var(--purple-dark); background: white; box-shadow: 0 3px 10px rgba(44,35,106,.12); }
.setting-hint { min-height: 2.5em; margin: 0 2px 18px; color: var(--muted); font-size: .78rem; }
.toggles { display: grid; gap: 10px; margin-bottom: 22px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 750; cursor: pointer; }
.toggle small { display: block; color: var(--muted); font-weight: 500; }
.toggle input { width: 45px; height: 26px; accent-color: var(--purple); flex: 0 0 auto; }
.waiting { text-align: center; color: var(--muted); padding: 18px 0 4px; }
.waiting-dots { display: inline-flex; gap: 5px; margin-right: 8px; }
.waiting-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--purple); animation: dots 1.2s infinite; }
.waiting-dots i:nth-child(2) { animation-delay: .15s; }.waiting-dots i:nth-child(3) { animation-delay: .3s; }
.instruction-wrap { max-width: 630px; margin: 2vh auto; text-align: center; }
.privacy-note { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .82rem; margin-bottom: 13px; }
.game-card { overflow: hidden; text-align: left; }
.card-band { min-height: 92px; padding: 20px 24px; color: white; background: linear-gradient(120deg, var(--purple), #8276ff); position: relative; }
.card-band.starting { background: linear-gradient(120deg, var(--coral), #ff8c63); }
.card-band::after { content: ''; position: absolute; width: 100px; height: 100px; right: -15px; top: -40px; border: 13px solid rgba(255,255,255,.15); border-radius: 50%; }
.card-kicker { font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 900; opacity: .9; }
.card-band h2 { margin: 4px 0 0; font-size: 1.45rem; }
.card-body { padding: clamp(24px, 7vw, 38px); }
.instruction-label { color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; font-weight: 900; }
.instruction-text { font-size: clamp(1.35rem, 6vw, 2.05rem); line-height: 1.15; letter-spacing: -.035em; font-weight: 900; margin: 8px 0 28px; }
.action-text { color: var(--purple-dark); }
.alternative { border-top: 1px dashed var(--line); padding-top: 18px; color: var(--muted); font-size: .9rem; }
.alternative summary { cursor: pointer; font-weight: 850; color: var(--ink); }
.alternative p { margin: 10px 0 0; }
.alternative-mode-note { border-top: 1px dashed var(--line); padding-top: 18px; color: var(--purple-dark); font-size: .86rem; font-weight: 850; }
.instruction-actions { margin-top: 24px; }
.text-action { display: inline-block; margin-top: 16px; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-weight: 850; text-decoration: underline; text-underline-offset: 3px; }
.countdown-screen { min-height: 70vh; display: grid; place-items: center; text-align: center; }
.countdown-number { width: min(72vw, 330px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--purple); font-size: clamp(7rem, 30vw, 12rem); line-height: 1; font-weight: 950; box-shadow: 0 0 0 18px #e4e0ff, 0 0 0 34px #f0eeff; animation: pulse 1s ease-in-out infinite; }
.countdown-screen h1 { font-size: 2rem; margin-top: 48px; }
.active-layout { max-width: 680px; margin: 0 auto; text-align: center; }
.timer { width: 118px; height: 118px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; position: relative; background: conic-gradient(var(--coral) var(--progress), #e8e5f0 0); }
.timer::after { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: var(--paper); }
.timer strong { z-index: 1; font-size: 2rem; letter-spacing: -.05em; }
.timer.untimed { background: linear-gradient(145deg, #e7e3ff, #d7fff0); }
.timer.untimed strong { color: var(--purple-dark); font-size: 3.4rem; }
.untimed-note { color: var(--muted); font-weight: 800; margin: -5px 0 16px; }
.progress-card { display: flex; align-items: center; gap: 12px; margin: 14px 0 18px; padding: 14px 16px; background: white; border: 1px solid var(--line); border-radius: 17px; text-align: left; }
.progress-track { flex: 1; height: 10px; background: #ebe8f2; border-radius: 99px; overflow: hidden; }
.progress-track i { display: block; height: 100%; width: var(--progress); background: linear-gradient(90deg, var(--mint), var(--purple)); border-radius: inherit; transition: width .4s; }
.progress-copy { font-size: .8rem; font-weight: 900; white-space: nowrap; }
.host-round-controls { display: flex; justify-content: center; gap: 8px; margin: -8px 0 16px; }
.disconnect-card { display: grid; gap: 7px; margin-bottom: 14px; padding: 12px; border-radius: 14px; color: #744115; background: #fff1cd; font-size: .8rem; font-weight: 800; }
.disconnect-card span { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.paused-screen { min-height: 72vh; display: grid; place-items: center; text-align: center; }
.paused-screen .panel { width: min(100%, 560px); }
.paused-screen h1 { font-size: clamp(2.8rem, 14vw, 5rem); }
.danger-zone { margin-top: 30px; padding-top: 24px; border-top: 2px solid #f1d7d4; }
.danger-zone h2 { color: #9d322c; font-size: 1.1rem; }
.danger-zone p { color: var(--muted); font-size: .9rem; }
.btn.danger { background: #a73832; box-shadow: 0 7px 0 #74231f; }
.done-state { padding: 15px; color: #166648; background: #e4fff3; border-radius: 17px; font-weight: 850; text-align: center; }
.guess-wrap { max-width: 720px; margin: 1vh auto; }
.guess-heading { text-align: center; margin-bottom: 24px; }
.guess-heading h1 { font-size: clamp(2.5rem, 12vw, 4.5rem); margin: 18px 0 12px; }
.discussion-card { margin-bottom: 18px; text-align: center; }
.discussion-icon { width: 76px; height: 76px; display: grid; place-items: center; margin: 0 auto 16px; border-radius: 26px; color: white; background: linear-gradient(145deg, var(--purple), #9187ff); font-size: 2.8rem; font-weight: 950; box-shadow: 0 8px 0 #4d3fd0; transform: rotate(-3deg); }
.discussion-card h2 { font-size: 1.45rem; margin-bottom: 15px; }
.discussion-card ol { display: grid; gap: 10px; margin: 0 auto 18px; padding: 0; max-width: 390px; list-style-position: inside; color: var(--ink); text-align: left; font-weight: 800; }
.discussion-card li { padding: 10px 12px; border-radius: 12px; background: #f5f2ff; }
.discussion-card p { color: var(--muted); margin: 0; }
.guess-host-actions { text-align: center; }
.guess-host-actions p { color: var(--muted); font-size: .82rem; margin-top: 12px; }
.result-hero { text-align: center; max-width: 680px; margin: 1vh auto 20px; }
.result-icon { width: 92px; height: 92px; display: grid; place-items: center; margin: auto; border-radius: 30px; background: var(--yellow); font-size: 3.5rem; transform: rotate(-4deg); box-shadow: 0 10px 0 #d9a91f; }
.result-hero h1 { font-size: clamp(2.6rem, 12vw, 4.8rem); margin: 28px 0 12px; }
.chain-list { max-width: 680px; margin: 26px auto; position: relative; }
.chain-item { display: grid; grid-template-columns: 46px 1fr; gap: 13px; position: relative; padding-bottom: 17px; animation: reveal .45s calc(var(--i) * .16s) both; }
.chain-item:not(:last-child)::after { content: ''; position: absolute; left: 22px; top: 46px; width: 3px; height: calc(100% - 42px); background: #d8d3ef; }
.chain-avatar { width: 46px; height: 46px; display: grid; place-items: center; background: var(--avatar); color: white; border-radius: 15px; font-weight: 950; z-index: 1; border: 2px solid rgba(23,21,43,.25); }
.chain-copy { padding: 13px 15px; background: white; border: 1px solid var(--line); border-radius: 16px; text-align: left; }
.chain-copy b { display: block; margin-bottom: 3px; }
.chain-copy span { color: var(--muted); font-size: .88rem; }
.chain-copy .missed { color: #a43c36; }
.replay-actions { max-width: 540px; margin: 25px auto 0; display: grid; gap: 12px; }
.toast { position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translate(-50%, 30px); background: var(--ink); color: white; padding: 12px 17px; border-radius: 13px; font-weight: 750; font-size: .9rem; z-index: 80; opacity: 0; pointer-events: none; transition: .25s; box-shadow: var(--shadow); width: max-content; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.error { color: #a12d27; background: #fff0ed; border-radius: 13px; padding: 10px 12px; margin: 0 0 16px; font-size: .87rem; font-weight: 750; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; margin: 0 0 22px; border-radius: 15px; background: #f0eef7; }
.auth-tabs button { min-height: 42px; border: 0; border-radius: 11px; color: var(--muted); background: transparent; cursor: pointer; font-weight: 850; }
.auth-tabs button[aria-selected="true"] { color: var(--purple-dark); background: white; box-shadow: 0 3px 10px rgba(44,35,106,.12); }
.auth-guest-note { margin: 22px 0 0; color: var(--muted); text-align: center; font-size: .86rem; }
.auth-guest-note button { border: 0; padding: 3px; color: var(--purple-dark); background: transparent; cursor: pointer; font-weight: 850; text-decoration: underline; text-underline-offset: 3px; }
.connection { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 70; color: #71421c; background: #fff0ce; border-radius: 999px; padding: 6px 12px; font-size: .75rem; font-weight: 900; }
.site-footer { width: min(calc(100% - 32px), 1080px); margin: 0 auto; padding: 16px 0 34px; display: flex; justify-content: center; flex-wrap: wrap; gap: 15px; color: var(--muted); font-size: .8rem; }
.site-footer a { color: inherit; font-weight: 750; }
.legal-page { width: min(calc(100% - 32px), 760px); margin: 28px auto 60px; }
.legal-page h1 { font-size: clamp(2.6rem, 12vw, 4.8rem); }
.legal-page h2 { margin-top: 30px; font-size: 1.25rem; }
.legal-page p, .legal-page li { color: var(--muted); line-height: 1.65; }
.legal-page .panel { margin-top: 20px; }

.c-coral { --avatar: #d84e45; }.c-sky { --avatar: #247fb6; }.c-sun { --avatar: #9b6b00; }.c-mint { --avatar: #25805f; }
.c-violet { --avatar: #6657ef; }.c-rose { --avatar: #b94375; }.c-navy { --avatar: #334879; }.c-teal { --avatar: #16777a; }

@media (max-width: 520px) {
  .player-list { grid-template-columns: 1fr; }
  .player-controls { margin-left: 0; }
}

@media (min-width: 700px) {
  #app { padding-top: 32px; }
  .action-grid { grid-template-columns: 1fr 1fr; }
  .room-layout { grid-template-columns: .88fr 1.12fr; align-items: start; }
  .room-header { grid-row: span 2; position: sticky; top: 28px; }
  .player-list { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .replay-actions { grid-template-columns: 1.5fr 1fr; }
}

@keyframes enter { from { opacity: 0; transform: translateY(12px) scale(.99); } }
@keyframes bob { 50% { transform: scaleY(.65); } }
@keyframes dots { 50% { transform: translateY(-5px); opacity: .4; } }
@keyframes pulse { 50% { transform: scale(.96); } }
@keyframes reveal { from { opacity: 0; transform: translateX(-16px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .001ms !important; }
}
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
