/* Ice Rush — UI «dark luxury» (интерьер: матовый графит + тёплый свет + дерево) */

:root {
  --panel-max: 460px;
  --search-col: 300px;
  --app-vh: 1vh;
  /* База — антрацит, как стены кухни */
  --bg-void: #080808;
  --bg-deep: #0e0e0e;
  --bg-mid: #141414;
  --bg-elev: #1a1a1a;
  --surface: rgba(22, 22, 22, 0.94);
  --surface-2: #181818;
  --surface-inset: #121212;

  --line-hair: rgba(255, 255, 255, 0.06);
  --line-panel: #2c2c2c;
  --line-metal: rgba(200, 198, 192, 0.35);

  --text: #eceae6;
  --text-muted: rgba(236, 234, 230, 0.48);
  --text-soft: rgba(236, 234, 230, 0.72);

  /* Тёплый свет (LED под фасадом), не неон */
  --warm-under: rgba(255, 198, 140, 0.14);
  --warm-glow: rgba(255, 190, 120, 0.22);
  --warm-ring: rgba(255, 200, 150, 0.45);

  /* Дерево — только акцент, матовый дуб */
  --wood-1: #d4c4a8;
  --wood-2: #a89872;
  --wood-3: #7a6b52;
  --wood-shadow: rgba(45, 38, 28, 0.55);

  /* Акценты без неона: тёплые металлы / дерево */
  --accent: #b09a72;
  --accent-2: #c4b59a;
  --ok: #8f9f8e;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --font: "Montserrat", system-ui, -apple-system, sans-serif;
  --shadow-sm: 0 4px 24px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 16px 48px rgba(0, 0, 0, 0.55);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --shadow-occlusion: inset 0 2px 8px rgba(0, 0, 0, 0.35);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Светлая тема — дневной интерьер */
body:not(.theme-dark) {
  --bg-void: #ebe8e3;
  --bg-deep: #f0ede8;
  --bg-mid: #e8e4de;
  --bg-elev: #faf8f5;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-2: #f5f3ef;
  --surface-inset: #ebe7e1;

  --line-hair: rgba(0, 0, 0, 0.06);
  --line-panel: #d4d0c8;
  --line-metal: rgba(80, 78, 72, 0.25);

  --text: #1c1b19;
  --text-muted: rgba(28, 27, 25, 0.5);
  --text-soft: rgba(28, 27, 25, 0.75);

  --warm-under: rgba(180, 140, 90, 0.12);
  --warm-glow: rgba(160, 110, 60, 0.15);
  --warm-ring: rgba(140, 100, 60, 0.35);

  --wood-1: #c4b896;
  --wood-2: #9a8660;
  --wood-3: #6b5d42;
  --wood-shadow: rgba(60, 50, 35, 0.2);

  --accent: #6b5d47;
  --accent-2: #5c5244;
  --ok: #4a6b52;

  --shadow-sm: 0 4px 28px rgba(0, 0, 0, 0.07);
  --shadow-md: 0 20px 50px rgba(0, 0, 0, 0.1);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  --shadow-occlusion: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

html,
body {
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0.02em;
  background: var(--bg-deep);
  background-image:
    linear-gradient(180deg, var(--bg-mid) 0%, var(--bg-deep) 35%, var(--bg-void) 100%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 2px,
      rgba(255, 255, 255, 0.012) 2px,
      rgba(255, 255, 255, 0.012) 3px
    );
  background-attachment: fixed;
}

body:not(.theme-dark) {
  background-image:
    linear-gradient(180deg, #f7f5f1 0%, var(--bg-deep) 60%, #e5e1da 100%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 3px,
      rgba(0, 0, 0, 0.015) 3px,
      rgba(0, 0, 0, 0.015) 4px
    );
}

.shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 14px 18px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.shell-footer {
  margin-top: auto;
  padding: 16px 0 8px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.tg-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  border-radius: 50%;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.tg-link:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.45), 0 0 24px var(--warm-under);
}

.tg-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-deep), 0 0 0 4px var(--warm-ring);
}

.tg-link img {
  width: 44px;
  height: 44px;
  display: block;
  border-radius: 50%;
  object-fit: cover;
}

/* Тёмная тема — синяя иконка (лучше на тёмном фоне); светлая — чёрный круг на светлом */
body.theme-dark .tg-icon--dark {
  display: none;
}

body:not(.theme-dark) .tg-icon--light {
  display: none;
}

body.is-mobile .shell {
  max-width: 100%;
  padding: 10px 12px 24px;
}

/* ——— Шапка: та же ширина, что у основной панели меню ——— */
.top-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: var(--panel-max);
  margin-left: auto;
  margin-right: auto;
  align-self: center;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line-panel);
  box-shadow: var(--shadow-sm), var(--shadow-inset);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
}

/* На экранах входа/регистрации шапка не нужна */
body.hide-nav .top-nav {
  display: none;
}

body.hide-nav .shell {
  gap: 0;
}

body.hide-nav .main-flow {
  padding-top: 0;
}

.top-nav-end {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.top-nav-end .btn-small {
  flex-shrink: 0;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.top-nav-end .nav-chip {
  flex-shrink: 0;
}

/* Тонкая линия «подсветки» снизу — один тон, без радуги */
.top-nav::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--warm-under) 20%,
    rgba(255, 210, 170, 0.18) 50%,
    var(--warm-under) 80%,
    transparent
  );
  pointer-events: none;
  border-radius: 0 0 var(--radius) var(--radius);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-right: auto;
}

/* Маркер: тёмная плоскость + «ручка» как штрих металла */
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(165deg, #222 0%, #0d0d0d 100%);
  border: 1px solid var(--line-panel);
  box-shadow: var(--shadow-occlusion), 0 1px 0 var(--line-metal);
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: 1px;
  background: linear-gradient(90deg, transparent, rgba(200, 196, 188, 0.5), transparent);
  opacity: 0.85;
}

.brand-text {
  font-weight: 700;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-soft);
}

.nav-chip {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--surface-inset);
  border: 1px solid var(--line-panel);
  color: var(--text-muted);
  box-shadow: var(--shadow-inset);
  display: inline-flex;
  align-items: center;
  min-height: 38px;
}

body:not(.theme-dark) .nav-chip {
  background: #fff;
  color: var(--text-muted);
}

/* ——— Контент ——— */
.main-flow {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0 28px;
}

.screen {
  width: 100%;
  display: none;
}

.screen.active {
  display: flex;
  justify-content: center;
}

.panel {
  width: 100%;
  max-width: var(--panel-max);
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line-panel);
  border-radius: var(--radius-lg);
  padding: 24px 22px 22px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* Лёгкий «свет сверху» на панели */
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035) 0%, transparent 35%);
  opacity: 1;
}

body:not(.theme-dark) .panel::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.65) 0%, transparent 40%);
}

.screen.active .panel {
  animation: panelEnter 0.28s var(--ease) both;
}

@keyframes panelEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.title {
  font-weight: 600;
  font-size: 1.65rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
  position: relative;
  z-index: 1;
  color: var(--text);
}

.title.small {
  font-size: 1.35rem;
}

.subtitle {
  margin-top: 10px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 40ch;
  position: relative;
  z-index: 1;
}

.card {
  margin-top: 20px;
  background: var(--surface-2);
  border: 1px solid var(--line-hair);
  border-radius: var(--radius);
  padding: 18px 16px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-inset), var(--shadow-occlusion);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.right {
  text-align: right;
}

.label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
}

.value {
  font-weight: 600;
  margin-top: 6px;
  font-size: 1.02rem;
  color: var(--text-soft);
}

.elo {
  margin-top: 18px;
  text-align: center;
  padding: 22px 18px;
  border-radius: var(--radius);
  background: var(--surface-inset);
  border: 1px solid var(--line-panel);
  position: relative;
  box-shadow: var(--shadow-occlusion);
}

/* Полоска как подсветка под полкой */
.elo::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 2px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, transparent, var(--warm-glow), transparent);
  opacity: 0.65;
}

.elo-num {
  font-size: 3.25rem;
  font-weight: 600;
  color: var(--text);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.elo-label {
  margin-top: 10px;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.actions {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.field {
  display: block;
}

.inline {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.input {
  width: 100%;
  padding: 14px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-panel);
  background: var(--surface-inset);
  color: var(--text);
  font-family: var(--font);
  font-weight: 500;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  box-shadow: var(--shadow-occlusion);
}

body:not(.theme-dark) .input {
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.input:focus {
  border-color: rgba(200, 185, 155, 0.45);
  box-shadow:
    0 0 0 1px rgba(255, 200, 150, 0.12),
    0 6px 20px var(--warm-under);
}

.input::placeholder {
  color: var(--text-muted);
}

/* Chrome/Safari autofill может перекрашивать input в белый — фикс под нашу тему */
.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus,
.input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
  transition: background-color 9999s ease-out 0s;
  box-shadow: 0 0 0 1000px var(--surface-inset) inset !important;
  border: 1px solid var(--line-panel) !important;
}

body:not(.theme-dark) .input:-webkit-autofill,
body:not(.theme-dark) .input:-webkit-autofill:hover,
body:not(.theme-dark) .input:-webkit-autofill:focus,
body:not(.theme-dark) .input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text) !important;
  box-shadow: 0 0 0 1000px #fff inset !important;
}

/* Nickpick: одна колонка, ровные кнопки */
#nickpick .panel {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#nickpick .panel > .title,
#nickpick .panel > .subtitle,
#nickpick .panel > .card {
  width: 100%;
  max-width: var(--search-col);
  margin-left: auto;
  margin-right: auto;
}

#nickpick .actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

#nickpick .actions .btn {
  width: 100%;
  max-width: none;
  margin: 0;
}

/* Auth legacy */
.auth-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.auth-panel {
  --auth-ease: cubic-bezier(0.22, 1, 0.36, 1);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-6px);
  transition:
    max-height 0.5s var(--auth-ease),
    opacity 0.35s var(--auth-ease),
    transform 0.4s var(--auth-ease),
    margin-top 0.35s var(--auth-ease);
  pointer-events: none;
  margin-top: 0;
}

.auth-panel.auth-panel--open {
  max-height: 560px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  margin-top: 14px;
}

.auth-panel-inner {
  padding-bottom: 2px;
}

.auth-panel-hint {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.45;
  font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
  .auth-panel,
  .auth-panel.auth-panel--open {
    transition-duration: 1ms !important;
  }
}

.friends {
  list-style: none;
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  border: 1px solid var(--line-panel);
  display: grid;
  gap: 8px;
}

.friends li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.friend-meta {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.84rem;
}

body.is-mobile .top-nav {
  padding: 10px 12px;
  max-width: min(var(--panel-max), 100%);
}

body.is-mobile .panel {
  max-width: 94vw;
  padding: 20px 16px 18px;
}

body.is-mobile .title {
  font-size: 1.45rem;
}

body.is-mobile .subtitle {
  font-size: 0.86rem;
}

body.is-mobile .btn {
  padding: 14px 16px;
  font-size: 0.88rem;
}

body.is-mobile .game-frame {
  width: min(100vw - 20px, 880px);
  max-width: 100%;
  margin: 0 auto;
}

body.is-mobile .game-frame:hover {
  transform: none;
  box-shadow: var(--shadow-md), var(--shadow-occlusion), 0 0 0 1px rgba(0, 0, 0, 0.5);
}

body:not(.theme-dark).is-mobile .game-frame:hover {
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* Матч: больше места под арену, без «обрезания» по высоте (iOS / Android) */
body.game-active.is-mobile .shell {
  min-height: 100vh;
  min-height: calc(var(--app-vh) * 100);
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}

body.game-active.is-mobile .main-flow {
  flex: 1;
  min-height: 0;
  padding-top: 6px;
  padding-bottom: 8px;
  align-items: stretch;
}

body.game-active.is-mobile .shell-footer {
  display: none;
}

body.game-active.is-mobile #game.screen.active {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 0;
  width: 100%;
}

/* Ширина по доступной высоте: арена целиком влезает в экран */
body.game-active.is-mobile .game-frame {
  width: min(calc(100vw - 20px), calc((calc(var(--app-vh) * 100) - 108px) * 880 / 520));
  max-height: min(calc(calc(var(--app-vh) * 100) - 108px), calc((100vw - 20px) * 520 / 880));
}

body.game-active.is-mobile .top-nav {
  max-width: 100%;
}

body.is-mobile .inline {
  grid-template-columns: 1fr;
}

/* ——— Кнопки: primary = деревянный фасад, secondary = тёмная панель ——— */
.btn {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform 0.18s var(--ease),
    box-shadow 0.22s var(--ease),
    border-color 0.2s var(--ease),
    filter 0.2s var(--ease);
}

.btn-accent {
  background: linear-gradient(180deg, var(--wood-1) 0%, var(--wood-2) 42%, var(--wood-3) 100%);
  color: #1a1612;
  border-color: rgba(40, 35, 28, 0.35);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 6px 0 var(--wood-shadow),
    0 12px 28px rgba(0, 0, 0, 0.35),
    0 8px 24px var(--warm-under);
}

.btn-accent:hover {
  filter: brightness(1.03);
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.28) inset,
    0 7px 0 var(--wood-shadow),
    0 16px 36px rgba(0, 0, 0, 0.4),
    0 10px 32px var(--warm-glow);
}

.btn-accent:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.15) inset,
    0 3px 0 var(--wood-shadow),
    0 6px 16px rgba(0, 0, 0, 0.35);
}

.btn-ghost {
  background: var(--surface-inset);
  border-color: var(--line-panel);
  color: var(--text-soft);
  box-shadow: var(--shadow-inset);
}

.btn-ghost:hover {
  border-color: rgba(200, 185, 155, 0.25);
  background: #1e1e1e;
  box-shadow: var(--shadow-inset), 0 0 24px var(--warm-under);
}

body:not(.theme-dark) .btn-ghost:hover {
  background: #eae6df;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-deep), 0 0 0 4px var(--warm-ring);
}

.btn-small {
  width: auto;
  padding: 8px 14px;
  font-size: 0.65rem;
}

.howto {
  margin-top: 14px;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-muted);
  font-weight: 500;
}

.hidden {
  display: none;
}

.search-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.84rem;
  position: relative;
  z-index: 1;
}

/* Поиск матча: одна колонка по центру — заголовок, мета и кнопки одной ширины */
#search .panel {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#search .panel > .title,
#search .panel > .search-meta,
#search .panel > .search-actions,
#search .panel > .status,
#search .panel > .log,
#search .panel > .found {
  width: 100%;
  max-width: var(--search-col);
  margin-left: auto;
  margin-right: auto;
}

/* Спиннер — всегда квадратная область, иначе при width:100% получается «овал» */
#search .panel > .spinner {
  width: 40px;
  height: 40px;
  max-width: none;
  margin-left: auto;
  margin-right: auto;
  flex-shrink: 0;
  box-sizing: border-box;
}

#search .panel > .title {
  text-align: left;
  align-self: center;
}

#search .search-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-top: 16px;
}

#search .search-actions .btn {
  width: 100%;
  max-width: none;
  margin: 0;
}

.spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--line-panel);
  border-top-color: var(--accent-2);
  animation: spin 0.75s linear infinite;
  margin: 20px auto 14px;
  flex-shrink: 0;
  aspect-ratio: 1;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.status {
  text-align: center;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--accent-2);
  letter-spacing: 0.04em;
}

.log {
  list-style: none;
  margin-top: 14px;
  padding: 12px 14px;
  max-height: 150px;
  overflow: auto;
  background: var(--surface-inset);
  border: 1px solid var(--line-panel);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.82rem;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-shadow: var(--shadow-occlusion);
}

body:not(.theme-dark) .log {
  background: #fff;
}

.log:empty {
  display: none;
}

.log li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line-hair);
}

.log li:last-child {
  border-bottom: none;
}

.ach-list {
  list-style: none;
  margin-top: 10px;
  padding: 12px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  border: 1px solid var(--line-panel);
  color: var(--text-soft);
  font-weight: 500;
  font-size: 0.88rem;
}

body:not(.theme-dark) .ach-list {
  background: #fff;
}

.ach-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--line-hair);
}

.ach-list li:last-child {
  border-bottom: none;
}

.ach-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-panel);
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
}

.found {
  margin-top: 14px;
  text-align: center;
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--ok);
  min-height: 1.2em;
}

.found:empty {
  display: none;
}

/* ——— Игровое поле — монолитный блок, без неоновой рамки ——— */
.game-frame {
  width: min(96vw, 880px);
  max-width: 100%;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line-panel);
  background: #0a0a0a;
  position: relative;
  transition: box-shadow 0.4s var(--ease), transform 0.4s var(--ease);
  box-shadow: var(--shadow-md), var(--shadow-occlusion), 0 0 0 1px rgba(0, 0, 0, 0.5);
  aspect-ratio: 880 / 520;
}

body:not(.theme-dark) .game-frame {
  background: #121212;
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.game-frame:hover {
  transform: translateY(-3px);
  box-shadow:
    var(--shadow-md),
    0 20px 56px rgba(0, 0, 0, 0.55),
    0 0 48px var(--warm-under);
}

body:not(.theme-dark) .game-frame:hover {
  box-shadow: var(--shadow-md), 0 16px 40px rgba(0, 0, 0, 0.12), 0 0 40px var(--warm-under);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 0;
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  background: rgba(8, 8, 8, 0.92);
  color: var(--text);
  font-family: var(--font);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  z-index: 3;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

body:not(.theme-dark) .overlay {
  background: rgba(248, 246, 242, 0.96);
  color: var(--text);
}

.overlay .btn {
  text-transform: uppercase;
  max-width: 260px;
}

.overlay .anim-in {
  animation: overlayIn 0.32s var(--ease) both;
}

.overlay .anim-pop {
  animation: overlayPop 0.48s var(--ease) both;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: none;
  color: var(--text-muted);
}

@keyframes overlayIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes overlayPop {
  0% {
    transform: scale(0.98);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.overlay.visible {
  display: flex;
}
