:root {
  --bg: #0d0a0f; --bg2: #19121c; --panel: #241a28; --panel2: #2f2234; --line: #3d2d44;
  --text: #f3e9e1; --dim: #a8949f; --accent: #e94560; --gold: #f5c96a; --good: #5ee08a; --bad: #ff4d5e; --ghost: #9fb7ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(ellipse at 50% -10%, #3a2430 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text); font-family: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
h1, h2, h3, .display { font-family: 'Russo One', 'Rubik', system-ui, sans-serif; font-weight: 400; letter-spacing: .02em; margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; touch-action: manipulation; }
input { font: inherit; }
.dim { color: var(--dim); }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

/* Гирлянда и лампочка */
.garland { position: fixed; top: 0; left: 0; right: 0; height: 26px; pointer-events: none; z-index: 0;
  background: radial-gradient(circle at 12px 14px, #ffd36e 3px, transparent 4px) 0 0 / 48px 26px repeat-x,
              radial-gradient(circle at 36px 18px, #ff6b8a 3px, transparent 4px) 0 0 / 48px 26px repeat-x;
  animation: twinkle 2.4s steps(2) infinite; opacity: .8; }
@keyframes twinkle { 50% { filter: hue-rotate(90deg) brightness(1.4); } }
.bulb { position: fixed; top: 0; left: 50%; width: 2px; height: 40px; background: #555; z-index: 0; pointer-events: none; }
.bulb::after { content: ''; position: absolute; top: 38px; left: -9px; width: 20px; height: 24px; border-radius: 50% 50% 45% 45%;
  background: #ffe9a8; box-shadow: 0 0 40px 16px rgba(255, 220, 140, .35); animation: flicker 6s infinite; }
@keyframes flicker { 0%, 18%, 22%, 62%, 64%, 100% { opacity: 1; } 20%, 63% { opacity: .25; } }

.btn { background: var(--accent); color: #fff; padding: 14px 22px; border-radius: 14px; font-weight: 700; font-size: 1.05rem;
  box-shadow: 0 4px 0 #9b2238; transition: transform .06s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #9b2238; }
.btn.ghost-btn { background: var(--panel2); box-shadow: 0 4px 0 #170f1a; }
.btn.small { padding: 8px 14px; font-size: .9rem; border-radius: 10px; }
.btn:disabled { opacity: .45; pointer-events: none; }
.pill { display: inline-block; padding: 4px 10px; border-radius: 99px; background: var(--panel2); font-size: .85rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }

.timer { position: relative; height: 12px; background: var(--panel2); border-radius: 99px; overflow: visible; margin: 10px 0; }
.timer i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--gold), var(--accent)); border-radius: 99px; }
.timer b { position: absolute; right: 0; top: -30px; font-family: 'Russo One', sans-serif; font-size: 1.4rem; }
.timer.urgent i { background: var(--bad); animation: pulse .5s infinite alternate; }
@keyframes pulse { to { opacity: .55; } }

.fingers { display: inline-flex; gap: 2px; vertical-align: middle; }
.fingers i { width: 4px; height: 12px; border-radius: 2px; background: #f1c9a5; }
.fingers i.lost { background: var(--bad); height: 5px; margin-top: 7px; }

/* ───────── Экран ведущего ───────── */
.host { min-height: 100vh; padding: 34px 40px 24px; display: flex; flex-direction: column; gap: 18px; position: relative; z-index: 1; }
.host-top { display: flex; align-items: center; gap: 20px; }
.logo { line-height: 1; }
.logo h1 { font-size: 2.6rem; color: var(--accent); text-shadow: 0 0 22px rgba(233, 69, 96, .5); }
.logo small { display: block; font-size: 1rem; color: var(--gold); font-family: 'Russo One', sans-serif; letter-spacing: .1em; }
.codebox { margin-left: auto; text-align: right; }
.codebox .code { font-family: 'Russo One', sans-serif; font-size: 3.2rem; letter-spacing: .18em; color: var(--gold); line-height: 1; }
.codebox .url { font-size: 1rem; color: var(--dim); }
.stage { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 20px; }
.quip { font-size: 1.35rem; color: var(--gold); font-style: italic; text-align: center; min-height: 1.6em; }
.quip::before { content: '🎤 '; font-style: normal; }
.big-q { font-size: clamp(1.6rem, 3.2vw, 3rem); line-height: 1.2; text-align: center; max-width: 1200px; margin: 0 auto; }
.cat { text-align: center; color: var(--accent); font-family: 'Russo One', sans-serif; letter-spacing: .08em; text-transform: uppercase; font-size: 1rem; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 1200px; margin: 0 auto; width: 100%; }
.opt { position: relative; background: var(--panel); border: 3px solid var(--line); border-radius: 18px; padding: 18px 20px 18px 70px; font-size: clamp(1.1rem, 1.8vw, 1.7rem); min-height: 86px; display: flex; align-items: center; transition: .3s; }
.opt .mark { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-family: 'Russo One'; color: #fff; }
.opt.right { border-color: var(--good); background: #173524; box-shadow: 0 0 30px rgba(94, 224, 138, .35); }
.opt.dimmed { opacity: .55; border-color: transparent; }
.opt.dimmed .mark { filter: grayscale(.8); }
.opt .who { position: absolute; right: 12px; bottom: -14px; display: flex; gap: 2px; }
.opt .cnt { margin-left: auto; padding-left: 12px; font-family: 'Russo One'; color: var(--dim); }
.mini-av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; border: 2px solid; background: var(--bg2); }
.expl { text-align: center; font-size: 1.3rem; max-width: 1000px; margin: 0 auto; color: var(--text); background: var(--panel); border-radius: 14px; padding: 12px 18px; }

.strip { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.pcard { position: relative; width: 112px; background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 10px 6px 8px; text-align: center; transition: .3s; }
.pcard .av { font-size: 34px; line-height: 1.1; }
.pcard .nm { font-weight: 700; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .sc { font-size: .8rem; color: var(--dim); }
.pcard .lv { font-size: .7rem; }
.pcard.ghost { filter: grayscale(.7); opacity: .65; border-style: dashed; border-color: var(--ghost); }
.pcard.ghost .av { animation: float 2s ease-in-out infinite; }
.pcard.off { opacity: .35; }
.pcard.done { border-color: var(--good); }
.pcard.done::after { content: '✓'; position: absolute; top: -8px; right: -6px; background: var(--good); color: #000; border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; font-weight: 900; }
.pcard.doomed { border-color: var(--bad); animation: shake .4s 2; }
.pcard .vip { position: absolute; top: -12px; left: -6px; font-size: 18px; }
.pcard .kick { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; background: var(--panel2); font-size: 12px; opacity: .6; }
.pcard .gain { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--good); color: #000; border-radius: 8px; padding: 1px 6px; font-size: .75rem; font-weight: 800; white-space: nowrap; }
@keyframes float { 50% { transform: translateY(-5px); } }
@keyframes shake { 25% { transform: translateX(-4px) rotate(-2deg); } 75% { transform: translateX(4px) rotate(2deg); } }

.lobby { display: grid; grid-template-columns: 1fr 360px; gap: 24px; align-items: start; }
.settings label { display: block; margin: 0 0 14px; }
.settings .lbl { font-size: .9rem; color: var(--dim); margin-bottom: 6px; display: block; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { background: var(--panel2); padding: 8px 14px; border-radius: 10px; min-width: 44px; }
.seg button.on { background: var(--accent); }
.empty { text-align: center; color: var(--dim); padding: 40px; font-size: 1.3rem; }
.hero-code { text-align: center; }
.hero-code .code { font-family: 'Russo One'; font-size: 7rem; letter-spacing: .2em; color: var(--gold); text-shadow: 0 0 40px rgba(245, 201, 106, .4); line-height: 1; }

.mg-title { text-align: center; font-size: clamp(2rem, 4.5vw, 4rem); color: var(--bad); text-shadow: 0 0 30px rgba(255, 77, 94, .5); }
.mg-rules { text-align: center; font-size: 1.5rem; }
.mg-board { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.mg-p { width: 170px; background: var(--panel); border-radius: 16px; padding: 12px; text-align: center; border: 2px solid var(--line); }
.mg-p .av { font-size: 40px; }
.mg-p .bar { height: 10px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.mg-p .bar i { display: block; height: 100%; background: var(--gold); transition: width .2s; }
.mg-p.fail { border-color: var(--bad); background: #3a1620; }
.mg-p.safe { border-color: var(--good); }
.snip { font-size: 3rem; animation: snip .6s ease-out; }
@keyframes snip { from { transform: scale(2.5) rotate(-30deg); opacity: 0; } }

.track { display: flex; flex-direction: column; gap: 4px; max-height: 46vh; overflow-y: auto; max-width: 1200px; margin: 0 auto; width: 100%; }
.lane { position: relative; height: 40px; background: linear-gradient(90deg, #1d1420, #2a1d2e); border-radius: 10px; }
.lane .runner { position: absolute; top: 2px; width: 36px; height: 36px; display: grid; place-items: center; font-size: 26px; transition: left .7s cubic-bezier(.3, 1.5, .5, 1); }
.lane-row { display: grid; grid-template-columns: 130px 1fr; gap: 10px; align-items: center; }
.lane-row .lname { font-size: .9rem; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.lane { flex: 1; }
.lane .door { position: absolute; right: 4px; top: 4px; font-size: 26px; }
.lane .start-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--line); }
.tf { display: flex; gap: 20px; justify-content: center; }
.tf .opt { flex: 0 1 380px; justify-content: center; padding-left: 20px; font-family: 'Russo One'; }

.podium { display: flex; justify-content: center; align-items: flex-end; gap: 18px; }
.podium .pl { text-align: center; }
.podium .pl .av { font-size: 60px; }
.podium .pl .block { background: var(--panel2); border-radius: 12px 12px 0 0; width: 160px; display: grid; place-items: center; font-family: 'Russo One'; font-size: 2rem; }
.podium .p1 .block { height: 170px; background: linear-gradient(var(--gold), #a7782b); color: #2a1a00; }
.podium .p2 .block { height: 120px; }
.podium .p3 .block { height: 90px; }
.ranks { max-width: 700px; margin: 0 auto; width: 100%; }
.ranks .r { display: flex; gap: 12px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.foot { display: flex; gap: 10px; justify-content: flex-end; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ───────── Телефон игрока ───────── */
.phone { max-width: 520px; margin: 0 auto; min-height: 100vh; padding: 40px 16px 24px; display: flex; flex-direction: column; gap: 16px; position: relative; z-index: 1; }
.phone .logo { text-align: center; }
.phone .logo h1 { font-size: 3rem; }
.field { display: block; }
.field span { display: block; font-size: .9rem; color: var(--dim); margin-bottom: 6px; }
.field input { width: 100%; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg2); color: var(--text); font-size: 1.2rem; }
.field input.codein { text-transform: uppercase; letter-spacing: .4em; font-family: 'Russo One'; font-size: 1.8rem; text-align: center; }
.avpick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.avpick button { font-size: 28px; padding: 6px 0; border-radius: 12px; background: var(--panel); border: 2px solid transparent; }
.avpick button.on { border-color: var(--gold); background: var(--panel2); }
.langs { display: flex; gap: 6px; justify-content: center; }
.langs button { background: var(--panel); padding: 6px 14px; border-radius: 10px; font-weight: 700; }
.langs button.on { background: var(--accent); }
.me-bar { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 14px; padding: 8px 12px; }
.me-bar .av { font-size: 28px; }
.me-bar .nm { font-weight: 700; }
.err { background: #4a1621; color: #ffd0d6; border-radius: 12px; padding: 10px 14px; text-align: center; }
.p-q { font-size: 1.25rem; line-height: 1.3; text-align: center; }
.p-opts { display: grid; gap: 10px; }
.p-opt { text-align: left; padding: 16px 16px 16px 60px; border-radius: 16px; font-size: 1.08rem; position: relative; background: var(--panel); border: 3px solid var(--line); min-height: 64px; }
.p-opt .mark { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-family: 'Russo One'; color: #fff; }
.p-opt.chosen { border-color: var(--gold); background: var(--panel2); }
.p-opt.right { border-color: var(--good); }
.p-opt:disabled { opacity: 1; }
.big-msg { text-align: center; font-family: 'Russo One'; font-size: 2rem; margin: 20px 0 6px; }
.big-msg.good { color: var(--good); } .big-msg.bad { color: var(--bad); }
.hint { text-align: center; color: var(--dim); }
.ghost-banner { background: #1f2440; border: 2px dashed var(--ghost); color: var(--ghost); border-radius: 14px; padding: 10px; text-align: center; font-size: .95rem; }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.numpad button { background: var(--panel2); border-radius: 14px; font-size: 1.6rem; padding: 14px 0; font-family: 'Russo One'; box-shadow: 0 3px 0 #170f1a; }
.numpad button:active { transform: translateY(2px); box-shadow: none; }
.numpad .ok { background: var(--good); color: #000; }
.calc-screen { background: #c7d6b0; color: #1b2a12; font-family: 'Russo One', monospace; border-radius: 12px; padding: 12px 16px; text-align: right; box-shadow: inset 0 3px 8px rgba(0, 0, 0, .4); }
.calc-screen .pq { font-size: 1.8rem; }
.calc-screen .pa { font-size: 2.4rem; min-height: 1.2em; }
.calc-screen.okf { animation: flashG .3s; } .calc-screen.badf { animation: flashR .3s; }
@keyframes flashG { from { background: #7dff9a; } } @keyframes flashR { from { background: #ff7d8a; } }
.mem-show { display: flex; justify-content: center; gap: 8px; font-size: 44px; }
.mem-slots { display: flex; justify-content: center; gap: 6px; font-size: 32px; min-height: 52px; }
.mem-slots span { width: 52px; height: 52px; border: 2px dashed var(--line); border-radius: 12px; display: grid; place-items: center; }
.mem-pool { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mem-pool button { font-size: 34px; padding: 10px 0; background: var(--panel); border-radius: 14px; }
.glasses { display: flex; justify-content: center; gap: 12px; }
.glasses button { min-width: 0; font-size: 64px; padding: 16px 10px; background: var(--panel); border-radius: 18px; border: 3px solid transparent; flex: 1; }
.glasses button.on { border-color: var(--gold); background: var(--panel2); }
.glasses .poison { border-color: var(--bad) !important; }
.tapbtn { width: 100%; aspect-ratio: 1; max-height: 52vh; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ff7b93, var(--accent) 60%, #8b1a30); font-family: 'Russo One'; font-size: 2.6rem; box-shadow: 0 8px 0 #6b1426, 0 0 40px rgba(233, 69, 96, .5); user-select: none; -webkit-user-select: none; }
.tapbtn:active { transform: translateY(5px) scale(.98); box-shadow: 0 3px 0 #6b1426; }
.tapcount { text-align: center; font-family: 'Russo One'; font-size: 2.4rem; }
.vip-tag { color: var(--gold); }

@media (max-width: 900px) {
  .host { padding: 34px 16px 16px; }
  .lobby { grid-template-columns: 1fr; }
  .opts { grid-template-columns: 1fr; }
  .hero-code .code { font-size: 4rem; }
  .codebox .code { font-size: 2rem; }
  .podium .pl .block { width: 90px; }
}
