/*
 * Инструменты /tools/… и страница 404 — в духе стартовой страницы:
 * шрифты Cormorant, золото с градиентом, искры над картинкой, рамки
 * с уголками. Грузится только на этих страницах (seo/tools.ts,
 * render404 в seo/render.ts).
 *
 * Шрифты Cormorant — SIL OFL, те же файлы, что у стартовой страницы.
 */
@font-face { font-family: 'Cormorant SC'; font-weight: 700; font-display: swap; src: url('fonts/CormorantSC-700-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Cormorant SC'; font-weight: 700; font-display: swap; src: url('fonts/CormorantSC-700-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Cormorant Garamond'; font-weight: 500 700; font-display: swap; src: url('fonts/CormorantGaramond-500-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Cormorant Garamond'; font-weight: 500 700; font-display: swap; src: url('fonts/CormorantGaramond-500-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Cormorant Garamond'; font-style: italic; font-weight: 500 700; font-display: swap; src: url('fonts/CormorantGaramond-500i-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Cormorant Garamond'; font-style: italic; font-weight: 500 700; font-display: swap; src: url('fonts/CormorantGaramond-500i-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --sc-bg: #0a0706;
  --sc-ink: #e9dcc4;
  --sc-muted: #a8977c;
  --sc-gold: #e9c46a;
  --sc-gold-hi: #fff0c0;
  --sc-gold-lo: #9a6b22;
  --sc-line: rgb(233 196 106 / 0.22);
  --sc-display: 'Cormorant SC', 'Cormorant Garamond', Georgia, serif;
  --sc-serif: 'Cormorant Garamond', Georgia, serif;
}
body { background: var(--sc-bg); color: var(--sc-ink); overflow-x: clip; }
/*
 * У Cormorant по умолчанию «старинные» цифры разной высоты — берём ровные.
 * !important: сокращённое свойство font у элементов сбрасывает эту настройку.
 */
main, main *, .brand { font-variant-numeric: lining-nums !important; }
.brand { font-family: var(--sc-display); letter-spacing: 0.08em; }
main h2 {
  margin: 3rem 0 0.9rem;
  font: 700 clamp(1.7rem, 1.2rem + 1.8vw, 2.4rem) / 1.05 var(--sc-display);
  background: linear-gradient(180deg, var(--sc-gold-hi) 0%, #f1cf73 45%, #c7973d 75%, #8a5e1c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
main h2::after { content: ''; display: block; width: 7rem; height: 1px; margin-top: 0.7rem; background: linear-gradient(90deg, var(--sc-gold), transparent); }
main h3, .race-names h3 { font-family: var(--sc-display); font-size: 1.3rem; color: var(--sc-gold); }
main details { border-color: var(--sc-line); background: rgb(22 17 13 / 0.7); }
main summary { font-family: var(--sc-serif); font-size: 1.15rem; }

/* Кнопки — как на стартовой странице */
main .btn {
  position: relative;
  min-height: 3rem;
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  font: 600 1rem/1.2 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(.2, .8, .2, 1), box-shadow 0.3s, background 0.3s, color 0.3s, border-color 0.3s;
}
main .btn:active { transform: scale(0.97); }
main .btn-gold {
  border: 0;
  color: #1a1006;
  background: linear-gradient(180deg, #fbe7a6 0%, #e9c46a 45%, #c08e2e 100%);
  box-shadow: 0 0 0 1px rgb(255 240 192 / 0.5) inset, 0 10px 30px -8px rgb(233 196 106 / 0.55), 0 0 60px -10px rgb(233 150 60 / 0.5);
  overflow: hidden;
}
main .btn-gold:hover { color: #1a1006; transform: translateY(-2px); box-shadow: 0 0 0 1px rgb(255 240 192 / 0.7) inset, 0 16px 36px -8px rgb(233 196 106 / 0.7), 0 0 80px -6px rgb(233 150 60 / 0.6); }
main .btn-gold::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgb(255 255 255 / 0.55) 50%, transparent 70%);
  background-size: 250% 100%;
  background-position: 150% 0;
  mix-blend-mode: soft-light;
  animation: sc-shine 5s ease-in-out infinite 2s;
  pointer-events: none;
}
main .btn-line { color: var(--sc-ink); border: 1px solid rgb(233 196 106 / 0.45); background: rgb(10 7 6 / 0.35); }
main .btn-line:hover { border-color: var(--sc-gold); color: var(--sc-gold-hi); background: rgb(233 196 106 / 0.08); }
@keyframes sc-shine { 0%, 70% { background-position: 150% 0; } 100% { background-position: -50% 0; } }

/* ── Первый экран ──────────────────────────────────────────────── */
.sc-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  /* Во всю ширину окна, хотя страница — узкой колонкой */
  margin: 0 calc(50% - 50vw) 2.5rem;
  min-height: min(78vh, 640px);
  display: grid;
  align-items: end;
  padding: 5rem max(16px, calc(50vw - 440px)) 6rem;
}
.sc-hero::before {
  content: '';
  position: absolute;
  inset: -3%;
  z-index: -3;
  background: var(--art) center 35% / cover no-repeat;
  animation: sc-drift 30s ease-in-out infinite alternate;
}
.sc-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 70% 60% at 50% 40%, rgb(10 7 6 / 0.15), rgb(10 7 6 / 0.7) 70%, rgb(10 7 6 / 0.95)),
    linear-gradient(180deg, rgb(10 7 6 / 0.55) 0%, transparent 30%, transparent 50%, var(--sc-bg) 100%);
}
.sc-hero-in { position: relative; max-width: 760px; }
.sc-hero .crumbs { margin: 0 0 1.4rem; font-size: 0.85rem; }
.sc-hero .crumbs, .sc-hero .crumbs a { color: rgb(233 220 196 / 0.7); }
.sc-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0;
  font: 500 0.95rem/1.2 var(--sc-serif);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--sc-gold);
}
.sc-diamond { display: inline-block; width: 7px; height: 7px; transform: rotate(45deg); background: var(--sc-gold); box-shadow: 0 0 10px rgb(233 196 106 / 0.8); }
.sc-title {
  margin: 0.9rem 0 1rem;
  font: 700 clamp(2.6rem, 1.6rem + 4.4vw, 4.8rem) / 0.98 var(--sc-display);
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, var(--sc-gold-hi) 0%, #f1cf73 42%, #c7973d 70%, #8a5e1c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 24px rgb(0 0 0 / 0.7));
}
.sc-lead { margin: 0; max-width: 620px; font: 500 clamp(1.2rem, 1rem + 0.9vw, 1.55rem) / 1.4 var(--sc-serif); color: #eadcc0; text-shadow: 0 1px 12px rgb(0 0 0 / 0.9); }
@keyframes sc-drift { to { transform: scale(1.08) translate(-1.5%, -1%); } }

/* Искры поднимаются от низа экрана */
.sc-embers { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.sc-embers i {
  position: absolute;
  bottom: -10px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ffcf70;
  box-shadow: 0 0 8px 2px rgb(255 170 60 / 0.8);
  opacity: 0;
  animation: sc-ember 9s linear infinite;
}
.sc-embers i:nth-child(1) { left: 6%; animation-delay: 0s; }
.sc-embers i:nth-child(2) { left: 14%; animation-delay: 3.2s; animation-duration: 11s; }
.sc-embers i:nth-child(3) { left: 22%; animation-delay: 6s; width: 3px; height: 3px; }
.sc-embers i:nth-child(4) { left: 31%; animation-delay: 1.5s; animation-duration: 12s; }
.sc-embers i:nth-child(5) { left: 39%; animation-delay: 7.5s; }
.sc-embers i:nth-child(6) { left: 47%; animation-delay: 4.4s; animation-duration: 10s; width: 3px; height: 3px; }
.sc-embers i:nth-child(7) { left: 55%; animation-delay: 2.2s; }
.sc-embers i:nth-child(8) { left: 63%; animation-delay: 8.6s; animation-duration: 13s; }
.sc-embers i:nth-child(9) { left: 70%; animation-delay: 5.1s; width: 5px; height: 5px; }
.sc-embers i:nth-child(10) { left: 77%; animation-delay: 0.8s; animation-duration: 11s; }
.sc-embers i:nth-child(11) { left: 84%; animation-delay: 6.8s; }
.sc-embers i:nth-child(12) { left: 90%; animation-delay: 3.9s; animation-duration: 12s; width: 3px; height: 3px; }
.sc-embers i:nth-child(13) { left: 96%; animation-delay: 9.4s; }
.sc-embers i:nth-child(14) { left: 52%; animation-delay: 11s; animation-duration: 14s; }
@keyframes sc-ember {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: 0.9; }
  50% { transform: translate(18px, -45vh); }
  85% { opacity: 0.6; }
  100% { transform: translate(-12px, -85vh); opacity: 0; }
}

/* ── Рамка инструмента ─────────────────────────────────────────── */
.sc-frame {
  position: relative;
  margin: -5rem 0 2rem;
  padding: 1px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgb(255 240 192 / 0.7), rgb(154 107 34 / 0.35) 30%, rgb(154 107 34 / 0.15) 70%, rgb(233 196 106 / 0.6));
  box-shadow: 0 40px 80px -30px #000, 0 0 90px -40px rgb(233 150 60 / 0.55);
}
.sc-corner { position: absolute; z-index: 2; width: 12px; height: 12px; transform: rotate(45deg); background: var(--sc-gold); box-shadow: 0 0 12px rgb(233 196 106 / 0.9); }
.sc-corner.tl { top: -6px; left: 28px; }
.sc-corner.tr { top: -6px; right: 28px; }
.sc-corner.bl { bottom: -6px; left: 28px; }
.sc-corner.br { bottom: -6px; right: 28px; }
.t-panel {
  position: relative;
  padding: 26px 22px;
  border-radius: 21px;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgb(233 196 106 / 0.12), transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgb(122 28 22 / 0.18), transparent 70%),
    linear-gradient(180deg, #19130e, #0f0b09);
}
.t-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin: 18px 0 0; }
.t-label { display: block; margin-bottom: 7px; font: 500 0.78rem/1.2 system-ui, sans-serif; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sc-muted); }
.t-hint { margin: 12px 0 0; font: italic 500 1.05rem/1.4 var(--sc-serif); color: var(--sc-muted); text-align: center; }
.t-kicker { margin: 0 0 8px; font: 500 0.95rem/1.3 var(--sc-serif); letter-spacing: 0.24em; text-transform: uppercase; color: var(--sc-gold); text-align: center; }
.t-sub { margin: 26px 0 12px; font: 700 1.35rem/1.2 var(--sc-display); color: var(--sc-gold); }

/* Степпер − 1 + */
.stepper { display: grid; grid-template-columns: 42px minmax(52px, auto) 42px; align-items: center; }
.stepper .t-label { grid-column: 1 / -1; }
.stepper button { height: 44px; border: 1px solid var(--sc-line); background: rgb(10 7 6 / 0.6); color: var(--sc-gold-hi); font-size: 1.3rem; cursor: pointer; transition: background 0.2s, border-color 0.2s; }
.stepper button:hover { border-color: var(--sc-gold); background: rgb(233 196 106 / 0.08); }
.stepper button:first-of-type { border-radius: 999px 0 0 999px; }
.stepper button:last-of-type { border-radius: 0 999px 999px 0; }
.stepper output { height: 44px; display: grid; place-items: center; padding: 0 10px; border-block: 1px solid var(--sc-line); background: rgb(10 7 6 / 0.8); font: 700 1.35rem/1 var(--sc-display); color: var(--sc-gold-hi); font-variant-numeric: lining-nums tabular-nums; }

/* Переключатель */
.seg { display: inline-flex; padding: 4px; border-radius: 999px; border: 1px solid var(--sc-line); background: rgb(10 7 6 / 0.7); }
.seg button { min-height: 36px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--sc-muted); font: 500 0.95rem/1 system-ui, sans-serif; cursor: pointer; transition: background 0.25s, color 0.25s, box-shadow 0.25s; }
.seg button:hover { color: var(--sc-ink); }
.seg button[aria-checked='true'] { color: #1a1006; font-weight: 600; background: linear-gradient(180deg, #fbe7a6, #e9c46a 45%, #c08e2e); box-shadow: 0 6px 18px -6px rgb(233 196 106 / 0.6); }
.seg-sm button { min-height: 28px; padding: 0 10px; font-size: 0.8rem; }

/* ── Кости ──────────────────────────────────────────────────────── */
.die-shape { overflow: visible; }
.die-body { fill: #a5731f; stroke: #4a2e0c; stroke-width: 1.6; stroke-linejoin: round; }
.die-face { fill: #f3d58a; stroke: #7a5214; stroke-width: 1.2; stroke-linejoin: round; }
.die-edge { fill: none; stroke: #5a3a10; stroke-width: 1.3; stroke-linecap: round; }
.die-label { fill: #2a1804; font-family: var(--sc-serif); font-weight: 700; text-anchor: middle; dominant-baseline: central; }

.dice-tray { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.die-btn { aspect-ratio: 1; padding: 6%; border: 0; background: none; cursor: pointer; transition: transform 0.3s cubic-bezier(.2, .8, .2, 1), filter 0.3s; filter: drop-shadow(0 10px 14px rgb(0 0 0 / 0.7)); }
.die-btn svg { width: 100%; height: 100%; }
.die-btn:hover { transform: translateY(-6px) rotate(-6deg); filter: drop-shadow(0 16px 18px rgb(0 0 0 / 0.75)) drop-shadow(0 0 16px rgb(233 196 106 / 0.55)); }
.die-btn:active { transform: scale(0.92); }
.die-btn:hover .die-face { fill: #fff0c0; }

.dice-stage { position: relative; margin-top: 22px; padding: 24px 12px 20px; border-radius: 18px; background: radial-gradient(ellipse at 50% 30%, rgb(233 196 106 / 0.1), rgb(0 0 0 / 0.35) 70%); border: 1px solid rgb(233 196 106 / 0.12); text-align: center; }
.dice-total {
  font: 700 clamp(4.5rem, 16vw, 7rem) / 1 var(--sc-display);
  font-variant-numeric: lining-nums;
  background: linear-gradient(180deg, var(--sc-gold-hi), #f1cf73 45%, #c7973d 75%, #8a5e1c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 24px rgb(233 196 106 / 0.35));
}
.dice-stage.is-rolling .dice-total { filter: blur(1px) drop-shadow(0 0 10px rgb(233 196 106 / 0.2)); opacity: 0.7; }
.dice-stage.is-crit .dice-total { filter: drop-shadow(0 0 30px rgb(255 210 110 / 0.95)) drop-shadow(0 0 60px rgb(255 160 50 / 0.6)); animation: sc-pop 0.55s; }
.dice-stage.is-fumble .dice-total { background: linear-gradient(180deg, #ffb3a3, #e06c5a 50%, #7a1c16); -webkit-background-clip: text; background-clip: text; animation: sc-shake 0.45s; }
.dice-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-height: 48px; margin-top: 14px; }
.dice-row .mini { width: 48px; height: 48px; animation: sc-drop 0.4s both; }
.dice-row .mini svg { width: 100%; height: 100%; filter: drop-shadow(0 4px 6px rgb(0 0 0 / 0.6)); }
.dice-row .mini.off { opacity: 0.35; }
.dice-row .mini.hi svg { filter: drop-shadow(0 0 10px rgb(233 196 106 / 0.8)); }
.dice-note { margin: 12px 0 0; min-height: 1.4em; font: italic 500 1.1rem/1.4 var(--sc-serif); color: var(--sc-muted); }
.dice-log { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.dice-log li { margin: 0; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--sc-line); font-size: 0.85rem; color: var(--sc-muted); }
.dice-log li:first-child { color: var(--sc-gold-hi); border-color: rgb(233 196 106 / 0.5); }
@keyframes sc-pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes sc-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-10px) rotate(-3deg); } 40% { transform: translateX(8px) rotate(2deg); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
@keyframes sc-drop { from { opacity: 0; transform: translateY(-14px) rotate(-30deg) scale(0.7); } }
@keyframes sc-in { from { opacity: 0; transform: translateY(8px); } }

/* ── Имена ──────────────────────────────────────────────────────── */
.race-grid { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 8px; }
.race-tile { position: relative; aspect-ratio: 3 / 4; overflow: hidden; padding: 0; border: 0; border-radius: 12px; background: #0b0908; cursor: pointer; box-shadow: 0 0 0 1px rgb(233 196 106 / 0.2); transition: transform 0.3s, box-shadow 0.3s; }
.race-tile img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; filter: saturate(0.6) brightness(0.6); transition: filter 0.3s, transform 0.8s; }
.race-tile span { position: absolute; inset: auto 0 0; padding: 18px 3px 6px; background: linear-gradient(0deg, rgb(10 7 6 / 0.95), transparent); color: var(--sc-ink); font: 700 0.95rem/1.1 var(--sc-display); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.race-tile:hover { transform: translateY(-3px); }
.race-tile:hover img { filter: saturate(0.9) brightness(0.85); transform: scale(1.06); }
.race-tile[aria-checked='true'] { box-shadow: 0 0 0 2px var(--sc-gold), 0 0 26px -4px rgb(233 196 106 / 0.8); transform: translateY(-3px); }
.race-tile[aria-checked='true'] img { filter: none; }
.race-tile[aria-checked='true'] span { color: var(--sc-gold-hi); }
.name-list { list-style: none; padding: 0; margin: 22px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 18px; }
.name-list li { margin: 0; }
.name-list button {
  position: relative;
  width: 100%;
  padding: 9px 4px 9px 22px;
  border: 0;
  border-bottom: 1px solid rgb(233 196 106 / 0.14);
  background: none;
  color: var(--sc-ink);
  font: 600 1.3rem/1.25 var(--sc-serif);
  text-align: left;
  cursor: pointer;
  animation: sc-in 0.35s both;
  transition: color 0.2s;
}
.name-list button::before { content: ''; position: absolute; left: 4px; top: 50%; width: 6px; height: 6px; margin-top: -3px; transform: rotate(45deg); background: var(--sc-gold-lo); transition: background 0.2s; }
.name-list button:hover { color: var(--sc-gold-hi); }
.name-list button:hover::before { background: var(--sc-gold); box-shadow: 0 0 8px var(--sc-gold); }
.name-list button.copied { color: #b9e0a5; }
.name-list button.copied::after { content: 'скопировано'; margin-left: 10px; font: 500 0.75rem system-ui, sans-serif; color: #8fc37a; }

/* ── НПС ────────────────────────────────────────────────────────── */
.npc {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 22px;
  padding: 16px;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 30% 20%, rgb(255 255 255 / 0.35), transparent 60%),
    linear-gradient(135deg, #f1e2bf, #d9bf88);
  color: #2a1f12;
  box-shadow: inset 0 0 50px rgb(110 70 20 / 0.45), 0 20px 40px -20px #000;
}
.npc-art { width: 100%; height: 100%; min-height: 240px; object-fit: cover; object-position: center 20%; border-radius: 10px; box-shadow: 0 0 0 2px #8a6424, 0 8px 18px -8px #000; }
.npc-name { margin: 4px 0 2px; font: 700 2rem/1.05 var(--sc-display); color: #3a2410; }
.npc-sub { margin: 0 0 12px; font: italic 500 1.15rem/1.3 var(--sc-serif); color: #6a4a24; }
.npc dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 0; }
.npc dt { font: 700 1rem/1.4 var(--sc-display); color: #7a5a2c; }
.npc dd { margin: 0; font: 500 1.12rem/1.4 var(--sc-serif); }
.npc.is-new { animation: sc-in 0.4s both; }

/* ── Характеристики ─────────────────────────────────────────────── */
.pb-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.pb-left { display: block; font: 700 3.2rem/1 var(--sc-display); color: var(--sc-gold-hi); text-shadow: 0 0 22px rgb(233 196 106 / 0.45); }
.pb-left.over { color: #e06c5a; }
.pb-meter { flex: 1; min-width: 200px; display: grid; grid-template-columns: repeat(27, 1fr); gap: 3px; }
.pb-meter i { height: 12px; transform: skewX(-18deg); background: linear-gradient(180deg, #fbe7a6, #c08e2e); box-shadow: 0 0 8px rgb(233 196 106 / 0.45); transition: background 0.25s, box-shadow 0.25s; }
.pb-meter i.used { background: #251c13; box-shadow: none; }
.chips-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-pick .t-label { width: 100%; margin: 0 0 2px; }
.chips-pick button { padding: 6px 14px; border: 1px solid var(--sc-line); border-radius: 999px; background: transparent; color: var(--sc-ink); font: 600 1rem/1.2 var(--sc-serif); cursor: pointer; transition: border-color 0.2s, color 0.2s, background 0.2s; }
.chips-pick button:hover, .chips-pick button[aria-pressed='true'] { border-color: var(--sc-gold); color: var(--sc-gold-hi); background: rgb(233 196 106 / 0.08); }
.pb-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.pb-card { display: grid; justify-items: center; gap: 6px; padding: 14px 8px; border-radius: 16px; background: radial-gradient(ellipse at 50% 0%, rgb(233 196 106 / 0.1), transparent 70%), rgb(10 7 6 / 0.55); box-shadow: 0 0 0 1px rgb(233 196 106 / 0.18); text-align: center; }
.pb-name { font: 700 1.05rem/1 var(--sc-display); letter-spacing: 0.04em; color: var(--sc-gold); }
.pb-mod { font: 700 2.8rem/1 var(--sc-display); color: var(--sc-gold-hi); text-shadow: 0 0 20px rgb(233 196 106 / 0.35); font-variant-numeric: lining-nums; }
.pb-mod.neg { color: #d98a78; text-shadow: none; }
.pb-total { font: italic 500 1rem/1 var(--sc-serif); color: var(--sc-muted); }
.pb-val { display: grid; grid-template-columns: 34px 40px 34px; align-items: center; }
.pb-val button { height: 34px; border: 1px solid var(--sc-line); background: rgb(10 7 6 / 0.6); color: var(--sc-gold-hi); font-size: 1.1rem; cursor: pointer; }
.pb-val button:first-child { border-radius: 999px 0 0 999px; }
.pb-val button:last-child { border-radius: 0 999px 999px 0; }
.pb-val button:disabled { opacity: 0.3; cursor: default; }
.pb-val output { height: 34px; display: grid; place-items: center; border-block: 1px solid var(--sc-line); font: 700 1.2rem/1 var(--sc-display); color: var(--sc-ink); font-variant-numeric: lining-nums; }

/* ── Опыт ───────────────────────────────────────────────────────── */
.xp-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.xp-cur input { width: min(240px, 52vw); min-height: 52px; padding: 6px 18px; border-radius: 999px; border: 1px solid var(--sc-line); background: rgb(10 7 6 / 0.8); color: var(--sc-gold-hi); font: 700 1.6rem/1 var(--sc-display); font-variant-numeric: lining-nums; }
.xp-cur input:focus { outline: none; border-color: var(--sc-gold); box-shadow: 0 0 0 3px rgb(233 196 106 / 0.2); }
.xp-level { text-align: right; }
.xp-level b { display: block; font: 700 4rem/0.9 var(--sc-display); color: var(--sc-gold-hi); text-shadow: 0 0 26px rgb(233 196 106 / 0.5); }
.xp-level span { font: italic 500 1.05rem var(--sc-serif); color: var(--sc-muted); }
.xp-bar { height: 10px; margin-top: 16px; border-radius: 999px; background: rgb(10 7 6 / 0.8); box-shadow: 0 0 0 1px var(--sc-line); overflow: hidden; }
.xp-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #8a5e1c, #e9c46a, #fff0c0); box-shadow: 0 0 14px rgb(233 196 106 / 0.8); transition: width 0.6s cubic-bezier(.2, .8, .2, 1); }
.cr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.cr-grid button { display: grid; gap: 3px; padding: 8px 2px; border: 0; border-radius: 12px; background: rgb(10 7 6 / 0.55); box-shadow: 0 0 0 1px rgb(233 196 106 / 0.15); color: var(--sc-ink); cursor: pointer; transition: box-shadow 0.2s, transform 0.2s; }
.cr-grid button:hover { box-shadow: 0 0 0 1px var(--sc-gold), 0 0 16px -4px rgb(233 196 106 / 0.6); transform: translateY(-2px); }
.cr-grid b { font: 700 1.2rem/1 var(--sc-display); color: var(--sc-gold-hi); }
.cr-grid span { font-size: 0.7rem; color: var(--sc-muted); }
.xp-list { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 14px 0 0; }
.xp-list li { margin: 0; }
.xp-list button { padding: 4px 12px; border: 1px solid rgb(233 196 106 / 0.4); border-radius: 999px; background: transparent; color: var(--sc-ink); font: 600 0.95rem var(--sc-serif); cursor: pointer; }
.xp-list button::after { content: ' ✕'; color: var(--sc-muted); font-size: 0.75rem; }
.xp-total { margin-top: 20px; text-align: center; }
.xp-total b { display: block; font: 700 3rem/1 var(--sc-display); color: var(--sc-gold-hi); text-shadow: 0 0 24px rgb(233 196 106 / 0.4); }
.xp-each { font: italic 500 1.1rem var(--sc-serif); color: var(--sc-muted); }

/* ── Кости лжеца ────────────────────────────────────────────────── */
.face-pick { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.face-pick button, .pip-die { width: 54px; height: 54px; padding: 0; border: 0; background: none; cursor: pointer; transition: transform 0.25s, filter 0.25s, opacity 0.25s; }
.pip-face rect { fill: #efe0bd; stroke: #8a6424; stroke-width: 3; }
.pip-face circle { fill: #2a1804; }
.face-pick button[aria-checked='false'] { opacity: 0.4; }
.face-pick button[aria-checked='true'] { transform: translateY(-6px) rotate(-6deg); filter: drop-shadow(0 0 14px rgb(233 196 106 / 0.9)); }
.liars-mine { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 16px; margin-top: 22px; }
.liars-mine .t-label { width: 100%; margin: 0; text-align: center; }
.liars-dice { display: flex; gap: 8px; }
.pip-die { width: 46px; height: 46px; cursor: default; filter: drop-shadow(0 6px 8px rgb(0 0 0 / 0.6)); }
.pip-die.match .pip-face rect { fill: #f3d58a; stroke: #c08e2e; }
.pip-die.rolling { animation: sc-drop 0.45s both; }
.liars-verdict { margin-top: 22px; padding: 20px 16px; border-radius: 18px; background: radial-gradient(ellipse at 50% 0%, rgb(233 196 106 / 0.1), rgb(0 0 0 / 0.35) 70%); box-shadow: 0 0 0 1px rgb(233 196 106 / 0.12); text-align: center; }
.gauge { position: relative; height: 12px; border-radius: 999px; background: linear-gradient(90deg, #7a1c16, #a8742a 50%, #4f8a44); }
.gauge i { position: absolute; top: -5px; left: 0; width: 4px; height: 22px; border-radius: 2px; background: #fff0c0; box-shadow: 0 0 12px #fff0c0; transition: left 0.6s cubic-bezier(.2, .8, .2, 1); }
.liars-pct { display: block; margin-top: 12px; font: 700 3.2rem/1 var(--sc-display); color: var(--sc-gold-hi); text-shadow: 0 0 24px rgb(233 196 106 / 0.45); }
.liars-say { margin: 6px 0 0; font: italic 600 1.3rem/1.35 var(--sc-serif); color: var(--sc-ink); }

/* ── Загадки ────────────────────────────────────────────────────── */
.riddle-panel { text-align: center; padding-block: 36px 28px; }
.riddle-q { margin: 14px auto 8px; max-width: 640px; font: italic 600 clamp(1.6rem, 1.1rem + 2.2vw, 2.4rem) / 1.3 var(--sc-serif); color: var(--sc-gold-hi); text-shadow: 0 0 30px rgb(233 196 106 / 0.25); }
.riddle-q.is-new { animation: sc-in 0.5s both; }
.riddle-hint { margin: 8px 0 0; font: italic 500 1.15rem var(--sc-serif); color: var(--sc-muted); }
.riddle-answer { display: inline-block; margin: 14px auto 0; padding: 8px 26px; border-radius: 999px; box-shadow: 0 0 0 1px var(--sc-gold), 0 0 26px -6px rgb(233 196 106 / 0.7); font: 700 1.6rem/1.2 var(--sc-display); color: var(--sc-gold-hi); animation: sc-pop 0.45s; }
.riddle-panel .t-controls { justify-content: center; margin-top: 24px; }

/* ── Карточки — как классы на стартовой странице ───────────────── */
.sc-cards { list-style: none; padding: 0; margin: 20px 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.sc-cards.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sc-cards li { margin: 0; }
.sc-card {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 16px;
  color: var(--sc-ink);
  text-decoration: none;
  box-shadow: 0 30px 50px -25px rgb(0 0 0 / 0.95), 0 0 0 1px rgb(233 196 106 / 0.35);
  transition: transform 0.5s cubic-bezier(.2, .8, .2, 1), box-shadow 0.5s;
}
.sc-card-art { position: absolute; inset: 0; background: #0b0908 center 30% / cover no-repeat; transition: transform 1.2s cubic-bezier(.2, .8, .2, 1); }
.sc-card-text { position: absolute; inset: auto 0 0; padding: 3.5rem 12px 14px; background: linear-gradient(0deg, rgb(10 7 6 / 0.97) 20%, rgb(10 7 6 / 0.7) 60%, transparent); }
.sc-card b { display: block; font: 700 1.35rem/1.05 var(--sc-display); color: var(--sc-gold-hi); }
.sc-card-text > span { display: block; margin-top: 6px; font-size: 0.8rem; line-height: 1.35; color: var(--sc-muted); }
.sc-card:hover { color: var(--sc-ink); transform: translateY(-8px); box-shadow: 0 40px 60px -25px rgb(0 0 0 / 0.95), 0 0 0 1px var(--sc-gold), 0 0 50px -10px rgb(233 150 60 / 0.6); }
.sc-card:hover .sc-card-art { transform: scale(1.08); }

/* ── 404 ────────────────────────────────────────────────────────── */
.sc-lost { min-height: calc(100svh - 61px); align-items: center; justify-items: center; text-align: center; padding-top: 3rem; padding-bottom: 3rem; margin-bottom: 0; }
.sc-lost .sc-hero-in { display: grid; justify-items: center; }
.sc-lost .sc-eyebrow { justify-content: center; }
.sc-lost .sc-title { margin-top: 0.4rem; }
.sc-lost .sc-lead { margin-inline: auto; }
.lost-code { display: flex; align-items: center; justify-content: center; gap: 0.08em; margin-top: 0.6rem; font: 700 clamp(7rem, 26vw, 12rem) / 1 var(--sc-display); }
.lost-code > span { background: linear-gradient(180deg, var(--sc-gold-hi), #f1cf73 42%, #c7973d 70%, #8a5e1c); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 6px 30px rgb(0 0 0 / 0.8)); }
.lost-die { width: 0.95em; height: 0.95em; padding: 0; border: 0; background: none; font-size: inherit; cursor: pointer; animation: sc-bob 3.2s ease-in-out infinite; filter: drop-shadow(0 12px 22px rgb(0 0 0 / 0.8)) drop-shadow(0 0 26px rgb(233 196 106 / 0.45)); }
.lost-die svg { width: 100%; height: 100%; }
.lost-die.spin { animation: sc-spin 0.9s cubic-bezier(.2, .8, .2, 1); }
.lost-rumor { max-width: 560px; margin: 1rem auto 1.6rem; font: italic 500 1.15rem/1.4 var(--sc-serif); color: var(--sc-muted); }
.lost-out { min-height: 1.6em; max-width: 560px; margin: 1rem auto 0; font: 600 1.25rem/1.4 var(--sc-serif); color: var(--sc-ink); }
.lost-out.bad { color: #f09a88; }
.lost-out.good { color: var(--sc-gold-hi); }
.lost-exits { justify-content: center; }
@keyframes sc-bob { 0%, 100% { transform: translateY(0) rotate(-7deg); } 50% { transform: translateY(-12px) rotate(7deg); } }
@keyframes sc-spin { 0% { transform: rotate(0) scale(1); } 60% { transform: rotate(640deg) scale(0.8); } 100% { transform: rotate(720deg) scale(1); } }

/* ── Телефон ────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .race-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sc-cards, .sc-cards.six { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
@media (max-width: 560px) {
  .sc-hero { min-height: 70svh; padding: 4rem 16px 5.5rem; }
  .sc-eyebrow { font-size: 0.78rem; letter-spacing: 0.2em; gap: 0.6rem; }
  .sc-frame { margin-top: -4rem; }
  .sc-corner.tl, .sc-corner.bl { left: 20px; }
  .sc-corner.tr, .sc-corner.br { right: 20px; }
  .t-panel { padding: 22px 14px; }
  .dice-tray { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .t-controls { gap: 12px; }
  .face-pick { gap: 4px; }
  .face-pick button { width: 48px; height: 48px; }
  .pb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .t-controls .btn { flex: 1; padding-inline: 1rem; }
  .name-list { grid-template-columns: 1fr; }
  .npc { grid-template-columns: 1fr; }
  .npc-art { height: 220px; min-height: 0; }
  .xp-level b { font-size: 3.2rem; }
  .sc-card b { font-size: 1.15rem; }
  .sc-lost { min-height: calc(100svh - 96px); }
}

@media (prefers-reduced-motion: reduce) {
  .sc-hero::before, .lost-die, main .btn-gold::after, .dice-stage *, .name-list button, .npc, .riddle-q { animation: none !important; }
  .sc-embers { display: none; }
}
