:root,
[data-scene="capybara"] {
  --page: #120e0a;
  --bg: #1a1410;
  --panel: #2a2218;
  --panel-2: #16110c;
  --accent: #e8a04a;
  --btn-secondary: #3d3024;
  --line: #4a3b2c;
  --hand: #352a20;
  --hand-border: #c8863a;
  --code: #ffd65a;
  --scene: url("/img/scene-capybara.jpg?v=7");
  --scene-position: center top;
  --veil: rgba(18, 12, 8, 0.58);
}
[data-scene="raccoon"] {
  --page: #0a0e14;
  --bg: #121820;
  --panel: #1a2430;
  --panel-2: #0e141c;
  --accent: #7eb0ff;
  --btn-secondary: #243040;
  --line: #2e3d52;
  --hand: #1c2838;
  --hand-border: #5a8fd4;
  --code: #b8d4ff;
  --scene: url("/img/scene-raccoon.jpg?v=7");
  --scene-position: 58% top;
  --veil: rgba(10, 14, 22, 0.58);
}
[data-scene="crocodile"] {
  --page: #081210;
  --bg: #101a14;
  --panel: #142820;
  --panel-2: #0a1410;
  --accent: #4caf6a;
  --btn-secondary: #1e3428;
  --line: #2a4a38;
  --hand: #183024;
  --hand-border: #3d9a5c;
  --code: #9ee8b0;
  --scene: url("/img/scene-crocodile.jpg?v=7");
  --scene-position: 44% top;
  --veil: rgba(8, 18, 14, 0.58);
}
[data-theme="light"] {
  --page: #cfd6e0;
  --bg: #f2f4f8;
  --panel: #ffffff;
  --panel-2: #e4eaf2;
  --text: #121722;
  --muted: #475066;
  --accent: #1565c0;
  --danger: #c62828;
  --ok: #2e7d32;
  --btn-secondary: #cbd6e4;
  --line: #a8b4c4;
  --hand: #dce8f5;
  --hand-border: #1565c0;
  --code: #6d5600;
  --shadow: 0 6px 16px rgba(18, 23, 34, 0.12);
  --veil: rgba(242, 244, 248, 0.68);
  color-scheme: light;
}
[data-theme="light"][data-scene="capybara"] {
  --accent: #a85f08;
  --btn-secondary: #ddd0bc;
  --line: #c4b5a0;
  --hand: #f0e6d8;
  --hand-border: #a85f08;
  --code: #6d4e00;
  --veil: rgba(246, 240, 232, 0.66);
}
[data-theme="light"][data-scene="raccoon"] {
  --accent: #2f6fc4;
  --btn-secondary: #c8d6e8;
  --line: #a8bdd4;
  --hand: #dce8f8;
  --hand-border: #2f6fc4;
  --code: #2a5080;
  --veil: rgba(238, 243, 250, 0.66);
}
[data-theme="light"][data-scene="crocodile"] {
  --accent: #1f7a42;
  --btn-secondary: #c0dcc8;
  --line: #9cc4aa;
  --hand: #d8eee0;
  --hand-border: #1f7a42;
  --code: #145530;
  --veil: rgba(236, 246, 240, 0.66);
}

/* Светлая тема: вуаль полупрозрачная — сцена видна; карточки с границей для читаемости. */
[data-theme="light"] .frame {
  border-color: var(--line);
}
[data-theme="light"] .btn.secondary {
  border: 1px solid color-mix(in srgb, var(--line) 80%, var(--text));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
[data-theme="light"] .game,
[data-theme="light"] .campaign-status,
[data-theme="light"] .hud-chip,
[data-theme="light"] .onboard-card,
[data-theme="light"] .rating-row,
[data-theme="light"] .diag {
  border: 1px solid var(--line);
}
[data-theme="light"] .hud-chip {
  box-shadow: none;
}
.app.skin-casual .play-head .muted,
.app.in-play .play-head .muted {
  color: var(--casual-ink);
  font-weight: 600;
}
[data-theme="light"] .hud-dot {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--line) 70%, var(--text));
}
[data-theme="light"] .onboard {
  background: color-mix(in srgb, var(--panel) 92%, var(--text));
}
[data-theme="light"] .onboard-special-item,
[data-theme="light"] .onboard-combo-row {
  background: var(--panel-2);
  border: 1px solid var(--line);
}
[data-theme="light"] pre.log {
  border: 1px solid var(--line);
}

:root {
  --text: #eef1f6;
  --muted: #8b93a7;
  --danger: #e74c3c;
  --ok: #2ecc71;
  --radius: 16px;
  --shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  --scene-size: 100% auto;
  --scene-position: center top;
  --scene-attachment: scroll;
  --vk-safe-top: 0px;
  --vk-safe-right: 0px;
  --vk-safe-bottom: 0px;
  --vk-safe-left: 0px;
  /* Casual warm skin (VK screenshot language) */
  --casual-cream: #fff8ee;
  --casual-cream-2: #f6efe4;
  --casual-ink: #3a2a1a;
  --casual-muted: #7a6550;
  --casual-wood: #5a3d28;
  --casual-wood-deep: #3e2a1c;
  --casual-chip-shadow: 0 4px 0 rgba(58, 42, 26, 0.12), 0 8px 18px rgba(58, 42, 26, 0.1);
  color-scheme: dark;
}

/*
  :root выше по специфичности равен [data-theme], но идёт позже раннего
  блока light и затирает --text/--muted на почти белые. Перебиваем снова.
*/
[data-theme="light"] {
  --text: #121722;
  --muted: #475066;
  --danger: #c62828;
  --ok: #2e7d32;
  --shadow: 0 6px 16px rgba(18, 23, 34, 0.12);
  color-scheme: light;
}

/* Play screen: cream HUD on scene backdrop */
.app.in-play {
  --panel: var(--casual-cream);
  --panel-2: var(--casual-cream-2);
  --text: var(--casual-ink);
  --muted: var(--casual-muted);
  --btn-secondary: #efe4d4;
  --line: #e0d2be;
  --shadow: var(--casual-chip-shadow);
  --hand: var(--casual-cream);
  --hand-border: var(--accent);
  --code: #9a6b00;
}

/* Shell (menu / campaign / rating): cream cards, scene stays behind */
.app.skin-casual:not(.in-play) {
  --panel: color-mix(in srgb, var(--casual-cream) 92%, transparent);
  --panel-2: color-mix(in srgb, var(--casual-cream-2) 88%, transparent);
  --btn-secondary: color-mix(in srgb, var(--casual-cream-2) 85%, var(--btn-secondary));
  --shadow: var(--casual-chip-shadow);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  min-height: 100%;
  overscroll-behavior-y: none;
  background-color: var(--page);
  background-image: var(--scene);
  background-size: var(--scene-size);
  background-repeat: no-repeat;
  background-position: var(--scene-position);
  background-attachment: var(--scene-attachment);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  transition: background-color 0.35s ease;
}

.devbar {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  background: var(--panel-2);
  font-size: 13px;
  color: var(--muted);
}
body.local-dev .devbar {
  display: flex;
}
.devbar[hidden] {
  display: none !important;
}
.devbar button, .devbar a {
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--btn-secondary);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}

.frame {
  position: relative;
  margin: 12px auto;
  background: var(--veil);
  border: 8px solid var(--line);
  border-radius: 20px;
  /* Keep viewport width stable: avoid auto scrollbar appear/disappear "zoom" effect. */
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}
.frame.phone {
  width: 360px;
  height: 640px;
}
.frame.desktop {
  width: min(960px, calc(100% - 24px));
  height: min(720px, calc(100vh - 80px));
}

.app {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: max(16px, env(safe-area-inset-top, 0px), var(--vk-safe-top));
  padding-right: max(16px, env(safe-area-inset-right, 0px), var(--vk-safe-right));
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px), var(--vk-safe-bottom));
  padding-left: max(16px, env(safe-area-inset-left, 0px), var(--vk-safe-left));
}
.app.in-play {
  height: 100%;
  overflow: hidden;
}
.frame.desktop .app {
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}
@media (min-width: 700px) {
  .app {
    max-width: 28rem;
    margin-left: auto;
    margin-right: auto;
  }
}
h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.03em; }
.brand {
  text-align: center;
  margin: 4px 0 12px;
}
.brand-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 10px;
}
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); }
.play-toast {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%) scale(0.96);
  z-index: 50;
  max-width: min(92%, 22rem);
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(48, 28, 18, 0.92);
  color: #ffe8dc;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.play-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.ok { color: var(--ok); }
.diag {
  margin: 8px 0 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.diag b {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.stack.tight { margin-top: 10px; }
.btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 18px;
  padding: 14px 16px;
  min-height: 52px;
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}
.btn.secondary {
  background: var(--btn-secondary);
  color: var(--text);
  box-shadow: var(--casual-chip-shadow);
}
.app.skin-casual .btn.secondary,
.app.in-play .btn.secondary {
  background: var(--casual-cream-2);
  color: var(--casual-ink);
  border: 1px solid color-mix(in srgb, var(--casual-cream-2) 60%, #cbb89a);
}
.btn.danger {
  background: var(--danger);
  color: #fff;
}
.app.skin-casual .btn.danger,
.app.in-play .btn.danger {
  background: var(--danger);
  color: #fff;
  border: 1px solid color-mix(in srgb, var(--danger) 75%, #000);
}
.btn:disabled { opacity: 0.5; cursor: default; box-shadow: none; }

.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border: 3px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: mp-spin 0.75s linear infinite;
}
@keyframes mp-spin {
  to { transform: rotate(360deg); }
}
.boot-busy {
  display: flex;
  justify-content: center;
  margin: 28px 0 8px;
}
.busy-veil {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--page) 55%, transparent);
  backdrop-filter: blur(2px);
}
.busy-veil[hidden] {
  display: none !important;
}
.busy-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-radius: 16px;
  background: var(--casual-cream, var(--panel));
  color: var(--casual-ink, var(--text));
  box-shadow: var(--casual-chip-shadow, 0 4px 16px rgba(0, 0, 0, 0.25));
  border: 1px solid color-mix(in srgb, var(--casual-cream-2, var(--line)) 70%, #cbb89a);
  min-width: 10rem;
}
.busy-label {
  margin: 0;
  font-size: 14px;
  text-align: center;
}
body.is-busy {
  cursor: progress;
}

.games { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.game {
  background: var(--casual-cream);
  color: var(--casual-ink);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--casual-chip-shadow);
  border: 1px solid color-mix(in srgb, var(--casual-cream-2) 70%, #cbb89a);
}
.app.skin-casual .game .muted {
  color: var(--casual-muted);
}
.app.skin-casual .brand h1 {
  color: var(--casual-cream);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}
.app.skin-casual .brand > .muted {
  color: color-mix(in srgb, var(--casual-cream) 88%, #fff);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}
/* Светлая тема: крем/белый на светлой вуали не читается — тёмный ink. */
[data-theme="light"] .app.skin-casual .brand h1 {
  color: var(--casual-ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}
[data-theme="light"] .app.skin-casual .brand > .muted {
  color: var(--casual-muted);
  text-shadow: none;
}
[data-theme="light"] .app.skin-casual .brand > .muted .coins {
  color: var(--code);
}
.game-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.game-ico {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 3px;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}
.game-ico .gem { width: 18px; height: 18px; flex: 0 0 18px; }
.game .row { display: flex; flex-direction: column; gap: 8px; margin-top: 0; }
.game .row .btn { flex: none; width: 100%; }
.hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 16px;
}
.prose { font-size: 15px; line-height: 1.45; color: var(--text); }
.prose h2 { font-size: 16px; margin: 16px 0 8px; color: var(--text); }
.prose p { margin: 0 0 10px; color: var(--text); }
.legal-prose { margin: 12px 0 16px; max-height: min(55vh, 28rem); overflow: auto; -webkit-overflow-scrolling: touch; }
.legal-prose h1 { font-size: 18px; margin: 0 0 8px; color: var(--text); text-shadow: none; }
.legal-prose h2 { font-size: 16px; margin: 16px 0 8px; color: var(--text); }
.legal-prose ul { margin: 0 0 10px; padding-left: 1.2em; color: var(--text); }
.legal-prose li { margin: 0 0 6px; color: var(--text); }
.legal-prose .muted { color: var(--muted); text-shadow: none; }
.legal-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 14px 0 8px;
  font-size: 14px;
  line-height: 1.35;
  cursor: pointer;
  color: var(--text);
}
.legal-check input {
  margin-top: 3px;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}
.legal-foot {
  margin-top: 14px;
  text-align: center;
}
.share-suggest {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--casual-cream, var(--panel)) 88%, var(--accent));
  border: 1px solid color-mix(in srgb, var(--casual-cream-2, var(--line)) 65%, #cbb89a);
  color: var(--casual-ink, var(--text));
}
.share-suggest p {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.35;
}
.share-suggest-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.share-suggest-actions .btn {
  min-height: 44px;
  font-size: 15px;
}
button.linkish {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--accent);
  font: inherit;
  font-size: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.rating { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.rating-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.rating-tabs .rating-tab {
  min-height: 44px;
  padding: 8px 10px;
  font-size: 13px;
  white-space: normal;
  line-height: 1.25;
}
.rating-tabs .rating-tab.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
}
.rating-board-hint { margin: 10px 0 0; }
.rating-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--casual-cream);
  color: var(--casual-ink);
  border-radius: 14px;
  font-size: 14px;
  box-shadow: var(--casual-chip-shadow);
  border: 1px solid color-mix(in srgb, var(--casual-cream-2) 70%, #cbb89a);
}
.rating-place { color: var(--casual-muted); font-weight: 700; }
.rating-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rating-value { font-weight: 800; font-variant-numeric: tabular-nums; }
.rating-meta { color: var(--casual-muted); font-size: 12px; }
.hud-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin: 0 2px;
  vertical-align: -1px;
  box-shadow: 0 0 0 1px #12161a;
}
.hud-dot.off { opacity: 0.28; }
.rating-row.mine { outline: 1px solid var(--accent); }

.gem {
  display: inline-block;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  object-fit: contain;
  vertical-align: -4px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.28));
}
img.gem {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}
.gem-1:not(img) {
  border-radius: 50%;
  background: radial-gradient(circle at 30% 26%, #ffc4b8 0%, #ff6b5a 38%, #e74c3c 58%, #8f180e 100%);
  box-shadow:
    inset 0 -3px 0 rgba(0, 0, 0, 0.28),
    inset 0 3px 6px rgba(255, 255, 255, 0.55),
    0 2px 3px rgba(0, 0, 0, 0.22);
}
.gem-2:not(img) {
  border-radius: 6px;
  background: radial-gradient(circle at 30% 26%, #b8f0cc 0%, #4fd68a 38%, #27ae60 58%, #0f5c30 100%);
  box-shadow:
    inset 0 -3px 0 rgba(0, 0, 0, 0.28),
    inset 0 3px 6px rgba(255, 255, 255, 0.55),
    0 2px 3px rgba(0, 0, 0, 0.22);
}
.gem-3:not(img) {
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  background: radial-gradient(circle at 30% 26%, #b8dcff 0%, #4aa3e8 38%, #2980b9 58%, #123d66 100%);
}
.gem-4:not(img) {
  border-radius: 50% 50% 50% 50% / 38% 38% 62% 62%;
  background: radial-gradient(circle at 30% 26%, #fff3a8 0%, #ffd84a 38%, #f1c40f 58%, #9a7208 100%);
}
.gem-5:not(img) {
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  background: radial-gradient(circle at 30% 26%, #e4b8f8 0%, #b06de0 38%, #8e44ad 58%, #4a1868 100%);
}
.ico-pipe {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 50%, #f5f8fc 0 18%, transparent 19%),
    linear-gradient(#d2dae2, #5c6874);
  box-shadow: inset 0 0 0 4px #5c6874;
  position: relative;
}
.ico-pipe::before,
.ico-pipe::after {
  content: "";
  position: absolute;
  background: #d2dae2;
  border-radius: 4px;
}
.ico-pipe::before { left: 6px; right: 6px; top: 16px; height: 8px; }
.ico-pipe::after { top: 6px; bottom: 6px; left: 16px; width: 8px; }

.hud-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
  align-items: stretch;
}
.hud-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 14px;
  min-height: 56px;
  min-width: 72px;
  background: var(--casual-cream);
  color: var(--casual-ink);
  border-radius: 18px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: var(--casual-chip-shadow);
  border: 1px solid color-mix(in srgb, var(--casual-cream-2) 70%, #cbb89a);
}
.hud-chip .hud-chip-label {
  color: var(--casual-muted);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.hud-chip .hud-chip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "Cascadia Mono", "Consolas", "Roboto Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.hud-chip b {
  font-size: 22px;
  line-height: 1.1;
  color: var(--casual-ink);
  font-family: inherit;
}
.hud-chip span { color: var(--casual-muted); font-weight: 600; font-size: 13px; font-family: inherit; }
.hud-chip.turns b { color: #b8860b; }
.hud-chip.turn-clock b { color: var(--accent); }
.hud-chip.turn-clock.urgent b { color: var(--danger); }
.boss-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  overflow: hidden;
  border-radius: 18px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 75%, rgba(90, 140, 70, 0.35), transparent 70%),
    linear-gradient(180deg, #e8dfc8 0%, #d4c9a8 45%, #b8c49a 100%);
  box-shadow: inset 0 -8px 24px rgba(40, 50, 20, 0.12), 0 2px 0 rgba(58, 42, 26, 0.12);
}
.boss-rail {
  position: relative;
  flex: 0.7 1 0;
  min-height: 8.5rem;
  max-height: 34vh;
  width: 100%;
  max-width: 28rem;
  margin: 0 auto 2px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.play-layout.has-boss .play-board {
  flex: 1.55 1 0;
  min-height: 14rem;
  max-width: min(100%, 32rem);
}
.boss-rail .power-tray {
  position: absolute;
  right: 6px;
  bottom: 2.8rem;
  z-index: 8;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  pointer-events: auto;
}
.boss-rail .power-tray .shop-item {
  width: 54px;
  height: 54px;
  min-height: 54px;
  padding: 6px;
  border-radius: 14px;
}
.boss-rail .power-tray .shop-item .coin-price {
  width: 22px;
  height: 22px;
}
.boss-rail .power-hint {
  position: absolute;
  left: 8px;
  right: 64px;
  bottom: 2.7rem;
  z-index: 8;
  margin: 0;
  padding: 4px 6px;
  border-radius: 10px;
  background: rgba(40, 50, 28, 0.55);
  color: #f4f0e4;
  text-align: left;
  font-size: 11px;
  pointer-events: none;
}
.play-layout:not(.has-boss) > .power-tray {
  flex: 0 0 auto;
  margin: 2px 0 0;
  padding: 4px;
}
.play-layout:not(.has-boss) > .power-hint {
  flex: 0 0 auto;
}
.boss-turns-bg {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  font-size: clamp(5rem, 32vw, 10rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  color: rgba(40, 55, 28, 0.26);
  text-shadow:
    0 2px 0 rgba(255, 255, 255, 0.35),
    0 6px 18px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  user-select: none;
  z-index: 6;
  font-variant-numeric: tabular-nums;
}
.boss-turns-label {
  position: absolute;
  left: 50%;
  top: calc(38% + clamp(2.4rem, 11vw, 4rem));
  transform: translate(-50%, -50%);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(40, 55, 28, 0.34);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.3), 0 6px 16px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  z-index: 6;
}
.boss-figure-wrap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 2.6rem;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}
.boss-figure {
  display: block;
  height: 100%;
  width: auto;
  max-width: 96%;
  object-fit: contain;
  object-position: bottom center;
  transform-origin: 50% 90%;
  animation: boss-breathe 2.4s ease-in-out infinite;
  filter: drop-shadow(0 6px 10px rgba(30, 40, 20, 0.28));
}
.boss-stage-hud {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 6px 12px 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  background: linear-gradient(180deg, transparent, rgba(40, 50, 28, 0.22) 30%, rgba(30, 40, 22, 0.42));
}
.boss-hp {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  flex: 1 1 auto;
  min-width: 0;
  color: #f4f0e4;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.boss-hp b { font-size: 15px; }
.boss-hp span { color: rgba(244, 240, 228, 0.75); font-size: 13px; font-weight: 600; }
.boss-hp-bar {
  flex: 1 1 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(20, 24, 12, 0.45);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}
.boss-hp-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8b1a12, #e74c3c 55%, #f39c12);
  transition: width 0.35s ease;
}
.boss-hint {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  color: rgba(244, 240, 228, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.boss-float {
  position: absolute;
  left: 58%;
  top: 28%;
  transform: translate(-50%, -8px);
  font-weight: 900;
  font-size: 28px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: 3;
  animation: boss-float-up 0.85s ease-out both;
}
.boss-float.hit { color: #ff6b4a; }
.boss-float.crit { color: #ffe566; font-size: 34px; }
.boss-float.heal { color: #6dff8a; }
.boss-capy-hit {
  position: absolute;
  left: 0;
  bottom: 6%;
  width: clamp(180px, 55%, 340px);
  height: auto;
  object-fit: contain;
  object-position: bottom center;
  pointer-events: none;
  z-index: 5;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35));
  animation: boss-capy-run 0.85s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
@keyframes boss-capy-run {
  0% { opacity: 0; transform: translateX(-120%) translateY(8%) scale(0.95) rotate(-4deg); }
  12% { opacity: 1; }
  45% { transform: translateX(18%) translateY(0) scale(1.05) rotate(2deg); }
  100% { opacity: 0; transform: translateX(130%) translateY(-4%) scale(1) rotate(6deg); }
}
.boss-react-hit .boss-figure {
  animation: boss-hit 0.55s ease;
}
.boss-react-crit .boss-figure {
  animation: boss-crit 0.75s ease;
  filter: drop-shadow(0 0 14px rgba(255, 200, 40, 0.75)) drop-shadow(0 6px 10px rgba(30, 40, 20, 0.28));
}
.boss-react-heal .boss-figure {
  animation: boss-heal 0.85s ease;
  filter: drop-shadow(0 0 16px rgba(80, 220, 120, 0.7)) drop-shadow(0 6px 10px rgba(30, 40, 20, 0.28));
}
.boss-react-hit .boss-hp-bar > i,
.boss-react-crit .boss-hp-bar > i {
  animation: boss-bar-flash 0.55s ease;
}
.boss-react-heal .boss-hp-bar > i {
  animation: boss-bar-heal 0.7s ease;
}
@keyframes boss-breathe {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.02) translateY(-3px); }
}
@keyframes boss-hit {
  0% { transform: scale(1); }
  20% { transform: translateX(-10px) rotate(-4deg) scale(1.03); }
  40% { transform: translateX(12px) rotate(3deg); }
  60% { transform: translateX(-6px) rotate(-2deg); }
  100% { transform: scale(1); }
}
@keyframes boss-crit {
  0% { transform: scale(1); }
  15% { transform: scale(0.92) rotate(-5deg); }
  35% { transform: scale(1.08) rotate(5deg); }
  55% { transform: translateX(-12px) rotate(-6deg); }
  75% { transform: translateX(12px) rotate(4deg); }
  100% { transform: scale(1); }
}
@keyframes boss-heal {
  0% { transform: scale(1); filter: brightness(1); }
  40% { transform: scale(1.06); filter: brightness(1.2); }
  100% { transform: scale(1); }
}
@keyframes boss-float-up {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.8); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -48px) scale(1.15); }
}
@keyframes boss-capy-run {
  0% { opacity: 0; transform: translateX(-120%) translateY(8%) scale(0.95) rotate(-4deg); }
  12% { opacity: 1; }
  45% { transform: translateX(18%) translateY(0) scale(1.05) rotate(2deg); }
  100% { opacity: 0; transform: translateX(130%) translateY(-4%) scale(1) rotate(6deg); }
}
@keyframes boss-bar-flash {
  0%, 100% { filter: brightness(1); }
  40% { filter: brightness(1.6); }
}
@keyframes boss-bar-heal {
  0%, 100% { filter: brightness(1); }
  40% { filter: brightness(1.35) saturate(1.4); }
}
@media (prefers-reduced-motion: reduce) {
  .boss-figure, .boss-float, .boss-capy-hit,
  .boss-react-hit .boss-figure, .boss-react-crit .boss-figure, .boss-react-heal .boss-figure {
    animation: none !important;
  }
}
.hud-overlay-ico {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

pre.log {
  margin-top: 16px;
  padding: 10px;
  background: var(--panel-2);
  border-radius: 8px;
  font-size: 11px;
  white-space: pre-wrap;
  color: var(--muted);
  max-height: 120px;
  overflow: auto;
}

.play-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.play-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.play-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 40px;
  box-shadow: 0 2px 0 rgba(58, 42, 26, 0.15);
  background: var(--casual-cream);
}
.play-head .status {
  margin: 0;
  text-align: right;
  font-size: 15px;
  color: var(--text);
}
.play-coach {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--casual-cream, var(--panel)) 88%, #fff);
  box-shadow: inset 0 0 0 1px rgba(58, 42, 26, 0.08);
}
.play-coach-text {
  flex: 1;
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--casual-ink, var(--text));
}
.btn-play-help {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  color: #2a2110;
  background: #ffe57a;
  box-shadow: 0 1px 0 rgba(58, 42, 26, 0.2);
}
.btn-back {
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 0;
  min-height: 40px;
  white-space: nowrap;
}
.hud {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 8px;
}
.status {
  text-align: center;
  margin: 0;
  font-weight: 700;
  font-size: 16px;
}
.play-bottom .players {
  text-align: center;
  margin: 6px 0 0;
  font-size: 13px;
}
.play-bottom .stack {
  margin-top: 8px;
  position: relative;
  z-index: 8;
}
.finish-rating {
  text-align: center;
  margin: 6px 0 0;
  font-family: "Cascadia Mono", "Consolas", "Roboto Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}
.session-id {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 4px;
  padding: 8px 10px;
  background: var(--panel-2);
  border-radius: 10px;
  font-size: 13px;
}
.session-id code {
  font-size: 16px;
  font-weight: 700;
  color: var(--code);
  letter-spacing: 0.04em;
}
.btn-copy {
  border: 0;
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--btn-secondary);
  color: inherit;
  font: inherit;
  cursor: pointer;
}
#btn-invite {
  width: 100%;
  margin: 4px 0 0;
  min-height: 44px;
  padding: 10px 16px;
}
.hand-card {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 6px;
  max-width: 100%;
  padding: 8px 12px;
  background: var(--casual-cream);
  color: var(--casual-ink);
  border: 0;
  border-radius: 18px;
  box-shadow: var(--casual-chip-shadow);
}
.hand-card canvas {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
}
.hand-card b { display: block; color: var(--casual-ink); }
.hand-card span { color: var(--casual-muted); font-size: 13px; }
.hand-tool {
  display: inline-block;
  margin-left: 4px;
  font-size: 16px;
  vertical-align: -1px;
}
.campaign-map {
  margin: 10px 0 12px;
  padding: 10px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(0,0,0,0.08)),
    var(--panel);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}
.campaign-map-head,
.campaign-map-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.campaign-road {
  --gap: 6px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--gap);
  margin: 10px 0 8px;
}
.campaign-road::before {
  content: "";
  position: absolute;
  inset: 12px 8px;
  border-radius: 999px;
  opacity: 0.32;
  background:
    linear-gradient(90deg, transparent 0 4%, rgba(255,255,255,0.12) 4% 96%, transparent 96% 100%);
  pointer-events: none;
}
.campaign-step {
  position: relative;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.campaign-node {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  background: var(--btn-secondary);
  border: 2px solid rgba(255,255,255,0.08);
}
.campaign-step.done .campaign-node {
  background: color-mix(in srgb, var(--accent) 75%, #ffffff 25%);
  color: #0f1218;
}
.campaign-step.current .campaign-node {
  background: #ffe57a;
  color: #2a2110;
  transform: scale(1.08);
  box-shadow: 0 0 0 3px rgba(255, 229, 122, 0.2);
}
.campaign-raccoon {
  position: absolute;
  top: -12px;
  font-size: 18px;
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.35));
}
.campaign-match .campaign-road::before {
  background:
    linear-gradient(90deg, transparent 0 3%, rgba(76,141,255,0.26) 3% 97%, transparent 97% 100%);
}
.campaign-pipe .campaign-road::before {
  background:
    linear-gradient(90deg, transparent 0 3%, rgba(76,175,106,0.28) 3% 97%, transparent 97% 100%);
}
.campaign-side {
  font-weight: 600;
}
.campaign-status-body {
  padding: 14px;
  background: var(--casual-cream);
  color: var(--casual-ink);
}
.campaign-status-body > b {
  display: block;
  font-size: 18px;
  margin-bottom: 6px;
  color: var(--casual-ink);
}
.campaign-status-body .muted {
  color: var(--casual-muted);
}
.campaign-status {
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--casual-cream);
  box-shadow: var(--casual-chip-shadow);
  border: 1px solid color-mix(in srgb, var(--casual-cream-2) 70%, #cbb89a);
}
.campaign-status-art {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  background-color: #335c3d;
  overflow: hidden;
}
.campaign-pipe .campaign-status-art {
  background-color: #3a6b5a;
}
.campaign-status-art-img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  pointer-events: none;
}
.campaign-journey-path {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.campaign-journey-path polyline {
  fill: none;
  stroke: rgba(72, 48, 22, 0.28);
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 2.4 2.0;
}
.campaign-journey-steps {
  position: absolute;
  inset: 0;
  z-index: 2;
}
.campaign-journey-step {
  position: absolute;
  width: 30px;
  height: 20px;
  margin: -14px 0 0 -15px;
  background: transparent;
  border: 0;
  box-shadow: none;
  opacity: 1;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.32));
}
.campaign-journey-step::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 8px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(180deg, #8a5a2e 0%, #5a3518 70%, #3a2210 100%);
}
.campaign-journey-step::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 14px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 32% 28%, #f7ebc8 0 28%, #d7b078 58%, #9a6a38 100%);
  box-shadow:
    0 1px 0 rgba(255, 248, 220, 0.7) inset,
    0 0 0 1px rgba(72, 48, 22, 0.4);
}
.campaign-journey-num {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 14px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
  color: #3a2a14;
  text-shadow: 0 1px 0 rgba(255, 245, 220, 0.75);
}
.campaign-journey-step.done::after {
  background:
    radial-gradient(ellipse at 32% 28%, #fff0b8 0 30%, #e8bc4a 62%, #a06a18 100%);
}
.campaign-journey-step.current {
  width: 34px;
  height: 22px;
  margin: -16px 0 0 -17px;
  z-index: 1;
  filter: drop-shadow(0 0 6px rgba(255, 220, 90, 0.5)) drop-shadow(0 3px 4px rgba(0, 0, 0, 0.32));
}
.campaign-journey-step.current::after {
  height: 16px;
  background:
    radial-gradient(ellipse at 32% 28%, #fff8d8 0 34%, #ffd56a 64%, #c48420 100%);
}
.campaign-journey-step.current::before {
  top: 9px;
  height: 11px;
}
.campaign-journey-step.current .campaign-journey-num {
  height: 16px;
  font-size: 11px;
}
.campaign-status-marker {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, -82%);
  width: 56px;
  height: 56px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35));
  animation: campaign-raccoon-bob 1.4s ease-in-out infinite;
}
@keyframes campaign-raccoon-bob {
  0%, 100% { transform: translate(-50%, -82%) translateY(0) rotate(-2deg); }
  50% { transform: translate(-50%, -82%) translateY(-4px) rotate(2deg); }
}
.play-layout {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}
.play-top, .play-bottom { flex: 0 0 auto; }
.play-board,
#board-host {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.board-square {
  max-width: 100%;
  max-height: 100%;
  border-radius: 16px;
  overflow: hidden;
}
#board-canvas {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  touch-action: none;
}
.board {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: 3px;
  max-width: 100%;
  margin: 0 auto;
  padding: 6px;
  background: var(--panel-2);
  border-radius: 12px;
}
.cell {
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  cursor: default;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}
.cell.pick:not(:disabled) {
  cursor: pointer;
}
.cell.pick:not(:disabled):hover {
  filter: brightness(1.1);
}
.cell.sel {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--accent);
}
.cell:disabled {
  opacity: 0.85;
}

/* VK iframe / WebView: fill the host, hide local DEV chrome. */
html.vk-embed,
body.vk-embed {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
}
html.mp-in-play,
body.mp-in-play {
  overscroll-behavior: none;
}
body.vk-embed.mp-in-play .frame {
  overscroll-behavior: none;
}
.app.in-play {
  overscroll-behavior: none;
  touch-action: manipulation;
}
body.vk-embed {
  background-color: var(--page);
  background-image: var(--scene);
  background-size: var(--scene-size);
  background-repeat: no-repeat;
  background-position: var(--scene-position);
  background-attachment: var(--scene-attachment);
}

@media (min-width: 900px), (min-aspect-ratio: 4/3) {
  :root,
  [data-scene="capybara"] {
    --scene: url("/img/scene-capybara-desktop.jpg?v=7");
    --scene-size: cover;
    --scene-position: center;
    --scene-attachment: fixed;
  }
  [data-scene="raccoon"] {
    --scene: url("/img/scene-raccoon-desktop.jpg?v=7");
    --scene-position: center;
  }
  [data-scene="crocodile"] {
    --scene: url("/img/scene-crocodile-desktop.jpg?v=7");
    --scene-position: center;
  }
}
html.vk-embed,
html.vk-embed[data-scene="capybara"],
html.vk-embed[data-scene="raccoon"],
html.vk-embed[data-scene="crocodile"] {
  --scene-size: 100% auto;
  --scene-position: center top;
  --scene-attachment: scroll;
}
body.vk-embed .devbar {
  display: none;
}
body.vk-embed .frame {
  margin: 0;
  border: 0;
  border-radius: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
body.vk-embed .app {
  min-height: min-content;
}
body.vk-embed .app.in-play {
  min-height: 100%;
  height: 100%;
}

.onboard {
  position: absolute;
  inset: 0;
  z-index: 8;
  background: rgba(8, 10, 16, 0.78);
  display: flex;
  align-items: flex-end;
  padding: 16px;
}
.onboard-card {
  width: 100%;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.onboard-card h2 {
  font-size: 18px;
  margin: 4px 0 8px;
}
.onboard-card p {
  margin: 0 0 10px;
  line-height: 1.4;
}
.onboard-dots {
  display: flex;
  gap: 6px;
  margin: 8px 0 12px;
}
.onboard-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--btn-secondary);
}
.onboard-dots span.on {
  background: var(--accent);
}
.onboard-specials {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 12px;
}
.onboard-special-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--btn-secondary) 70%, transparent);
}
.onboard-special-ico {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
}
.onboard-special-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.onboard-special-copy b {
  font-size: 15px;
  color: var(--text);
}
.onboard-special-copy span {
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}
.onboard-combos {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 12px;
  max-height: min(42vh, 280px);
  overflow-y: auto;
  padding-right: 2px;
}
.onboard-combo-row {
  display: grid;
  grid-template-columns: 56px auto 56px 1fr;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--btn-secondary) 65%, transparent);
}
.onboard-combo-plus {
  font-weight: 800;
  font-size: 16px;
  color: var(--muted);
  text-align: center;
}
.onboard-combo-text {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text);
}

.coins { color: var(--code); font-weight: 700; }
.coin-ico {
  width: 16px;
  height: 16px;
  vertical-align: text-bottom;
  margin-right: 6px;
}
.coin-ico-inline {
  width: 14px;
  height: 14px;
  vertical-align: text-bottom;
  margin-left: 6px;
}
.power-ico {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
}
.coin-price {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}
.power-tray {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 8px 0 4px;
  padding: 8px 4px;
}
.power-tray .shop-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 72px;
  height: 72px;
  padding: 8px;
  min-height: 72px;
  border-radius: 18px;
  background: var(--casual-cream);
  color: var(--casual-ink);
  border: 2px solid transparent;
  box-shadow: var(--casual-chip-shadow);
  cursor: pointer;
}
.power-tray .shop-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent), var(--casual-chip-shadow);
}
.power-tray .shop-item .coin-price {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}
.power-hint {
  text-align: center;
  margin: 0 0 6px;
  padding: 0 10px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--casual-muted);
}
.power-hint .coin-ico-inline {
  width: 14px;
  height: 14px;
  margin: 0 2px;
  vertical-align: -2px;
}
.shop-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
}
.app.skin-casual .quest {
  background: var(--casual-cream);
  color: var(--casual-ink);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: var(--casual-chip-shadow);
  border: 1px solid color-mix(in srgb, var(--casual-cream-2) 70%, #cbb89a);
}
.app.skin-casual .quest p.muted {
  color: var(--casual-muted);
}
.app.skin-casual .onboard-card {
  background: var(--casual-cream);
  color: var(--casual-ink);
  border: 1px solid color-mix(in srgb, var(--casual-cream-2) 70%, #cbb89a);
}
.app.skin-casual .diag {
  background: var(--casual-cream-2);
  color: var(--casual-ink);
  border-color: color-mix(in srgb, var(--casual-cream-2) 60%, #cbb89a);
}
.quest-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}
.quest.done .quest-row b { color: var(--ok); }
.quest-bar {
  height: 6px;
  margin: 6px 0 2px;
  background: var(--panel-2);
  border-radius: 4px;
  overflow: hidden;
}
.quest-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}
.quest p.muted { margin: 0; font-size: 12px; }

.finish-fx {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 12px 72px;
  background: linear-gradient(180deg, transparent 30%, rgba(8, 12, 18, 0.55) 100%);
  animation: finish-fade 0.45s ease-out;
}
.finish-stage {
  position: relative;
  width: min(100%, 320px);
  text-align: center;
}
.finish-caption {
  margin: 8px 0 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
  animation: finish-caption-pop 0.5s cubic-bezier(0.34, 1.4, 0.64, 1) 0.15s both;
}
.finish-art {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.45));
}
.finish-run-cycle {
  position: relative;
  width: 100%;
}
.finish-run-cycle .finish-frame-a {
  position: relative;
  z-index: 1;
  width: 100%;
  animation: finish-run-a 0.42s steps(1, end) infinite;
}
.finish-run-cycle .finish-frame-b {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: finish-run-b 0.42s steps(1, end) infinite;
}
.finish-glow {
  position: absolute;
  left: 50%;
  top: 38%;
  width: 140%;
  height: 70%;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, rgba(255, 220, 90, 0.35) 0%, transparent 68%);
  animation: finish-glow-pulse 1.8s ease-in-out infinite;
  pointer-events: none;
}
.finish-sparks {
  position: absolute;
  inset: 0 0 40px;
  overflow: hidden;
  pointer-events: none;
}
.finish-spark {
  position: absolute;
  bottom: 28%;
  border-radius: 50%;
  opacity: 0;
  animation: finish-spark-rise 1.6s ease-out infinite;
}
.finish-bounce {
  animation: finish-hop 1.1s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  transform-origin: 50% 92%;
}
.finish-shake {
  animation: finish-panic 0.55s ease-in-out infinite;
  transform-origin: 50% 90%;
}
.finish-duo, .finish-croc-svg {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}
.finish-thumb {
  transform-origin: 148px 58px;
  animation: finish-thumb 0.7s ease-in-out infinite alternate;
}
.finish-chase {
  overflow: hidden;
  min-height: 180px;
}
.finish-runners {
  position: relative;
  z-index: 2;
  animation: finish-flee 1.35s ease-in-out infinite;
}
.finish-croc {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 28px;
  z-index: 1;
  animation: finish-croc 1.35s ease-in-out infinite;
}
.finish-win .finish-caption { color: #ffe57a; }
.finish-lose .finish-caption { color: #ff9a8c; }
.finish-lose .finish-art {
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.5)) saturate(1.05);
}
.finish-bomb .finish-caption { color: #ffd27a; text-shadow: 0 2px 12px rgba(255, 80, 0, 0.55); }
.finish-bomb-stage {
  position: relative;
  overflow: hidden;
}
.finish-bomb-blast {
  position: absolute;
  inset: -20% -10%;
  background:
    radial-gradient(circle at 55% 45%, rgba(255, 240, 160, 0.95) 0%, rgba(255, 140, 40, 0.75) 22%, rgba(220, 40, 20, 0.45) 48%, transparent 70%),
    radial-gradient(circle at 40% 60%, rgba(255, 200, 80, 0.55) 0%, transparent 55%);
  animation: finish-bomb-blast 1.1s ease-out both;
  pointer-events: none;
}
.finish-bomb-flash {
  position: absolute;
  inset: 0;
  background: rgba(255, 250, 220, 0.85);
  animation: finish-bomb-flash 0.7s ease-out both;
  pointer-events: none;
}
.finish-bomb-hero {
  position: relative;
  z-index: 2;
}
.finish-bomb-sparks .finish-spark {
  background: #ffb74d !important;
}
@keyframes finish-bomb-blast {
  0% { transform: scale(0.35); opacity: 0.2; }
  40% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1.2); opacity: 0.75; }
}
@keyframes finish-bomb-flash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .finish-bounce, .finish-shake, .finish-spark, .finish-glow,
  .finish-runners, .finish-croc, .finish-thumb,
  .finish-frame-a, .finish-frame-b {
    animation: none !important;
  }
  .finish-bomb-blast, .finish-bomb-flash { animation: none !important; opacity: 0.7; }
  .finish-caption { animation: finish-fade 0.35s ease-out both; }
}

@keyframes finish-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes finish-caption-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes finish-glow-pulse {
  0%, 100% { opacity: 0.55; transform: translate(-50%, -50%) scale(0.96); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
}
@keyframes finish-spark-rise {
  0% { opacity: 0; transform: translateY(0) scale(0.4); }
  12% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-90px) scale(1.1); }
}
@keyframes finish-run-a {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
@keyframes finish-run-b {
  0%, 49% { opacity: 0; }
  50%, 100% { opacity: 1; }
}
@keyframes finish-hop {
  0%, 100% { transform: translateY(0) scale(1, 1) rotate(-0.5deg); }
  35% { transform: translateY(-10px) scale(1.03, 0.97) rotate(0.5deg); }
  55% { transform: translateY(-16px) scale(0.98, 1.02) rotate(1deg); }
  75% { transform: translateY(-6px) scale(1.01, 0.99) rotate(0deg); }
}
@keyframes finish-panic {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  25% { transform: translateX(-3px) rotate(-0.6deg); }
  50% { transform: translateX(2px) rotate(0.4deg); }
  75% { transform: translateX(-2px) rotate(-0.3deg); }
}
@keyframes finish-thumb {
  from { transform: translateY(0) rotate(-8deg); }
  to { transform: translateY(-6px) rotate(10deg); }
}
@keyframes finish-flee {
  0% { transform: translateX(18%) translateY(0); }
  50% { transform: translateX(-8%) translateY(-6px); }
  100% { transform: translateX(-42%) translateY(0); }
}
@keyframes finish-croc {
  0% { transform: translateX(55%); }
  100% { transform: translateX(-15%); }
}

