:root {
  color-scheme: dark;
  --ink: #f8f5ff;
  --muted: #aea7c2;
  --bg: #110b21;
  --panel: #211636;
  --panel-2: #2a1c42;
  --line: rgba(255,255,255,.11);
  --violet: #9f79ff;
  --violet-2: #c9b7ff;
  --lime: #d8ff62;
  --coral: #ff6c87;
  --green: #63e6b5;
  --shadow: 0 22px 70px rgba(0,0,0,.38);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: #08050f; }
body { color: var(--ink); overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; }
button { touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }
[hidden] { display: none !important; }

.app-shell {
  position: relative; width: 100%; min-height: 100dvh; overflow: hidden;
  background:
    radial-gradient(circle at 80% 5%, rgba(129,87,230,.22), transparent 30%),
    radial-gradient(circle at 5% 85%, rgba(255,89,134,.12), transparent 31%),
    linear-gradient(155deg, #17102b 0%, #100a1f 54%, #170b22 100%);
}

.screen { display: none; min-height: 100dvh; padding: max(18px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom)); }
.screen--active { display: flex; flex-direction: column; animation: screen-in .24s ease-out both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(7px); } }

.home { position: relative; justify-content: center; align-items: center; text-align: center; padding-inline: 24px; }
.home__glow { position: absolute; width: 330px; height: 330px; top: 5%; left: 50%; translate: -50% 0; border-radius: 50%; background: rgba(151,103,255,.18); filter: blur(75px); pointer-events: none; }
.brand-symbol {
  position: relative; width: 104px; height: 104px; margin-bottom: 22px; border: 1px solid rgba(255,255,255,.16); border-radius: 34px;
  background: linear-gradient(145deg, #9f79ff, #5d39c0 63%, #40246f); box-shadow: 0 20px 55px rgba(85,45,160,.45), inset 0 1px rgba(255,255,255,.35);
  transform: rotate(-5deg);
}
.brand-symbol::after { content: ''; position: absolute; inset: 8px; border-radius: 26px; border: 1px solid rgba(255,255,255,.11); }
.brand-symbol__eye { position: absolute; z-index: 1; top: 36px; width: 10px; height: 13px; border-radius: 50%; background: #170f28; }
.brand-symbol__eye:nth-child(1) { left: 30px; }
.brand-symbol__eye:nth-child(2) { right: 30px; }
.brand-symbol__mouth { position: absolute; z-index: 1; left: 50%; top: 58px; width: 34px; height: 14px; translate: -50% 0; border-bottom: 5px solid var(--lime); border-radius: 0 0 50% 50%; }
.eyebrow { margin: 0; color: var(--violet-2); font-size: .68rem; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
.home h1 { margin: 7px 0 9px; font-family: Manrope, sans-serif; font-size: clamp(4.2rem, 23vw, 7rem); line-height: .88; letter-spacing: -.09em; }
.home h1 span { color: var(--lime); }
.lead { max-width: 420px; margin: 0; color: var(--muted); font-size: .98rem; line-height: 1.55; }
.hero-preview { display: flex; justify-content: center; margin: 25px 0 22px; transform: rotate(-2deg); }
.mini-card { min-width: 106px; padding: 12px 13px; border-radius: 16px; font-size: .72rem; font-weight: 800; letter-spacing: .1em; box-shadow: 0 12px 30px rgba(0,0,0,.24); }
.mini-card--truth { color: #12251e; background: var(--green); transform: rotate(-7deg) translateX(8px); }
.mini-card--bluff { color: #2c0d17; background: var(--coral); transform: rotate(7deg) translateX(-8px); }
.home-actions { display: grid; width: min(100%, 430px); gap: 9px; }
.feature-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 23px; }
.feature-row span { padding: 7px 9px; border: 1px solid var(--line); border-radius: 999px; color: #8f88a3; font-size: .61rem; font-weight: 700; }

.btn { min-height: 50px; border: 0; border-radius: 17px; padding: 0 18px; color: var(--ink); font-weight: 800; cursor: pointer; transition: transform .12s, opacity .12s, background .12s; }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn--xl { min-height: 59px; }
.btn--primary { color: #1a1225; background: linear-gradient(135deg, var(--lime), #baff7a); box-shadow: 0 12px 30px rgba(194,255,88,.15); }
.btn--soft { border: 1px solid var(--line); background: rgba(255,255,255,.065); }
.btn--outline { width: 100%; border: 1px dashed rgba(201,183,255,.35); background: rgba(159,121,255,.06); color: var(--violet-2); }
.text-button { border: 0; padding: 11px; color: var(--violet-2); background: transparent; font-size: .78rem; font-weight: 700; cursor: pointer; }
.text-button--danger { color: #ff9aae; }

.topbar, .game-header { display: grid; grid-template-columns: 48px minmax(0,1fr) 48px; align-items: center; gap: 10px; flex: 0 0 auto; }
.topbar h2 { margin: 3px 0 0; font: 800 1.25rem/1.1 Manrope, sans-serif; letter-spacing: -.035em; }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: rgba(255,255,255,.045); font-size: 1.45rem; font-weight: 700; cursor: pointer; }
.icon-button--empty { opacity: 0; pointer-events: none; }
.scroll-content { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 22px 0 118px; scrollbar-width: thin; }
.intro-card { display: grid; gap: 5px; margin-bottom: 16px; padding: 17px; border: 1px solid rgba(159,121,255,.22); border-radius: 20px; background: linear-gradient(145deg, rgba(159,121,255,.12), rgba(255,255,255,.035)); }
.intro-card strong { font-size: .9rem; }
.intro-card span { color: var(--muted); font-size: .73rem; line-height: 1.45; }
.player-fields { display: grid; gap: 9px; }
.player-field { display: grid; grid-template-columns: 38px minmax(0,1fr) 38px; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.04); }
.player-number { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; color: #211731; background: var(--violet-2); font-weight: 800; }
.player-field input { width: 100%; min-width: 0; height: 43px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 1rem; font-weight: 700; }
.player-field input::placeholder { color: #756e89; font-weight: 500; }
.remove-player { width: 35px; height: 35px; border: 0; border-radius: 11px; color: #ae9fc6; background: transparent; font-size: 1.35rem; cursor: pointer; }
.remove-player:disabled { opacity: .2; }
.player-fields + .btn { margin-top: 10px; }
.settings-card { margin: 20px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; background: rgba(255,255,255,.035); }
.settings-card legend { width: 100%; padding: 15px 17px 5px; color: var(--violet-2); font-size: .68rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.setting-group { padding: 13px 16px 17px; }
.setting-group + .setting-group { border-top: 1px solid var(--line); }
.setting-label { display: block; margin-bottom: 10px; font-size: .8rem; font-weight: 700; }
.segments { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; padding: 4px; border-radius: 14px; background: rgba(0,0,0,.2); }
.segments button { min-height: 39px; border: 0; border-radius: 11px; color: var(--muted); background: transparent; font-size: .7rem; font-weight: 800; cursor: pointer; }
.segments button.is-active { color: #1d1427; background: var(--violet-2); box-shadow: 0 5px 15px rgba(0,0,0,.2); }
.sticky-footer { position: absolute; z-index: 4; right: 0; bottom: 0; left: 0; padding: 16px 18px max(16px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, #110b21 27%); }
.sticky-footer .btn { width: 100%; }
.form-error { min-height: 18px; margin: 0 0 4px; color: #ff9aae; text-align: center; font-size: .72rem; }

.game-screen { background: radial-gradient(circle at 50% -5%, rgba(159,121,255,.14), transparent 34%); }
.game-header { grid-template-columns: 48px 1fr 48px; }
.round-pill, .vote-progress { justify-self: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--violet-2); background: rgba(255,255,255,.04); font-size: .66rem; font-weight: 800; letter-spacing: .11em; }
.vote-progress { justify-self: end; letter-spacing: .03em; }
.center-content { display: grid; place-items: center; flex: 1 1 auto; padding: 20px 0 12px; }
.privacy-card, .secret-card, .ballot-card { width: min(100%, 500px); padding: 24px 20px; border: 1px solid var(--line); border-radius: 27px; text-align: center; background: linear-gradient(145deg, rgba(255,255,255,.075), rgba(255,255,255,.035)); box-shadow: var(--shadow); }
.privacy-card h2, .secret-card h2, .ballot-card h2 { margin: 9px 0 9px; font: 800 clamp(1.6rem, 7vw, 2.25rem)/1.08 Manrope, sans-serif; letter-spacing: -.05em; }
.privacy-card p:not(.eyebrow), .ballot-card > p:not(.eyebrow):not(.section-label) { margin: 0 auto 23px; max-width: 390px; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.privacy-card .btn, .secret-card .btn, .ballot-card .btn { width: 100%; }
.avatar { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.065); font-size: 1.5rem; }
.avatar--large { width: 82px; height: 82px; margin: 0 auto 20px; border-radius: 27px; font-size: 2.5rem; box-shadow: 0 12px 35px rgba(0,0,0,.25); }
.role-badge, .result-role { display: inline-grid; place-items: center; min-height: 54px; margin: 18px 0 8px; padding: 0 25px; border-radius: 16px; font: 800 1.15rem Manrope, sans-serif; letter-spacing: .12em; transform: rotate(-2deg); }
.role-badge--truth, .result-role--truth { color: #10271f; background: var(--green); }
.role-badge--bluff, .result-role--bluff { color: #330e19; background: var(--coral); }
.secret-card h2 { font-size: clamp(1.4rem, 6.5vw, 2rem); }
.detail-cue { margin: 0 auto; padding: 13px 14px; border-radius: 15px; color: #d7d0e8; background: rgba(0,0,0,.18); font-size: .76rem; line-height: 1.45; }
.role-instruction { margin: 14px 0 20px; color: var(--violet-2); font-size: .77rem; font-weight: 700; line-height: 1.5; }

.interrogate-content { display: flex; flex-direction: column; justify-content: center; flex: 1 1 auto; width: min(100%, 540px); margin: auto; padding: 14px 0; }
.story-card { padding: 20px; border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(145deg, rgba(159,121,255,.11), rgba(255,255,255,.035)); }
.story-card h2 { margin: 8px 0; font: 800 clamp(1.35rem, 6vw, 1.95rem)/1.15 Manrope, sans-serif; letter-spacing: -.045em; }
.story-card > p:last-child { margin: 0; color: var(--muted); font-size: .74rem; line-height: 1.45; }
.timer { position: relative; display: grid; place-items: center; align-content: center; width: 145px; height: 145px; margin: 18px auto; border-radius: 50%; background: conic-gradient(var(--lime) calc(var(--progress) * 1turn), rgba(255,255,255,.07) 0); box-shadow: 0 13px 40px rgba(0,0,0,.25); }
.timer::before { content: ''; position: absolute; width: 124px; height: 124px; border-radius: 50%; background: #181028; }
.timer strong, .timer span { position: relative; z-index: 1; }
.timer strong { font: 800 2.8rem/1 Manrope, sans-serif; }
.timer span { margin-top: 2px; color: var(--muted); font-size: .62rem; }
.timer--done { background: var(--coral); animation: pulse 1.1s ease-in-out 2; }
@keyframes pulse { 50% { transform: scale(1.035); } }
.section-label { margin: 0 0 9px; color: #8f87a4; font-size: .66rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.question-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.question-chips span { padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; color: #c7c0d7; background: rgba(255,255,255,.035); font-size: .66rem; }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 21px 0 22px; }
.choice-grid button { min-height: 91px; border: 1px solid var(--line); border-radius: 20px; color: var(--ink); background: rgba(255,255,255,.04); cursor: pointer; }
.choice-grid b, .choice-grid span { display: block; }
.choice-grid b { margin-bottom: 5px; font-size: 1.7rem; }
.choice-grid span { font-weight: 800; }
.choice-grid button[data-guess="truth"].is-selected { border-color: var(--green); background: rgba(99,230,181,.14); box-shadow: inset 0 0 0 1px var(--green); }
.choice-grid button[data-guess="bluff"].is-selected { border-color: var(--coral); background: rgba(255,108,135,.14); box-shadow: inset 0 0 0 1px var(--coral); }
.confidence-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 11px; }
.confidence-grid button { min-height: 70px; border: 1px solid var(--line); border-radius: 17px; color: var(--ink); background: rgba(255,255,255,.035); font-size: 1.25rem; font-weight: 800; cursor: pointer; }
.confidence-grid small { display: block; margin-top: 3px; color: var(--muted); font-size: .55rem; font-weight: 600; }
.confidence-grid button.is-selected { border-color: var(--lime); color: #1d2610; background: var(--lime); }
.confidence-grid button.is-selected small { color: #37401e; }
.stake-note { margin-bottom: 14px !important; font-size: .64rem !important; }

.result-content { display: flex; flex-direction: column; justify-content: center; flex: 1 1 auto; width: min(100%, 520px); margin: auto; padding: 22px 0 10px; text-align: center; }
.result-role { align-self: center; margin: 13px 0 13px; font-size: 1.4rem; }
.result-content h2 { margin: 0; font: 800 clamp(1.65rem, 7.5vw, 2.4rem)/1.08 Manrope, sans-serif; letter-spacing: -.05em; }
.result-content > p:not(.eyebrow) { margin: 10px auto 18px; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.vote-reveal { display: grid; gap: 7px; max-height: 34dvh; overflow-y: auto; margin-bottom: 17px; }
.vote-row { display: grid; grid-template-columns: minmax(0,1fr) auto 36px; gap: 9px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 15px; text-align: left; background: rgba(255,255,255,.035); font-size: .74rem; }
.vote-row span:nth-child(2) { color: var(--muted); }
.vote-row strong { text-align: right; }
.vote-row--correct strong { color: var(--green); }
.vote-row--wrong strong { color: var(--coral); }
.result-actions { display: grid; gap: 8px; }

.score-list { display: grid; gap: 9px; }
.score-row { display: grid; grid-template-columns: 28px 48px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 11px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.04); }
.score-row:first-child { border-color: rgba(216,255,98,.32); background: rgba(216,255,98,.06); }
.score-rank { color: var(--muted); text-align: center; font-weight: 800; }
.score-row div { min-width: 0; }
.score-row div strong, .score-row div span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-row div strong { font-size: .86rem; }
.score-row div span { margin-top: 3px; color: var(--muted); font-size: .62rem; }
.score-row > b { color: var(--lime); font: 800 1.5rem Manrope, sans-serif; }
.stats-card { display: grid; grid-template-columns: repeat(3,1fr); margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.025); text-align: center; }
.stats-card div + div { border-left: 1px solid var(--line); }
.stats-card strong, .stats-card span { display: block; }
.stats-card strong { font: 800 1.35rem Manrope, sans-serif; }
.stats-card span { margin-top: 3px; color: var(--muted); font-size: .61rem; }

.dialog { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom)); border: 0; color: var(--ink); background: rgba(7,4,13,.76); backdrop-filter: blur(14px); }
.dialog[open] { display: grid; place-items: center; animation: fade-in .18s ease-out; }
@keyframes fade-in { from { opacity: 0; } }
.dialog::backdrop { background: transparent; }
.dialog__card { position: relative; display: grid; gap: 9px; width: min(100%, 450px); padding: 25px; border: 1px solid var(--line); border-radius: 27px; background: #201533; box-shadow: var(--shadow); text-align: center; }
.dialog__card h2 { margin: 3px 0; font: 800 1.85rem Manrope, sans-serif; letter-spacing: -.05em; }
.dialog__card > p:not(.eyebrow):not(.safe-note) { margin: 0 0 10px; color: var(--muted); font-size: .77rem; line-height: 1.5; }
.dialog-close { position: absolute; top: 13px; right: 13px; width: 40px; height: 40px; border: 0; border-radius: 13px; color: var(--ink); background: rgba(255,255,255,.06); font-size: 1.4rem; cursor: pointer; }
.dialog__card--help { text-align: left; }
.dialog__card--help ol { display: grid; gap: 12px; margin: 11px 0; padding-left: 20px; color: var(--muted); font-size: .76rem; line-height: 1.48; }
.dialog__card--help li::marker { color: var(--lime); font-weight: 800; }
.dialog__card--help b { color: var(--ink); }
.safe-note { margin: 4px 0 0; padding: 12px; border-radius: 14px; color: #bdebd9; background: rgba(99,230,181,.09); font-size: .71rem; line-height: 1.45; }
.toast { position: fixed; z-index: 20; right: 18px; bottom: max(20px, env(safe-area-inset-bottom)); left: 18px; max-width: 460px; margin: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: #2a1d40; box-shadow: var(--shadow); opacity: 0; transform: translateY(18px); pointer-events: none; transition: .2s ease; text-align: center; font-size: .73rem; }
.toast--visible { opacity: 1; transform: translateY(0); }

@media (max-height: 710px) {
  .brand-symbol { width: 80px; height: 80px; margin-bottom: 14px; border-radius: 27px; }
  .brand-symbol__eye { top: 27px; }
  .brand-symbol__eye:nth-child(1) { left: 24px; }
  .brand-symbol__eye:nth-child(2) { right: 24px; }
  .brand-symbol__mouth { top: 44px; }
  .home h1 { font-size: 4rem; }
  .hero-preview { margin: 18px 0 16px; }
  .privacy-card, .secret-card, .ballot-card { padding-block: 18px; }
  .avatar--large { width: 65px; height: 65px; margin-bottom: 14px; border-radius: 22px; font-size: 2rem; }
  .timer { width: 118px; height: 118px; margin: 11px auto; }
  .timer::before { width: 100px; height: 100px; }
  .timer strong { font-size: 2.3rem; }
}

@media (min-width: 700px) {
  body { display: grid; place-items: center; background: #08050f; }
  .app-shell { width: 680px; min-height: min(930px, 100dvh); max-height: 100dvh; border-inline: 1px solid rgba(255,255,255,.06); box-shadow: 0 0 80px rgba(0,0,0,.35); }
  .screen { min-height: min(930px, 100dvh); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
