/* base.css — структура и «хром» приложения (в слое app).
   Ни одного «сырого» цвета/шрифта: всё через семантические токены темы.
   Зона чтения (.reading) живёт в reading.css (слой reading — выше) и темами не красится. */
@layer app {

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background var(--speed), color var(--speed);
  min-height: 100dvh;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; margin: 0 0 .5em; letter-spacing: var(--display-spacing, 0); }
img, svg { max-width: 100%; }

/* ---------- каркас ---------- */
.shell { max-width: 1180px; margin: 0 auto; padding: 14px 16px 40px; }
.shell.wide { max-width: 1400px; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; margin-bottom: 0;
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: var(--border-w) solid var(--border);
}
.topbar .brand { font-family: var(--font-display); font-weight: 800; font-size: 20px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.topbar .brand .logo { width: 26px; height: 26px; }
.topbar .grow { flex: 1; }
.wallet { display: flex; gap: 14px; align-items: center; font-weight: 700; }
.wallet .chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); border: var(--border-w) solid var(--border); font-variant-numeric: tabular-nums; }
.chip .ic { width: 16px; height: 16px; }
.sig { color: var(--gold); }
.cup { color: var(--cups); }

/* верхняя навигация (в топбаре, везде) */
.topnav { display: flex; gap: 2px; align-items: center; overflow-x: auto; scrollbar-width: none; margin-left: 8px; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 9px 14px; border-radius: 999px; color: var(--text-dim); font-weight: 700; font-size: 14px;
  transition: color var(--speed), background var(--speed); }
.topnav a:hover { color: var(--text); background: color-mix(in oklab, var(--accent) 12%, transparent); }
.topnav a .ic { width: 18px; height: 18px; }
.topnav a.on { color: var(--accent-contrast); background: var(--accent); }
@media (max-width: 900px) {          /* планшет/узкий десктоп: топбар компактный (иконки) */
  .brand-name { display: none; }
  .topnav a .lbl { display: none; }
  .topnav a { padding: 9px 11px; }
}

/* ---------- карточки/плашки ---------- */
.card { background: var(--surface); border: var(--border-w) solid var(--border);
  border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow);
  clip-path: var(--card-clip, none); }
.card + .card { margin-top: 14px; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.muted { color: var(--text-dim); }
.big-num { font-family: var(--font-display); font-size: 34px; font-weight: 800; line-height: 1; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); }
.row { display: flex; align-items: center; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); border: var(--border-w) solid var(--border); font-size: 12px; font-weight: 600; }
.pill.gold { color: var(--gold); border-color: color-mix(in oklab, var(--gold) 40%, var(--border)); }
.pill.accent { color: var(--accent-contrast); background: var(--accent); border-color: transparent; }

/* ---------- кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; font-weight: 700; font-size: 15px; cursor: pointer;
  color: var(--text); background: var(--surface-2);
  border: var(--btn-border, var(--border-w) solid var(--border));
  border-radius: var(--radius); clip-path: var(--btn-clip, none);
  transition: transform var(--speed), filter var(--speed), background var(--speed);
  -webkit-tap-highlight-color: transparent; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { color: var(--accent-contrast); background: var(--accent); border-color: transparent;
  box-shadow: var(--btn-glow, none); }
.btn.danger { color: #fff; background: var(--danger); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.big { padding: 16px 26px; font-size: 17px; }

input, select, textarea { font-family: var(--font-ui); font-size: 15px; color: var(--text);
  background: var(--surface-2); border: var(--border-w) solid var(--border);
  border-radius: var(--radius); padding: 11px 13px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label.field { display: block; }
label.field > span { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 5px; }

/* ---------- прогресс/бары ---------- */
.bar { height: 9px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: var(--border-w) solid var(--border); }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width var(--speed); }
.bar.hp > i { background: linear-gradient(90deg, var(--success), color-mix(in oklab, var(--success) 60%, var(--warn))); }

/* ---------- титульные/геймификация ---------- */
.hero { text-align: center; padding: 26px 18px; }
.title-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  font-weight: 800; background: linear-gradient(120deg, var(--accent), var(--gold));
  color: #fff; box-shadow: var(--shadow); }
.streak-flame { color: var(--warn); font-weight: 800; }

/* спарклайн */
.spark { font-family: var(--font-ui); letter-spacing: 1px; color: var(--accent); }

/* ---------- цитадель ---------- */
.citadel-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.bld { position: relative; border-radius: var(--radius); border: var(--border-w) solid var(--border);
  background: var(--surface-2); padding: 10px; text-align: center; overflow: hidden;
  transition: transform var(--speed); clip-path: var(--tile-clip, none); }
.bld:hover { transform: translateY(-2px); }
.bld .art { width: 100%; aspect-ratio: 1; display: grid; place-items: center; }
.bld .art svg, .bld .art img { width: 82%; height: 82%; object-fit: contain; }
.bld .nm { font-size: 13px; font-weight: 700; margin-top: 4px; }
.bld .lv { font-size: 11px; color: var(--text-dim); }
.bld.locked { opacity: .5; filter: grayscale(.6); }
.bld.empty { border-style: dashed; color: var(--text-dim); display: grid; place-items: center; min-height: 130px; cursor: pointer; }

/* повреждённое состояние — тема-независимо, красиво: десатурация + трещины + дым/угли */
.bld.damaged .art { filter: grayscale(.5) brightness(.72) contrast(1.05); }
.bld.damaged::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(115deg, transparent 44%, color-mix(in oklab, #000 55%, transparent) 45%, transparent 46%),
    linear-gradient(160deg, transparent 62%, color-mix(in oklab, #000 45%, transparent) 63%, transparent 64%);
  mix-blend-mode: multiply; }
.bld.damaged .smoke { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.bld.damaged .smoke i { position: absolute; bottom: 30%; left: var(--x, 50%); width: 12px; height: 12px;
  border-radius: 50%; background: color-mix(in oklab, #888 60%, transparent);
  filter: blur(3px); animation: smoke 2.6s var(--d,0s) infinite ease-out; }
@keyframes smoke { 0% { transform: translateY(0) scale(.5); opacity: 0; }
  25% { opacity: .55; } 100% { transform: translateY(-38px) scale(1.6); opacity: 0; } }
.bld .fix { position: absolute; top: 6px; right: 6px; font-size: 10px; padding: 2px 7px; border-radius: 999px;
  background: var(--danger); color: #fff; font-weight: 700; }

.unit-card { text-align: center; }
.unit-card .art { width: 64px; height: 64px; margin: 0 auto; }

/* ---------- лидерборд ---------- */
.lb-row { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius); }
.lb-row + .lb-row { margin-top: 6px; }
.lb-row.me { background: color-mix(in oklab, var(--accent) 14%, var(--surface)); border: var(--border-w) solid var(--accent); }
.lb-row .rank { font-family: var(--font-display); font-weight: 800; font-size: 18px; text-align: center; }
.lb-row .rank.top { color: var(--gold); }
.lb-row .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lb-row .who .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .sc { font-weight: 800; font-variant-numeric: tabular-nums; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2);
  display: grid; place-items: center; border: var(--border-w) solid var(--border); overflow: hidden; flex: none; }
.avatar svg, .avatar img { width: 76%; height: 76%; }
.avatar.mascot { background: transparent; }
.avatar.mascot img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 84px; height: 84px; }

/* ---------- вкладки-переключатели ---------- */
.segmented { display: inline-flex; background: var(--surface-2); border: var(--border-w) solid var(--border);
  border-radius: 999px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; color: var(--text-dim); font-weight: 700;
  padding: 7px 15px; border-radius: 999px; cursor: pointer; font-size: 13px; }
.segmented button.on { background: var(--accent); color: var(--accent-contrast); }

/* ---------- таймер тура ---------- */
.timer { font-family: var(--font-display); font-variant-numeric: tabular-nums; font-weight: 800; }
.timer.warn { color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* ---------- бой ---------- */
.battle-stage { position: relative; border-radius: var(--radius-lg); overflow: hidden;
  background:
    radial-gradient(90% 70% at 50% 120%, color-mix(in oklab, var(--danger) 22%, #0b1020), transparent 65%),
    linear-gradient(180deg, #0d1326, #070a15);
  border: var(--border-w) solid var(--border); min-height: 230px; padding: 22px 16px;
  box-shadow: inset 0 0 100px rgba(0,0,0,.6); display: grid; place-items: center; }
.battle-stage::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 80px 16px rgba(0,0,0,.5); }
.battle-stage .clash { font-size: 46px; filter: drop-shadow(0 0 16px color-mix(in oklab, var(--danger) 70%, transparent));
  animation: bob 2.2s ease-in-out infinite; position: relative; z-index: 2; }
.log-line { padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--surface-2);
  border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 6px; font-size: 14px;
  animation: slidein .4s both; }
@keyframes slidein { from { opacity: 0; transform: translateX(-10px); } }

/* ---------- тост ---------- */
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 999px;
  font-weight: 700; z-index: 100; box-shadow: var(--shadow); max-width: 90vw; }
.toast.err { background: var(--danger); color: #fff; }

/* ---------- модалка ---------- */
.modal-bg { position: fixed; inset: 0; background: color-mix(in oklab, #000 55%, transparent);
  z-index: 90; display: grid; place-items: center; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border: var(--border-w) solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; max-width: 460px; width: 100%; box-shadow: var(--shadow);
  clip-path: var(--card-clip, none); max-height: 86dvh; overflow: auto; }

@media (max-width: 859px) {
  .desktop-only { display: none; }
}

.center { text-align: center; }
.mt { margin-top: 16px; } .mt-lg { margin-top: 28px; }
.hidden { display: none !important; }
.fade-in { animation: fade .3s both; }

/* ============ ИЗОМЕТРИЧЕСКАЯ СЦЕНА-БАЗА (Цитадель / бой) ============ */
.scene {                       /* фон НА ВЕСЬ ЭКРАН (по ширине и на всю высоту под меню) */
  position: relative; width: 100vw; margin-left: calc(50% - 50vw);
  height: calc(100vh - 66px); min-height: 480px;
  overflow: hidden; border: none; border-radius: 0;
  background: linear-gradient(180deg, #0d1326, #070a15);
  box-shadow: inset 0 0 120px rgba(0,0,0,.55);
}
.scene::after {   /* виньетка */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 150px 30px rgba(0,0,0,.5);
}
.scene.scene-img { background-size: cover; background-position: center; }
.scene.flush { margin-top: -14px; }     /* впритык к верхнему меню — без зазора */

/* СТЕЙДЖ = картинка острова + постройки в % ОТ НЕЁ. Размер по ВЫСОТЕ → верх не режется.
   top: 56% — остров оттянут ВНИЗ, сверху остаётся воздух для башен замка. */
.ui-ic { display: inline-block; vertical-align: -0.2em; object-fit: contain; flex: none; }

.tour-ta { width: 100%; resize: vertical; min-height: 68px; border-radius: var(--radius);
  padding: 10px 12px; background: var(--surface-2); border: var(--border-w) solid var(--border);
  color: var(--text); font-family: var(--font-ui); font-size: 14px; }

/* ─── отчёт боя ─── */
.ubadge { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600;
  background: var(--surface-2); border: var(--border-w) solid var(--border); border-radius: 999px;
  padding: 3px 10px 3px 4px; }
.ubadge-av { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex: none;
  border: 1px solid var(--border); }
.battle-log { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
  background: var(--surface-2); border: var(--border-w) solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; }
.battle-log .log-line { display: flex; align-items: flex-start; gap: 8px; font-size: 14px;
  opacity: 0; animation: fadeIn .35s ease forwards; }
.battle-log .lp-ic { flex: none; }
.loss-col { background: var(--surface); border: var(--border-w) solid var(--border);
  border-radius: var(--radius); padding: 12px; }
@keyframes fadeIn { to { opacity: 1; } }

/* ─── виджет фидбека тестера (вечное окошко в углу) ─── */
.fb-widget { position: fixed; right: 16px; bottom: 16px; width: 300px; max-width: calc(100vw - 24px);
  z-index: 900; background: rgba(20, 24, 38, .92); color: #eef1f7; border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.45); backdrop-filter: blur(12px);
  overflow: hidden; font-family: var(--font-ui, system-ui); }
.fb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; cursor: pointer; font-weight: 700; font-size: 13px; color: #fff;
  background: linear-gradient(90deg, #2b59ff, #6a3df0); }
.fb-min { background: rgba(255,255,255,.2); color: #fff; border: none; width: 22px; height: 22px;
  border-radius: 6px; cursor: pointer; font-weight: 700; line-height: 1; }
.fb-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.fb-widget.min .fb-body { display: none; }
.fb-hint { font-size: 11px; color: #aab2c5; }
.fb-ta { width: 100%; resize: vertical; min-height: 46px; border-radius: 8px; padding: 8px 10px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.16); color: #fff;
  font-family: inherit; font-size: 13px; }
.fb-ta::placeholder { color: #8b93a7; }
.fb-actions { display: flex; justify-content: flex-end; }
.fb-log { display: flex; flex-direction: column; gap: 6px; max-height: 160px; overflow-y: auto; }
.fb-msg { font-size: 12px; background: rgba(255,255,255,.06); border-left: 2px solid #4ade80;
  padding: 5px 8px; border-radius: 6px; color: #d7dcea; word-break: break-word; }
.fb-msg.err { border-left-color: #f87171; }
@media (max-width: 560px) { .fb-widget { width: calc(100vw - 24px); bottom: 10px; right: 12px; } }

.stage { position: absolute; left: 50%; top: 53%; transform: translate(-50%, -50%);
  height: 90%; aspect-ratio: 1264 / 848; max-width: 100vw; }
@media (max-aspect-ratio: 13 / 10) { .stage { height: auto; width: 100%; max-width: none; } }
/* Пиксель: у арта острова травяная площадка мельче в кадре → остров крупнее + постройки
   мельче, чтобы между ними был воздух и запас до края (как в фэнтези). */
:root[data-theme="minecraft"] .stage { height: 118%; top: 50%; }
:root[data-theme="minecraft"] .iso-b { width: 7.6%; }
:root[data-theme="minecraft"] .iso-b.core { width: 13%; }
:root[data-theme="minecraft"] .iso-plot { width: 4.8%; }
.island-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  pointer-events: none; filter: drop-shadow(0 34px 44px rgba(0,0,0,.5)); }
.emblem-img { position: absolute; left: 50%; top: 72%; transform: translate(-50%, -50%);
  width: 9%; z-index: 60; pointer-events: none;
  filter: drop-shadow(0 0 16px color-mix(in oklab, var(--accent) 70%, transparent));
  animation: pulseGlow 3.5s ease-in-out infinite; }
.iso-b .art img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* PNG-арт в меню-плитках, портретах армии и иконках исследований */
.bm-tile .bm-art img { width: 46px; height: 46px; object-fit: contain; }
.uportrait.img { padding: 0; background: none; border: none; }
.uportrait.img img { width: 100%; height: 100%; object-fit: contain; }
.tn-ic.img, .tech-node.avail .tn-ic.img, .tech-node.done .tn-ic.img {
  background: transparent !important; border: none !important; padding: 0; overflow: visible; }
.tn-ic.img img { width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.4)); }
.tech-node.locked .tn-ic.img img { filter: grayscale(.75) brightness(.6); }

/* остров-заглушка для тем без готового арта окружения (default/anime/minecraft) */
.iso-ground { position: absolute; left: 50%; top: 44%; width: 80%; aspect-ratio: 2 / 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(80% 80% at 50% 35%, color-mix(in oklab, var(--accent) 30%, #223), transparent 70%),
    linear-gradient(180deg, #202b45, #141c30);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  box-shadow: inset 0 0 60px color-mix(in oklab, var(--accent) 35%, transparent); }
.iso-ground::before { content: ""; position: absolute; inset: 0; transform: translateY(3%); z-index: -1;
  background: linear-gradient(180deg, #10162a, #0a0e1c); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); filter: brightness(.6); }
.iso-ground .rim { position: absolute; inset: 0; border: 2px solid color-mix(in oklab, var(--accent) 55%, transparent);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); opacity: .5; }
.iso-ground .grid { position: absolute; inset: 0; opacity: .16; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  background: repeating-linear-gradient(63deg, transparent 0 22px, color-mix(in oklab, var(--accent) 90%, #fff) 22px 23px),
    repeating-linear-gradient(-63deg, transparent 0 22px, color-mix(in oklab, var(--accent) 90%, #fff) 22px 23px); }
.iso-emblem { position: absolute; left: 50%; top: 72%; transform: translate(-50%, -50%);
  width: 9%; aspect-ratio: 1; display: grid; place-items: center; z-index: 60; pointer-events: none; }
.iso-emblem svg { width: 100%; height: 100%; color: var(--accent);
  filter: drop-shadow(0 0 10px color-mix(in oklab, var(--accent) 80%, transparent)); animation: spin 26s linear infinite; }
.iso-emblem b { position: absolute; font-family: var(--font-display); font-size: 28px; font-weight: 800; color: #fff; text-shadow: 0 0 10px var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.scene .stars { position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(1px 1px at 20% 30%, #fff, transparent),
    radial-gradient(1px 1px at 70% 20%, #cdd6ff, transparent),
    radial-gradient(1px 1px at 45% 12%, #fff, transparent),
    radial-gradient(1px 1px at 85% 40%, #aeb8ff, transparent),
    radial-gradient(1px 1px at 30% 18%, #fff, transparent); }

/* постройка на сцене — размер и позиция в % ОТ СТЕЙДЖА (масштабируется с островом) */
.iso-b { position: absolute; transform: translate(-50%, -84%); width: 10.5%; cursor: pointer;
  transition: transform .15s, filter .15s; }
.iso-b:hover { filter: brightness(1.12); transform: translate(-50%, -88%); z-index: 250 !important; }
.iso-b .art { position: relative; width: 100%; aspect-ratio: 1;
  filter: drop-shadow(0 10px 9px rgba(0,0,0,.5)); }
.iso-b .art svg { width: 100%; height: 100%;
  filter: drop-shadow(0 0 8px color-mix(in oklab, var(--accent) 65%, transparent)); }
.iso-b.core { width: 18%; }
.iso-b.core::before { content: ""; position: absolute; left: 50%; top: 54%; width: 84%; aspect-ratio: 1;
  transform: translate(-50%, -50%); border-radius: 50%; z-index: -1;
  background: radial-gradient(closest-side, color-mix(in oklab, var(--accent) 38%, transparent), transparent 72%);
  filter: blur(6px); animation: pulseGlow 3.5s ease-in-out infinite; }
@keyframes pulseGlow { 50% { opacity: .5; } }
.iso-b .shadow { position: absolute; bottom: 9%; left: 50%; transform: translateX(-50%);
  width: 60%; height: 11%; background: radial-gradient(closest-side, rgba(0,0,0,.5), transparent); border-radius: 50%; }
.iso-b.dmg .art { filter: grayscale(.5) brightness(.7) drop-shadow(0 8px 6px rgba(0,0,0,.5)); }
.iso-b .fixbadge { position: absolute; top: 4%; right: 12%; font-size: clamp(10px, 1vw, 13px);
  padding: 1px 6px; border-radius: 999px; background: var(--danger); color: #fff; font-weight: 700; z-index: 3; }

/* пустой участок под постройку */
.iso-plot { position: absolute; transform: translate(-50%, -50%); width: 6.5%; aspect-ratio: 1;
  display: grid; place-items: center; cursor: pointer; z-index: 55; opacity: .9;
  transition: opacity .15s, transform .15s; }
.iso-plot:hover { opacity: 1; transform: translate(-50%, -50%) scale(1.14); }
.iso-plot img { width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0; }
.iso-plot span { position: relative; z-index: 2; font-weight: 800; color: #fff;
  font-size: clamp(15px, 1.7vw, 24px); text-shadow: 0 2px 5px rgba(0,0,0,.85); }

/* парящие частицы/искры — распределены по всему небу, мягко дрейфуют вверх */
.embers { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.embers i { position: absolute; width: 3px; height: 3px; border-radius: 50%;
  background: color-mix(in oklab, var(--accent) 75%, #ffe6a8); opacity: 0;
  box-shadow: 0 0 7px color-mix(in oklab, var(--accent) 70%, transparent);
  animation: ember linear infinite; }
@keyframes ember { 0% { transform: translateY(0) scale(.6); opacity: 0; }
  20% { opacity: .85; } 80% { opacity: .7; }
  100% { transform: translateY(-150px) translateX(var(--dx, 10px)) scale(1.15); opacity: 0; } }

/* дымок от повреждённых построек */
.iso-b .smoke { position: absolute; left: 12%; right: 12%; top: 14%; height: 46%; pointer-events: none; z-index: 5; }
.iso-b .smoke i { position: absolute; bottom: 0; width: 30%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(150, 150, 150, .55), transparent 70%);
  filter: blur(2px); animation: bsmoke 3.2s infinite ease-out; }
@keyframes bsmoke { 0% { transform: translateY(0) scale(.35); opacity: 0; }
  25% { opacity: .6; } 100% { transform: translateY(-64px) scale(1.5); opacity: 0; } }

/* стеклянные контролы ПОВЕРХ сцены (не на «коричневом полотне») */
.g-chip { background: rgba(10, 12, 22, .55); backdrop-filter: blur(8px);
  border: 1px solid color-mix(in oklab, var(--accent) 42%, transparent); color: #eef;
  padding: 7px 13px; border-radius: 999px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.scene-hud { position: absolute; left: 14px; top: 14px; z-index: 300; display: flex; gap: 8px; align-items: center; }
.scene-topbar { position: absolute; right: 14px; top: 14px; z-index: 300; display: flex; gap: 8px; align-items: center; }
.scene-tabs { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 300; }
.scene-tabs .segmented { background: rgba(10, 12, 22, .55); backdrop-filter: blur(8px);
  border: 1px solid color-mix(in oklab, var(--accent) 40%, transparent); }
.scene-tabs .segmented button { color: #cfd4e6; }
.scene-tabs .segmented button.on { background: var(--accent); color: var(--accent-contrast); }

/* Армия / Исследования — скролл внутри экрана-неба, вкладки/HUD остаются на месте */
.ct-scroll { position: absolute; top: 66px; left: 0; right: 0; bottom: 0; overflow-y: auto;
  padding: 8px clamp(16px, 4vw, 40px) 48px; z-index: 10; }
.ct-scroll::-webkit-scrollbar { width: 8px; }
.ct-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); border-radius: 999px; }
/* стеклянные карточки поверх неба */
.ct-scroll .card, .ct-scroll .ucard, .ct-scroll .tech-node, .ct-scroll .tc-head {
  background: rgba(12, 14, 26, .55); backdrop-filter: blur(12px);
  border-color: color-mix(in oklab, var(--accent) 34%, rgba(255,255,255,.16));
  color: #eaedf6; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.ct-scroll .ucard .uhero { background: linear-gradient(180deg, rgba(255,255,255,.08), transparent); }
.ct-scroll .tech-node .tn-ic:not(.img) { background: rgba(255,255,255,.08); color: #eaedf6; border-color: rgba(255,255,255,.18); }
.ct-scroll .ustat, .ct-scroll .pill, .ct-scroll .stepper button, .ct-scroll input, .ct-scroll select {
  background: rgba(255,255,255,.08); color: #eef1f8; border-color: rgba(255,255,255,.18); }
.ct-scroll .pill.gold, .ct-scroll .ustat.hp, .ct-scroll .ustat.dmg { background: rgba(255,255,255,.08); }
.ct-scroll .muted, .ct-scroll .utrait, .ct-scroll .tn-eff, .ct-scroll .label, .ct-scroll .lv,
.ct-scroll .srow { color: #b9c1d9 !important; }
.ct-scroll .uname, .ct-scroll .tn-name, .ct-scroll h2, .ct-scroll h3, .ct-scroll .big-num { color: #f3f5fc; }
.ct-scroll .cap-bar .track { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.16); }
.ct-scroll .segmented { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); }
.scene-topbar .g-chip.gold { color: var(--gold); border-color: color-mix(in oklab, var(--gold) 55%, transparent); }
.scene-topbar .btn { box-shadow: 0 6px 18px rgba(0,0,0,.4); }

.build-dock { position: absolute; left: 0; right: 0; bottom: 0; z-index: 300;
  padding: 12px 14px 14px;
  background: linear-gradient(0deg, rgba(6,8,16,.86), rgba(6,8,16,.5) 68%, transparent);
  backdrop-filter: blur(5px); }
.build-dock .bm-filter { margin: 0 0 9px; }
.build-dock .bm-filter .btn { background: rgba(20,22,34,.65); border-color: color-mix(in oklab, var(--accent) 35%, transparent); color: #dfe3f0; }
.build-dock .bm-filter .btn.primary { background: var(--accent); color: var(--accent-contrast); }
.build-dock .build-menu { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.build-dock .build-menu::-webkit-scrollbar { height: 6px; }
.build-dock .build-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,.25); border-radius: 999px; }
.build-dock .bm-tile { flex: 0 0 auto; width: 88px; background: rgba(22, 24, 38, .72);
  border-color: color-mix(in oklab, var(--accent) 28%, transparent); clip-path: none; }
.build-dock .bm-tile .bm-nm { color: #cfd4e6; }

/* выделение выбранной постройки на сцене */
.iso-b.sel .art { filter: drop-shadow(0 0 16px var(--accent)) drop-shadow(0 8px 6px rgba(0,0,0,.5)); }
.iso-b.sel::after { content: ""; position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%);
  width: 62%; height: 13%; border: 2px solid var(--accent); border-radius: 50%;
  box-shadow: 0 0 16px var(--accent); }

/* ---------- КОМПАКТНОЕ МЕНЮ ПОСТРОЕК (плитки; действия — во всплывающей панели) ---------- */
.bm-filter { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 10px; }
.build-menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.bm-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px 8px; border-radius: var(--radius); cursor: pointer;
  background: var(--surface); border: var(--border-w) solid var(--border);
  transition: transform .12s, border-color .12s; clip-path: var(--card-clip, none); }
.bm-tile:hover { transform: translateY(-2px); border-color: color-mix(in oklab, var(--accent) 60%, var(--border)); }
.bm-tile.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.bm-tile.locked { opacity: .5; }
.bm-tile .bm-art { width: 46px; height: 46px; display: grid; place-items: center; color: var(--accent); }
.bm-tile .bm-art .art { width: 100%; height: 100%; display: grid; place-items: center; }
.bm-tile .bm-art svg { width: 40px; height: 40px; }
.bm-tile .bm-nm { font-size: 11px; font-weight: 600; text-align: center; line-height: 1.15;
  text-transform: capitalize; color: var(--text-dim); }
.bm-badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; font-size: 10px; font-weight: 800; display: grid; place-items: center; line-height: 1; color: #fff; }
.bm-badge.build { background: var(--accent); }
.bm-badge.up { background: var(--success); }
.bm-badge.dmg { background: var(--danger); }
.bm-badge.max { background: var(--text-dim); }
.bm-badge.lock { background: transparent; color: var(--text-dim); font-size: 12px; }

/* ---------- АРМИЯ: карточки с КРУПНЫМ портретом ---------- */
.cap-bar { margin-top: 4px; }
.cap-bar .track { height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: var(--border-w) solid var(--border); }
.cap-bar .track i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); transition: width .3s; }
.uarmy { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-top: 14px; }
.ucard { background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow); clip-path: var(--card-clip, none); text-align: center; }
.ucard.locked { opacity: .6; }
.ucard .uhero { position: relative; padding: 18px 14px 6px;
  background: radial-gradient(130% 100% at 50% -10%, color-mix(in oklab, var(--accent) 22%, var(--surface)), var(--surface)); }
.ucard .uportrait { width: 64%; aspect-ratio: 1; margin: 0 auto; display: grid; place-items: center; }
.ucard .uportrait img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 8px 14px rgba(0,0,0,.45)); }
.ucard .uportrait:not(.img) { font-size: 68px; }
.ucard .uname { font-weight: 800; font-size: 19px; margin-top: 8px; text-transform: capitalize; }
.ucard .utrait { font-size: 12px; color: var(--text-dim); }
.ucard .ubody { padding: 6px 14px 12px; }
.ustats { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; }
.ustat { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700;
  padding: 5px 11px; border-radius: 999px; background: var(--surface-2); border: var(--border-w) solid var(--border); }
.ustat.hp { color: var(--success); } .ustat.dmg { color: var(--danger); }
.ufoot { display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 11px 14px; border-top: var(--border-w) solid var(--border); flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; }
.stepper button { width: 30px; height: 30px; border-radius: 8px; border: var(--border-w) solid var(--border);
  background: var(--surface-2); color: var(--text); font-weight: 800; font-size: 17px; cursor: pointer; line-height: 1; }
.stepper button:hover { border-color: var(--accent); }

/* ---------- ИССЛЕДОВАНИЯ: дерево с КРУПНЫМИ иконками ---------- */
.tech { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 14px; }
.tc-head { font-family: var(--font-display); font-weight: 800; text-align: center; padding: 9px;
  border-radius: var(--radius); background: var(--surface-2); border: var(--border-w) solid var(--border); margin-bottom: 16px; }
.tech-node { position: relative; display: flex; gap: 16px; align-items: center; padding: 14px;
  margin-bottom: 20px; border-radius: var(--radius-lg); border: var(--border-w) solid var(--border); background: var(--surface); }
.tech-node .tn-ic { width: 92px; height: 92px; flex: none; border-radius: 16px; display: grid; place-items: center;
  font-weight: 800; font-size: 32px; background: var(--surface-2); color: var(--text-dim); border: var(--border-w) solid var(--border); }
.tech-node.done { border-color: var(--success); }
.tech-node.done .tn-ic { background: var(--success); color: #fff; border-color: transparent; }
.tech-node.avail { border-color: color-mix(in oklab, var(--accent) 55%, var(--border)); }
.tech-node.avail .tn-ic { background: var(--accent); color: var(--accent-contrast); border-color: transparent; }
.tech-node.locked { opacity: .5; }
.tech-node.chained::before { content: ""; position: absolute; left: 60px; top: -20px; width: 2px; height: 20px;
  background: color-mix(in oklab, var(--accent) 60%, var(--border)); }
.tech-node.chained.done::before { background: var(--success); }
.tn-body { flex: 1; min-width: 0; }
.tn-name { font-weight: 800; font-size: 15px; text-transform: capitalize; }
.tn-eff { font-size: 12px; color: var(--text-dim); margin: 3px 0 8px; }
@media (max-width: 720px) { .tech { grid-template-columns: 1fr; } }

/* ============ ПРЕМИУМ-ПОЛИРОВКА (дашборд / бои / рейтинг) ============ */
.dash-hero { display: flex; align-items: center; gap: 18px; position: relative; overflow: hidden;
  background: radial-gradient(130% 150% at 0 0, color-mix(in oklab, var(--accent) 22%, var(--surface)), var(--surface) 62%); }
.dash-hero .avatar.lg { width: 92px; height: 92px; flex: none;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 30%, transparent), var(--shadow); }
.dash-hero .streak-box { padding-left: 12px; }

.statcard { position: relative; overflow: hidden; padding-top: 22px; transition: transform .15s, border-color .15s; }
.statcard::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent); opacity: .85; }
.statcard.sig::before { background: var(--gold); }
.statcard.cup::before { background: var(--cups); }
.statcard.ok-num::before { background: var(--success); }
.statcard:hover { transform: translateY(-3px); border-color: color-mix(in oklab, var(--accent) 45%, var(--border)); }
.statcard .sc-ic { color: var(--text-dim); opacity: .85; }
.statcard.sig .sc-ic { color: var(--gold); } .statcard.cup .sc-ic { color: var(--cups); }
.big-num.accent-num { color: var(--accent); } .big-num.ok-num { color: var(--success); }
.big-num { text-shadow: 0 0 22px color-mix(in oklab, currentColor 28%, transparent); }

.action-card { display: flex; align-items: center; gap: 14px; transition: transform .15s, border-color .15s, box-shadow .15s; }
.action-card:hover { transform: translateY(-3px); border-color: color-mix(in oklab, var(--accent) 55%, var(--border));
  box-shadow: var(--shadow), 0 12px 28px rgba(0,0,0,.2); }
.action-card .ac-ic { width: 52px; height: 52px; flex: none; border-radius: 14px; display: grid; place-items: center;
  color: var(--accent-contrast); background: linear-gradient(135deg, var(--accent), color-mix(in oklab, var(--accent) 55%, var(--gold))); }
.action-card .ac-title { font-weight: 800; font-size: 17px; }
.action-card .ac-sub { font-size: 13px; }
.action-card .ac-arrow { color: var(--text-dim); transform: rotate(180deg); transition: transform .15s, color .15s; }
.action-card:hover .ac-arrow { transform: rotate(180deg) translateX(-3px); color: var(--accent); }

.lb-row.card { transition: transform .12s, border-color .12s; }
.lb-row.card:hover { transform: translateX(3px); border-color: color-mix(in oklab, var(--accent) 45%, var(--border)); }
.battle-target { transition: transform .15s, border-color .15s, box-shadow .15s; }
.battle-target:hover { transform: translateY(-3px); border-color: color-mix(in oklab, var(--accent) 50%, var(--border));
  box-shadow: var(--shadow), 0 10px 24px rgba(0,0,0,.22); }

/* ============ РЕДИЗАЙН PHASE 2: композиция экранов (общая, темы красят токенами) ============ */

/* --- ЛОГИН: две колонки --- */
.login-split { display: grid; grid-template-columns: 1.12fr .88fr; gap: clamp(24px, 5vw, 56px);
  align-items: center; min-height: calc(100vh - 40px); max-width: 1080px; margin: 0 auto; padding: 24px 20px; }
.login-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display);
  font-weight: 800; font-size: 20px; }
.login-brand .logo { width: 30px; height: 30px; color: var(--accent); }
.sigma-orbit { position: relative; width: 92px; height: 92px; border-radius: 50%; margin: 30px 0 26px;
  display: grid; place-items: center; font-family: var(--font-display); font-size: 40px; font-weight: 800; color: var(--accent);
  background: radial-gradient(circle, color-mix(in oklab, var(--accent) 22%, var(--surface)), var(--surface) 72%);
  border: 2px solid color-mix(in oklab, var(--accent) 40%, var(--border));
  box-shadow: 0 0 42px color-mix(in oklab, var(--accent) 30%, transparent); }
.sigma-orbit::before { content: ""; position: absolute; inset: -9px; border-radius: 50%;
  border: 1.5px solid color-mix(in oklab, var(--accent) 18%, transparent); border-top-color: var(--accent);
  animation: spin 9s linear infinite; }
.login-h1 { font-family: var(--font-display); font-weight: 800; line-height: 1.08; letter-spacing: var(--display-spacing);
  font-size: clamp(28px, 4.4vw, 42px); margin: 0 0 12px; }
.login-sub { color: var(--text-dim); max-width: 30ch; margin: 0; }
.login-bullets { display: flex; flex-direction: column; gap: 11px; margin-top: 20px; }
.login-bullets > div { display: flex; align-items: center; gap: 11px; color: var(--text-dim); font-weight: 600; }
.login-form { padding: 24px; }
.login-form .kicker { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); }
.login-themes { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 6px; }
@media (max-width: 820px) { .login-split { grid-template-columns: 1fr; gap: 26px; }
  .login-left { text-align: center; } .login-left .sigma-orbit, .login-brand { margin-left: auto; margin-right: auto; }
  .login-sub { margin: 0 auto; } .login-bullets > div { justify-content: center; } }

/* --- ЛЕНДИНГ (воронка продаж) --- */
.lp { max-width: 1080px; margin: 0 auto; padding: 16px 20px 24px; }
.lp-nav { display: flex; align-items: center; gap: 12px; padding: 8px 0 4px; }
.lp-nav .grow { flex: 1; }
.lp-brand { display: flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 800; font-size: 19px; }
.lp-brand .logo { width: 28px; height: 28px; color: var(--accent); }
.lp-hero { text-align: center; padding: 44px 0 26px; }
.lp-hero h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(30px, 5.4vw, 52px);
  line-height: 1.04; margin: 18px auto 14px; letter-spacing: var(--display-spacing); max-width: 16ch; }
.lp-hero .lead { color: var(--text-dim); font-size: clamp(15px, 2vw, 19px); max-width: 46ch; margin: 0 auto 26px; }
.lp-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.lp-note { color: var(--text-dim); font-size: 13px; margin-top: 14px; }
.lp-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 44px 0; }
.lp-feat { padding: 22px; }
.lp-feat .ico { font-size: 30px; line-height: 1; }
.lp-feat h3 { margin: 12px 0 6px; font-size: 18px; }
.lp-feat p { color: var(--text-dim); margin: 0; font-size: 14px; }
.lp-sec-title { text-align: center; font-family: var(--font-display); font-weight: 800;
  font-size: clamp(24px, 3.6vw, 34px); margin: 52px 0 8px; letter-spacing: var(--display-spacing); }
.lp-sec-sub { text-align: center; color: var(--text-dim); margin: 0 auto 28px; max-width: 48ch; }
.lp-prices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; align-items: stretch; }
.lp-price { padding: 26px; display: flex; flex-direction: column; }
.lp-price.hot { border: 2px solid var(--accent); box-shadow: 0 0 40px color-mix(in oklab, var(--accent) 20%, transparent); }
.lp-price .tname { font-family: var(--font-display); font-weight: 800; font-size: 22px; }
.lp-price .price { font-size: 32px; font-weight: 800; margin: 10px 0 2px; }
.lp-price .price small { font-size: 14px; color: var(--text-dim); font-weight: 600; }
.lp-price ul { list-style: none; padding: 0; margin: 16px 0; display: flex; flex-direction: column; gap: 9px; }
.lp-price li { display: flex; gap: 9px; color: var(--text-dim); font-size: 14px; align-items: flex-start; }
.lp-price li::before { content: "✓"; color: var(--accent); font-weight: 800; flex: none; }
.lp-price .btn { margin-top: auto; }
.lp-badge { display: inline-block; align-self: flex-start; font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; padding: 3px 9px; border-radius: 99px; background: var(--accent); color: #fff;
  font-weight: 700; margin-bottom: 8px; }
.lp-foot { text-align: center; color: var(--text-dim); font-size: 13px; padding: 44px 0 16px; }
.auth-panel { max-width: 440px; margin: 24px auto; }
.auth-back { cursor: pointer; color: var(--text-dim); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 4px; }

/* --- Баннер «подтвердите e-mail» --- */
.email-banner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: color-mix(in oklab, var(--accent) 14%, var(--surface));
  border-bottom: 1px solid color-mix(in oklab, var(--accent) 30%, var(--border));
  color: var(--text); font-size: 13px; padding: 8px 16px; }
.email-banner-lnk { background: none; border: none; color: var(--accent); font-weight: 700;
  cursor: pointer; text-decoration: underline; padding: 0; font-size: 13px; }
.email-banner-x { margin-left: auto; background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 14px; line-height: 1; }

/* --- Пул задач (админ) --- */
.pool-tbl { border-collapse: collapse; font-size: 13px; min-width: 420px; }
.pool-tbl th, .pool-tbl td { padding: 5px 10px; border: 1px solid var(--border); }
.pool-tbl th { color: var(--text-dim); font-weight: 600; font-size: 12px; }

/* --- ПРОГРЕСС ПРОВЕРКИ ЖЮРИ --- */
.gp { max-width: 460px; margin: 40px auto; padding: 30px 26px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: 0 12px 40px color-mix(in oklab, var(--accent) 12%, transparent); }
.gp-emoji { font-size: 46px; line-height: 1; animation: gpBob 2.2s ease-in-out infinite; }
@keyframes gpBob { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-6px) rotate(4deg); } }
.gp-title { font-family: var(--font-display); font-weight: 800; font-size: 20px; margin: 14px 0 6px; }
.gp-cap { color: var(--text-dim); min-height: 22px; font-size: 15px; margin-bottom: 18px; }
@keyframes gpCapIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.gp-track { height: 12px; border-radius: 99px; overflow: hidden;
  background: color-mix(in oklab, var(--text) 10%, transparent); }
.gp-fill { height: 100%; width: 0; border-radius: 99px; transition: width .35s cubic-bezier(.4,0,.2,1);
  background: linear-gradient(90deg, color-mix(in oklab, var(--accent) 70%, var(--accent-2, var(--accent))), var(--accent));
  background-size: 200% 100%; animation: gpShimmer 1.4s linear infinite; }
@keyframes gpShimmer { from { background-position: 200% 0; } to { background-position: 0 0; } }
.gp-row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px;
  font-size: 13px; color: var(--text-dim); }
.gp-pct { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); }
.gp-task { font-weight: 600; }

/* --- ДАШБОРД: bento-сетка --- */
.bento { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.bento > * { min-width: 0; }
.b-hero { grid-column: span 8; display: flex; flex-direction: column; gap: 16px; }
.b-balance { grid-column: span 4; display: flex; flex-direction: column; }
.b-action { grid-column: span 6; }
.b-progress { grid-column: span 12; }
@media (max-width: 900px) { .b-hero, .b-balance, .b-action, .b-progress { grid-column: span 12; } }
.hero-top { display: flex; align-items: center; gap: 18px; }
.hero-id { flex: 1; min-width: 0; }
.hero-nick { margin: 2px 0 8px; font-size: 26px; overflow-wrap: anywhere; line-height: 1.1; }
.hero-streak { flex: none; }
.streak-ring { --p: 70; width: 88px; height: 88px; border-radius: 50%; flex: none; padding: 4px;
  background: conic-gradient(var(--warn) calc(var(--p) * 1%), color-mix(in oklab, var(--accent) 12%, var(--surface-2)) 0);
  display: grid; place-items: center; box-shadow: 0 0 22px color-mix(in oklab, var(--warn) 30%, transparent); }
.streak-ring .avatar { width: 100%; height: 100%; border: 2px solid var(--surface); }
.hero-stats { display: flex; gap: 26px; flex-wrap: wrap; padding-top: 4px; border-top: var(--border-w) solid var(--border); }
.hero-stats .hs { }
.hero-stats .hs .n { font-family: var(--font-display); font-weight: 800; font-size: 22px; }
.bal-num { font-family: var(--font-display); font-weight: 800; font-size: clamp(34px, 5vw, 46px); color: var(--gold);
  line-height: 1; text-shadow: 0 0 26px color-mix(in oklab, var(--gold) 30%, transparent); }
.bal-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; padding-top: 14px; }
.bal-tile { background: var(--surface-2); border: var(--border-w) solid var(--border); border-radius: var(--radius);
  padding: 12px; text-align: center; }
.bal-tile .bt-ic { font-size: 22px; }
.bal-tile .bt-v { font-weight: 800; margin-top: 3px; }
.b-action.cta { position: relative; overflow: hidden; color: var(--accent-contrast);
  background: linear-gradient(135deg, var(--accent), color-mix(in oklab, var(--accent) 62%, var(--gold)));
  border-color: transparent; box-shadow: var(--btn-glow, var(--shadow)); }
.b-action.cta .muted, .b-action.cta .ac-sub { color: color-mix(in oklab, var(--accent-contrast) 82%, transparent); }
.b-action.cta::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.28), transparent); animation: shimmer 3.4s ease-in-out infinite; }
@keyframes shimmer { 0% { left: -60%; } 55%, 100% { left: 130%; } }
.prog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 26px; margin-top: 12px; }
@media (max-width: 640px) { .prog-grid { grid-template-columns: 1fr; } }

/* --- РЕЙТИНГ: пьедестал топ-3 --- */
.podium { display: grid; grid-template-columns: 1fr 1.14fr 1fr; gap: 14px; align-items: end; margin: 18px 0 20px; }
.podium-card { background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 12px 16px; text-align: center; cursor: pointer; transition: transform .15s; clip-path: var(--card-clip, none); }
.podium-card:hover { transform: translateY(-3px); }
.podium-card.first { transform: translateY(-18px); border-color: color-mix(in oklab, var(--gold) 50%, var(--border));
  box-shadow: 0 0 34px color-mix(in oklab, var(--gold) 26%, transparent); }
.podium-card.first:hover { transform: translateY(-21px); }
.podium-card .p-av { position: relative; width: 76px; height: 76px; margin: 0 auto 8px; }
.podium-card .p-av .avatar { width: 100%; height: 100%; }
.podium-card.first .p-av .avatar { box-shadow: 0 0 0 3px var(--gold), 0 0 22px color-mix(in oklab, var(--gold) 55%, transparent);
  animation: glowpulse 2.2s ease-in-out infinite; }
.podium-card .p-medal { position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); font-size: 20px; }
.podium-card .p-name { font-weight: 700; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-card .p-score { font-family: var(--font-display); font-weight: 800; }
.podium-card.first .p-score { color: var(--gold); font-size: 20px; }
@keyframes glowpulse { 50% { box-shadow: 0 0 0 3px var(--gold), 0 0 38px color-mix(in oklab, var(--gold) 80%, transparent); } }
@media (max-width: 560px) { .podium { grid-template-columns: 1fr 1fr 1fr; } .podium-card { padding: 12px 6px; }
  .podium-card .p-av { width: 56px; height: 56px; } .podium-card .p-name { font-size: 12px; } }
}

/* ============================================================
   МОБИЛЬНЫЙ АДАПТИВ — телефоны и планшеты (портрет + ландшафт)
   ============================================================ */

/* ---- ПЛАНШЕТ (≤1024): плотнее сетки, уже топбар ---- */
@media (max-width: 1024px) {
  .shell { padding: 12px 14px 40px; }
  .grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

/* ---- ТЕЛЕФОН / малый планшет (≤720): нижняя навигация ---- */
@media (max-width: 720px) {
  .shell, .shell.wide { padding: 12px 12px calc(78px + env(safe-area-inset-bottom)); }
  /* ВАЖНО: backdrop-filter создаёт containing-block для position:fixed потомков →
     без него нижняя навигация корректно крепится к вьюпорту, а не к топбару */
  .topbar { gap: 8px; padding: 9px 12px; backdrop-filter: none;
    background: color-mix(in oklab, var(--surface) 94%, transparent); }
  .topbar .brand .logo { width: 24px; height: 24px; }
  .wallet { gap: 7px; }
  .wallet .chip { padding: 4px 9px; font-size: 13px; max-width: 42vw; }
  .wallet .chip > span:last-child, .wallet .chip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* топнав → фиксированная нижняя панель, иконка + подпись */
  .topnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; margin: 0; gap: 0;
    overflow: visible; justify-content: space-around; align-items: stretch;
    background: color-mix(in oklab, var(--surface) 97%, transparent);
    backdrop-filter: blur(14px); border-top: var(--border-w) solid var(--border);
    padding: 6px 2px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 22px rgba(0,0,0,.28);
  }
  .topnav a { flex: 1; flex-direction: column; gap: 3px; padding: 4px 2px; border-radius: 12px;
    justify-content: center; min-width: 0; }
  .topnav a .ic { width: 22px; height: 22px; }
  .topnav a .lbl { display: block; font-size: 10px; font-weight: 700; line-height: 1;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topnav a.on { color: var(--accent); background: color-mix(in oklab, var(--accent) 15%, transparent); }

  /* дашборд-герой: не наезжает, ник переносится */
  .hero-top { flex-wrap: wrap; gap: 12px; align-items: flex-start; }
  .streak-ring { width: 66px; height: 66px; }
  .hero-id { flex: 1 1 55%; }
  .hero-nick { font-size: clamp(19px, 6.4vw, 26px); }
  .hero-streak { margin-left: auto; }
  .hero-stats { gap: 16px 22px; }
  .hero-stats .hs .n { font-size: 20px; }

  /* виджет фидбека — выше нижней навигации, не на весь экран */
  .fb-widget { bottom: calc(84px + env(safe-area-inset-bottom)); right: 10px; left: auto;
    width: min(300px, calc(100vw - 20px)); }

  /* сцена цитадели/боя: учитываем нижнюю навигацию и dvh (адресная строка) */
  .scene { height: calc(100dvh - 60px - 74px); min-height: 380px; }
  .scene.flush { margin-top: -12px; }

  /* заголовки/шрифты компактнее */
  h2 { font-size: 22px; }
  .bal-num { font-size: clamp(30px, 9vw, 40px); }
  .big-num { font-size: 28px; }

  /* сегмент-переключатели: на всю ширину, длинные наборы (4 этапа) переносятся,
     короткие (2-3) остаются в одну строку */
  .segmented { width: 100%; flex-wrap: wrap; border-radius: 14px; }
  .segmented button { flex: 1 1 auto; white-space: nowrap; }
  .modal { max-height: 88dvh; }

  /* таблицы/широкое — горизонтальный скролл вместо разлома */
  .lb-list .lb-row { padding: 10px 12px; }
}

/* ---- Узкий телефон (≤380): ещё компактнее ---- */
@media (max-width: 380px) {
  .topnav a .lbl { font-size: 9px; }
  .wallet .chip { font-size: 12px; padding: 4px 7px; }
  .btn { padding: 10px 14px; font-size: 14px; }
  .card { padding: 14px; }
}

/* ---- Ландшафт на телефоне (низкая высота): экономим вертикаль ---- */
@media (max-height: 480px) and (max-width: 900px) {
  .topbar { position: static; }
  .topnav { padding-top: 4px; padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
  .topnav a .lbl { display: none; }        /* только иконки — сохраняем высоту */
  .topnav a { padding: 6px 2px; }
  .shell, .shell.wide { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  .scene { height: calc(100dvh - 52px); }
  .hero { padding: 14px; }
}

/* ── глобальный лоадер экрана + плавная загрузка графики ── */
@layer app {
  .app-loader {
    position: fixed; inset: 0; z-index: 3000;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    background: color-mix(in srgb, var(--bg) 62%, transparent);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    opacity: 0; transition: opacity .18s ease; pointer-events: none;
  }
  .app-loader.on { opacity: 1; }
  .app-spinner {
    width: 46px; height: 46px; border-radius: 50%;
    border: 3px solid color-mix(in srgb, var(--text) 16%, transparent);
    border-top-color: var(--accent); animation: app-spin .8s linear infinite;
  }
  .app-loader-txt { color: var(--text-dim); font-size: 14px; font-weight: 600; letter-spacing: .02em; }
  @keyframes app-spin { to { transform: rotate(360deg); } }

  /* тяжёлые картинки (маскоты, цитадель) — проявляются плавно после декодирования */
  .img-fade { opacity: 0; transition: opacity .35s ease; }
  .img-fade.ready { opacity: 1; }

  /* пока фон/картинки цитадели грузятся — мягкий мерцающий плейсхолдер вместо пустоты */
  .scene { background-color: var(--surface-2); position: relative; }
  .scene::before {
    content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background: linear-gradient(100deg,
      color-mix(in srgb, var(--surface) 88%, transparent) 30%,
      color-mix(in srgb, var(--surface-2) 60%, transparent) 50%,
      color-mix(in srgb, var(--surface) 88%, transparent) 70%);
    background-size: 200% 100%; animation: scene-shimmer 1.3s ease-in-out infinite;
    opacity: 1; transition: opacity .4s ease;
  }
  .scene.loaded::before { opacity: 0; }
  @keyframes scene-shimmer { 0% { background-position: 180% 0; } 100% { background-position: -180% 0; } }

  @media (prefers-reduced-motion: reduce) {
    .app-spinner { animation-duration: 1.6s; }
    .scene::before { animation: none; }
  }

  /* лоадер-бокс (распознавание фото / проверка жюри) */
  .busy-box { display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; padding: 40px 20px; text-align: center; }
  .busy-msg { font-size: 17px; font-weight: 700; color: var(--text); }
  .busy-sub { font-size: 13px; max-width: 360px; line-height: 1.4; }

  /* превью подгруженных листов (staging перед распознаванием) */
  .sheet-grid { display: flex; flex-wrap: wrap; gap: 10px; }
  .sheet-grid:empty { display: none; }
  .sheet-thumb { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden;
    border: 1px solid var(--surface-2); background: var(--surface-2); }
  .sheet-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .sheet-num { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.6); color: #fff;
    font-size: 11px; font-weight: 700; border-radius: 6px; padding: 1px 6px; }
  .sheet-del { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border: none;
    border-radius: 50%; background: rgba(0,0,0,.62); color: #fff; font-size: 12px; line-height: 1;
    cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
  .sheet-del:hover { background: var(--danger); }

  /* сегменты читаются как нажимаемые кнопки, а не как простой текст */
  .segmented button { background: color-mix(in oklab, var(--surface) 55%, transparent);
    transition: background .12s, color .12s; }
  .segmented button:hover { color: var(--text); background: color-mix(in oklab, var(--surface) 90%, transparent); }
  .segmented button.on { box-shadow: var(--shadow); }
  /* в цитадели свои «стеклянные» вкладки — не навешиваем на них фон-кнопки */
  .scene-tabs .segmented button, .ct-scroll .segmented button { background: transparent; }

  /* пикер маскотов — крупнее и целиком (без обрезки краёв) */
  .mascot-picker { gap: 12px !important; }
  .mascot-picker .avatar { width: 60px; height: 60px; }
  .mascot-picker .avatar.mascot img { object-fit: contain; }
}

/* ── цитадель: анимация повышения уровня, награда и приветственный гайд ── */
@layer app {
  .iso-b.lvlup { animation: cit-pump 1.1s cubic-bezier(.2,1.4,.4,1); z-index: 500 !important; }
  @keyframes cit-pump { 0%{transform:scale(1)} 30%{transform:scale(1.22)} 60%{transform:scale(.97)} 100%{transform:scale(1)} }
  .iso-b.lvlup::after { content:""; position:absolute; inset:-25%; border-radius:50%; pointer-events:none;
    background: radial-gradient(circle, rgba(255,207,77,.5), transparent 65%); animation: cit-flash 1.1s ease-out; }
  @keyframes cit-flash { 0%{opacity:1;transform:scale(.6)} 100%{opacity:0;transform:scale(1.7)} }

  .cit-spark { position:absolute; width:7px; height:7px; border-radius:50%; pointer-events:none; z-index:600;
    transition: transform .9s cubic-bezier(.15,.7,.3,1), opacity .9s; }

  .cit-overlay { position:absolute; inset:0; z-index:700; display:flex; align-items:center; justify-content:center;
    background: rgba(6,9,20,.72); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
  .cit-card { width: min(340px, 88%); background: linear-gradient(180deg,#141a34,#0e1226);
    border:1px solid rgba(140,120,255,.4); border-radius:18px; padding:22px; text-align:center;
    box-shadow:0 16px 50px rgba(90,70,220,.4); animation: cit-pop .3s ease; }
  @keyframes cit-pop { from{transform:translateY(14px) scale(.96);opacity:0} to{transform:none;opacity:1} }

  .cit-reward .rw-top { color:#9aa3c8; font-size:13px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; }
  .cit-reward .rw-lvl { margin:6px 0 14px; font-family:var(--font-display); font-weight:800; font-size:44px; color:#eef1ff; }
  .cit-reward .rw-lvl .old { color:#7a83a8; font-size:30px; }
  .cit-reward .rw-lvl .arr { color:#8a90b8; margin:0 8px; font-size:26px; }
  .cit-reward .rw-lvl .new { color:#ffcf4d; }
  .cit-reward .rwlist { list-style:none; margin:0; padding:0; text-align:left; }
  .cit-reward .rwlist li { display:flex; gap:9px; align-items:center; color:#d8def7; font-size:14px;
    padding:7px 0; border-bottom:1px solid rgba(255,255,255,.08); }
  .cit-reward .rwlist li:last-child { border:0; }
  .cit-reward .rwi { font-size:17px; }

  .cit-onb .onb-emoji { font-size:52px; line-height:1; margin-bottom:8px; }
  .cit-onb .onb-h { font-size:21px; font-weight:800; color:#f0f2ff; margin-bottom:8px; }
  .cit-onb .onb-p { font-size:15px; color:#c2c9e6; line-height:1.5; min-height:64px; }
  .cit-onb .onb-dots { display:flex; gap:7px; justify-content:center; margin:14px 0 16px; }
  .cit-onb .onb-dots .dot { width:8px; height:8px; border-radius:50%; background:rgba(255,255,255,.22); transition:.2s; }
  .cit-onb .onb-dots .dot.act { background:var(--accent); width:22px; border-radius:5px; }
  .cit-onb .onb-nav { display:flex; gap:10px; }
  .cit-onb .onb-back { flex:1; border-radius:12px; padding:11px; font-weight:800; font-size:15px; cursor:pointer;
    background:transparent; color:#aab2d6; border:1px solid rgba(255,255,255,.16); }
  .cit-onb .onb-back:disabled { opacity:.35; cursor:default; }
  .cit-onb .onb-next { flex:1; }
  .cit-onb .onb-skip { margin-top:12px; background:none; border:0; color:#7f88ad; font-size:12px;
    cursor:pointer; text-decoration:underline; }

  .g-chip.cit-help { cursor:pointer; font-weight:800; width:28px; padding:0;
    display:inline-flex; align-items:center; justify-content:center; }

  /* приветственный онбординг (первый вход) — на весь экран */
  .welcome-overlay { position:fixed; inset:0; z-index:4000; display:flex; align-items:center;
    justify-content:center; padding:16px; background:rgba(6,9,20,.85);
    -webkit-backdrop-filter:blur(5px); backdrop-filter:blur(5px); animation:cit-pop .3s ease; }

  /* достижения (бейджи) */
  .ach-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:10px; margin-top:8px; }
  .ach { position:relative; background:var(--surface); border:1px solid var(--border); border-radius:14px;
    padding:14px 12px; text-align:center; opacity:.55; transition:transform .12s; }
  .ach.got { opacity:1; border-color:color-mix(in oklab, var(--accent) 55%, transparent);
    box-shadow:0 0 0 1px color-mix(in oklab, var(--accent) 30%, transparent) inset, var(--shadow); }
  .ach:not(.got) .ach-ic { filter:grayscale(1); }
  .ach-ic { font-size:38px; line-height:1; }
  .ach-name { font-weight:800; margin-top:6px; font-size:14px; }
  .ach-desc { font-size:11.5px; color:var(--text-dim); margin-top:3px; line-height:1.3; }
  .ach-check { position:absolute; top:8px; right:8px; width:22px; height:22px; border-radius:50%;
    background:var(--success); color:#fff; font-weight:800; font-size:13px; display:flex;
    align-items:center; justify-content:center; }
  .ach-prog { margin-top:8px; display:flex; flex-direction:column; gap:2px; align-items:center; }
  .ach-prog .bar { width:100%; }
  .ach-prog span { font-size:11px; color:var(--text-dim); font-weight:700; }

  /* столбчатый мини-график с числами (админ-аналитика) */
  .mini-bars { display:flex; align-items:flex-end; gap:3px; margin-top:6px; min-height:80px;
    overflow-x:auto; padding-bottom:2px; }
  .mb-col { display:flex; flex-direction:column; align-items:center; justify-content:flex-end;
    gap:2px; min-width:26px; flex:0 0 auto; }
  .mb-val { font-size:11px; font-weight:800; color:var(--text); line-height:1; }
  .mb-bar { width:18px; border-radius:4px 4px 0 0; min-height:4px;
    background:linear-gradient(180deg, var(--accent), color-mix(in oklab, var(--accent) 55%, transparent)); }
  .mb-lbl { font-size:9px; color:var(--text-dim); white-space:nowrap; }
}
