:root {
  --bg: #070912;
  --panel: rgba(16, 19, 36, 0.94);
  --line: rgba(255, 255, 255, 0.09);
  --text: #eef0fb;
  --muted: #8d93b5;
  --gold: #ffd166;
  --gold-d: #b8860b;
  --ai: #b388ff;
  --ok: #3ddc97;
  --bad: #ff6b6b;
  --r: 18px;
  --font: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Russo One', 'Rubik', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font); }
body { -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
[hidden] { display: none !important; }
canvas#cv { position: fixed; inset: 0; display: block; touch-action: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
a { color: var(--muted); }
kbd { display: inline-block; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--line); background: rgba(255,255,255,.06); font: 600 12px var(--font); }

/* ---------- кнопки й панелі ---------- */
.btn { appearance: none; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--text); font: 600 15px var(--font);
  padding: 10px 16px; border-radius: 12px; cursor: pointer; transition: transform .08s, background .15s; }
.btn:hover { background: rgba(255,255,255,.11); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, #ffd166, #ff9f1c); color: #1d1300; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.big { font-size: 17px; padding: 13px 22px; }
.btn:disabled { opacity: .45; cursor: default; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }

.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(ellipse at 50% 30%, rgba(40, 30, 90, .55), rgba(7, 9, 18, .82)); overflow-y: auto; z-index: 10; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 26px; width: 100%;
  box-shadow: 0 30px 80px rgba(0,0,0,.5); backdrop-filter: blur(10px); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; user-select: text; -webkit-user-select: text; }
.panel.narrow { max-width: 440px; display: flex; flex-direction: column; gap: 14px; }
.panel.wide { max-width: 1040px; }
.panel.center { text-align: center; align-items: center; }
h2, h3 { margin: 0; }
h3 { margin: 18px 0 8px; font-size: 15px; letter-spacing: .02em; }
.ph { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.timer { font: 800 26px var(--font); color: var(--gold); font-variant-numeric: tabular-nums; }

.logo { font: 400 44px/1 var(--display); margin: 0; letter-spacing: .02em; }
.logo span { display: block; color: var(--gold); text-shadow: 0 0 24px rgba(255, 209, 102, .45); }
.logo.small { font-size: 34px; text-align: center; margin-bottom: 12px; }
.tag { margin: 0; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.field input { font: 500 18px var(--font); padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.35); color: var(--text); outline: none; }
.field input:focus { border-color: var(--gold); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches button { width: 38px; height: 38px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatches button.on { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.2); }

/* ---------- лобі ---------- */
.lobby { display: grid; grid-template-columns: 1.15fr 1fr; gap: 30px; }
.rules { padding-left: 20px; margin: 20px 0; line-height: 1.5; }
.rules li { margin-bottom: 10px; }
.qr { display: flex; gap: 14px; align-items: center; background: rgba(0,0,0,.25); padding: 12px; border-radius: 16px; }
.qr img { width: 112px; height: 112px; border-radius: 10px; background: #fff; }
.qr code { font: 600 16px ui-monospace, Menlo, monospace; color: var(--gold); word-break: break-all; }
.pname { font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.85), 0 0 1px rgba(0,0,0,.9); }
a.pname:hover { text-decoration: underline; }
.plist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.plist li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(255,255,255,.04); }
.plist li .x { margin-left: auto; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: 0 0 10px currentColor; }
.off { opacity: .45; }

/* ---------- кузня ---------- */
.budget { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--muted); margin-bottom: 10px; }
.budget b { font: 800 30px var(--font); color: var(--gold); }
.tok { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 35%, #ffe7a3, #ffd166 45%, #c99a2e); color: #4a3300; font: 800 14px var(--font); box-shadow: 0 0 12px rgba(255,209,102,.5); }
textarea { width: 100%; min-height: 120px; resize: vertical; font: 500 18px/1.45 var(--font); padding: 14px; border-radius: 14px;
  border: 1px solid var(--line); background: rgba(0,0,0,.35); color: var(--text); outline: none; }
textarea:focus { border-color: var(--ai); }
.preview { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: rgba(179,136,255,.07); border: 1px dashed rgba(179,136,255,.35);
  min-height: 46px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.preview:empty::before { content: 'Тут буде те, що побачить AI'; color: var(--muted); }
.preview .kept { color: #e9ddff; }
.preview .dropped { color: var(--bad); text-decoration: line-through; opacity: .7; }
.preview .hint { color: var(--muted); }
.counter { font: 800 22px var(--font); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--bad); }
.tips { margin-top: 14px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.tips summary { cursor: pointer; color: var(--text); font-weight: 600; }
.tips p { margin: 8px 0; }
.big-note { font-size: 18px; color: var(--ai); text-align: center; margin: 24px 0; }
.status { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; text-align: left; width: 100%; }
.status li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.04); font-size: 14px; }
.status li .st { margin-left: auto; color: var(--muted); white-space: nowrap; }
.status li.done .st { color: var(--ok); }
.status li.forging .st { color: var(--ai); }
.status li.fallback .st { color: var(--bad); }
.anvil { font-size: 64px; animation: hammer .7s ease-in-out infinite; transform-origin: 70% 80%; }
@keyframes hammer { 0%, 100% { transform: rotate(0); } 40% { transform: rotate(-22deg); } 55% { transform: rotate(6deg); } }

/* ---------- картки здібностей ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card { position: relative; padding: 16px 16px 14px; border-radius: 18px; background: rgba(255,255,255,.04); border: 1px solid var(--line); overflow: hidden; }
.card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--c, #fff); }
.card .who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.card .who .rd { margin-left: auto; }
.card .ab { display: flex; align-items: center; gap: 12px; margin: 10px 0 8px; }
.card .ic { font-size: 38px; line-height: 1; }
.card .nm { font: 800 19px/1.15 var(--font); }
.card .badge { display: inline-block; margin-top: 4px; font: 700 11px var(--font); letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; background: rgba(255,209,102,.14); color: var(--gold); }
.card .badge.pass { background: rgba(179,136,255,.16); color: var(--ai); }
.card .sum { margin: 6px 0 10px; line-height: 1.4; font-size: 15px; }
.card .said { font-size: 13px; color: var(--muted); line-height: 1.4; border-top: 1px solid var(--line); padding-top: 8px; word-break: break-word; }
.card .said s { color: var(--bad); opacity: .75; }
.card .fb { color: var(--bad); font-size: 12px; margin-top: 6px; }
.card .ready { position: absolute; top: 12px; right: 12px; color: var(--ok); font-weight: 800; }

.podium { list-style: none; padding: 0; margin: 0 auto; max-width: 560px; display: flex; flex-direction: column; gap: 8px; }
.podium li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; background: rgba(255,255,255,.05); font-size: 17px; }
.podium li:first-child { background: linear-gradient(90deg, rgba(255,209,102,.25), rgba(255,209,102,.05)); font-size: 21px; }
.podium .medal { width: 34px; text-align: center; font-size: 24px; }
.podium .sc { margin-left: auto; font-weight: 800; color: var(--gold); }
.podium .hist { color: var(--muted); font-size: 13px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.pill { background: rgba(10, 12, 26, .84); border: 1px solid var(--line); border-radius: 14px; }
/* без backdrop-filter: blur над полем, що перемальовується 60 разів на секунду, — кожна плашка HUD (їх до 14) — окремий
   прохід розмиття на GPU щокадру; на темному полі непрозоріший фон виглядає так само */
.hud-tl { position: absolute; top: 8px; left: 8px; }
.tokens { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; }
.tokens b { font: 800 26px var(--font); color: var(--gold); font-variant-numeric: tabular-nums; min-width: 1.4ch; }
.tokens .lbl { display: flex; flex-direction: column; font-size: 12px; line-height: 1.1; color: var(--muted); }
.tokens .lbl small { font-size: 10px; opacity: .8; }
.tokens.bump b { animation: bump .25s; }
@keyframes bump { 50% { transform: scale(1.35); } }
.hud-tc { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; padding: 4px 16px; }
.hud-tc small { font-size: 11px; color: var(--muted); }
.hud-tc b { font: 800 22px var(--font); font-variant-numeric: tabular-nums; }
.hud-tc b.hot { color: var(--bad); }
.hud-tc .ping { font-size: 10px; font-variant-numeric: tabular-nums; }
.hud-tc .gold-left { font-size: 10.5px; color: var(--gold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hud-tc .gold-left.out { color: var(--muted); }
.hud-tc .ping.ok { color: var(--ok); }
.hud-tc .ping.mid { color: var(--gold); }
.hud-tc .ping.bad { color: var(--bad); }
.hud-tr { position: absolute; top: 8px; right: 52px; display: flex; flex-direction: column; gap: 3px; min-width: 150px; }
.hud-tr .lb { display: flex; align-items: center; gap: 7px; padding: 3px 9px; font-size: 13px; }
.hud-tr .lb.me { border-color: rgba(255,255,255,.35); }
.hud-tr .lb .n { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-tr .lb .s { margin-left: auto; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.hud-tr .lb .s small { color: var(--muted); font-weight: 500; }
.hud-tr .dot { width: 10px; height: 10px; }
.hud-bc { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; align-items: flex-end; }
.slot { position: relative; width: 74px; padding: 6px 4px 5px; border-radius: 14px; text-align: center; overflow: hidden; }
.slot .ic { font-size: 26px; line-height: 1.1; }
.slot .k { font: 800 10px var(--font); color: var(--gold); letter-spacing: .04em; }
.slot .nm { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .cd { position: absolute; inset: 0; background: conic-gradient(rgba(0,0,0,.68) calc(var(--cd, 0) * 360deg), transparent 0); }
.slot .cdn { position: absolute; inset: 0; display: grid; place-items: center; font: 800 20px var(--font); text-shadow: 0 1px 4px #000; }
.slot.pass { border-color: rgba(179,136,255,.4); }
.slot.pass .k { color: var(--ai); }
.slot.flash { animation: flash .3s; }
@keyframes flash { 50% { background: rgba(255,209,102,.4); } }
.mute { position: absolute; top: 8px; right: 8px; pointer-events: auto; width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(10,12,26,.72); color: #fff; font-size: 17px; cursor: pointer; }

.hud-bl { position: absolute; left: 8px; bottom: 10px; padding: 7px 12px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; transition: all .15s; }
.hud-bl .lv { width: 34px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; position: relative; }
.hud-bl .lv::after { content: ''; position: absolute; inset: 0; width: 0; background: #4cc9f0; transition: width .2s; }
.hud-bl.on { color: #fff; border-color: rgba(76,201,240,.5); }
.hud-bl.on .lv::after { width: 30%; }
.hud-bl[data-lvl="1"] .lv::after { width: 65%; background: #4cc9f0; box-shadow: 0 0 8px #4cc9f0; }
.hud-bl[data-lvl="2"] .lv::after { width: 100%; background: #ff9f1c; box-shadow: 0 0 8px #ff9f1c; }
.hud-bl[data-lvl="2"] { border-color: rgba(255,159,28,.6); }
/* Сурвайвер: бар Жнеця / сундука і банер подій */
.hud-tc .hud-boss { width: 236px; padding: 3px 0 4px; }
.hud-boss .bn { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.hud-tc .hud-boss .bn b { font: 800 12px var(--font); white-space: nowrap; }
.hud-tc .hud-boss .bn small { font-size: 11px; color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hud-boss .bar { height: 6px; margin-top: 3px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.hud-boss .bar i { display: block; height: 100%; width: 100%; background: #e0415a; border-radius: 3px; transition: width .15s; }
.hud-boss.rage .bn b { color: #ff6b6b; }
#banner { position: fixed; left: 50%; top: 30%; transform: translate(-50%, -50%); z-index: 7; pointer-events: none; text-align: center;
  display: flex; flex-direction: column; align-items: center; animation: banner 2.6s ease-out forwards; }
#banner b { font: 400 54px/1.05 var(--display); color: #e9dcff; text-shadow: 0 0 28px rgba(179,136,255,.8), 0 3px 0 #000; letter-spacing: .02em; }
#banner small { margin-top: 6px; font-size: 17px; font-weight: 700; color: #fff; text-shadow: 0 2px 6px #000; }
#banner.gold b { color: var(--gold); text-shadow: 0 0 28px rgba(255,209,102,.7), 0 3px 0 #000; }
#banner.red b { color: #ff6b6b; text-shadow: 0 0 28px rgba(255,59,48,.7), 0 3px 0 #000; }
#banner.ice b { color: #d4f3ff; text-shadow: 0 0 28px rgba(120,200,255,.8), 0 3px 0 #000; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  20% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
@media (max-height: 480px) { #banner { top: 40%; } #banner b { font-size: 34px; } #banner small { font-size: 13px; max-width: 80vw; } }
#countdown { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 6; pointer-events: none; }
#countdown b { font: 400 140px/1 var(--display); color: var(--gold); text-shadow: 0 0 40px rgba(255,209,102,.6); }
#countdown small { font-size: 20px; color: var(--muted); margin-top: 8px; }

#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 30; background: rgba(20,16,40,.95); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: min(560px, calc(100vw - 32px)); box-shadow: 0 10px 30px rgba(0,0,0,.4); }
#conn { position: fixed; top: 0; left: 0; right: 0; z-index: 40; text-align: center; padding: 8px; background: #8a1c2b; font-weight: 600; }

/* ---------- сенсор ---------- */
#touch { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
#joy-zone { position: absolute; left: 0; top: 0; bottom: 0; width: 55%; pointer-events: auto; touch-action: none; }
#joy-base { position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.05); left: 90px; top: calc(100% - 100px); }
#joy-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(255,255,255,.35); }
#tbtns { position: absolute; right: 14px; bottom: 112px; display: grid; grid-template-columns: repeat(2, 58px); gap: 8px; pointer-events: auto; }
#t-drift { position: absolute; right: 14px; bottom: 14px; width: 124px; height: 86px; border-radius: 43px; pointer-events: auto; touch-action: none;
  border: 2px solid rgba(76,201,240,.6); background: rgba(10,12,26,.6); color: #fff; font: 800 15px var(--font); letter-spacing: .06em; }
#t-drift.on { background: rgba(76,201,240,.25); }
#t-roll { position: absolute; right: 150px; bottom: 22px; width: 76px; height: 70px; border-radius: 35px; pointer-events: auto; touch-action: none;
  border: 2px solid rgba(61,220,151,.6); background: rgba(10,12,26,.6); color: #fff; font: 800 12px var(--font); letter-spacing: .05em; }
#t-roll.on { background: rgba(61,220,151,.25); }
body.miners #t-drift { border-color: rgba(255,209,102,.7); }
body.miners #t-drift.on { background: rgba(255,209,102,.25); }
body.miners .hud-bl .lv::after { width: calc(var(--p, 1) * 100%); background: #3ddc97; }
body.miners .tok { font-size: 11px; }
#t-drift[data-lvl="1"] { box-shadow: 0 0 18px #4cc9f0; }
#t-drift[data-lvl="2"] { border-color: #ff9f1c; box-shadow: 0 0 22px #ff9f1c; background: rgba(255,159,28,.25); }
#tbtns .tb { position: relative; width: 58px; height: 58px; }
#tbtns .tbb { width: 58px; height: 58px; border-radius: 50%; border: 2px solid rgba(255,209,102,.6); background: rgba(10,12,26,.6); color: #fff;
  font-size: 28px; touch-action: none; position: relative; overflow: hidden; }
#tbtns .tbb .cd { position: absolute; inset: 0; background: conic-gradient(rgba(0,0,0,.7) calc(var(--cd, 0) * 360deg), transparent 0); }
/* пасивна на телефоні — не кнопка, а значок: менший, пунктирний, фіолетовий */
#tbtns .tbb.tpass { width: 46px; height: 46px; margin: 6px; display: grid; place-items: center; font-size: 22px; line-height: 1;
  border: 2px dashed rgba(179,136,255,.75); background: rgba(30,18,52,.55); }
#tbtns .tb .ti { top: -9px; left: -9px; }
#tbtns .tb.pass .ti { top: -3px; left: -3px; }
body.touch #h-slots { display: none; }

/* кузня: «All in» — кнопка (шанси — секрет для гравця) */
.allin { margin: 0 0 10px; padding: 9px 11px; border-radius: 12px; background: rgba(255,209,102,.06); border: 1px dashed rgba(255,209,102,.4); }
.allin-top { display: flex; align-items: center; gap: 10px; }
.allin-btn { flex: none; padding: 8px 14px; font: 800 14px var(--font); color: #1b1300; background: linear-gradient(180deg, #ffe08a, #ffb703); border: 0; border-radius: 10px; cursor: pointer; }
.allin-txt { font-size: 12.5px; line-height: 1.35; color: var(--muted); }
.t0 { color: #9aa0b5; } .t1 { color: #3ddc97; } .t2 { color: #4cc9f0; } .t3 { color: #ffd166; }
.badge.allin { margin-left: 6px; background: rgba(255,255,255,.07); }
.badge.allin.t3 { box-shadow: 0 0 10px rgba(255,209,102,.5); }
/* мало золота — лише «All in»: поле опису й кнопка «Кувати» ховаються */
#f-editor.only-allin #f-text, #f-editor.only-allin #f-preview, #f-editor.only-allin .row.between, #f-editor.only-allin .tips { display: none; }
#f-editor.only-allin .allin { padding: 14px; }
#f-editor.only-allin .allin-btn { padding: 12px 20px; font-size: 17px; }
@media (max-height: 480px) { .allin { padding: 6px 9px; margin-bottom: 6px; } }
/* кузня: звичайна здібність чи ульта */
.slot-note { margin: 2px 0 10px; padding: 7px 11px; border-radius: 10px; font-size: 13px; line-height: 1.35; color: var(--muted);
  background: rgba(255,255,255,.04); border: 1px solid var(--line); }
.slot-note.ult { color: #fff; background: rgba(179,136,255,.12); border-color: rgba(179,136,255,.45); }
@media (max-height: 480px) { .slot-note { margin: 0 0 6px; padding: 4px 9px; font-size: 11.5px; } }
/* ---------- ⓘ біля кожної здібності й попап «що робить ця здібність» ---------- */
.hud-bc .slots { display: flex; gap: 10px; }
.slot-w { position: relative; pointer-events: auto; }
.hud-bc .slot { cursor: pointer; }
/* маленька «i» в куті слота / кнопки; ::before — більша невидима ціль для пальця */
.ti { position: absolute; top: -7px; right: -7px; z-index: 2; width: 19px; height: 19px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255,209,102,.75); background: rgba(14,16,32,.95); color: var(--gold); pointer-events: auto; touch-action: none;
  font: italic 700 12px/17px Georgia, 'Times New Roman', serif; text-align: center; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.ti::before { content: ''; position: absolute; inset: -7px; border-radius: 50%; }
.slot-w .slot.pass + .ti, #tbtns .tb.pass .ti { border-color: rgba(179,136,255,.8); color: var(--ai); }
body.touch .ti { width: 22px; height: 22px; font-size: 14px; line-height: 20px; }
/* на телефоні — між джойстиком і кнопками, щоб не накривати ні те, ні інше */
body.touch .skills-pop { width: max(280px, min(420px, calc(100vw - 460px))); }
.skills-pop { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 8; pointer-events: auto; touch-action: pan-y;
  width: min(380px, calc(100vw - 24px)); max-height: min(62vh, 520px); overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: rgba(14, 16, 32, .96); border: 1px solid rgba(255,209,102,.35); border-radius: 18px; padding: 12px 12px 10px;
  box-shadow: 0 18px 50px rgba(0,0,0,.55); user-select: text; -webkit-user-select: text; animation: popIn .16s ease-out; }
@keyframes popIn { from { opacity: 0; transform: translate(-50%, 10px); } }
.skills-pop .sp-x { flex: none; width: 30px; height: 30px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--text); font-size: 14px; cursor: pointer; }
.skills-pop .sp-ab { padding: 2px 2px 0; }
.skills-pop .sp-top { display: flex; align-items: center; gap: 9px; }
.skills-pop .sp-ic { font-size: 26px; line-height: 1; }
.skills-pop .sp-nm { font: 800 15px/1.2 var(--font); flex: 1; }
.skills-pop .sp-k { font: 800 11px var(--font); letter-spacing: .04em; padding: 3px 8px; border-radius: 999px; background: rgba(255,209,102,.14); color: var(--gold); white-space: nowrap; }
.skills-pop .sp-k.pass { background: rgba(179,136,255,.16); color: var(--ai); }
.skills-pop .sp-sum { margin: 6px 0 0; font-size: 14px; line-height: 1.4; }
.skills-pop .sp-said { margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.35; word-break: break-word; }
.skills-pop .sp-meta { margin-top: 4px; font-size: 11px; color: var(--muted); }
.skills-pop .sp-fb { color: var(--bad); }
@media (max-height: 480px) { .skills-pop { bottom: 64px; max-height: calc(100dvh - 120px); padding: 9px 9px 8px; } .skills-pop .sp-sum { font-size: 13px; } }

/* Сурвайвер: що з тобою зробив Жнець і скільки ще */
.cc-chip { margin-top: 6px; padding: 5px 10px; font: 700 13px var(--font); color: #fff; display: inline-flex; align-items: center; gap: 6px; border-color: rgba(255,107,107,.55); }
.cc-chip.slow { border-color: rgba(125,200,255,.55); }
.cc-chip b { font-variant-numeric: tabular-nums; color: var(--gold); }
.cc-chip.rev { border-color: rgba(214,120,255,.8); background: rgba(70,20,100,.8); animation: revPulse 1s ease-in-out infinite; }
@keyframes revPulse { 50% { box-shadow: 0 0 14px rgba(214,120,255,.7); } }
/* інверсія: джойстик фіолетовий і показує ⇄ */
#joy-base.rev { border-color: rgba(214,120,255,.9); background: rgba(150,60,220,.18); }
#joy-base.rev::after { content: '⇄ навпаки'; position: absolute; left: 50%; top: -26px; transform: translateX(-50%); white-space: nowrap;
  font: 800 12px var(--font); color: #e9c2ff; text-shadow: 0 1px 3px #000; }

/* ---------- «Що нового» (public/news.js; і в грі, і на сторінках сайту) ---------- */
.news-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(4,5,12,.62); backdrop-filter: blur(3px); }
.news-box { position: relative; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid rgba(255,209,102,.35); border-radius: 22px; padding: 22px 22px 18px; box-shadow: 0 30px 80px rgba(0,0,0,.6);
  user-select: text; -webkit-user-select: text; color: var(--text); font-family: var(--font); animation: newsIn .25s ease-out; }
@keyframes newsIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.news-h { margin: 0 40px 12px 0; font: 400 26px/1.1 var(--display); color: var(--gold); }
.news-x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--text); font-size: 16px; cursor: pointer; }
.news-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding-right: 4px; }
.news-ver + .news-ver { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.news-vh { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 16px; }
.news-date { color: var(--muted); font-size: 13px; white-space: nowrap; }
.news-ver ul { margin: 8px 0 0; padding-left: 20px; line-height: 1.45; font-size: 15px; }
.news-ver li { margin-bottom: 6px; }
.news-ok { margin-top: 14px; align-self: flex-end; }
@media (max-height: 480px) { .news-box { padding: 14px 16px 12px; } .news-h { font-size: 20px; margin-bottom: 8px; } .news-ver ul { font-size: 14px; } .news-ok { margin-top: 8px; padding: 8px 14px; } }

@media (max-width: 760px) {
  .lobby { grid-template-columns: 1fr; gap: 10px; }
  .logo { font-size: 34px; }
  .panel { padding: 18px; }
  .hud-tr { display: none; }
  .tokens b { font-size: 22px; }
}
@media (max-height: 480px) {
  .panel { padding: 16px; }
  .rules { margin: 10px 0; font-size: 14px; }
  .logo { font-size: 30px; }
  textarea { min-height: 80px; font-size: 16px; }
  .hud-tr { display: none; }
}

/* ---------- вхід / реєстрація ---------- */
.auth { display: flex; flex-direction: column; gap: 12px; }
.modes { margin: 4px 0 14px; }
.modes .tabs { margin-bottom: 6px; }
.modes .tab:disabled { cursor: default; }
.modes .tab:disabled:not(.on) { opacity: .45; }
.modes .tab[data-mode="survivor"].on { background: rgba(179,136,255,.22); color: #e9dcff; }
.modes p { margin: 0; min-height: 2.6em; }
.tabs { display: flex; gap: 6px; background: rgba(0,0,0,.25); padding: 4px; border-radius: 12px; }
.tab { flex: 1; appearance: none; border: 0; background: transparent; color: var(--muted); font: 700 15px var(--font); padding: 9px; border-radius: 9px; cursor: pointer; }
.tab.on { background: rgba(255,255,255,.1); color: var(--text); }
.err { margin: 0; color: var(--bad); font-size: 14px; }
.hello { margin: 0; font-size: 16px; }
.hello b { color: var(--gold); }
.links { margin: 0; color: var(--muted); }
.links a { color: var(--muted); }
.links a:hover { color: var(--text); }
.center { text-align: center; }
.podium .rk { font-size: 13px; font-weight: 700; color: var(--ok); white-space: nowrap; }
.podium .rk.zero { color: var(--muted); font-weight: 500; }
.podium a.nm { color: inherit; text-decoration: none; }
.podium a.nm:hover { text-decoration: underline; }
