:root {
  --primary: #18999D;
  --primary-dark: #117377;
  --primary-soft: #E6F5F5;
  --gold: #F2B632;
  --gold-dark: #C98E10;
  --bg: #E6F5F5;
  --bg-2: #F5FBFB;
  --surface: #FFFFFF;
  --text: #1F2937;
  --muted: #64748B;
  --border: #CFE3E3;
  --tile-border: #B9D2D2;
  --tile-filled: #5C7C7D;
  --correct: #22C55E;
  --present: #EAB308;
  --absent: #64748B;
  --key: #FFFFFF;
  --key-text: #1F2937;
  --city-far: #C4E6E6;
  --city-mid: #A6D8D9;
  --city-near: #86C8CA;
  --shadow: 0 10px 30px rgba(17, 115, 119, .16);
  --radius: 14px;
  --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

/* Evening Astana for dark-mode users */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #25B5B9;
    --primary-dark: #18999D;
    --primary-soft: #143235;
    --bg: #0D1F26;
    --bg-2: #13303A;
    --surface: #16272F;
    --text: #EEF6F6;
    --muted: #94A9B4;
    --border: #24414A;
    --tile-border: #2F525C;
    --tile-filled: #8FB3B8;
    --absent: #3C4B57;
    --key: #24404A;
    --key-text: #EEF6F6;
    --city-far: #183843;
    --city-mid: #1C4450;
    --city-near: #23525F;
    --shadow: 0 10px 30px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --primary: #25B5B9; --primary-dark: #18999D; --primary-soft: #143235;
  --bg: #0D1F26; --bg-2: #13303A; --surface: #16272F; --text: #EEF6F6; --muted: #94A9B4;
  --border: #24414A; --tile-border: #2F525C; --tile-filled: #8FB3B8; --absent: #3C4B57;
  --key: #24404A; --key-text: #EEF6F6; --city-far: #183843; --city-mid: #1C4450; --city-near: #23525F;
  --shadow: 0 10px 30px rgba(0, 0, 0, .4); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 70%);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- background ---------- */
.bg { position: fixed; inset: auto 0 0 0; height: 46vh; pointer-events: none; z-index: 0; transition: opacity .4s; }
body.in-game .bg { opacity: .35; }
.bg-layer { position: absolute; inset: 0; width: 100%; height: 100%; transition: transform .4s ease-out; }
.bg-far { color: var(--city-far); }
.bg-mid { color: var(--city-mid); }
.bg-near { color: var(--city-near); }
.sphere { fill: var(--gold); }
.sphere-shine { fill: none; stroke: #fff6; stroke-width: 4; stroke-linecap: round; }

/* ---------- layout ---------- */
.app {
  position: relative; z-index: 1;
  height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.screen { display: none; height: 100%; flex-direction: column; }
.screen.active { display: flex; animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- shared bits ---------- */
/* Монета — та же, что в «Зерде Run» (play/zerde-run/img/coin.png) */
.coin {
  display: inline-block; width: 20px; height: 20px; flex: none;
  background: url("coin.png") center / contain no-repeat;
}
.coin-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 6px 12px 6px 7px; border-radius: 999px; font-weight: 800; font-size: 15px;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.coin-pill.small { padding: 4px 10px 4px 5px; font-size: 14px; }
.coin-pill.bump { animation: bump .5s ease; }
@keyframes bump { 40% { transform: scale(1.18); } }

.pill {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px;
}

.btn {
  border: 0; border-radius: var(--radius); padding: 14px 20px;
  font-weight: 800; font-size: 16px; letter-spacing: .01em;
  transition: transform .1s ease, box-shadow .2s ease, background .2s;
}
.btn:active { transform: translateY(2px) scale(.98); }
.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 5px 0 var(--primary-dark), var(--shadow);
}
.btn-primary:active { box-shadow: 0 2px 0 var(--primary-dark); }
.btn-ghost { background: var(--primary-soft); color: var(--primary-dark); }
:root[data-theme="dark"] .btn-ghost { color: var(--primary); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-ghost { color: var(--primary); } }
.btn-xl { font-size: 19px; padding: 18px 40px; min-width: 260px; }
#start-btn { margin-top: 30px; }   /* не прилипать к подзаголовку */
.btn:focus-visible, .icon-btn:focus-visible, .key:focus-visible, .pill:focus-visible, .link-btn:focus-visible {
  outline: 3px solid var(--gold); outline-offset: 2px;
}

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0;
  background: transparent; color: var(--text); display: grid; place-items: center;
}
.icon-btn:hover { background: var(--primary-soft); }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#sound-btn .ico-off { display: none; }
#sound-btn.muted .ico-on { display: none; }
#sound-btn.muted .ico-off { display: block; }

/* Ornament: stylised qoshqar müiz drawn with CSS masks, used sparingly */
.ornament-line {
  width: 150px; height: 18px; margin: 0 auto 6px;
  background: var(--primary);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 18'%3E%3Cpath d='M25 2c-4 0-6 3-6 6 0 2 1 3 3 3s3-1 3-3c0 2 1 3 3 3s3-1 3-3c0-3-2-6-6-6zM0 9h12c2 0 3-2 2-3M50 9H38c-2 0-3-2-2-3M25 11v6' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x center / 50px 18px;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 18'%3E%3Cpath d='M25 2c-4 0-6 3-6 6 0 2 1 3 3 3s3-1 3-3c0 2 1 3 3 3s3-1 3-3c0-3-2-6-6-6zM0 9h12c2 0 3-2 2-3M50 9H38c-2 0-3-2-2-3M25 11v6' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x center / 50px 18px;
  opacity: .8;
}

/* ---------- home ---------- */
.home-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 16px; }
/* Режим ҚАЗ / РУС — как переключатель языка в «Зерде Run» */
.lang-toggle { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.lang-toggle button { border: 0; background: transparent; border-radius: 999px; padding: 6px 12px; font-weight: 800; font-size: 13px; color: var(--muted); }
.lang-toggle button.on { background: var(--primary); color: #fff; }
/* Иконки Lucide */
.pill-ico, .h-ico { width: 18px; height: 18px; vertical-align: -3px; color: var(--gold-dark); flex: none; }
.h-ico { width: 22px; height: 22px; vertical-align: -4px; }
.stat-ico { width: 12px; height: 12px; vertical-align: -1px; margin-right: 2px; color: #F97316; }
.close { display: grid; place-items: center; }
.close svg { width: 20px; height: 20px; }
.rating-list .sub svg { width: 11px; height: 11px; vertical-align: -1px; color: #F97316; }
.hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 16px 24px; text-align: center; min-height: 0; }
.logo {
  margin: 0; font-size: clamp(44px, 13vw, 64px); font-weight: 900; letter-spacing: .04em;
  color: var(--primary-dark); line-height: 1;
}
:root[data-theme="dark"] .logo { color: var(--primary); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo { color: var(--primary); } }
.logo span {
  display: inline-block; background: var(--gold); color: #fff; border-radius: 12px;
  padding: 0 .12em; margin: 0 .04em; transform: rotate(-6deg);
  box-shadow: 0 4px 0 var(--gold-dark);
}
.tagline { margin: 12px 0 0; font-weight: 600; color: var(--muted); font-size: 15px; }

.character-wrap { position: relative; margin: 10px 0 18px; }
.character { width: 130px; height: 162px; overflow: visible; }
.speech {
  position: absolute; left: calc(50% + 50px); top: 8px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px 14px 14px 4px;
  padding: 7px 11px; font-size: 13px; font-weight: 700; box-shadow: var(--shadow);
  animation: fadeIn .5s ease .4s both;
}
@media (max-width: 400px) { .speech { left: auto; right: calc(50% + 46px); border-radius: 14px 14px 4px 14px; } }

.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; max-width: 380px; margin-top: 26px; }
.stat { background: color-mix(in srgb, var(--surface) 85%, transparent); border: 1px solid var(--border); border-radius: 12px; padding: 10px 4px; backdrop-filter: blur(6px); }
.stat b { display: block; font-size: 20px; font-weight: 800; }
.stat span { font-size: 11px; color: var(--muted); font-weight: 600; }
.home-links { margin-top: 18px; display: flex; gap: 10px; color: var(--muted); }
/* «Правила» — заметной кнопкой: ссылка терялась на фоне Байтерека */
.rules-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 15px; padding: 10px 18px; color: var(--primary-dark); }
.rules-pill .pill-ico { color: var(--primary); }
.link-btn { background: none; border: 0; color: var(--primary-dark); font-weight: 700; font-size: 14px; padding: 6px; }
:root[data-theme="dark"] .link-btn { color: var(--primary); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .link-btn { color: var(--primary); } }

/* ---------- character ---------- */
.c-skin { fill: #F1C7A1; }
.c-hair { fill: #2B1D16; }
.c-jacket { fill: var(--primary); }
.c-shirt { fill: #fff; }
.c-band { fill: var(--gold); }
.c-band-mark { fill: #fff; }
.c-pants { fill: #2E3E55; }
.c-shoe { fill: #fff; stroke: #2E3E55; stroke-width: 2; }
.c-ink { fill: #1F2937; }
.c-blush { fill: #F29C9C; opacity: .5; }
.char-shadow { fill: #000; opacity: .1; }
.mouth { fill: none; stroke: #1F2937; stroke-width: 2.6; stroke-linecap: round; }
.mouth-happy { fill: #8C2F2F; stroke-linejoin: round; }
.mouth-happy, .mouth-sad { display: none; }
.hair-girl { display: none; }
.character.girl .hair-girl { display: inline; }
.character.girl .hair-boy { display: none; }
.character.girl .c-jacket { fill: #E36C6C; }

.character .char-body, .character .arm { transform-box: fill-box; }
.character .arm-l { transform-origin: top center; }
.character .arm-r { transform-origin: top center; }
.character.idle .char-body { animation: breathe 3s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes breathe { 50% { transform: translateY(-3px); } }
.character .eyes { animation: blink 4s infinite; transform-origin: 80px 62px; transform-box: view-box; }
@keyframes blink { 0%, 46%, 50%, 100% { transform: scaleY(1); } 48% { transform: scaleY(.1); } }

.character.happy .mouth-idle, .character.victory .mouth-idle { display: none; }
.character.happy .mouth-happy, .character.victory .mouth-happy { display: inline; }
.character.happy .char-body, .character.victory .char-body { animation: jump .7s cubic-bezier(.3,.7,.4,1.4) infinite; transform-origin: 50% 100%; }
.character.happy .arm-l, .character.victory .arm-l { transform: rotate(150deg); }
.character.happy .arm-r, .character.victory .arm-r { transform: rotate(-150deg); }
.character.happy .char-shadow, .character.victory .char-shadow { animation: shadow .7s ease infinite; transform-origin: 80px 192px; transform-box: view-box; }
@keyframes jump { 0%, 100% { transform: translateY(0) scaleY(1); } 15% { transform: translateY(0) scaleY(.92); } 50% { transform: translateY(-26px) scaleY(1.03); } }
@keyframes shadow { 50% { transform: scale(.7); opacity: .05; } }
.character.lose .mouth-idle { display: none; }
.character.lose .mouth-sad { display: inline; }
.character.lose .char-body { animation: slump 1.2s ease forwards; transform-origin: 50% 100%; }
.character.lose .arm-l { transform: rotate(8deg); }
.character.lose .arm-r { transform: rotate(-8deg); }
@keyframes slump { to { transform: translateY(4px) rotate(-3deg); } }

/* ---------- game ---------- */
.game-top { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; gap: 6px; }
.game-title { font-weight: 900; font-size: 20px; letter-spacing: .05em; color: var(--primary-dark); }
:root[data-theme="dark"] .game-title { color: var(--primary); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .game-title { color: var(--primary); } }
.game-title span { color: var(--gold-dark); }
.top-right { display: flex; align-items: center; gap: 2px; }
.top-right .coin-pill { margin-right: 4px; }

.score-strip {
  display: flex; justify-content: space-between; margin: 0 16px; padding: 7px 12px;
  background: color-mix(in srgb, var(--surface) 80%, transparent); border: 1px solid var(--border);
  border-radius: 10px; font-size: 13px; color: var(--muted); font-weight: 600; backdrop-filter: blur(6px);
}
.score-strip b { color: var(--text); }
.potential b { color: var(--gold-dark); }

.board-wrap { flex: 1; min-height: 0; container-type: size; display: grid; place-items: center; padding: 10px 16px; }
.board {
  width: min(100cqw, 100cqh * 5 / 6, 350px);
  aspect-ratio: 5 / 6;
  display: grid; grid-template-rows: repeat(6, 1fr); gap: 6px;
}
.row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.row.shake { animation: shake .45s ease; }
@keyframes shake { 15%, 55% { transform: translateX(-7px); } 35%, 75% { transform: translateX(7px); } 90% { transform: translateX(-2px); } }

.tile {
  position: relative; display: grid; place-items: center;
  border: 2px solid var(--tile-border); border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  font-weight: 800; font-size: clamp(22px, 7cqw, 32px); text-transform: uppercase; color: var(--text);
  backdrop-filter: blur(4px);
}
.tile.filled { border-color: var(--tile-filled); animation: pop .13s ease; }
/* Выбранная клетка текущего ряда — сюда встанет следующая буква; на клетки ряда можно нажимать */
.tile.cursor { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); cursor: pointer; }
.row:has(.cursor) .tile { cursor: pointer; }
@keyframes pop { 50% { transform: scale(1.08); } }
.tile.flip-out { transform: rotateY(90deg); transition: transform .16s ease-in; }
.tile.flip-in { transform: rotateY(0); transition: transform .16s ease-out; }
.tile.correct, .tile.present, .tile.absent { color: #fff; border-color: transparent; }
.tile.correct { background: var(--correct); }
.tile.present { background: var(--present); }
.tile.absent { background: var(--absent); }
/* Not colour alone (spec §32): ✓ for correct, dot for present */
.tile.correct::after, .tile.present::after {
  position: absolute; top: 3px; right: 5px; font-size: 11px; line-height: 1; font-weight: 900; opacity: .9;
}
.tile.correct::after { content: '✓'; }
.tile.present::after { content: '●'; font-size: 8px; top: 5px; }
.tile.bounce { animation: tileBounce .6s ease; }
@keyframes tileBounce { 0%, 100% { transform: translateY(0); } 35% { transform: translateY(-22px); } 60% { transform: translateY(4px); } }

.tile.mini { width: 36px; height: 36px; font-size: 17px; border-radius: 8px; }
.mini-row { display: flex; gap: 4px; margin-top: 12px; }

/* ---------- keyboard ---------- */
/* Невидимое поле для системной клавиатуры телефона; пока она открыта, экранная не нужна */
.native-input { position: fixed; left: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; font-size: 16px; }
body.native-kb .keyboard { display: none; }
.keyboard { padding: 4px 6px 10px; display: flex; flex-direction: column; gap: 6px; }
.kb-row { display: flex; gap: 4px; justify-content: center; }
.kb-row.kz { margin-top: 2px; }
.key {
  flex: 1 1 0; min-width: 0; height: 52px; max-width: 46px;
  border: 0; border-radius: 8px; background: var(--key); color: var(--key-text);
  font-weight: 700; font-size: 16px; padding: 0;
  box-shadow: 0 2px 0 var(--border);
  transition: background .25s, transform .06s;
}
.key:active, .key.pressed { transform: translateY(2px); box-shadow: none; }
.key.kz-letter { background: color-mix(in srgb, var(--primary) 12%, var(--key)); color: var(--primary-dark); font-weight: 800; }
:root[data-theme="dark"] .key.kz-letter { color: var(--primary); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .key.kz-letter { color: var(--primary); } }
.key.wide { flex: 1.7 1 0; max-width: 78px; font-size: 12px; font-weight: 800; }
.key.wide svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.key.enter { background: var(--primary); color: #fff; box-shadow: 0 2px 0 var(--primary-dark); }
.key.correct, .key.present, .key.absent { color: #fff; box-shadow: none; }
.key.correct { background: var(--correct); }
.key.present { background: var(--present); }
.key.absent { background: var(--absent); }
@media (max-height: 640px) { .key { height: 44px; } }
@media (max-width: 360px) { .key { font-size: 14px; } .kb-row { gap: 3px; } }

/* ---------- toasts ---------- */
.toast-zone { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 10px;
  font-weight: 700; font-size: 14px; box-shadow: var(--shadow); animation: toastIn .2s ease;
}
.toast.out { opacity: 0; transition: opacity .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }

/* ---------- modals ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(13, 31, 38, .45); backdrop-filter: blur(3px); animation: fadeIn .2s ease;
}
.sheet {
  position: relative; width: 100%; max-width: 420px; max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--surface); border-radius: 20px; padding: 24px 20px 20px; box-shadow: var(--shadow);
  user-select: text;
}
.sheet h2 { margin: 0 0 8px; font-size: 22px; font-weight: 900; }

/* Окно рейтинга — компактное, прокрутка без видимой полосы */
/* Шапка (заголовок, крестик, вкладки) стоит на месте, листается только .rating-body */
#modal-rating .sheet { max-width: 360px; max-height: min(560px, 78dvh); padding: 18px 16px 16px; display: flex; flex-direction: column; overflow: hidden; }
#modal-rating .rating-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 0 -16px -16px; padding: 0 16px 16px; scrollbar-width: none; -ms-overflow-style: none; }
#modal-rating .rating-body::-webkit-scrollbar { display: none; }
#modal-rating .sheet h2 { font-size: 19px; padding-right: 40px; }
#modal-rating .sheet h3 { margin: 14px 0 6px; font-size: 14px; }
#modal-rating .rating-totals { gap: 6px; margin: 10px 0; }
/* Вкладки окна рейтинга: общий рейтинг / мой результат */
.rating-tabs { display: flex; gap: 4px; padding: 3px; margin: 10px 0 2px; border-radius: 12px; background: var(--primary-soft); }
.rating-tabs button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 8px 6px; font-weight: 800; font-size: 13px; color: var(--muted); }
.rating-tabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
[data-rating-panel="mine"] .dist { margin-top: 12px; }
#modal-rating .rating-totals div { padding: 7px 4px; border-radius: 10px; }
#modal-rating .rating-totals b { font-size: 17px; }
#modal-rating .rating-totals span { font-size: 10.5px; }
#modal-rating .rating-list { gap: 5px; }
#modal-rating .rating-list li { padding: 7px 10px; gap: 8px; font-size: 13px; border-radius: 10px; }
#modal-rating .rating-list .rk { width: 22px; height: 22px; font-size: 12px; }
#modal-rating .rating-list .sub { font-size: 10.5px; }
#modal-rating .rating-list .coin { width: 17px; height: 17px; }
#modal-rating .rating-mine { margin-top: 8px; padding: 8px 10px; font-size: 13px; }
#modal-rating .close { top: 12px; right: 12px; width: 32px; height: 32px; }
.sheet h3 { margin: 18px 0 8px; font-size: 16px; font-weight: 800; }
.sheet p { line-height: 1.5; font-size: 14px; margin: 8px 0; }
.sheet form, form.sheet { display: flex; flex-direction: column; gap: 10px; }
.close { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--primary-soft); color: var(--text); font-size: 22px; line-height: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px !important; }
.input {
  font: inherit; font-size: 17px; font-weight: 600; padding: 13px 14px; border-radius: 12px;
  border: 2px solid var(--border); background: var(--bg-2); color: var(--text); outline: none;
}
.input:focus { border-color: var(--primary); }
.form-error { color: #DC2626; font-size: 13px !important; min-height: 1em; margin: 0 !important; }
.avatar-pick { display: flex; gap: 10px; }
.avatar-pick label { flex: 1; }
.avatar-pick input { position: absolute; opacity: 0; }
.avatar-pick span { display: block; text-align: center; padding: 10px; border-radius: 12px; border: 2px solid var(--border); font-weight: 700; cursor: pointer; }
.avatar-pick input:checked + span { border-color: var(--primary); background: var(--primary-soft); }
.avatar-pick input:focus-visible + span { outline: 3px solid var(--gold); }

.t-green, .t-green-wrap b { color: var(--correct); } .t-yellow, .t-yellow-wrap b { color: var(--gold-dark); } .t-gray, .t-gray-wrap b { color: var(--muted); }
.coins-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.coins-table td { padding: 5px 4px; }
.coins-table td:nth-child(even) { font-weight: 800; color: var(--gold-dark); text-align: right; padding-right: 14px; }

.rating-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.rating-totals div { background: var(--primary-soft); border-radius: 12px; padding: 10px 6px; text-align: center; }
.rating-totals b { display: block; font-size: 20px; }
.rating-totals span { font-size: 11px; color: var(--muted); font-weight: 600; }
.rating-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rating-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--bg-2); font-weight: 700; font-size: 14px; }
.rating-list li.me { outline: 2px solid var(--primary); }
.rating-list .rk { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--border); font-size: 13px; flex: none; }
.rating-list li:nth-child(1) .rk { background: var(--gold); color: #fff; }
.rating-list li:nth-child(2) .rk { background: #A8B4C0; color: #fff; }
.rating-list li:nth-child(3) .rk { background: #D08B52; color: #fff; }
.rating-list .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rating-list .sub { font-size: 11px; color: var(--muted); font-weight: 600; }
.rating-list .pts { display: flex; align-items: center; gap: 5px; }
.rating-mine { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--primary-soft); font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 12px; }

.dist { display: flex; flex-direction: column; gap: 4px; }
.dist-row { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.dist-row i { font-style: normal; width: 12px; color: var(--muted); }
.dist-bar { background: var(--absent); color: #fff; border-radius: 4px; padding: 2px 6px; min-width: 22px; text-align: right; font-size: 12px; }
.dist-row.cur .dist-bar { background: var(--correct); }

.toggle { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; font-weight: 700; border-bottom: 1px solid var(--border); cursor: pointer; }
.toggle input { position: absolute; opacity: 0; }
.toggle i { width: 46px; height: 26px; border-radius: 99px; background: var(--border); position: relative; transition: background .2s; }
.toggle i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px #0003; }
.toggle input:checked + i { background: var(--primary); }
.toggle input:checked + i::after { transform: translateX(20px); }
.toggle input:focus-visible + i { outline: 3px solid var(--gold); }

.result-sheet { text-align: center; padding-top: 16px; }
.mini-char { width: 100px; height: 125px; margin: 0 auto; display: block; }
.result-sub { color: var(--muted); font-weight: 600; }
.answer { display: flex; justify-content: center; gap: 4px; margin: 10px 0; }
.answer .tile { width: 42px; height: 42px; font-size: 20px; }
/* Толкование загаданного слова под ответом */
.meaning { margin: 2px auto 8px; max-width: 300px; font-size: 14px; line-height: 1.4; color: var(--muted); }
.reward { display: inline-flex; align-items: center; gap: 8px; font-size: 24px; font-weight: 900; color: var(--gold-dark); margin: 6px 0 14px; }
.reward .coin { width: 28px; height: 28px; }
.result-actions { display: flex; flex-direction: column; gap: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Правила: строка о выборе клетки */
.rules-cursor { margin: 10px 0 0; font-size: 14px; line-height: 1.45; }
