@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url(fonts/inter-cyrillic-400-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-weight: 400; font-display: swap; src: url(fonts/inter-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+2000-206F,U+2190-21FF; }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url(fonts/inter-cyrillic-500-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-weight: 500; font-display: swap; src: url(fonts/inter-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+2000-206F,U+2190-21FF; }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url(fonts/inter-cyrillic-600-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-weight: 600; font-display: swap; src: url(fonts/inter-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+2000-206F,U+2190-21FF; }
@font-face { font-family: "Mont"; font-weight: 800; font-display: swap; src: url(fonts/montserrat-cyrillic-800-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Mont"; font-weight: 800; font-display: swap; src: url(fonts/montserrat-latin-800-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+2000-206F,U+2190-21FF; }
@font-face { font-family: "Mont"; font-weight: 900; font-display: swap; src: url(fonts/montserrat-cyrillic-900-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Mont"; font-weight: 900; font-display: swap; src: url(fonts/montserrat-latin-900-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+2000-206F,U+2190-21FF; }

:root {
  --base: #2b2624;
  --red: #6a2b24;
  --teal: #1f4b49;
  --text: #f4f1ee;
  --muted: #a69e98;
  --bubble-ex: #403a37;
  --bubble-me: #5e8a3c;
  --green: #81b64c;
  --green-dark: #5e8a3c;
  --panel: rgba(0, 0, 0, .26);

  --g-brilliant: #1fa9a2;
  --g-great: #5b8bbf;
  --g-best: #7fb34a;
  --g-good: #8a9f7a;
  --g-inaccuracy: #e8b83e;
  --g-mistake: #e5852e;
  --g-blunder: #e0453a;

  --safe-b: max(12px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #1c1917; color: var(--text); overflow: hidden; }
body { font-family: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

#app {
  position: fixed; inset: 0;
  height: var(--tg-viewport-height, 100dvh);
  display: flex; flex-direction: column;
  max-width: 560px; margin: 0 auto;
  overflow: hidden; isolation: isolate;
}

/* ---------- фон-доска ---------- */
.bg, .tint, .flash { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.bg {
  background-color: var(--base);
  background-image: conic-gradient(rgba(255,255,255,.035) 25%, transparent 0 50%, rgba(255,255,255,.035) 0 75%, transparent 0);
  background-size: 76px 76px;
}
.tint { opacity: 0; transition: opacity 1s ease; mix-blend-mode: normal; }
.tint-red { background: var(--red); }
.tint-teal { background: var(--teal); }
.tint::after { /* клетки поверх тонировки */
  content: ""; position: absolute; inset: 0;
  background-image: conic-gradient(rgba(255,255,255,.035) 25%, transparent 0 50%, rgba(255,255,255,.035) 0 75%, transparent 0);
  background-size: 76px 76px;
}
.flash { z-index: 20; opacity: 0; }
.flash.go { animation: flash .7s ease-out; }
@keyframes flash { 0% { opacity: .55; } 100% { opacity: 0; } }

/* ---------- шапка ---------- */
.top { padding: 18px 16px 8px; text-align: center; flex: none; }
.title {
  margin: 0; font-family: "Mont", sans-serif; font-weight: 900;
  font-size: min(6.6vw, 30px); letter-spacing: -.01em; line-height: 1.05;
  text-transform: uppercase; white-space: nowrap;
  text-shadow: 0 2px 0 rgba(0,0,0,.28);
}
.sub { margin-top: 5px; font-size: 13.5px; font-weight: 600; color: #bdb5af; }
.players { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.player {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: var(--panel); border-radius: 10px; padding: 7px 10px 7px 7px;
}
.player b { display: block; font-size: 16px; font-weight: 600; line-height: 1.15; }
.player span { display: block; font-size: 11.5px; color: var(--muted); }
.piece { width: 34px; height: 34px; border-radius: 7px; display: grid; place-items: center; flex: none; }
.piece svg { width: 22px; height: 22px; }
.me .piece { background: var(--green); color: #fff; }
.ex .piece { background: #4a4441; color: #d9d2cc; }

/* ---------- доска с чатом ---------- */
.board { position: relative; flex: 1; min-height: 0; display: flex; padding: 6px 16px 0 8px; }
.eval { width: 30px; flex: none; display: flex; flex-direction: column; align-items: center; padding-bottom: 8px; }
.eval-num { width: 40px; text-align: center; font-size: 12px; font-weight: 600; color: #e9e4df; height: 18px; line-height: 18px; white-space: nowrap; transition: color .4s; }
.eval-num.pos { color: #9fd36c; }
.eval-track { position: relative; flex: 1; width: 11px; border-radius: 3px; background: rgba(0,0,0,.38); overflow: hidden; }
.eval-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 50%;
  background: #f1eeea; border-radius: 3px;
  transition: height .9s cubic-bezier(.2,.9,.25,1.15);
}
.eval-track.thinking .eval-fill { animation: think 1s ease-in-out infinite; }
@keyframes think { 50% { opacity: .55; } }

.chat {
  flex: 1; min-width: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 0 120px 10px; display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: none;
}
.chat::-webkit-scrollbar { display: none; }
.row { display: flex; align-items: center; animation: msgIn .32s cubic-bezier(.2,.9,.3,1.2) both; }
.row.me { justify-content: flex-end; }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px) scale(.96); } }
.bubble {
  max-width: 80%; padding: 9px 14px 10px; border-radius: 12px;
  font-size: 17px; font-weight: 500; line-height: 1.3; word-wrap: break-word;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.ex .bubble { background: var(--bubble-ex); }
.me .bubble { background: var(--bubble-me); }
.row.pending .bubble { opacity: .75; }

.badge {
  width: 31px; height: 31px; border-radius: 50%; flex: none; margin-right: -5px; z-index: 1;
  display: grid; place-items: center; border: 2.5px solid #fff;
  font-family: "Mont", sans-serif; font-weight: 900; font-size: 12.5px; color: #fff; letter-spacing: -.04em;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  animation: badgeIn .45s cubic-bezier(.2,1.6,.4,1) both;
}
@keyframes badgeIn { from { transform: scale(0) rotate(-40deg); } }

.typing { display: flex; gap: 5px; padding: 13px 16px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: #e8e2dc; animation: dot 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { transform: translateY(0); opacity: .55; } 30% { transform: translateY(-4px); opacity: 1; } }

/* ---------- плашки оценки ---------- */
.stamps { position: absolute; left: 0; right: 0; bottom: 64px; height: 0; pointer-events: none; display: flex; justify-content: center; }
.stamp {
  position: absolute; bottom: 0; white-space: nowrap;
  font-family: "Mont", sans-serif; font-weight: 900; font-size: 27px; letter-spacing: .01em;
  padding: 9px 24px 10px; border-radius: 999px; color: #fff;
  box-shadow: 0 10px 30px rgba(0,0,0,.4), inset 0 -3px 0 rgba(0,0,0,.15);
  animation: stamp 1.9s cubic-bezier(.2,1.4,.4,1) both;
}
.stamp.dark-text { color: #2a2111; }
@keyframes stamp {
  0% { opacity: 0; transform: scale(2.3) rotate(var(--rot)); }
  14% { opacity: 1; transform: scale(.94) rotate(var(--rot)); }
  22% { transform: scale(1.03) rotate(var(--rot)); }
  30%, 78% { opacity: 1; transform: scale(1) rotate(var(--rot)); }
  100% { opacity: 0; transform: translateY(-26px) scale(.96) rotate(var(--rot)); }
}
.spark { position: absolute; width: 18px; height: 18px; color: #4fe3d0; filter: drop-shadow(0 0 6px rgba(79,227,208,.8)); animation: spark 1.8s ease-out both; }
@keyframes spark {
  0% { opacity: 0; transform: translate(0,0) scale(0) rotate(0); }
  25% { opacity: 1; transform: translate(var(--dx), var(--dy)) scale(1.1) rotate(45deg); }
  70% { opacity: 1; transform: translate(var(--dx), var(--dy)) scale(.8) rotate(90deg); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0) rotate(120deg); }
}

/* ---------- финал ---------- */
.final { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; padding: 0 22px 70px; }
.final-card {
  width: 100%; max-width: 420px; text-align: center; border-radius: 14px; padding: 14px 18px 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,.55);
  animation: drop .55s cubic-bezier(.2,1.5,.4,1) both;
}
.final-card h2 { margin: 0; font-family: "Mont", sans-serif; font-weight: 900; font-size: 34px; letter-spacing: .02em; }
.final-card p { margin: 4px 0 0; font-size: 15px; font-weight: 600; }
.final-card.loss { --rot: -4deg; background: rgba(24,12,11,.94); border: 2.5px solid #e0453a; transform: rotate(-4deg); }
.final-card.loss h2 { color: #f0473b; }
.final-card.win { --rot: 0deg; background: rgba(36,30,12,.95); border: 2.5px solid #e9c046; box-shadow: 0 20px 50px rgba(0,0,0,.5), 0 0 40px rgba(233,192,70,.25); }
.final-card.win h2 { color: #f4c84a; }
.final-card.draw { --rot: 2deg; background: rgba(28,28,28,.95); border: 2.5px solid #9d9894; transform: rotate(2deg); }
@keyframes drop { from { opacity: 0; transform: scale(1.6) rotate(var(--rot, 0deg)); } }
#app.shake { animation: shake .45s; }
@keyframes shake { 20% { transform: translate(-7px, 3px); } 40% { transform: translate(6px, -3px); } 60% { transform: translate(-4px, 2px); } 80% { transform: translate(3px, -1px); } }

/* ---------- низ ---------- */
.bottom { flex: none; padding: 0 16px var(--safe-b); display: flex; flex-direction: column; gap: 10px; }
.composer { position: relative; display: flex; align-items: center; background: rgba(0,0,0,.28); border-radius: 12px; }
.composer input {
  flex: 1; min-width: 0; height: 46px; padding: 0 50px 0 15px; border: 0; outline: 0; background: none;
  color: var(--text); font: 500 16px "Inter", sans-serif;
}
.composer input::placeholder { color: #8d847e; }
.composer button {
  position: absolute; right: 5px; width: 36px; height: 36px; border-radius: 9px; background: var(--green-dark);
  display: grid; place-items: center; opacity: 0; transform: scale(.6); transition: .18s;
}
.composer.has-text button { opacity: 1; transform: none; }
.composer button svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.composer.locked { opacity: .55; }

.coach { display: flex; gap: 11px; align-items: center; background: rgba(0,0,0,.3); border-radius: 12px; padding: 9px 12px 9px 9px; min-height: 60px; }
.coach-icon { width: 42px; height: 42px; flex: none; border-radius: 9px; background: var(--green-dark); color: #fff; display: grid; place-items: center; }
.coach-icon svg { width: 26px; height: 26px; }
.coach-body b { display: block; font-size: 11.5px; font-weight: 600; color: #9cd067; letter-spacing: .03em; }
.coach-body p { margin: 2px 0 0; font-size: 14.5px; line-height: 1.3; color: #eee9e4; }
.coach-body p.swap { animation: coachIn .4s ease both; }
@keyframes coachIn { from { opacity: 0; transform: translateY(5px); } }

/* ---------- экран блокировки ---------- */
.lock {
  position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px 18px;
  background: radial-gradient(120% 70% at 50% 0%, #26211f 0%, #121010 70%);
  transition: opacity .45s ease, transform .45s ease;
}
.lock.hidden { opacity: 0; transform: scale(1.08); pointer-events: none; }
.lock-inner { width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: center; }
.lock-date { font-size: 17px; font-weight: 500; color: #cfc7c1; margin-bottom: 4px; min-height: 21px; }
.lock-date::first-letter { text-transform: uppercase; }
.lock-time { font-size: 76px; font-weight: 600; letter-spacing: -.02em; line-height: 1; margin-bottom: 26px; font-variant-numeric: tabular-nums; }
.notif {
  width: 100%; display: flex; gap: 12px; align-items: center; text-align: left;
  background: rgba(64, 59, 56, .92);
  border-radius: 16px; padding: 12px 14px; animation: notifIn .6s .2s cubic-bezier(.2,1.3,.4,1) both;
}
@keyframes notifIn { from { opacity: 0; transform: translateY(-16px) scale(.96); } }
.notif-ava { width: 40px; height: 40px; border-radius: 10px; flex: none; background: #b0384a; display: grid; place-items: center; font-weight: 600; font-size: 18px; }
.notif-body { flex: 1; min-width: 0; }
.notif-head { display: flex; justify-content: space-between; align-items: baseline; }
.notif-head b { font-size: 15.5px; font-weight: 600; }
.notif-head span { font-size: 12px; color: #c9c1bb; }
.notif-text { font-size: 15px; color: #ece6e1; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lock-q { margin-top: 34px; font-family: "Mont", sans-serif; font-weight: 900; font-size: 27px; }
.lock-warn { margin-top: 6px; font-family: "Mont", sans-serif; font-weight: 900; font-size: 21px; color: #ef4438; animation: notifIn .5s .9s both; }
.lock .btn { margin-top: 34px; }
.lock-meta { margin-top: 14px; font-size: 13px; color: var(--muted); text-align: center; min-height: 18px; }

/* кнопки как на шахматном сайте: плоские, с «полкой» снизу */
.btn {
  width: 100%; height: 52px; border-radius: 10px; font-family: "Mont", sans-serif; font-weight: 800; font-size: 18px;
  transition: transform .08s, box-shadow .08s, opacity .2s;
}
.btn:disabled { opacity: .45; }
.btn-green { background: #81b64c; color: #fff; box-shadow: 0 4px 0 #45753c; text-shadow: 0 1px 0 rgba(0,0,0,.25); }
.btn-green:active { transform: translateY(3px); box-shadow: 0 1px 0 #45753c; }
.btn-dark { background: #3c3936; color: #eae7e3; box-shadow: 0 4px 0 #2a2725; font-size: 15px; height: 46px; }
.btn-dark:active { transform: translateY(3px); box-shadow: 0 1px 0 #2a2725; }
.btn-ghost { background: rgba(255,255,255,.07); color: #eee; margin-top: 10px; }
.link-btn { font-size: 14px; font-weight: 600; color: #b9b2ab; padding: 8px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(185,178,171,.4); }

.toast {
  position: absolute; left: 50%; top: 14px; z-index: 60; transform: translate(-50%, -150%);
  background: #3b3533; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); transition: transform .3s cubic-bezier(.2,1.2,.4,1); max-width: 90%; text-align: center;
}
.toast.show { transform: translate(-50%, 0); }

@media (max-height: 640px) {
  .top { padding-top: 10px; }
  .players { margin-top: 9px; }
  .coach { min-height: 0; }
  .lock-time { font-size: 60px; margin-bottom: 18px; }
  .lock-q { margin-top: 22px; }
  .lock .btn { margin-top: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* ===================== v4: выбор соперника, разбор, подсказки ===================== */
.top { position: relative; }
.back-btn {
  position: absolute; left: 12px; top: 14px; z-index: 2; width: 36px; height: 36px; border-radius: 10px;
  background: rgba(0,0,0,.28); display: grid; place-items: center;
}
.back-btn svg { width: 20px; height: 20px; fill: none; stroke: #e9e4df; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.tg .back-btn { display: none; }
body:not(.tg) .top { padding-left: 56px; padding-right: 56px; }

.toast { opacity: 0; transition: transform .3s cubic-bezier(.2,1.2,.4,1), opacity .2s; }
.toast.show { opacity: 1; }

/* ---------- подсказка ---------- */
.composer-row { display: flex; gap: 8px; align-items: center; }
.composer-row .composer { flex: 1; min-width: 0; }
.hint-btn {
  position: relative; flex: none; width: 46px; height: 46px; border-radius: 12px; background: rgba(0,0,0,.28);
  display: grid; place-items: center; color: #f0c64a;
}
.hint-btn svg { width: 22px; height: 22px; }
.hint-btn i {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #e8b83e; color: #2a2111; font: 800 11px/18px "Mont", sans-serif; font-style: normal;
}
.hint-btn.empty { color: #8d847e; }
.hint-btn.empty i { background: #5a5450; color: #d6d0ca; }
.hint-btn.hidden { display: none; }
.coach.hinting { box-shadow: inset 0 0 0 1.5px rgba(232,184,62,.55); }
.coach.hinting .coach-body b { color: #f0c64a; }
.coach.hinting .coach-icon { background: #b8892a; }

/* ---------- выбор соперника ---------- */
.home {
  position: absolute; inset: 0; z-index: 35; display: flex; flex-direction: column;
  background-color: var(--base);
  background-image: conic-gradient(rgba(255,255,255,.035) 25%, transparent 0 50%, rgba(255,255,255,.035) 0 75%, transparent 0);
  background-size: 76px 76px;
  transition: opacity .3s ease, transform .3s ease;
}
.home.hidden { opacity: 0; transform: scale(.98); pointer-events: none; }
.home-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 4px; }
.wordmark { font-family: "Mont", sans-serif; font-weight: 900; font-size: 24px; letter-spacing: -.01em; text-shadow: 0 2px 0 rgba(0,0,0,.28); }
.me-chip { color: inherit; display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,.28); border-radius: 10px; padding: 6px 10px; }
.me-chip svg { width: 18px; height: 18px; color: #81b64c; }
.me-chip b { font-weight: 600; font-size: 15px; }
.me-chip span { font-size: 12.5px; font-weight: 600; color: #f0a24a; }
.me-chip span:empty { display: none; }
.home-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 10px 16px 18px; scrollbar-width: none; }
.home-scroll::-webkit-scrollbar { display: none; }

.avatar {
  display: grid; place-items: center; border-radius: 8px; background: var(--c, #4a4441); color: #fff;
  font-family: "Mont", sans-serif; font-weight: 900; text-shadow: 0 2px 0 rgba(0,0,0,.18);
}
.avatar-lg { width: 76px; height: 76px; font-size: 34px; flex: none; }
.hero { display: flex; align-items: center; gap: 14px; }
.hero-name { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.hero-name b { font-family: "Mont", sans-serif; font-weight: 900; font-size: 26px; }
.hero-name span { font-size: 16px; font-weight: 600; color: var(--muted); }
.hero-meta { margin-top: 2px; font-size: 13.5px; color: #c9c1bb; display: flex; align-items: center; gap: 6px; }
.hero-meta svg { width: 13px; height: 13px; color: #f0c64a; }
.hero-say { margin-top: 14px; position: relative; }
.hero-say p {
  display: inline-block; max-width: 92%; margin: 0; padding: 10px 14px 11px; border-radius: 12px; border-top-left-radius: 3px;
  background: #403a37; font-size: 17px; font-weight: 500; line-height: 1.3; box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.hero-about { margin: 10px 0 0; font-size: 14px; color: #bdb5af; line-height: 1.35; }

.level-title { margin: 22px 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #a69e98; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 10px; }
.tile { text-align: center; min-width: 0; }
.tile .avatar { position: relative; width: 100%; aspect-ratio: 1; font-size: 26px; transition: transform .1s; }
.tile:active .avatar { transform: scale(.95); }
.tile.sel .avatar { box-shadow: 0 0 0 3px var(--base), 0 0 0 6px #81b64c; }
.tile b { display: block; margin-top: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile span { display: block; font-size: 11.5px; color: var(--muted); }
.tile .lock-badge {
  position: absolute; right: -4px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%;
  background: #262421; display: grid; place-items: center; color: #f0c64a; box-shadow: 0 0 0 2px var(--base);
}
.tile .lock-badge svg { width: 12px; height: 12px; }
.tile.locked .avatar { filter: saturate(.55) brightness(.85); }

.home-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 26px; }
.home-links button { height: 44px; border-radius: 10px; background: rgba(0,0,0,.28); font-size: 14px; font-weight: 600; color: #ddd6d0;
  display: flex; align-items: center; justify-content: center; gap: 8px; }
.home-links button svg { width: 18px; height: 18px; color: #81b64c; flex: none; }
.home-links button:active { background: rgba(0,0,0,.4); }
.home-bottom { flex: none; padding: 10px 16px calc(var(--safe-b) + 2px); background: linear-gradient(rgba(43,38,36,0), var(--base) 30%); }
.btn-play { height: 58px; font-size: 21px; }
.btn-play.premium { background: #e8b83e; color: #2a2111; box-shadow: 0 4px 0 #a9801f; text-shadow: none; }
.home-status { margin-top: 10px; text-align: center; font-size: 13px; color: var(--muted); min-height: 17px; }

/* ---------- листы ---------- */
.review, .retry, .paywall, .sharesheet, .infosheet { position: absolute; inset: 0; display: flex; align-items: flex-end; background: rgba(0,0,0,0); pointer-events: none; transition: background .35s; }
.review { z-index: 25; } .retry { z-index: 28; } .sharesheet { z-index: 40; } .infosheet { z-index: 42; } .paywall { z-index: 45; }
.review.open, .retry.open, .paywall.open, .sharesheet.open, .infosheet.open { background: rgba(0,0,0,.55); pointer-events: auto; }
.sheet {
  width: 100%; max-height: 92%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  background: #262421; border-radius: 16px 16px 0 0; padding: 8px 16px calc(var(--safe-b) + 8px);
  transform: translateY(105%); transition: transform .45s cubic-bezier(.2,1,.3,1); box-shadow: 0 -10px 40px rgba(0,0,0,.4);
}
.sheet::-webkit-scrollbar { display: none; }
.open > .sheet { transform: none; }
.grip { width: 40px; height: 4px; border-radius: 2px; background: #4a4441; margin: 0 auto 12px; }

/* ---------- разбор партии ---------- */
.rv-head { display: flex; gap: 10px; align-items: flex-start; }
.rv-coach { width: 44px; height: 44px; flex: none; border-radius: 8px; background: #5e8a3c; color: #fff; display: grid; place-items: center; }
.rv-coach svg { width: 28px; height: 28px; }
.rv-bubble { flex: 1; background: #3c3936; border-radius: 10px; border-top-left-radius: 3px; padding: 9px 12px 10px; }
.rv-bubble b { display: block; font-family: "Mont", sans-serif; font-weight: 900; font-size: 22px; letter-spacing: .02em; }
.rv-bubble b.loss { color: #f0473b; } .rv-bubble b.win { color: #f4c84a; } .rv-bubble b.draw { color: #ddd; }
.rv-bubble span { display: block; margin-top: 2px; font-size: 14.5px; color: #e2dcd6; }
.rv-graph { margin: 14px 0 12px; height: 64px; border-radius: 6px; overflow: hidden; background: #403d39; }
.rv-graph svg { display: block; width: 100%; height: 100%; }
.rv-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rv-stats div { background: #312e2b; border-radius: 8px; padding: 8px 10px; }
.rv-stats span { display: block; font-size: 11.5px; color: var(--muted); }
.rv-stats b { display: block; margin-top: 2px; font-family: "Mont", sans-serif; font-weight: 900; font-size: 20px; }
.rv-stats b small { font-family: "Inter", sans-serif; font-weight: 600; font-size: 12.5px; margin-left: 3px; }
.rv-stats .up { color: #9fd36c; } .rv-stats .down { color: #f0675d; }
.rv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 14px; margin-top: 14px; }
.rv-item { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.rv-item .badge { margin: 0; width: 24px; height: 24px; font-size: 10px; border-width: 2px; animation: none; }
.rv-item b { margin-left: auto; font-weight: 600; }
.rv-item.zero { opacity: .35; }
.rv-title { margin: 18px 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #a69e98; }
.mv { display: grid; grid-template-columns: 22px 26px 1fr; gap: 0 8px; padding: 9px 0; border-top: 1px solid #34312e; }
.mv:first-child { border-top: 0; }
.mv-n { font-size: 13px; color: #8d847e; padding-top: 4px; }
.mv .badge { margin: 0; width: 26px; height: 26px; font-size: 10.5px; border-width: 2px; animation: none; }
.mv-body { min-width: 0; }
.mv-text { font-size: 15px; font-weight: 500; line-height: 1.3; padding-top: 3px; word-wrap: break-word; }
.mv-coach { margin-top: 3px; font-size: 13px; color: #a9a19b; line-height: 1.3; }
.mv-better { margin-top: 6px; font-size: 13.5px; line-height: 1.3; color: #a6d36f; }
.mv-better b { color: #8d847e; font-weight: 600; margin-right: 4px; }
.mv-retry {
  margin-top: 7px; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 8px;
  background: #3c3936; box-shadow: 0 3px 0 #2a2725; font-size: 13px; font-weight: 600; color: #eae7e3;
}
.mv-retry svg { width: 14px; height: 14px; }
.mv-retry:active { transform: translateY(2px); box-shadow: 0 1px 0 #2a2725; }
.rv-actions { margin-top: 18px; }
.rv-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.rv-left { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 12px; min-height: 16px; }
.rv-actions .link-btn { display: block; margin: 4px auto 0; }

/* ---------- повтор хода ---------- */
.rt-head { display: flex; align-items: center; justify-content: space-between; }
.rt-head b { font-family: "Mont", sans-serif; font-weight: 900; font-size: 20px; }
.rt-chat { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.rt-chat .bubble { font-size: 15.5px; }
.rt-chat .row.old .bubble { opacity: .55; text-decoration: line-through; text-decoration-color: rgba(255,255,255,.35); }
.rt-result { min-height: 0; }
.rt-result .coach { margin-bottom: 10px; }
.rt-better { font-size: 13.5px; color: #a6d36f; margin: -2px 0 10px; }
.rt-composer { margin-top: 4px; }

/* ---------- премиум ---------- */
.pw-sheet { text-align: center; }
.pw-badge { width: 56px; height: 56px; margin: 4px auto 0; border-radius: 14px; background: rgba(240,198,74,.14); color: #f0c64a; display: grid; place-items: center; }
.pw-badge svg { width: 30px; height: 30px; }
.pw-title { margin: 12px 0 0; font-family: "Mont", sans-serif; font-weight: 900; font-size: 24px; }
.pw-text { margin: 6px auto 0; max-width: 340px; font-size: 15px; line-height: 1.35; color: #d8d1cb; }
.pw-list { list-style: none; margin: 18px 0 22px; padding: 0; text-align: left; display: grid; gap: 12px; }
.pw-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 1.3; color: #ece6e1; }
.pw-list svg { flex: none; width: 20px; height: 20px; color: #81b64c; margin-top: 1px; }
.pw-sheet .btn-dark { margin-top: 14px; }
.pw-invite { margin-top: 10px; }
.pw-note { margin-top: 4px; font-size: 12px; color: var(--muted); }

@media (max-height: 640px) {
  .avatar-lg { width: 64px; height: 64px; font-size: 28px; }
  .hero-name b { font-size: 22px; }
}
@media (max-width: 350px) {
  .tiles { gap: 10px 8px; }
  .tile b { font-size: 11.5px; }
}

/* ---------- поделиться ---------- */
.sh-sheet { text-align: center; }
.sh-title { font-family: "Mont", sans-serif; font-weight: 900; font-size: 20px; margin-bottom: 12px; }
.sh-card { position: relative; width: min(56vw, 230px); aspect-ratio: 9 / 16; margin: 0 auto 16px; border-radius: 12px; overflow: hidden; background: #1d1a18; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.sh-card img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .3s; }
.sh-card img.ready { opacity: 1; }
.sh-wait { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: var(--muted); }
.sh-card img.ready + .sh-wait { display: none; }
.sh-sheet .btn-dark { margin-top: 12px; }
.sh-sheet .link-btn { margin-top: 8px; }

/* ---------- профиль, рейтинг, правила ---------- */
.info-sheet { min-height: 46%; }
.info-title { margin: 2px 0 14px; font-family: "Mont", sans-serif; font-weight: 900; font-size: 22px; }
.info-body p { margin: 0 0 12px; font-size: 15px; line-height: 1.4; color: #ddd6d0; }
.info-body b { color: #fff; }
.info-muted { font-size: 13px; color: var(--muted); line-height: 1.35; }
.info-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 10px; margin-top: 14px; }

.pf-head { display: flex; align-items: center; gap: 12px; }
.pf-head .avatar { width: 54px; height: 54px; font-size: 24px; border-radius: 50%; --c: #5e8a3c; }
.pf-name { font-family: "Mont", sans-serif; font-weight: 900; font-size: 20px; line-height: 1.15; word-break: break-word; }
.pf-rank { margin-top: 2px; font-size: 13.5px; color: #c9c1bb; }
.pf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.pf-cell { background: rgba(255,255,255,.05); border-radius: 10px; padding: 10px 8px; text-align: center; }
.pf-cell b { display: block; font-family: "Mont", sans-serif; font-weight: 900; font-size: 20px; }
.pf-cell span { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.pf-next { margin-top: 12px; }
.pf-bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 6px; }
.pf-bar i { display: block; height: 100%; background: #81b64c; border-radius: 3px; }
.pf-card { margin-top: 14px; background: rgba(255,255,255,.05); border-radius: 12px; padding: 12px; }
.pf-card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pf-card-row + .pf-card-row { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.06); }
.pf-card-row b { display: block; font-size: 15px; font-weight: 600; }
.pf-card-row span { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.btn-sm { width: auto; height: 36px; padding: 0 14px; font-size: 14px; flex: none; }
.btn-gold { background: #e8b83e; color: #2a2111; box-shadow: 0 3px 0 #a9801f; }
.btn-gold:active { transform: translateY(2px); box-shadow: 0 1px 0 #a9801f; }

.switch { position: relative; flex: none; width: 50px; height: 30px; border-radius: 15px; background: #4a4441; transition: background .2s; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch.on { background: #81b64c; }
.switch.on::after { transform: translateX(20px); }
.switch:disabled { opacity: .6; }

.top-list { display: grid; gap: 6px; }
.top-row { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: rgba(255,255,255,.04); }
.top-row.me { background: rgba(129,182,76,.16); box-shadow: inset 0 0 0 1.5px rgba(129,182,76,.6); }
.top-place { font-family: "Mont", sans-serif; font-weight: 900; font-size: 15px; color: var(--muted); text-align: center; }
.top-row:nth-child(1) .top-place { color: #f0c64a; } .top-row:nth-child(2) .top-place { color: #cfd3d6; } .top-row:nth-child(3) .top-place { color: #d4935a; }
.top-name { min-width: 0; }
.top-name b { display: block; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-name span { display: block; font-size: 12px; color: var(--muted); }
.top-rating { font-family: "Mont", sans-serif; font-weight: 900; font-size: 16px; }
.top-gap { text-align: center; color: var(--muted); line-height: 1; padding: 2px 0; }
.top-empty { padding: 18px 0; text-align: center; color: #ddd6d0; }

.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 4px 0 16px; }
.legend div { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #ece6e1; }
.legend .badge { margin: 0; width: 28px; height: 28px; font-size: 11px; border-width: 2px; animation: none; }
.info-steps { margin: 0 0 14px; padding-left: 20px; }
.info-steps li { margin-bottom: 8px; font-size: 15px; line-height: 1.4; color: #ddd6d0; }
.info-h { margin: 6px 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #a69e98; }

/* ---------- откуда узнал ---------- */
.ask-card { margin: 0 0 16px; padding: 12px; border-radius: 12px; background: rgba(0,0,0,.3); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.ask-card.hidden { display: none; }
.ask-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ask-head b { font-size: 15px; font-weight: 600; }
.ask-x { width: 30px; height: 30px; border-radius: 8px; color: var(--muted); font-size: 14px; flex: none; }
.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ask-chip { height: 34px; padding: 0 12px; border-radius: 17px; background: rgba(255,255,255,.08); font-size: 14px; font-weight: 600; color: #ece6e1; }
.ask-chip:active { background: rgba(129,182,76,.35); }

/* ---------- статистика ---------- */
.seg { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: rgba(255,255,255,.05); margin-bottom: 12px; }
.seg-btn { flex: 1; height: 32px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: #bdb5af; white-space: nowrap; }
.seg-btn.on { background: #3c3936; color: #fff; }
.kpi { margin-top: 0; }
.kpi .pf-cell { color: inherit; }
.kpi-tab { box-shadow: inset 0 0 0 1.5px transparent; transition: box-shadow .15s; }
.kpi-tab.on { box-shadow: inset 0 0 0 1.5px #81b64c; background: rgba(129,182,76,.1); }
.st-chart { position: relative; margin-top: 14px; padding: 10px 10px 4px; border-radius: 12px; background: rgba(255,255,255,.04); }
.st-chart svg { display: block; touch-action: pan-y; }
.st-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.st-title b { font-size: 13.5px; font-weight: 600; }
.st-title span { font-size: 12px; color: var(--muted); }
.st-val { font: 600 11px Inter, sans-serif; fill: #ece6e1; }
.st-axis { font: 500 10px Inter, sans-serif; fill: #8f8781; }
.st-tip { min-height: 18px; margin-top: 4px; font-size: 12px; color: #ddd6d0; opacity: 0; transition: opacity .15s; }
.st-tip.show { opacity: 1; }
.st-funnel { margin: 10px 0 4px; }
.st-table { display: grid; gap: 4px; }
.st-row { display: grid; grid-template-columns: 1.3fr .8fr 1fr 1fr; gap: 6px; align-items: center; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.04); font-size: 13.5px; }
.st-row b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-row span { color: #ece6e1; }
.st-head { background: none; padding-top: 0; padding-bottom: 2px; }
.st-head span { font-size: 11.5px; color: var(--muted); }
.st-labels { margin: -2px 0 2px; padding: 0 10px 4px; font-size: 12px; color: var(--muted); line-height: 1.35; }
.st-links { display: grid; gap: 6px; margin-bottom: 10px; }
.st-links div { padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.04); }
.st-links span { display: block; font-size: 12px; color: var(--muted); }
.st-links code { display: block; margin-top: 2px; font: 500 13px ui-monospace, Menlo, monospace; color: #e6e0db; word-break: break-all; user-select: all; -webkit-user-select: all; }

/* ---------- готовые ответы ---------- */
.quick { display: none; gap: 8px; overflow-x: auto; padding: 0 16px 8px; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.quick.show { display: flex; }
.quick-chip { flex: none; max-width: 78%; height: 36px; padding: 0 14px; border-radius: 18px; background: rgba(255,255,255,.1);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); font-size: 14px; font-weight: 500; color: #f1ece8;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: chipIn .25s ease both; }
.quick-chip:nth-child(2) { animation-delay: .05s; } .quick-chip:nth-child(3) { animation-delay: .1s; }
.quick-chip:active { background: rgba(129,182,76,.35); }
@keyframes chipIn { from { opacity: 0; transform: translateY(6px); } }

/* ---------- пробная партия ---------- */
.tile .trial-badge {
  position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%); padding: 2px 6px; border-radius: 8px;
  background: #81b64c; color: #fff; font: 700 9.5px Inter, sans-serif; font-style: normal; letter-spacing: .02em;
  box-shadow: 0 0 0 2px var(--base); text-shadow: none; white-space: nowrap;
}

/* ---------- путь игрока ---------- */
.fn { display: grid; gap: 8px; }
.fn-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: #ddd6d0; }
.fn-head b { font-weight: 600; color: #fff; white-space: nowrap; }
.fn-bar { height: 8px; margin-top: 4px; border-radius: 4px; background: rgba(255,255,255,.06); overflow: hidden; }
.fn-bar i { display: block; height: 100%; border-radius: 4px; background: #81b64c; }
