/* Imposter — game screens */
body { background: var(--bg); }
.app { min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 10px) calc(env(safe-area-inset-right) + 18px) calc(env(safe-area-inset-bottom) + 18px) calc(env(safe-area-inset-left) + 18px); }
.screen { flex: 1; display: flex; flex-direction: column; gap: 18px; animation: screenIn .38s var(--ease) both; min-height: 0; }
.screen.center { justify-content: center; text-align: center; align-items: stretch; }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px); } }
.screen.fade { animation: fadeIn .25s ease both; }
@keyframes fadeIn { from { opacity: 0; } }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; }
.topbar .title { font-family: var(--font-display); font-weight: 750; font-stretch: 85%; font-size: 20px; letter-spacing: -.01em; }
.spacer { flex: 1; }
.stack { display: grid; gap: 12px; }
.stack-lg { display: grid; gap: 22px; }
.row { display: flex; align-items: center; gap: 12px; }
.bottom { margin-top: auto; display: grid; gap: 10px; padding-top: 8px; }
.hero-title { font-size: clamp(44px, 13vw, 68px); font-weight: 800; }
.big-title { font-size: clamp(36px, 11vw, 54px); font-weight: 800; }
.mid-title { font-size: clamp(26px, 7.5vw, 34px); font-weight: 780; }
.lead { font-size: 18px; color: var(--ink-2); margin: 0; }
.center-col { display: grid; justify-items: center; gap: 14px; text-align: center; }

/* home */
.home-hero { padding: 18px 2px 4px; display: grid; gap: 12px; }
.home-hero .eyebrow { color: var(--accent); }
.mode-card { position: relative; display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 16px; width: 100%; text-align: left; padding: 20px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); transition: transform .2s var(--ease), box-shadow .2s; }
.mode-card:active { transform: scale(.985); }
.mode-card .ic { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--surface-2); }
.mode-card .ic svg { width: 28px; height: 28px; }
.mode-card.primary { background: var(--ink); color: var(--bg); border-color: transparent; }
.mode-card.primary .ic { background: var(--accent); color: #fff; }
.mode-card.primary .sub { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.mode-card h2 { font-size: 25px; font-weight: 780; }
.mode-card .sub { font-size: 15px; color: var(--ink-2); margin-top: 4px; }
.mode-card .arrow { opacity: .5; transform: rotate(180deg); }
.home-links { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.link-btn { background: none; border: 0; color: var(--ink-2); font-weight: 650; font-size: 15px; padding: 10px 12px; border-radius: 10px; display: inline-flex; gap: 8px; align-items: center; }
.link-btn svg { width: 18px; height: 18px; }

/* setup */
.section { display: grid; gap: 10px; }
.section > .label { padding-left: 2px; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.stepper .num { font-family: var(--font-display); font-size: 44px; font-weight: 800; min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }
.stepper .icon-btn { width: 56px; height: 56px; }
.name-list { display: grid; gap: 8px; }
.name-row { display: grid; grid-template-columns: 34px 1fr 40px; gap: 8px; align-items: center; animation: screenIn .25s var(--ease) both; }
.name-row .n { font-weight: 800; color: var(--ink-3); text-align: center; font-variant-numeric: tabular-nums; }
.name-row .input.bad { border-color: var(--accent); }
.name-row .icon-btn { width: 40px; height: 40px; background: transparent; color: var(--ink-3); }
.errors { color: var(--accent); font-weight: 650; font-size: 15px; display: grid; gap: 4px; }
.opt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.opt { text-align: left; padding: 14px; border-radius: 16px; border: 1.5px solid var(--line-2); background: var(--surface); transition: all .15s var(--ease); min-height: 78px; }
.opt b { display: block; font-size: 16.5px; }
.opt span { display: block; font-size: 13.5px; color: var(--ink-3); margin-top: 3px; line-height: 1.3; }
.opt[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); background: var(--surface-2); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.setting-row .t { font-weight: 650; }
.setting-row .d { font-size: 13.5px; color: var(--ink-3); }
details.adv { border-radius: 16px; border: 1px dashed var(--line-2); padding: 4px 14px; }
details.adv summary { padding: 12px 0; font-weight: 700; cursor: pointer; color: var(--ink-2); list-style: none; display: flex; justify-content: space-between; }
details.adv summary::after { content: "+"; font-size: 20px; line-height: 1; }
details.adv[open] summary::after { content: "–"; }
details.adv > div { display: grid; gap: 14px; padding-bottom: 14px; }
.mini-num { display: flex; align-items: center; gap: 8px; }
.mini-num .icon-btn { width: 36px; height: 36px; }
.mini-num b { min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }
.sticky-cta { position: sticky; bottom: 0; padding: 14px 0 calc(env(safe-area-inset-bottom) + 4px); background: linear-gradient(to bottom, transparent, var(--bg) 30%); margin-top: auto; }

/* pass-the-phone */
.pass { flex: 1; display: grid; place-content: center; gap: 22px; text-align: center; }
.pass .avatar { width: 112px; height: 112px; border-radius: 36px; margin: 0 auto; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow); font-family: var(--font-display); font-size: 52px; font-weight: 800; font-stretch: 80%; animation: pop .5s var(--spring) both; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.pass .who { font-size: clamp(40px, 12vw, 60px); font-weight: 800; word-break: break-word; }
.progress-dots { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; max-width: 280px; margin: 0 auto; }
.progress-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.progress-dots i.on { background: var(--ink); }
.progress-dots i.cur { background: var(--accent); transform: scale(1.3); }

/* role card */
.role-wrap { flex: 1; display: grid; place-items: center; perspective: 1400px; padding: 6px 0; }
.role-card { position: relative; width: min(100%, 380px); aspect-ratio: 3 / 4.1; max-height: 62dvh; transform-style: preserve-3d; transition: transform .7s var(--spring); touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.role-card.flipped { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; border-radius: 30px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 26px; text-align: center; overflow: hidden; }
.face.front { background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); cursor: pointer; }
.face.front .pattern { position: absolute; inset: 0; opacity: .09; background-image: radial-gradient(circle at 25% 25%, currentColor 1.6px, transparent 2px); background-size: 22px 22px; }
.face.front .big-logo svg { width: 92px; height: 92px; }
.face.front .hold-ring { position: relative; width: 120px; height: 120px; display: grid; place-items: center; }
.face.front .hold-ring svg.ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.face.front .hold-ring circle.track { stroke: color-mix(in srgb, var(--bg) 20%, transparent); }
.face.front .hold-ring circle.bar { stroke: var(--accent); stroke-dasharray: 339.3; stroke-dashoffset: 339.3; }
.face.front .cta { font-weight: 800; letter-spacing: .14em; text-transform: uppercase; font-size: 14px; z-index: 1; }
.face.front .small { font-size: 14px; opacity: .6; z-index: 1; }
.face.back { transform: rotateY(180deg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.face.back.imp { background: var(--accent); color: #fff; border: 0; }
.face.back .tag { font-weight: 800; letter-spacing: .14em; text-transform: uppercase; font-size: 13px; padding: 7px 14px; border-radius: 99px; background: var(--safe-soft); color: var(--safe); }
.face.back.imp .tag { background: rgba(0,0,0,.18); color: #fff; }
.face.back .wordlabel { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .6; margin-top: 8px; }
.face.back .word { font-family: var(--font-display); font-weight: 800; font-stretch: 80%; font-size: clamp(38px, 12vw, 64px); line-height: .95; letter-spacing: -.02em; word-break: break-word; hyphens: auto; }
.face.back .word.long { font-size: clamp(30px, 9vw, 46px); }
.face.back .imp-title { font-family: var(--font-display); font-weight: 800; font-stretch: 78%; font-size: clamp(40px, 12vw, 60px); line-height: .92; }
.face.back .meta { display: grid; gap: 6px; font-size: 15px; opacity: .8; }
.face.back .hintbox { background: rgba(0,0,0,.16); border-radius: 16px; padding: 12px 16px; font-size: 18px; font-weight: 700; }
.face.back .hintbox small { display: block; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; opacity: .75; margin-bottom: 4px; }
.face.back .whisper { font-size: 14px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .75; }

/* clue/order */
.order { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.order .chip { font-size: 14px; padding: 7px 12px; }
.order .chip.first { background: var(--accent); color: #fff; }
.starter { font-size: clamp(46px, 14vw, 72px); font-weight: 800; color: var(--accent); }
.phone-down { width: 120px; height: 120px; margin: 0 auto; border-radius: 40px; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow); }
.phone-down svg { width: 54px; height: 54px; animation: layDown 1.6s var(--ease) infinite alternate; }
@keyframes layDown { from { transform: rotate(0) translateY(-4px); } to { transform: rotateX(55deg) translateY(6px); } }
.clue-list { display: grid; gap: 8px; }
.clue-item { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); animation: screenIn .3s var(--ease) both; }
.clue-item b { font-size: 19px; font-family: var(--font-display); font-weight: 750; word-break: break-word; }
.clue-item span { color: var(--ink-3); font-weight: 650; font-size: 14px; white-space: nowrap; }

/* timer */
.timer { position: relative; width: 220px; height: 220px; margin: 0 auto; display: grid; place-items: center; }
.timer svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.timer .t { font-family: var(--font-display); font-size: 58px; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer circle.track { stroke: var(--line); }
.timer circle.bar { stroke: var(--accent); transition: stroke-dashoffset 1s linear; }
.timer.done .t { color: var(--accent); animation: pulse .8s ease infinite alternate; }
@keyframes pulse { to { opacity: .4; } }
.timer-ctrl { display: flex; justify-content: center; gap: 10px; }

/* voting */
.suspects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.suspect { min-height: 72px; padding: 12px; border-radius: 18px; border: 1.5px solid var(--line-2); background: var(--surface); font-weight: 750; font-size: 18px; display: flex; align-items: center; gap: 10px; text-align: left; transition: all .15s var(--ease); word-break: break-word; }
.suspect .ini { width: 38px; height: 38px; flex: none; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; }
.suspect[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.suspect[aria-pressed="true"] .ini { background: var(--accent); color: #fff; }
.locked { width: 96px; height: 96px; border-radius: 32px; margin: 0 auto; display: grid; place-items: center; background: var(--ink); color: var(--bg); animation: pop .5s var(--spring) both; }
.locked svg { width: 44px; height: 44px; }

/* results */
.tally { display: grid; gap: 8px; }
.tally-row { display: grid; grid-template-columns: minmax(70px, 34%) 1fr 30px; align-items: center; gap: 10px; font-weight: 700; }
.tally-row .bar { height: 14px; border-radius: 99px; background: var(--line); overflow: hidden; }
.tally-row .bar i { display: block; height: 100%; border-radius: 99px; background: var(--ink); width: 0; transition: width .9s var(--ease); }
.tally-row.top .bar i { background: var(--accent); }
.tally-row .c { text-align: right; font-variant-numeric: tabular-nums; }
.tally-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.verdict { display: grid; gap: 14px; justify-items: center; text-align: center; }
.verdict .who { font-size: clamp(40px, 12vw, 62px); font-weight: 800; word-break: break-word; }
.stamp { display: inline-block; padding: 10px 18px; border-radius: 14px; font-family: var(--font-display); font-weight: 800; font-stretch: 80%; font-size: clamp(24px, 7vw, 32px); letter-spacing: .02em; text-transform: uppercase; transform: rotate(-4deg); animation: stamp .55s var(--spring) both; }
.stamp.red { background: var(--accent); color: #fff; box-shadow: 0 16px 40px -14px var(--accent); }
.stamp.green { background: var(--safe); color: #03130D; }
.stamp.grey { background: var(--surface-2); color: var(--ink); }
@keyframes stamp { from { transform: rotate(-4deg) scale(2.4); opacity: 0; } }
.suspense { font-size: 22px; font-weight: 700; color: var(--ink-2); animation: fadeIn .4s ease both; }
.dots::after { content: ""; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.result-head { text-align: center; display: grid; gap: 10px; padding-top: 6px; }
.result-head .big-title.red { color: var(--accent); }
.result-head .big-title.green { color: var(--safe); }
.wordreveal { text-align: center; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); display: grid; gap: 6px; }
.wordreveal .w { font-family: var(--font-display); font-size: clamp(36px, 10vw, 52px); font-weight: 800; font-stretch: 82%; line-height: 1; word-break: break-word; }
.facts { display: grid; gap: 8px; }
.fact { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; font-size: 15.5px; }
.fact span:first-child { color: var(--ink-3); font-weight: 650; }
.fact span:last-child { font-weight: 700; text-align: right; }
.deltas { display: grid; gap: 6px; }
.delta { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); font-weight: 650; }
.delta em { font-style: normal; color: var(--ink-3); font-weight: 600; font-size: 13.5px; margin-left: 8px; }
.delta b { color: var(--safe); font-variant-numeric: tabular-nums; }

/* scoreboard */
.board { display: grid; gap: 8px; }
.board-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); animation: screenIn .4s var(--ease) both; }
.board-row .pos { font-family: var(--font-display); font-weight: 800; color: var(--ink-3); font-size: 20px; text-align: center; }
.board-row .nm { font-weight: 750; font-size: 18px; word-break: break-word; }
.board-row .sc { font-family: var(--font-display); font-weight: 800; font-size: 26px; font-variant-numeric: tabular-nums; }
.board-row .plus { color: var(--safe); font-size: 14px; font-weight: 800; margin-left: 6px; }
.board-row.lead { background: var(--ink); color: var(--bg); border-color: transparent; }
.board-row.lead .pos { color: var(--gold); }
.round-pill { display: inline-flex; gap: 6px; align-items: baseline; font-family: var(--font-display); font-weight: 800; font-stretch: 85%; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }

.winner { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 10px 0 4px; }
.winner .crown { width: 104px; height: 104px; border-radius: 34px; background: var(--gold-soft); color: var(--gold); display: grid; place-items: center; animation: pop .7s var(--spring) both; }
.winner .crown svg { width: 54px; height: 54px; }
.winner .who { font-size: clamp(46px, 14vw, 76px); font-weight: 800; word-break: break-word; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* sheet (menu) */
.sheet-back { position: fixed; inset: 0; background: rgba(10, 6, 16, .5); z-index: 60; animation: fadeIn .2s ease both; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-width: 560px; margin: 0 auto; background: var(--bg); border-radius: 28px 28px 0 0; padding: 10px 20px calc(env(safe-area-inset-bottom) + 20px); box-shadow: var(--shadow-lg); animation: sheetIn .38s var(--spring) both; max-height: 88dvh; overflow: auto; }
@keyframes sheetIn { from { transform: translateY(100%); } }
.sheet .grab { width: 40px; height: 5px; border-radius: 99px; background: var(--line-2); margin: 0 auto 14px; }
.sheet h3 { font-size: 26px; margin-bottom: 14px; }
.howto ol { padding-left: 20px; margin: 0; display: grid; gap: 10px; color: var(--ink-2); }
.howto b { color: var(--ink); }

.banner { padding: 12px 16px; border-radius: 14px; background: var(--gold-soft); color: var(--ink); font-size: 15px; font-weight: 600; }
.banner.red { background: var(--accent-soft); }
.offline-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink-3); }
.offline-pill svg { width: 15px; height: 15px; }

/* online */
.code-big { font-family: var(--font-display); font-size: clamp(54px, 17vw, 84px); font-weight: 800; letter-spacing: .12em; font-stretch: 90%; text-align: center; }
.code-input { text-align: center; font-family: var(--font-display); font-size: 34px; font-weight: 800; letter-spacing: .3em; text-transform: uppercase; min-height: 70px; }
.lobby-list { display: grid; gap: 8px; }
.lobby-p { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; font-weight: 700; }
.lobby-p .st { font-size: 13px; color: var(--ink-3); font-weight: 650; }
.lobby-p .st.ok { color: var(--safe); }
.lobby-p .st.off { color: var(--accent); }
.waiting { display: grid; gap: 10px; justify-items: center; text-align: center; padding: 18px; }
.conn { position: fixed; top: calc(env(safe-area-inset-top) + 8px); left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 99px; font-weight: 700; font-size: 14px; z-index: 70; box-shadow: var(--shadow); }

@media (min-width: 700px) {
  .app { padding-top: 28px; }
  .suspects { grid-template-columns: repeat(3, 1fr); }
}
@media (max-height: 640px) {
  .role-card { max-height: 56dvh; }
  .pass .avatar { width: 84px; height: 84px; font-size: 40px; border-radius: 28px; }
  .timer { width: 170px; height: 170px; }
  .timer .t { font-size: 44px; }
}
