/* --- Roboto (основной текст) --- */
/* Пути от корня игры (как index.html); crossorigin согласован с <link rel="preload"> */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./assets/fonts/Roboto.woff2') format('woff2');
}
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('./assets/fonts/Roboto.woff2') format('woff2');
}

/* --- Material Icons (локальный woff2) --- */
@font-face {
  font-family: 'Material Icons';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./assets/fonts/MaterialIcons-Regular.woff2') format('woff2');
}
/* Размеры иконок только 18 / 24 / 36 / 48 px (рекомендация Material Icons) */
.mi {
  font-family: var(--font-icons, 'Material Icons');
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  width: 1em;
  height: 1em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'liga';
  font-variant: normal;
}
.mi--18 { font-size: 18px; width: 18px; height: 18px; }
.mi--24 { font-size: 24px; width: 24px; height: 24px; }
.mi--36 { font-size: 36px; width: 36px; height: 36px; }
.mi--48 { font-size: 48px; width: 48px; height: 48px; }
.mi--sm { font-size: 18px; width: 18px; height: 18px; }
.mi--md { font-size: 24px; width: 24px; height: 24px; }

/* --- Reset / base --- */
*, *::before, *::after { box-sizing: border-box; }

/*
 * Шрифты везде одинаковые: Roboto (woff2) + системный fallback; иконки — только Material Icons.
 * Размеры — плавно от vmin/dvw, без скачков между брейкпоинтами.
 */
:root {
  --font-text: 'Roboto', system-ui, -apple-system, 'BlinkMacSystemFont', 'Segoe UI', 'Helvetica Neue', sans-serif;
  --font-icons: 'Material Icons';
  --app-max: none;
  --game-pad-x: 0.65rem;
  --game-pad-y: 0.5rem;
  --game-gap: 0.5rem;
  --level-pad: 0.65rem;
  --level-gap: 0.5rem;
  --level-cols: 3;
  --question-card-pref-h: 220px;
  --question-card-floor-h: 88px;
  /* Плитки уровней — одна кривая на всех экранах */
  --tile-font: clamp(1.05rem, 0.5rem + 2.35vmin, 1.42rem);
  --key-height: clamp(38px, 2.35rem + 1.5vmin, 46px);
  /* Базовый кегль UI (подписи, модалки, подсказки) */
  --text-base: clamp(0.875rem, 0.15rem + 2.05vmin, 1rem);
  --text-lg: clamp(1rem, 0.2rem + 2.35vmin, 1.2rem);
  --bar-pad-x: 0.5rem;
}

html {
  margin: 0;
  height: 100%;
  min-height: 100dvh;
  touch-action: manipulation;
  overscroll-behavior-y: none;
  font-family: var(--font-text);
  /* Единый корень rem: плавно на телефоне / планшете / десктопе */
  font-size: clamp(15px, 0.25rem + 2.4vmin, 17px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  height: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  font-family: var(--font-text);
  background-color: #0f1419;
  /* Виньетка по краям (единственный слой фона body) */
  background-image: radial-gradient(
    ellipse 75% 75% at 50% 50%,
    transparent 50%,
    rgba(0, 0, 0, 0.18) 100%
  );
  background-size: 100% 100%;
  background-position: 0 0;
  color: #e8eaed;
  overflow: hidden;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
}

/*
 * Hexagon background: only left and right edges (level-select style).
 * SVG hex outlines, mask fades toward center, no DOM, optional drift.
 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: transparent;
  /* ~50px hex tile: flat-top hex, stroke opacity 0.04–0.07 */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='50' height='44'%3E%3Cpath d='M25,0 L50,12.7 L50,31.2 L25,43.9 L0,31.2 L0,12.7 Z' fill='none' stroke='rgba(162,155,254,0.1)' stroke-width='1.0'/%3E%3C/svg%3E");
  background-size: 70px 62px;
  background-position: 0 0;
  background-repeat: repeat;
  /* Visible on left/right edges, soft fade toward center; center stays empty */
  mask-image: linear-gradient(
    to right,
    black 0%,
    black 22%,
    rgba(0,0,0,0.9) 32%,
    rgba(0,0,0,0.3) 45%,
    rgba(0,0,0,0.3) 55%,
    rgba(0,0,0,0.9) 68%,
    black 78%,
    black 100%
  );
  -webkit-mask-image: linear-gradient(
    to right,
    black 0%,
    black 22%,
    rgba(0,0,0,0.9) 32%,
    rgba(0,0,0,0.3) 45%,
    rgba(0,0,0,0.3) 55%,
    rgba(0,0,0,0.9) 68%,
    black 78%,
    black 100%
  );
  mask-size: 100% 100%;
  -webkit-mask-size: 100% 100%;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    ellipse 70% 70% at 50% 50%,
    transparent 55%,
    rgba(0,0,0,0.22) 100%
  );
}

img, a {
  -webkit-user-drag: none;
  user-drag: none;
}

/* --- WCAG 2.1: видимый фокус клавиатуры (2.4.7 Focus Visible) --- */
:focus {
  outline: none;
}
:focus-visible {
  outline: 3px solid #a29bfe;
  outline-offset: 2px;
}
:focus:not(:focus-visible) {
  outline: none;
}
button:focus-visible,
.key:focus-visible,
.level-tile:focus-visible:not(:disabled),
.modal__btn:focus-visible,
.hint-btn:focus-visible,
.keyboard-ad-btn:focus-visible,
.reward__btn:focus-visible {
  outline-color: #c9b8ff;
  box-shadow: 0 0 0 1px rgba(162, 155, 254, 0.5);
}

/* ТВ (п. 1.6.3): более заметное кольцо фокуса для пульта */
body.device-tv button:focus-visible,
body.device-tv .key:focus-visible,
body.device-tv .level-tile:focus-visible:not(:disabled),
body.device-tv .modal__btn:focus-visible,
body.device-tv .hint-btn:focus-visible,
body.device-tv .keyboard-ad-btn:focus-visible,
body.device-tv .reward__btn:focus-visible {
  outline-width: 4px;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .loading__bar-fill {
    animation: none !important;
    width: 30%;
  }
}

/*
 * Десктоп (широкое окно + обычная мышь): узкая колонка.
 * Планшет / телефон / тач / окно ≤1280px — на всю ширину (iPad часто >768px).
 */
.app {
  height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  width: 100%;
  max-width: var(--app-max);
  margin: 0 auto;
  position: relative;
  flex: 1;
  font-family: var(--font-text);
  background: #0f1419;
  outline: 2px solid #2d3548;
}

/* Кнопки/поля не подменяют шрифт системой */
button,
input,
select,
textarea {
  font-family: inherit;
}

@media (min-width: 1281px) and (hover: hover) and (pointer: fine) {
  :root {
    --app-max: 520px;
  }
  body {
    align-items: center;
  }
  .app {
    border-radius: 0;
    box-shadow: none;
  }
}

/* Планшет: средние отступы, сетка 4 колонки, выше карточка вопроса */
@media (min-width: 600px) and (max-width: 1280px),
  (min-width: 600px) and (hover: none) and (pointer: coarse) {
  :root {
    --game-pad-x: 1rem;
    --game-pad-y: 0.85rem;
    --game-gap: 0.85rem;
    --level-pad: 1.1rem;
    --level-gap: 0.85rem;
    --level-cols: 4;
    --question-card-pref-h: 280px;
    --question-card-floor-h: 100px;
    --bar-pad-x: 0.75rem;
  }
}

/* Только крупный планшет в альбоме */
@media (min-width: 900px) and (max-width: 1280px) {
  :root {
    --level-cols: 5;
    --question-card-pref-h: 300px;
    --question-card-floor-h: 112px;
  }
}

/* Телефон портрет узкий */
@media (max-width: 399px) {
  :root {
    --game-pad-x: 0.5rem;
    --level-pad: 0.5rem;
    --level-gap: 0.45rem;
  }
}

.screen {
  display: none;
  flex-direction: column;
  height: 100%;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.screen.active { display: flex; }

/* --- Loading --- */
.screen--loading {
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #1a2332 0%, #0f1419 50%);
}
.loading__logo {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: rgba(30, 38, 51, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  overflow: hidden;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.loading__logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.loading__text { color: #9aa0a6; margin-bottom: 1rem; }
.loading__bar {
  width: 200px; height: 6px;
  background: #2d3548; border-radius: 3px; overflow: hidden;
}
.loading__bar-fill {
  display: block; height: 100%; width: 30%;
  background: linear-gradient(90deg, #6c5ce7, #a29bfe);
  border-radius: 3px;
  animation: load-bar 1.2s ease-in-out infinite;
}
@keyframes load-bar {
  0% { width: 15%; margin-left: 0; }
  50% { width: 70%; margin-left: 15%; }
  100% { width: 15%; margin-left: 85%; }
}

/* --- App bar (одинаковая высота/сетка на Level select и Game) --- */
.app-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem var(--bar-pad-x, 0.75rem);
  min-height: calc(44px + 1.2rem);
  box-sizing: border-box;
  background: rgba(15, 20, 25, 0.92);
  border-bottom: 1px solid #2d3548;
  flex-shrink: 0;
}
.app-bar--game {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 0.5rem;
}
/* Игра: назад | заголовок слева | монетки справа */
.app-bar--game-play {
  grid-template-columns: 44px minmax(0, 1fr) auto;
}
.app-bar__level-title--near-back {
  grid-column: 2;
  text-align: left;
  justify-self: start;
  padding-left: 0.15rem;
  padding-right: 0.5rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-bar__coins {
  grid-column: 3;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.35rem 0.5rem;
  border-radius: 12px;
  background: #2a3244;
  font-size: 0.95rem;
  font-weight: 800;
  color: #f4d03f;
  flex-shrink: 0;
  line-height: 1;
}
.app-bar__coins-icon.mi {
  font-size: 24px;
  width: 24px;
  height: 24px;
  color: #f4d03f;
}
.app-bar__btn .mi {
  font-size: 24px;
  width: 24px;
  height: 24px;
  line-height: 1;
  vertical-align: middle;
}
.app-bar--game-play #btn-back {
  grid-column: 1;
}
/* Выбор уровней: кубок + счётчик | заголовок | фильтр */
.app-bar--level-select {
  grid-template-columns: auto 1fr 44px;
}
.app-bar__trophy-stat {
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.45rem;
  border-radius: 12px;
  background: #2a3244;
  flex-shrink: 0;
  line-height: 1;
}
.app-bar__trophy-icon.mi {
  flex-shrink: 0;
  font-size: 24px;
  width: 24px;
  height: 24px;
  color: #f4d03f;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}
.app-bar__trophy-count {
  font-size: 1rem;
  font-weight: 800;
  color: #f4d03f;
  min-width: 1.25rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.app-bar--level-select .app-bar__level-title {
  grid-column: 2;
}
.app-bar--level-select #btn-filter-done {
  grid-column: 3;
}
.app-bar__spacer {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  pointer-events: none;
  visibility: hidden;
}
.app-bar__level-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  grid-column: 2;
  grid-row: 1;
}
/* Назад — слева; фильтр — справа (колонка 3) */
#btn-back {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
}
#btn-filter-done {
  grid-column: 3;
  grid-row: 1;
  justify-self: center;
}

.app-bar__btn {
  width: 44px; height: 44px;
  border: none; border-radius: 12px;
  background: #2d3548; color: #e8eaed;
  font-size: 1.25rem; cursor: pointer;
}
.app-bar__btn:active { background: #3d4558; }
.app-bar__btn--filter {
  font-size: 1.1rem;
  line-height: 1;
}
.app-bar__btn--filter[aria-pressed='true'] {
  background: linear-gradient(145deg, #6c5ce7, #5548c4);
  color: #fff;
}

.level-select__empty {
  margin: 0;
  padding: 1.25rem 1.5rem;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.5;
  /* Контраст на тёмном фоне ≥ 4.5:1 (WCAG AA текст) */
  color: #bdc1c6;
  flex-shrink: 0;
}
.level-select__empty[hidden] {
  display: none !important;
}

/* Прогресс загадок внутри уровня — над карточкой */
.game-progress {
  flex-shrink: 0;
}
.game-progress__track {
  height: 10px;
  background: #2d3548;
  border-radius: 6px;
  overflow: hidden;
}
.game-progress__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00b894, #55efc4);
  border-radius: 6px;
  transition: width 0.25s ease;
}

/* --- Level select --- */
.level-select__grid {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: var(--level-pad, 1rem);
  display: grid;
  grid-template-columns: repeat(var(--level-cols, 3), 1fr);
  gap: var(--level-gap, 0.75rem);
  align-content: start;
}
.level-select__grid::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.level-tile {
  aspect-ratio: 1;
  border: none; border-radius: 16px;
  background: linear-gradient(145deg, #2d3548, #1e2633);
  color: #e8eaed;
  font-size: var(--tile-font, 1.35rem);
  font-weight: 700;
  cursor: pointer;
  position: relative;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.level-tile:active { transform: scale(0.98); }
/* Прогресс пака (начат): правый нижний угол */
.level-tile__progress {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(15, 20, 28, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.85rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #9aa0a6;
  line-height: 1.2;
  pointer-events: none;
  z-index: 1;
}
.level-tile--locked {
  opacity: 0.45;
  cursor: pointer;
}
.level-tile--locked:active {
  opacity: 0.6;
}
/* Замок — Material Icons (TTF) */
.level-tile--locked::after {
  content: 'lock';
  font-family: var(--font-icons);
  font-size: 24px;
  font-feature-settings: 'liga';
  line-height: 1;
  position: absolute;
  bottom: 6px;
  right: 6px;
  color: #c4c8d0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
  pointer-events: none;
}

/* Модальное окно разблокировки за рекламу */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}
.modal[hidden] {
  display: none !important;
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}
.modal__card {
  position: relative;
  max-width: 340px;
  width: 100%;
  padding: 1.35rem 1.25rem;
  border-radius: 20px;
  background: linear-gradient(160deg, #1e2633, #151b24);
  border: 1px solid #2d3548;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.modal__text {
  margin: 0 0 1.25rem;
  font-size: 1rem;
  line-height: 1.45;
  color: #e8eaed;
  text-align: center;
}
.modal__actions {
  display: flex;
  gap: 0.65rem;
  justify-content: stretch;
}
.modal__btn {
  flex: 1;
  padding: 0.8rem 0.75rem;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.modal__btn--secondary {
  background: #2d3548;
  color: #e8eaed;
}
.modal__btn--primary {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
}
.modal__btn:active {
  opacity: 0.92;
}
/* Пройденный уровень — кубок по центру, без повторного входа */
.level-tile--done {
  cursor: default;
  opacity: 0.95;
}
.level-tile--done:active {
  transform: none;
  opacity: 0.95;
}
.level-tile--done:disabled {
  opacity: 0.95;
}
.level-tile--done:not(.level-tile--locked)::after {
  content: 'emoji_events';
  font-family: var(--font-icons);
  font-feature-settings: 'liga';
  line-height: 1;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 36px;
  color: #f4d03f;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
  pointer-events: none;
}

/* --- Game --- */
.screen--game { background: #0f1419; }
.game__body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: none;
  padding: var(--game-pad-y, 0.75rem) var(--game-pad-x, 1rem) 1rem;
  display: flex;
  flex-direction: column;
  gap: var(--game-gap, 0.75rem);
}

/*
 * Карточка вопроса: ширина как раньше (100% колонки); высота по умолчанию — pref-h,
 * на низком viewport сжимается до max(floor-h, 26dvh), не ниже floor-h.
 */
.question-card {
  background: linear-gradient(160deg, #1e2633 0%, #151b24 100%);
  border-radius: 20px;
  padding: clamp(0.5rem, 2dvh, 1rem) clamp(0.75rem, 2.5dvw, 1.25rem);
  border: 1px solid #2d3548;
  width: 100%;
  flex: 0 1 auto;
  align-self: stretch;
  box-sizing: border-box;
  min-height: var(--question-card-floor-h, 88px);
  max-height: var(--question-card-pref-h, 220px);
  height: min(
    var(--question-card-pref-h, 220px),
    max(var(--question-card-floor-h, 88px), 26dvh)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.question-card__text {
  margin: 0;
  font-size: var(--text-lg);
  line-height: 1.45;
  color: #e8eaed;
  text-align: center;
  max-width: 100%;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
}

.answer-slots {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  justify-content: center;
  min-height: 44px;
}
/* Пауза после верного слова — без ввода */
.game__body--win-pause .keyboard {
  pointer-events: none;
  opacity: 0.65;
}
/* Анимация «верно» */
.answer-slots--success .answer-slot {
  animation: answer-slot-win 0.45s ease-out both;
  animation-delay: calc(var(--slot-i, 0) * 0.045s);
}
.answer-slots--success .answer-slot:nth-child(1) { --slot-i: 0; }
.answer-slots--success .answer-slot:nth-child(2) { --slot-i: 1; }
.answer-slots--success .answer-slot:nth-child(3) { --slot-i: 2; }
.answer-slots--success .answer-slot:nth-child(4) { --slot-i: 3; }
.answer-slots--success .answer-slot:nth-child(5) { --slot-i: 4; }
.answer-slots--success .answer-slot:nth-child(6) { --slot-i: 5; }
.answer-slots--success .answer-slot:nth-child(7) { --slot-i: 6; }
.answer-slots--success .answer-slot:nth-child(8) { --slot-i: 7; }
.answer-slots--success .answer-slot:nth-child(9) { --slot-i: 8; }
.answer-slots--success .answer-slot:nth-child(10) { --slot-i: 9; }
.answer-slots--success .answer-slot:nth-child(11) { --slot-i: 10; }
.answer-slots--success .answer-slot:nth-child(12) { --slot-i: 11; }
.answer-slots--success .answer-slot:nth-child(13) { --slot-i: 12; }
.answer-slots--success .answer-slot:nth-child(14) { --slot-i: 13; }
.answer-slots--success .answer-slot:nth-child(15) { --slot-i: 14; }
.answer-slots--success .answer-slot:nth-child(16) { --slot-i: 15; }
.answer-slots--success .answer-slot:nth-child(17) { --slot-i: 16; }
.answer-slots--success .answer-slot:nth-child(18) { --slot-i: 17; }
.answer-slots--success .answer-slot:nth-child(19) { --slot-i: 18; }
.answer-slots--success .answer-slot:nth-child(20) { --slot-i: 19; }
.answer-slots--success .answer-slot:nth-child(n + 21) { --slot-i: 20; }
@keyframes answer-slot-win {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  40% {
    transform: scale(1.12);
    background: linear-gradient(180deg, #2ecc71, #27ae60);
    border-color: #55efc4;
    color: #fff;
    box-shadow: 0 0 16px rgba(46, 204, 113, 0.55);
  }
  100% {
    transform: scale(1);
    background: linear-gradient(180deg, #1e8449, #196f3d);
    border-color: #2ecc71;
    color: #eafaf1;
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.3);
  }
}
.answer-slot {
  min-width: 36px; height: 44px;
  border-radius: 10px;
  background: #2d3548;
  border: 2px solid #3d4a5c;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-lg);
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
}
.answer-slot--empty { color: transparent; border-style: dashed; }
/* Следующая клетка для ввода */
.answer-slot--next {
  border-style: solid;
  border-color: #6c5ce7;
  border-width: 2px;
  background: linear-gradient(180deg, #353b5c 0%, #2d3548 100%);
  box-shadow:
    0 0 0 1px rgba(108, 92, 231, 0.35),
    0 0 12px rgba(108, 92, 231, 0.2);
  transform: scale(1.04);
  z-index: 1;
}
/* Буква с подсказки — нельзя стереть ⌫; визуально отлична от ввода с клавиатуры */
.answer-slot--hint {
  background: linear-gradient(160deg, #3d2e1f, #2a2218);
  border-color: #c9a227;
  color: #f4d03f;
  box-shadow: inset 0 0 0 1px rgba(244, 208, 63, 0.25);
}

.hint-buttons,
.keyboard__row--hints {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
  width: 100%;
}
.hint-btn {
  flex: 1;
  min-width: 0;
  max-width: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.7rem;
  border: none;
  border-radius: 12px;
  background: #2d3548;
  color: #e8eaed;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.hint-btn__label {
  flex: 1;
  min-width: 0;
  text-align: left;
}
.hint-btn__price {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  font-weight: 700;
  color: #f4d03f;
  font-size: 0.88rem;
}
.hint-btn__price-num {
  font-variant-numeric: tabular-nums;
}
.hint-btn__price .mi {
  font-size: 18px;
  width: 18px;
  height: 18px;
  color: #f4d03f;
  vertical-align: middle;
}
.hint-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.hint-btn:not(:disabled):active { background: #3d4558; }

/*
 * Прямоугольник сразу: высота = клавиша, ширина ~1.75× (как под таймер).
 * Таймер — тот же кегль, что подписи подсказок (.hint-btn 0.9rem).
 */
.keyboard-ad-btn {
  flex: 0 0 auto;
  width: calc(var(--key-height, 40px) * 1.75);
  min-width: calc(var(--key-height, 40px) * 1.75);
  max-width: calc(var(--key-height, 40px) * 2);
  height: var(--key-height, 40px);
  padding: 0 6px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(145deg, #3d3560, #2d3548);
  border: 1px solid #6c5ce7;
  color: #c9b8ff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
.keyboard-ad-btn--cooldown {
  opacity: 1;
  cursor: default;
}
.keyboard-ad-btn .mi {
  font-size: 18px;
  width: 18px;
  height: 18px;
  color: #c9b8ff;
}
.keyboard-ad-btn__timer {
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #e8eaed;
  line-height: 1;
  white-space: nowrap;
}
.keyboard-ad-btn:disabled:not(.keyboard-ad-btn--cooldown) {
  opacity: 0.4;
  cursor: not-allowed;
}
.keyboard-ad-btn:not(:disabled):active {
  background: #3d4558;
}
.keyboard-ad-btn--cooldown:disabled {
  opacity: 1;
}

.keyboard {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: auto;
  padding-top: 0.5rem;
  width: 100%;
  box-sizing: border-box;
}
/* Одна строка — без переноса; клавиши делят ширину (в т.ч. на 375px) */
.keyboard__row:not(.keyboard__row--hints) {
  display: flex;
  flex-wrap: nowrap;
  justify-content: stretch;
  align-items: stretch;
  width: 100%;
  gap: 3px;
  box-sizing: border-box;
}
.keyboard__row--hints {
  order: -1;
  flex-shrink: 0;
  align-items: center;
}
.key {
  flex: 1 1 0;
  min-width: 0;
  width: 0;
  height: var(--key-height, 40px);
  padding: 0 1px;
  border: none;
  border-radius: 8px;
  background: #2d3548;
  color: #e8eaed;
  font-size: clamp(0.65rem, 0.12rem + 2.1vmin, 0.95rem);
  font-weight: 600;
  cursor: pointer;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
/* Backspace шире одной буквы, но в той же строке */
.key--wide {
  flex: 1.65 1 0;
  min-width: 0;
}
.key--backspace .mi {
  font-size: clamp(16px, 0.5rem + 3.5vmin, 24px);
  width: 1em;
  height: 1em;
  color: #e8eaed;
}
.key:active { background: #4a5568; }

/* --- Reward --- */
.screen--reward {
  align-items: center; justify-content: center;
  background: linear-gradient(180deg, #1a2332, #0f1419);
}
.reward__card {
  text-align: center; padding: 2rem 1.5rem;
  max-width: 320px;
}
.reward__icon {
  width: 80px; height: 80px; margin: 0 auto 1rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #00b894, #55efc4);
  display: flex; align-items: center; justify-content: center;
}
.reward__icon .mi {
  font-size: 48px;
  width: 48px;
  height: 48px;
  color: #0f1419;
}
.reward__title { margin: 0 0 0.5rem; font-size: 1.5rem; }
.reward__subtitle { color: #9aa0a6; margin: 0 0 0.5rem; }
.reward__coins {
  margin: 0 0 1.25rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: #e8eaed;
  text-align: center;
  line-height: 1.4;
}
.reward__coins strong {
  color: #f4d03f;
  font-size: 1.25rem;
  font-weight: 800;
}
.reward__coins .reward__coins-note {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: #9aa0a6;
}
.reward__coins[hidden] {
  display: none !important;
}
.reward__btn {
  display: block; width: 100%;
  margin-bottom: 0.6rem;
  padding: 0.85rem 1rem;
  border: none; border-radius: 14px;
  background: #2d3548; color: #e8eaed;
  font-size: 1rem; font-weight: 600; cursor: pointer;
}
.reward__btn.primary {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
}
.reward__btn--double {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: linear-gradient(145deg, #2d3548, #243044);
  border: 1px solid #6c5ce7;
  color: #c9b8ff;
}
.reward__btn--double .mi {
  font-size: 24px;
  width: 24px;
  height: 24px;
  color: #c9b8ff;
}
.reward__btn--double[hidden] {
  display: none !important;
}
.reward__btn:active { opacity: 0.92; }
