:root {
  --icon-trophy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3.5h8v5a4 4 0 0 1-8 0Z'/%3E%3Cpath d='M8 5.5H5a3 3 0 0 0 3 4M16 5.5h3a3 3 0 0 1-3 4'/%3E%3Cpath d='M12 12.5V17M8.5 20.5h7M10 17h4v3.5h-4Z'/%3E%3C/svg%3E");
  --bg: #070b18;
  --panel: rgba(14, 20, 40, 0.95);
  --panel-border: rgba(120, 160, 255, 0.18);
  --text: #e9eefc;
  --muted: #8f9bc2;
  --accent: #3cffa4;
  --accent-2: #1b6dff;
  --accent-end: #5ef0ff;
  --danger: #ff3355;
  --radius: 16px;
  color-scheme: dark;
}

/* Акцент интерфейса следует за темой 3D-сцены. */
:root[data-theme="forest"] {
  --bg: #0b140d;
  --panel: rgba(16, 28, 18, 0.95);
  --panel-border: rgba(184, 243, 107, 0.2);
  --muted: #94a88a;
  --accent: #b8f36b;
  --accent-2: #2e7d32;
  --accent-end: #e9ff9a;
}

:root[data-theme="sunset"] {
  --bg: #170a19;
  --panel: rgba(36, 16, 40, 0.95);
  --panel-border: rgba(255, 209, 102, 0.2);
  --muted: #b39bb8;
  --accent: #ffd166;
  --accent-2: #ef476f;
  --accent-end: #ff9f6e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  /* Двойной клик по интерфейсу не выделяет текст. */
  user-select: none;
  -webkit-user-select: none;
  /* Свайп в игре не должен обновлять страницу или листать её «резинкой». */
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

input, textarea { user-select: text; -webkit-user-select: text; }

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hidden { display: none !important; }

/* ---------- Экраны и панели ---------- */
.screen {
  position: fixed;
  inset: 0;
  display: grid;
  /* Одна колонка по ширине экрана: без этого колонка растягивалась под самое
     широкое содержимое, и меню на телефоне вылезало за правый край. */
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  /* Отступы с учётом выреза экрана и полоски «домой» на телефонах. */
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overscroll-behavior: contain;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--bg) 55%, transparent), color-mix(in srgb, var(--bg) 92%, transparent));
  backdrop-filter: blur(6px);
  animation: fade 0.25s ease-out;
  overflow-y: auto;
}

.panel {
  width: min(460px, 100%);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px 24px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  text-align: center;
}

.panel.small { width: min(360px, 100%); }

h1, h2 {
  margin: 0;
  font-family: Unbounded, Inter, sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(34px, 9vw, 52px); line-height: 1; }

h1 span {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

h2 { font-size: 26px; }

.subtitle { margin: 0 0 6px; color: var(--muted); }

.hint, .credits { margin: 4px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.credits a { color: var(--muted); }

.row { display: flex; gap: 10px; }
/* min-width: 0 — кнопки в ряду ужимаются по ширине экрана, а не выталкивают соседей за край. */
.row > * { flex: 1; min-width: 0; }

/* ---------- Кнопки ---------- */
.btn {
  padding: 13px 18px;
  font: 600 15px Inter, sans-serif;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.12s, background 0.2s;
}

.btn:hover { background: rgba(255, 255, 255, 0.12); }
.btn:active { transform: scale(0.97); }

.btn.primary {
  color: #04120b;
  background: linear-gradient(90deg, var(--accent), var(--accent-end));
  border: none;
  font-size: 17px;
  box-shadow: 0 8px 30px color-mix(in srgb, var(--accent) 30%, transparent);
}

.btn:focus-visible, .segmented button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.segmented {
  display: flex;
  padding: 4px;
  gap: 4px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius);
}

.segmented button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  font: 600 14px Inter, sans-serif;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: 12px;
  cursor: pointer;
}

.segmented button small { font-size: 11px; font-weight: 400; opacity: 0.8; }

.segmented button.active {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
}

.segmented.compact button { padding: 8px 4px; font-size: 13px; }

/* ---------- Легенда ---------- */
.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--muted);
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 5px;
  border-radius: 50%;
  vertical-align: -1px;
}

.dot.apple { background: var(--danger); }
.dot.bad { background: #8e44ad; }
.dot.slow { background: #4cc9f0; }
.dot.ghost { background: #fff; }
.dot.stone { background: #5b6378; border-radius: 2px; }

/* ---------- HUD ---------- */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  pointer-events: none;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  min-width: 64px;
  padding: 6px 12px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
}

.hud-stat span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.hud-stat b { font: 800 20px Unbounded, sans-serif; font-variant-numeric: tabular-nums; }

.hud-effects { display: flex; gap: 6px; margin-left: auto; }

.effect {
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid currentColor;
}

.effect.slow { color: #4cc9f0; }
.effect.ghost { color: #fff; }

.icon-btn {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  font-size: 14px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  cursor: pointer;
}

.toast {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  font: 800 clamp(24px, 6vw, 42px) Unbounded, sans-serif;
  color: var(--accent);
  text-shadow: 0 0 30px color-mix(in srgb, var(--accent) 60%, transparent);
  pointer-events: none;
  opacity: 0;
}

.toast.show { animation: toast 1.4s ease-out; }

/* ---------- Конец игры, рекорды ---------- */
.big-score { display: flex; flex-direction: column; margin: 4px 0 8px; }
.big-score span { font: 800 56px Unbounded, sans-serif; line-height: 1; }
.big-score small { color: var(--muted); }

.record-form { display: flex; flex-direction: column; gap: 8px; text-align: left; font-size: 14px; }

input:not([type]), input[type="text"], textarea {
  min-width: 0;
  padding: 12px 14px;
  font: 15px Inter, sans-serif;
  color: var(--text);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
}

.records {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: place;
  text-align: left;
}

.records li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--panel-border);
  counter-increment: place;
}

.records li::before { content: counter(place); color: var(--muted); font-weight: 600; }
.records li b { font-variant-numeric: tabular-nums; }
.records li small { grid-column: 2 / -1; color: var(--muted); font-size: 12px; }
.records .empty { display: block; text-align: center; color: var(--muted); border: none; }
/* Своя строка в общей таблице и лучшая попытка в истории — подсвечены. */
.records li.me, .records li.best { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.records li.best b { color: var(--accent); }
/* История попыток: без номеров мест. */
.records.history li::before { content: none; }
.records.history li { grid-template-columns: 1fr auto; }

.records-me {
  margin: 0;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 12px;
}
.records-me b { color: var(--accent); }

.record-auto { display: flex; flex-direction: column; gap: 6px; }
.record-auto-title { margin: 0; font-weight: 600; color: var(--accent); }
.record-auto .hint { margin: 0; }
.text-btn {
  padding: 0;
  font: inherit;
  color: var(--accent);
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
}
.records .empty::before { content: none; }

/* ---------- Настройки ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  text-align: left;
}

input[type="range"] { width: 100%; accent-color: var(--accent); }

/* ---------- Вдвоём ---------- */
.duo {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px dashed var(--panel-border);
  border-radius: var(--radius);
}

.duo-title {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stack { display: flex; flex-direction: column; gap: 10px; }

#room-link { font-size: 13px; }

.room-code { margin: 0; color: var(--muted); }
.room-code b { color: var(--text); font: 800 20px Unbounded, sans-serif; letter-spacing: 0.15em; }

.vpn-note {
  margin: 0;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 12px;
}

.status { min-height: 1.4em; margin: 0; color: var(--accent); font-weight: 600; }
.status.error { color: var(--danger); }

.you { color: var(--accent); }
.rival { color: #ffb347; }

.hud-duel {
  display: flex;
  gap: 16px;
  padding: 8px 14px;
  font: 600 15px Inter, sans-serif;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
}

.hud-duel b { font: 800 20px Unbounded, sans-serif; font-variant-numeric: tabular-nums; }

.duel-stat { display: none; }
body.duel .duel-stat { display: flex; }
body.duel .solo-stat { display: none; }

.duel-score {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 12px;
  margin: 4px 0 8px;
  font: 800 22px Unbounded, sans-serif;
}

.duel-score i { color: var(--muted); font-style: normal; }

/* ---------- Общие рекорды и отзыв ---------- */
textarea { resize: vertical; min-height: 96px; line-height: 1.4; }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.link-btn {
  padding: 8px;
  font-size: 14px;
  background: none;
  border: none;
  color: var(--muted);
}

.link-btn:hover { color: var(--text); background: none; }

.records .comment { grid-column: 2 / -1; font-style: italic; color: var(--text); opacity: 0.8; font-size: 13px; }
.records .loading { display: block; text-align: center; color: var(--muted); border: none; }
.records .loading::before { content: none; }

/* ---------- Как играть ---------- */
.howto {
  text-align: left;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
}

.howto summary {
  padding: 10px 14px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  list-style: none;
}

.howto summary::-webkit-details-marker { display: none; }
.howto summary::before { content: '▸'; display: inline-block; margin-right: 8px; transition: transform 0.2s; color: var(--accent); }
.howto[open] summary::before { transform: rotate(90deg); }

.howto-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 18px;
  padding: 0 14px 12px;
}

.howto h3 {
  margin: 4px 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.howto ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }

.keys li { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.keys li b { font-weight: 600; }
.keycaps { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); }
.keycaps i { font-style: normal; margin: 0 3px; }

kbd {
  display: inline-block;
  min-width: 22px;
  padding: 2px 5px;
  font: 600 11px Inter, sans-serif;
  text-align: center;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom-width: 2px;
  border-radius: 5px;
}


.items li {
  display: grid;
  grid-template-columns: 12px auto;
  column-gap: 8px;
  align-items: center;
  font-size: 13px;
}

.items li .dot { margin: 0; }
.items li span { grid-column: 2; font-size: 12px; color: var(--muted); }

.howto-note { margin: 10px 0 0; font-size: 12px; line-height: 1.45; color: var(--muted); }
.howto-note b { color: var(--text); font-weight: 600; }

@media (max-width: 520px) {
  .howto-grid { grid-template-columns: 1fr; gap: 12px; }
}

/* ---------- Против бота ---------- */
.bot-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }

.bot-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px;
}

.bot-btn b { font-size: 14px; }
.bot-btn small { font-size: 11px; font-weight: 400; color: var(--muted); }
.bot-btn.legendary { border-color: rgba(255, 200, 80, 0.45); }
.bot-btn.legendary b { color: #ffd166; }

/* Кубок — своя иконка (маска из SVG), цвет — золото легендарных достижений. */
.bot-btn.beaten::after {
  content: '';
  position: absolute;
  top: -8px;
  right: -6px;
  width: 18px;
  height: 18px;
  background: #ffd166;
  -webkit-mask: var(--icon-trophy) center / contain no-repeat;
  mask: var(--icon-trophy) center / contain no-repeat;
}

@media (max-width: 520px) {
  .bot-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Достижения: экран ---------- */
.achievements { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; text-align: left; }

.achievements li {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 2px 12px;
  align-items: center;
  padding: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
}

.achievements li .achievement-icon { grid-row: span 2; }
.achievements li b { font-size: 15px; }
.achievements li span { font-size: 12px; color: var(--muted); }
.achievements li.locked { opacity: 0.45; }
.achievements li.locked .achievement-icon { filter: grayscale(1); }
.achievements li.legendary:not(.locked) { border-color: rgba(255, 200, 80, 0.5); }

.achievement-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  font-size: 26px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2b3550, #1a2036);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.legendary .achievement-icon { background: linear-gradient(135deg, #5a4210, #2b1d05); box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.5); }
.rare .achievement-icon { background: linear-gradient(135deg, #2a2f6b, #161a3d); box-shadow: inset 0 0 0 1px rgba(140, 150, 255, 0.4); }

/* ---------- Достижения: всплывашка как в Steam ---------- */
.achievement-toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.achievement-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(320px, calc(100vw - 32px));
  padding: 12px;
  color: #e9eefc;
  background: linear-gradient(180deg, #23283b, #171b29);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  transform: translateY(140%);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2), opacity 0.3s;
}

.achievement-toast.visible { transform: translateY(0); opacity: 1; }
.achievement-toast.legendary { border-color: rgba(255, 209, 102, 0.6); box-shadow: 0 0 30px rgba(255, 209, 102, 0.25), 0 12px 30px rgba(0, 0, 0, 0.5); }
.achievement-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.achievement-text small { font-size: 11px; color: #8f9bc2; text-transform: uppercase; letter-spacing: 0.06em; }
.achievement-text b { font-size: 15px; }
.achievement-text span { font-size: 12px; color: #b9c2de; }
.achievement-toast.legendary .achievement-text b { color: #ffd166; }

@media (prefers-reduced-motion: reduce) {
  .achievement-toast { transition: none; }
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -70%); }
}

@media (max-width: 520px) {
  .hud { gap: 6px; padding-left: 10px; padding-right: 10px; flex-wrap: wrap; }
  .hud-stat { min-width: 0; padding: 4px 8px; }
  .hud-stat b { font-size: 16px; }
  .panel { padding: 22px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .screen, .toast.show { animation: none; }
}

/* ---------- Телефоны и планшеты ---------- */
/* Сенсорный экран без мыши: прячем клавиатурное, показываем подсказки для пальцев.
   !important — иначе их перебивают более точные правила списков и полей. */
@media not all and (hover: none) and (pointer: coarse) {
  .touch-only { display: none !important; }
}

@media (hover: none) and (pointer: coarse) {
  .keyboard-only { display: none !important; }
  .btn:hover { background: rgba(255, 255, 255, 0.06); }
}

/* Длинные подсказки переносятся, а не растягивают панель. */
.keycaps { flex-wrap: wrap; min-width: 0; }

@media (max-width: 400px) {
  /* Три кнопки в ряд («Рекорды · Достижения · Настройки») на самом узком телефоне. */
  .row { gap: 6px; }
  .row > .btn { padding-left: 4px; padding-right: 4px; font-size: 13px; }
}

@media (max-width: 520px) {
  .screen { padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .panel { gap: 10px; border-radius: 20px; }
  .btn { padding: 12px 14px; }
}

/* Невысокие экраны (телефон боком, маленькие телефоны): меню компактнее. */
@media (max-height: 700px) {
  .panel { gap: 8px; padding-top: 18px; padding-bottom: 18px; }
  h1 { font-size: clamp(28px, 7vh, 44px); }
  .subtitle { margin-bottom: 0; }
}

/* Кнопки-стрелки: крупные, у нижнего края, под большой палец. */
.dpad {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(3, 64px);
  grid-template-rows: repeat(3, 64px);
  grid-template-areas: ". up ." "left . right" ". down .";
  gap: 6px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  z-index: 5;
}

/* Невидимое поле вокруг креста: нажатие чуть мимо кнопки тоже считается (src/ui/dpad.js). */
.dpad::before {
  content: '';
  position: absolute;
  inset: -28px;
}

.dpad button {
  font-size: 22px;
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  touch-action: none;
}

.icon { display: block; width: 1em; height: 1em; margin: auto; }
/* Иконка перед текстом в кнопках, плашках и заголовках. */
.ic { display: inline-flex; vertical-align: -0.18em; margin-right: 0.4em; }
.ic .icon, .record-auto-title .icon, .records b .icon, .effect .icon { display: inline-block; width: 1.1em; height: 1.1em; margin: 0; vertical-align: -0.2em; }
.record-auto-title .icon, .records b .icon { margin-right: 0.3em; }
.achievement-icon .icon { width: 60%; height: 60%; }
.dpad button .icon { width: 26px; height: 26px; }
#btn-pause .icon { width: 18px; height: 18px; }

/* Подсветку включает и снимает src/ui/dpad.js: :active на некоторых телефонах залипает после отпускания. */
.dpad button.pressed { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.dpad [data-dir="UP"] { grid-area: up; }
.dpad [data-dir="LEFT"] { grid-area: left; }
.dpad [data-dir="RIGHT"] { grid-area: right; }
.dpad [data-dir="DOWN"] { grid-area: down; }

/* Плашки «вышла новая версия» и «пройдите обучение» — первыми строками в меню: ничего не перекрывают. */
.update-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 14px;
  font-size: 14px;
  text-align: left;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.update-banner .btn { padding: 8px 14px; font-size: 14px; }
.update-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Номер версии и «Что нового» внизу меню; точка — есть непрочитанные изменения. */
.app-version { margin: 0; font-size: 12px; color: var(--muted); }
.app-version .text-btn { color: var(--muted); }
.dot-new {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 4px;
  vertical-align: 2px;
  border-radius: 50%;
  background: var(--accent);
}

.whats-new { display: flex; flex-direction: column; gap: 14px; text-align: left; max-height: 55vh; overflow-y: auto; }
.whats-new h3 { margin: 0; font-size: 15px; }
.whats-new h3 small { margin-left: 6px; font-weight: 400; color: var(--muted); }
.whats-new b { display: block; margin: 2px 0 4px; color: var(--accent); font-size: 14px; }
.whats-new ul { margin: 0; padding-left: 18px; color: var(--text); font-size: 14px; line-height: 1.45; }

/* Обучение: карточка с заданием под счётом, над полем. */
.tutorial-card {
  position: fixed;
  top: calc(max(12px, env(safe-area-inset-top)) + 64px);
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 24px));
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px 14px;
  text-align: left;
  font-size: 17px;
  line-height: 1.4;
  background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  z-index: 6;
}
.tutorial-card p { margin: 0; }
.tutorial-card b { color: var(--accent); }
.tutorial-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tutorial-title { font-size: 19px; }
.tutorial-progress { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.tutorial-skip {
  padding: 6px 0 6px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}
.tutorial-notice { color: #ffb347; font-weight: 600; min-height: 0; }
.tutorial-notice:empty { display: none; }
.tutorial-card .btn { padding: 10px 12px; font-size: 16px; }

/* Подсказка первых партий — над нижним краем, не перекрывает счёт. */
.first-hint {
  position: fixed;
  left: 50%;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 8px);
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  pointer-events: none;
  z-index: 6;
}

.install-steps { margin: 0; padding-left: 22px; text-align: left; line-height: 1.5; color: var(--muted); }
.install-steps b { color: var(--text); }
