/* Шрифты лежат рядом — ничего не грузим с Google */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(fonts/inter-cyrillic-wght-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(fonts/inter-latin-wght-normal.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: "Playfair Display"; font-style: normal; font-weight: 400 900; font-display: swap; src: url(fonts/playfair-display-cyrillic-wght-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 400 900; font-display: swap; src: url(fonts/playfair-display-latin-wght-normal.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: "Playfair Display"; font-style: italic; font-weight: 400 900; font-display: swap; src: url(fonts/playfair-display-cyrillic-wght-italic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 400 900; font-display: swap; src: url(fonts/playfair-display-latin-wght-italic.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; }

/* Палитра и шрифты — как у страницы-барабана ../slot */
:root {
  --bg: #1a110c;
  --bg-2: #24170f;
  --wood: #6b3f24;
  --wood-hi: #8a5532;
  --wood-lo: #3e2414;
  --brass: #e0b45c;
  --brass-lo: #9c7428;
  --cream: #f6ecd9;
  --cream-2: #eadbbf;
  --ink: #2a1a10;
  --ink-soft: #7a6450;
  --red: #d8412f;
  --red-lo: #9e2a1c;
  --text: #f6ecd9;
  --text-soft: #b89f84;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  --st: env(safe-area-inset-top, 0px);
  --sr: env(safe-area-inset-right, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 700px at 50% 35%, #3a2416 0%, var(--bg) 60%), var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ---------- кнопки ---------- */
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid #ffffff1f;
  background: #1a110cb8; display: grid; place-items: center; font-size: 18px; flex: none; padding: 0;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: background .15s, border-color .15s, transform .08s;
}
.icon-btn:hover { background: #2a1a10d9; }
.icon-btn:active { transform: scale(.94); }
.icon-btn.on { border-color: var(--brass); background: #e0b45c33; }
.btn {
  height: 46px; padding: 0 20px; border-radius: 999px; border: 1px solid #ffffff26; background: #ffffff0f;
  font-weight: 600; white-space: nowrap; transition: filter .15s, transform .08s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brass); color: var(--ink); border-color: transparent; box-shadow: 0 4px 0 var(--brass-lo); }
.play {
  width: 100%; height: 60px; padding: 0 30px; border-radius: 999px; border: 0;
  background: linear-gradient(180deg, #ef5a45, var(--red) 55%, var(--red-lo));
  color: #fff; font-weight: 700; font-size: 19px; letter-spacing: .02em;
  box-shadow: 0 6px 0 #6d1c12, 0 14px 30px -8px #d8412f99, inset 0 1px 0 #ffffff55;
  transition: transform .08s, box-shadow .08s;
}
.play:active { transform: translateY(4px); box-shadow: 0 2px 0 #6d1c12, 0 8px 20px -8px #d8412f99, inset 0 1px 0 #ffffff55; }
.link {
  border: 0; background: none; color: var(--text-soft); font-size: 15px; padding: 10px 12px;
  text-decoration: underline; text-decoration-color: #b89f8466; text-underline-offset: 4px;
}
.link:hover { color: var(--cream); }

/* ---------- сцена ---------- */
#stage { position: fixed; inset: 0; z-index: 0; overflow: hidden; will-change: transform; }
#cam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); pointer-events: none; }
body.no-cam #cam { display: none; }
.tint {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, #1a110cd0 0%, #1a110c00 26%, #1a110c00 70%, #1a110cd8 100%),
    radial-gradient(130% 95% at 50% 48%, #1a110c00 52%, #1a110c9e 86%, #1a110ce8 100%);
}
body.no-cam .tint {
  background:
    radial-gradient(90% 70% at 50% 45%, #6b3f2433 0%, #1a110c00 70%),
    repeating-linear-gradient(92deg, #ffffff05 0 2px, transparent 2px 11px),
    linear-gradient(180deg, #1a110cb0 0%, #1a110c00 30%, #1a110c00 70%, #1a110cc0 100%);
}
#hands, #fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#hands { z-index: 3; }
#fx { z-index: 5; }
body.in-menu #stage .hud, body.in-menu .banner { visibility: hidden; }

/* линия раздела в режиме «Вдвоём» */
.duo-line {
  position: absolute; z-index: 2; top: 0; bottom: 0; left: 50%; width: 0;
  border-left: 2px dashed #e0b45c66; pointer-events: none;
}
.duo-line span {
  position: absolute; top: calc(78px + var(--st)); white-space: nowrap;
  font-family: var(--serif); font-style: italic; font-weight: 700; font-size: 18px; color: var(--brass);
  text-shadow: 0 2px 8px #000;
}
.duo-line span:first-child { right: 14px; }
.duo-line span:last-child { left: 14px; color: #ff8a78; }

/* ---------- HUD ---------- */
.hud { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.hud button { pointer-events: auto; }
.hud-top {
  position: absolute; top: calc(10px + var(--st)); left: calc(12px + var(--sl)); right: calc(12px + var(--sr));
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 8px;
}
.hud-top > :first-child { justify-self: start; }
.hud-icons { justify-self: end; display: flex; gap: 8px; }
.scoreboard {
  display: flex; align-items: center; gap: 10px; padding: 6px 14px; border-radius: 18px;
  background: linear-gradient(180deg, #2b1a10e6, #1b100ae6); border: 1px solid #e0b45c55;
  box-shadow: 0 10px 30px -14px #000, inset 0 1px 0 #ffffff14;
}
.sb-side { display: flex; align-items: center; gap: 8px; }
.sb-side b { font-family: var(--serif); font-weight: 800; font-size: 32px; line-height: 1; min-width: .7em; text-align: center; font-variant-numeric: lining-nums tabular-nums; }
.sb-side:first-child b { color: var(--brass); }
.sb-side:last-child b { color: #ff8a78; }
.sb-side b.bump { animation: bump .45s ease-out; }
@keyframes bump { 30% { transform: scale(1.45); filter: brightness(1.4); } }
.sb-lbl { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--text-soft); }
.sb-mid { font-size: 11px; color: var(--text-soft); text-align: center; line-height: 1.2; min-width: 38px; white-space: nowrap; }
/* вдвоём и в серии подписи длиннее — ставим их под числом */
.scoreboard.stack { gap: 8px; padding: 5px 12px 6px; }
.scoreboard.stack .sb-side { flex-direction: column; gap: 3px; }
.scoreboard.stack .sb-side:first-child { flex-direction: column-reverse; }
.scoreboard.stack .sb-side b { font-size: 26px; }
.scoreboard.stack .sb-lbl { font-size: 9.5px; letter-spacing: .1em; white-space: nowrap; }
.sb-mid b { display: block; font-size: 15px; color: var(--cream); font-variant-numeric: lining-nums tabular-nums; }

/* карта ИИ и плашка «читает тебя» */
.ai-zone {
  position: absolute; top: calc(72px + var(--st)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; width: max-content; max-width: calc(100% - 24px);
}
body.duo .ai-zone { display: none; }
.ai-card { position: relative; width: 84px; height: 114px; perspective: 700px; flex: none; }
.ai-card-in {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.3, 1.45, .5, 1);
}
.ai-card.open .ai-card-in { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; border-radius: 14px; -webkit-backface-visibility: hidden; backface-visibility: hidden;
  display: grid; place-items: center; overflow: hidden;
}
.face.back {
  background:
    repeating-linear-gradient(92deg, #ffffff08 0 2px, transparent 2px 8px),
    linear-gradient(160deg, var(--wood-hi), var(--wood) 45%, var(--wood-lo));
  box-shadow: inset 0 0 0 3px #1b100a, inset 0 0 0 5px var(--brass-lo), 0 14px 30px -10px #000, 0 0 0 1px #0008;
  align-content: center; gap: 2px;
}
.face.back .mono { font-family: var(--serif); font-weight: 800; font-style: italic; font-size: 30px; color: var(--brass); text-shadow: 0 0 12px #e0b45c66; line-height: 1; }
.face.back .lock { font-size: 16px; opacity: 0; transform: scale(.4); transition: opacity .2s, transform .3s cubic-bezier(.3, 1.8, .5, 1); }
.ai-card.sealed .face.back .lock { opacity: 1; transform: none; }
.face.front {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, var(--cream), var(--cream-2));
  box-shadow: inset 0 0 0 3px var(--brass), 0 14px 30px -10px #000;
}
.face.front span { font-family: var(--emoji); font-size: 54px; line-height: 1; }
.ai-card.deal { animation: deal .5s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes deal { from { transform: translateY(-40px) rotate(-10deg) scale(.7); opacity: 0; } }
.ai-card.win .face.front { box-shadow: inset 0 0 0 3px var(--red), 0 0 30px #d8412faa; }
.bubble {
  position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%);
  white-space: nowrap; padding: 6px 12px; border-radius: 12px; font-size: 13px; font-weight: 700;
  background: var(--cream); color: var(--ink); box-shadow: 0 8px 20px -8px #000;
  animation: pop .35s cubic-bezier(.2, 1.6, .4, 1);
}
.bubble::before {
  content: ""; position: absolute; left: 50%; top: -6px; margin-left: -6px;
  border: 6px solid transparent; border-top: 0; border-bottom-color: var(--cream);
}
.bubble.hit { background: var(--red); color: #fff; }
.bubble.hit::before { border-bottom-color: var(--red); }
@keyframes pop { from { transform: translateX(-50%) scale(.4); opacity: 0; } }

.ai-meta { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ai-status { font-size: 13px; color: var(--cream-2); font-weight: 600; text-shadow: 0 1px 6px #000; max-width: 190px; line-height: 1.25; }
.read {
  padding: 8px 12px; border-radius: 14px; background: #1a110cd0; border: 1px solid #e0b45c44;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); min-width: 176px;
}
.read.flash { animation: readflash .8s ease-out; }
@keyframes readflash { 20% { border-color: var(--red); box-shadow: 0 0 24px #d8412f99; } }
.read-t { font-size: 12.5px; color: var(--cream-2); white-space: nowrap; }
.read-t b { font-family: var(--serif); font-size: 20px; color: #ff8a78; font-variant-numeric: lining-nums tabular-nums; margin-left: 2px; }
.read-bar { position: relative; height: 6px; border-radius: 3px; background: #ffffff1a; margin-top: 6px; overflow: visible; }
.read-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--brass), var(--red)); transition: width .6s cubic-bezier(.3, 1.3, .5, 1); }
.read-bar .chance { position: absolute; left: 33.3%; top: -3px; bottom: -3px; width: 2px; background: var(--cream); opacity: .55; border-radius: 1px; }

/* отсчёт */
.count {
  position: absolute; left: 0; right: 0; top: 45%; transform: translateY(-50%);
  text-align: center; pointer-events: none;
  font-family: var(--serif); font-weight: 800; font-style: italic;
  font-size: clamp(50px, 15vw, 128px); line-height: 1; color: var(--cream);
  text-shadow: 0 4px 0 var(--wood-lo), 0 10px 40px #000c;
}
.count.pop { animation: countpop .42s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes countpop { from { transform: translateY(-50%) scale(1.8); opacity: 0; filter: blur(4px); } }
.count.go {
  font-style: normal; font-size: clamp(72px, 26vw, 200px); letter-spacing: .02em;
  color: #ffe39a; text-shadow: 0 5px 0 var(--red-lo), 0 0 50px #d8412fcc, 0 12px 40px #000;
}
.count.go.pop { animation: gopop .5s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes gopop { from { transform: translateY(-50%) scale(2.6) rotate(-8deg); opacity: 0; } 60% { transform: translateY(-50%) scale(.92); } }
.count.out { opacity: 0; transition: opacity .25s; }

/* подсказка внизу */
.hint {
  position: absolute; left: 50%; bottom: calc(132px + var(--sb)); transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 999px; width: max-content;
  background: #1a110ce0; border: 1px solid #e0b45c55; color: var(--cream);
  font-weight: 600; font-size: 15px; text-align: center; line-height: 1.3;
  box-shadow: 0 10px 30px -10px #000; pointer-events: auto;
}
.hint.hot { border-color: var(--red); color: #ffe39a; }
.hint button { margin-left: 8px; border: 0; border-radius: 999px; padding: 4px 12px; background: var(--brass); color: var(--ink); font-weight: 700; font-size: 14px; }
body.cam .hint { bottom: calc(40px + var(--sb)); }

/* запасные кнопки жестов */
.pads {
  position: absolute; left: 0; right: 0; bottom: calc(18px + var(--sb));
  display: flex; justify-content: center; gap: 18px; padding: 0 12px;
}
body.cam .pads { display: none; }
.pad { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pad-lbl { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--text-soft); text-shadow: 0 1px 4px #000; }
.pad-row { display: flex; gap: 10px; }
.mv {
  width: 78px; height: 78px; border-radius: 20px; border: 0; padding: 0;
  font-family: var(--emoji); font-size: 42px; line-height: 1;
  background: linear-gradient(180deg, var(--cream), var(--cream-2));
  box-shadow: 0 6px 0 #b8a07a, 0 12px 24px -8px #000, inset 0 1px 0 #fff;
  transition: transform .1s, box-shadow .1s, opacity .2s, filter .2s;
}
.mv:active { transform: translateY(4px); box-shadow: 0 2px 0 #b8a07a, 0 6px 14px -8px #000, inset 0 1px 0 #fff; }
.mv.sel { transform: translateY(-6px); box-shadow: 0 0 0 4px var(--brass), 0 10px 0 #b8a07a, 0 18px 30px -8px #e0b45c88; }
.pads.locked .mv { opacity: .45; pointer-events: none; }
/* вдвоём ходы соседа не подсматриваем: выбранная кнопка просто «готово» */
body.duo .mv { width: 52px; height: 52px; font-size: 28px; border-radius: 14px; }
body.duo .pad-row { gap: 6px; }
body.duo .pads { justify-content: space-between; gap: 8px; }
body.duo .pad[data-side="1"] .pad-lbl { color: #ff8a78; }
body.duo .pad[data-side="0"] .pad-lbl { color: var(--brass); }
body.duo .pad.ready .mv { filter: grayscale(1) brightness(.7); }
body.duo .pad.ready .mv.sel { transform: none; box-shadow: 0 6px 0 #b8a07a, 0 12px 24px -8px #000, inset 0 1px 0 #fff; }
body.duo .pad.ready .pad-lbl::after { content: " · готов ✓"; color: #8fd694; }

/* большой итог раунда */
.banner {
  position: absolute; z-index: 6; left: 0; right: 0; top: 68%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none;
  opacity: 0;
}
.banner.show { opacity: 1; }
.banner-big {
  font-family: var(--serif); font-weight: 900; font-size: clamp(44px, 13.5vw, 118px); line-height: 1;
  text-transform: uppercase; letter-spacing: .02em; text-align: center; padding: 0 10px;
  color: var(--cream); text-shadow: 0 5px 0 var(--wood-lo), 0 14px 40px #000;
}
.banner.win .banner-big { color: #ffe39a; text-shadow: 0 5px 0 var(--brass-lo), 0 0 40px #e0b45c99, 0 14px 40px #000; }
.banner.lose .banner-big { color: #ff6b57; text-shadow: 0 5px 0 #6d1c12, 0 0 40px #d8412f88, 0 14px 40px #000; }
.banner.void .banner-big { font-size: clamp(28px, 8vw, 56px); text-transform: none; font-style: italic; }
.banner.show .banner-big { animation: stamp .55s cubic-bezier(.2, 1.7, .4, 1); }
@keyframes stamp { from { transform: scale(2.8) rotate(-10deg); opacity: 0; } 55% { transform: scale(.9) rotate(1deg); opacity: 1; } }
.banner-small {
  padding: 8px 16px; border-radius: 999px; background: #1a110cd8; border: 1px solid #e0b45c55;
  font-weight: 600; font-size: 16px; color: var(--cream); text-align: center; max-width: calc(100% - 32px);
}
.banner-small:empty { display: none; }
.banner.show .banner-small { animation: rise .5s .15s both cubic-bezier(.2, 1.4, .4, 1); }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }

/* ---------- стартовый экран ---------- */
.screen { position: fixed; inset: 0; z-index: 10; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#start {
  background: radial-gradient(1200px 700px at 50% 30%, #3a2416 0%, var(--bg) 62%), var(--bg);
  padding: 0 calc(16px + var(--sr)) calc(18px + var(--sb)) calc(16px + var(--sl));
  display: flex; flex-direction: column;
}
body:not(.in-menu) #start { display: none; }
.start-top {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; max-width: 520px; margin: 0 auto; padding: calc(12px + var(--st)) 0 0;
}
.brand { font-family: var(--emoji); font-size: 18px; letter-spacing: 2px; opacity: .9; }
.start-wrap { width: 100%; max-width: 520px; margin: auto; display: flex; flex-direction: column; gap: 16px; padding: 4px 0 8px; }
.start-head { text-align: center; }
.kicker { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--brass); font-weight: 600; }
h1 {
  font-family: var(--serif); font-weight: 800; font-size: clamp(34px, 9.6vw, 58px); line-height: 1.02;
  margin: 8px 0 0; letter-spacing: -.01em;
}
h1 em { color: var(--brass); font-weight: 700; }

.gcards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gcard {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px 10px; border-radius: 18px;
  background: linear-gradient(180deg, var(--cream), var(--cream-2)); color: var(--ink);
  box-shadow: 0 6px 0 #b8a07a, 0 16px 30px -12px #000, inset 0 1px 0 #fff;
}
.gcard .ge { font-family: var(--emoji); font-size: 44px; line-height: 1.1; animation: bob 2.4s ease-in-out infinite; }
.gcard:nth-child(2) .ge { animation-delay: -.8s; }
.gcard:nth-child(3) .ge { animation-delay: -1.6s; }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-6deg); } }
.gcard b { font-size: 15px; font-weight: 700; }
.gcard small { font-size: 12px; color: var(--ink-soft); }

.panel {
  position: relative; border-radius: 24px; padding: 14px 14px 12px;
  background:
    repeating-linear-gradient(92deg, #ffffff06 0 2px, transparent 2px 9px),
    linear-gradient(180deg, var(--wood-hi), var(--wood) 40%, var(--wood-lo));
  box-shadow: inset 0 2px 0 #ffffff26, inset 0 -6px 12px #0006, 0 24px 50px -20px #000c, 0 0 0 3px var(--brass-lo), 0 0 0 5px #0008;
  display: flex; flex-direction: column; gap: 10px;
}
.seg {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px;
  background: linear-gradient(180deg, #2b1a10, #1b100a); box-shadow: inset 0 2px 8px #000a, 0 1px 0 #ffffff1a;
}
.seg button {
  height: 42px; border: 0; border-radius: 10px; background: none; color: var(--text-soft);
  font-weight: 600; font-size: 14px; padding: 0 4px; display: flex; align-items: center; justify-content: center; gap: 5px;
  transition: background .15s, color .15s;
}
.seg button i { font-style: normal; font-family: var(--emoji); font-size: 15px; }
.seg button:hover { color: var(--cream); }
.seg button.on { background: linear-gradient(180deg, #f0c872, var(--brass)); color: var(--ink); box-shadow: 0 2px 0 var(--brass-lo), inset 0 1px 0 #fff8; }
.seg.off { opacity: .35; pointer-events: none; }
.mode-desc { margin: 0; font-size: 13px; line-height: 1.4; color: var(--cream-2); text-align: center; min-height: 2.8em; padding: 0 4px; }
.mode-desc b { color: var(--brass); }

.cta { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 2px; }
.notes { text-align: center; font-size: 13px; color: var(--text-soft); line-height: 1.45; }
.notes p { margin: 0 0 4px; }

/* ---------- оверлеи ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px;
  background: #120b07c4; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  overflow-y: auto;
}
.card {
  width: min(440px, 100%); padding: 26px 22px; border-radius: 22px; text-align: center;
  background: linear-gradient(180deg, #2e1d12, #22150d); border: 1px solid #e0b45c44;
  box-shadow: 0 20px 50px -20px #000; animation: cardin .4s cubic-bezier(.2, 1.3, .4, 1);
}
@keyframes cardin { from { transform: translateY(16px) scale(.97); opacity: 0; } }
.card h2 { font-family: var(--serif); font-size: clamp(26px, 7vw, 36px); margin: 6px 0 10px; line-height: 1.1; }
.card p { color: var(--text-soft); line-height: 1.5; margin: 0 auto 6px; max-width: 380px; }
.card .lbl { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--brass); font-weight: 600; }
.big-emoji { font-family: var(--emoji); font-size: 56px; line-height: 1; margin-bottom: 6px; }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.actions.col { flex-direction: column; align-items: stretch; }
.muted { font-size: 13px; }
.spin-emoji { font-family: var(--emoji); font-size: 40px; display: flex; justify-content: center; gap: 10px; margin-bottom: 4px; }
.spin-emoji span { animation: hop 1.2s ease-in-out infinite; }
.spin-emoji span:nth-child(2) { animation-delay: .2s; }
.spin-emoji span:nth-child(3) { animation-delay: .4s; }
@keyframes hop { 30% { transform: translateY(-12px) rotate(-10deg); } 60% { transform: none; } }
.load-row { font-size: 15px; margin: 6px 0; color: var(--cream-2); }
.load-row.ok { color: #8fd694; }
.bar { height: 8px; border-radius: 4px; background: #ffffff14; overflow: hidden; margin: 12px 0 14px; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brass), #ffe39a); transition: width .2s; }

.result .res-score { font-family: var(--serif); font-weight: 800; font-size: 64px; line-height: 1; margin: 4px 0 8px; font-variant-numeric: lining-nums tabular-nums; }
.result .res-score .a { color: var(--brass); }
.result .res-score .b { color: #ff8a78; }
.res-badge {
  display: inline-block; padding: 5px 12px; border-radius: 999px; background: var(--brass); color: var(--ink);
  font-weight: 700; font-size: 13px; margin-bottom: 10px; animation: stamp .6s cubic-bezier(.2, 1.7, .4, 1);
}
.res-read { text-align: left; padding: 12px 14px; border-radius: 14px; background: #1a110c; border: 1px solid #e0b45c33; margin: 6px 0 12px; }
.res-read .read-t { font-size: 15px; white-space: normal; }
.res-read .read-t b { font-size: 26px; }
.res-read .read-bar { height: 8px; }
.read-note { font-size: 12px; color: var(--text-soft); margin-top: 6px; }
.res-facts { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.res-facts div { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; line-height: 1.4; color: var(--cream-2); padding: 8px 10px; border-radius: 12px; background: #ffffff08; }
.res-facts .fe { font-family: var(--emoji); font-size: 20px; line-height: 1.1; flex: none; }
.res-facts b { color: var(--cream); }

.toast {
  position: fixed; z-index: 70; left: 50%; bottom: calc(24px + var(--sb)); transform: translate(-50%, 20px);
  padding: 12px 18px; border-radius: 14px; background: var(--cream); color: var(--ink); font-weight: 600; font-size: 15px;
  box-shadow: 0 14px 40px -12px #000; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 60; pointer-events: none; }
.fatal { z-index: 80; }

/* ---------- компьютер и широкие экраны ---------- */
@media (min-width: 760px) and (min-height: 560px) {
  .ai-zone { top: calc(84px + var(--st)); gap: 20px; }
  .ai-card { width: 104px; height: 140px; }
  .face.front span { font-size: 66px; }
  .face.back .mono { font-size: 36px; }
  .ai-status { font-size: 15px; max-width: 240px; }
  .read { min-width: 220px; }
  .read-t { font-size: 14px; }
  .mv { width: 90px; height: 90px; font-size: 50px; }
  body.duo .mv { width: 72px; height: 72px; font-size: 38px; }
  body.duo .pads { justify-content: center; gap: 30vw; }
  .hint { bottom: calc(150px + var(--sb)); font-size: 16px; }
  .start-wrap { gap: 20px; padding-top: 10px; }
  .gcard { padding: 16px 8px 14px; }
  .gcard .ge { font-size: 54px; }
}
/* большие экраны: всё крупнее, чтобы на записи с компьютера читалось */
@media (min-width: 1100px) and (min-height: 700px) {
  .hud-top { top: calc(18px + var(--st)); left: calc(22px + var(--sl)); right: calc(22px + var(--sr)); }
  .icon-btn { width: 50px; height: 50px; font-size: 21px; border-radius: 14px; }
  .scoreboard { padding: 8px 20px; gap: 14px; border-radius: 22px; }
  .sb-side b { font-size: 44px; }
  .sb-lbl { font-size: 13px; }
  .sb-mid { font-size: 13px; }
  .scoreboard.stack .sb-side b { font-size: 36px; }
  .scoreboard.stack .sb-lbl { font-size: 11px; }
  .ai-zone { top: calc(104px + var(--st)); gap: 24px; }
  .ai-card { width: 132px; height: 178px; }
  .face { border-radius: 18px; }
  .face.front span { font-size: 86px; }
  .face.back .mono { font-size: 46px; }
  .face.back .lock { font-size: 20px; }
  .ai-status { font-size: 17px; max-width: 300px; }
  .read { min-width: 280px; padding: 12px 16px; border-radius: 16px; }
  .read-t { font-size: 16px; }
  .read-t b { font-size: 28px; }
  .read-bar { height: 8px; }
  .bubble { font-size: 15px; padding: 8px 14px; }
  .banner-small { font-size: 19px; padding: 10px 20px; }
  .pad-lbl { font-size: 13px; }
  .mv { width: 104px; height: 104px; font-size: 58px; border-radius: 24px; }
  body.duo .mv { width: 84px; height: 84px; font-size: 46px; }
  .duo-line span { top: calc(96px + var(--st)); font-size: 22px; }
}
/* низкие экраны (телефон боком, маленькие ноутбуки) */
@media (max-height: 560px) {
  .ai-zone { top: calc(62px + var(--st)); }
  .ai-card { width: 64px; height: 86px; }
  .face.front span { font-size: 40px; }
  .face.back .mono { font-size: 22px; }
  .mv { width: 60px; height: 60px; font-size: 32px; }
  .banner { top: 62%; }
  .hint { bottom: calc(100px + var(--sb)); }
}
/* невысокие телефоны (iPhone SE и т. п.): стартовый экран должен влезать без прокрутки */
@media (max-height: 700px) and (max-width: 759px) {
  .start-wrap { gap: 10px; }
  .start-top { padding-top: calc(8px + var(--st)); }
  .brand { font-size: 15px; }
  .start-top .icon-btn { width: 36px; height: 36px; font-size: 16px; }
  h1 { font-size: clamp(30px, 8.6vw, 40px); margin-top: 4px; }
  .kicker { font-size: 11px; }
  .gcard { padding: 8px 4px 7px; border-radius: 16px; }
  .gcard .ge { font-size: 34px; }
  .gcard b { font-size: 14px; }
  .gcard small { font-size: 11px; }
  .panel { padding: 10px 10px 8px; gap: 8px; }
  .seg button { height: 38px; }
  .mode-desc { font-size: 12.5px; min-height: 0; }
  .play { height: 54px; font-size: 18px; }
  .link { padding: 6px 12px; }
  .notes { font-size: 12.5px; }
}
@media (max-width: 360px) {
  .mv { width: 68px; height: 68px; font-size: 36px; }
  .read { min-width: 150px; }
  .seg button { font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .gcard .ge, .spin-emoji span { animation: none; }
}
