:root {
  --bg: #eef2f7;
  --bg-accent: #dce8f5;
  --surface: #ffffff;
  --text: #1a2332;
  --text-muted: #5c6b7f;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #0ea5e9;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --border: #e2e8f0;
  --shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 2px 12px rgba(15, 23, 42, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --app-vh: 100dvh;
  --topbar-h: clamp(48px, 5.5vh, 60px);
  --layout-w: min(1180px, 96vw);
  --gap: clamp(10px, 1.4vh, 18px);
  --text-sm: clamp(0.78rem, 1.45vh, 0.92rem);
  --text-base: clamp(0.875rem, 1.65vh, 1.05rem);
  --text-lg: clamp(1rem, 2vh, 1.2rem);
  --card-pad: clamp(14px, 2.2vh, 26px);

  /* Шрифты — только для главной (Electric Blue), остальные экраны
     используют старый --font без изменений. */
  --font-display: 'Unbounded', 'Manrope', var(--font);
  --font-body: 'Inter', var(--font);
}

/* Шрифт заголовков — Unbounded (SIL OFL 1.1), начертание Medium; диапазон весов объявлен, чтобы браузер не рисовал «псевдо-жирный».
   Прежний GetVoIP Grotesque (CC BY-ND) заменён по правам. */
@font-face {
  font-family: 'Unbounded';
  src: url('../assets/fonts/Unbounded-500-cyrillic.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Unbounded';
  src: url('../assets/fonts/Unbounded-500-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/Inter-Regular.woff2') format('woff2'),
       url('../assets/fonts/Inter-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/Inter-Medium.woff2') format('woff2'),
       url('../assets/fonts/Inter-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/Inter-SemiBold.woff2') format('woff2'),
       url('../assets/fonts/Inter-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/Inter-Bold.woff2') format('woff2'),
       url('../assets/fonts/Inter-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

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

[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: var(--app-vh);
  height: var(--app-vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

.app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 55% at 50% 42%, rgba(37, 99, 235, 0.14), transparent 70%),
    radial-gradient(ellipse 50% 40% at 15% 10%, rgba(14, 165, 233, 0.12), transparent),
    radial-gradient(ellipse 45% 35% at 92% 18%, rgba(37, 99, 235, 0.08), transparent),
    linear-gradient(165deg, #e8eef8 0%, #eef2f7 45%, #dce8f5 100%);
}

.app-bg::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(90vw, 900px);
  height: min(55vh, 520px);
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, rgba(37, 99, 235, 0.08) 0%, transparent 68%);
  pointer-events: none;
}

.app-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, rgba(238, 242, 247, 0.92) 0%, transparent 22%),
    linear-gradient(180deg, rgba(238, 242, 247, 0.35) 0%, transparent 18%);
  pointer-events: none;
}

.app-bg__map {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(118vw, 1180px);
  transform: translate(-50%, -48%);
  pointer-events: none;
  filter: drop-shadow(0 24px 48px rgba(37, 99, 235, 0.06));
  -webkit-mask-image: radial-gradient(ellipse 88% 78% at 50% 46%, #000 35%, rgba(0, 0, 0, 0.4) 72%, transparent 92%);
  mask-image: radial-gradient(ellipse 88% 78% at 50% 46%, #000 35%, rgba(0, 0, 0, 0.4) 72%, transparent 92%);
}

.app-bg__map svg {
  width: 100%;
  height: auto;
  display: block;
}

.app-bg__map path {
  fill: rgba(37, 99, 235, 0.13);
  stroke: rgba(29, 78, 216, 0.22);
  stroke-width: 0.55;
  vector-effect: non-scaling-stroke;
  transition: fill 0.3s;
}

/* Главная: вращающаяся планета (js/home-globe.js) — canvas на заднем фоне, только на главном экране */
.app-bg__globe {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
body.is-home .app-bg__globe { display: block; animation: globeIn 1.6s ease both; }

/* Появление главного экрана (один раз при загрузке страницы): планета проявляется, текст hero мягко «всплывает» по очереди.
   Анимация включена с первого кадра (скрипты грузятся несколько секунд: иначе текст сначала виден, потом пропадает и появляется заново).
   Класс intro-done ставит js/home-globe.js через 2.4 с после запуска и тем возвращает обычное состояние; при prefers-reduced-motion анимации нет. */
@keyframes globeIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes homeRise {
  from { opacity: 0; transform: translateY(14px); filter: blur(3px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}
html:not(.intro-done) body.is-home .hero__eyebrow,
html:not(.intro-done) body.is-home .hero--electric .hero__title,
html:not(.intro-done) body.is-home .hero--electric .hero__sub,
html:not(.intro-done) body.is-home .hero--electric .hero__cta {
  animation: homeRise 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}
html:not(.intro-done) body.is-home .hero__eyebrow { animation-delay: 0.1s; }
html:not(.intro-done) body.is-home .hero--electric .hero__title { animation-delay: 0.22s; }
html:not(.intro-done) body.is-home .hero--electric .hero__sub { animation-delay: 0.42s; }
html:not(.intro-done) body.is-home .hero--electric .hero__cta { animation-delay: 0.62s; }
@media (prefers-reduced-motion: reduce) {
  body.is-home .app-bg__globe { animation: none; }
  html:not(.intro-done) body.is-home .hero__eyebrow,
  html:not(.intro-done) body.is-home .hero--electric .hero__title,
  html:not(.intro-done) body.is-home .hero--electric .hero__sub,
  html:not(.intro-done) body.is-home .hero--electric .hero__cta { animation: none; }
}

body:not(.is-home) .app-bg__map {
  opacity: 0;
  visibility: hidden;
}

@media (max-width: 640px) {
  .app-bg__map {
    width: 155vw;
    top: 46%;
    transform: translate(-50%, -46%);
    -webkit-mask-image: radial-gradient(ellipse 90% 75% at 50% 48%, #000 28%, rgba(0, 0, 0, 0.35) 70%, transparent 92%);
    mask-image: radial-gradient(ellipse 90% 75% at 50% 48%, #000 28%, rgba(0, 0, 0, 0.35) 70%, transparent 92%);
  }

  .app-bg__map path {
    fill: rgba(37, 99, 235, 0.11);
    stroke: rgba(29, 78, 216, 0.2);
  }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  max-width: var(--layout-w);
  margin: 0 auto;
  padding: clamp(10px, 1.4vh, 14px) clamp(16px, 2vw, 24px);
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
  padding: 4px 0;
}

.logo__icon { font-size: 1.4rem; }

.logo__text {
  font-weight: 800;
  font-size: clamp(0.95rem, 1.8vh, 1.15rem);
}

.topbar__nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.topbar__link {
  border: none;
  background: none;
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.topbar__link:hover { background: rgba(37, 99, 235, 0.08); }

.topbar__link-num { display: none; }

.topbar__link--active {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary-dark);
}

.main {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: var(--layout-w);
  margin: 0 auto;
  padding: clamp(12px, 2vh, 22px) clamp(16px, 2vw, 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.is-home .main {
  padding: clamp(10px, 1.6vh, 18px) clamp(16px, 2vw, 24px);
}

body:not(.is-home) .main {
  padding: clamp(8px, 1.2vh, 14px) clamp(16px, 2vw, 24px);
}

.screen { display: none; }

.screen--active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  animation: fadeIn 0.25s ease;
  overflow: hidden;
}

#screen-setup-solo.screen--active,
#screen-setup-multi.screen--active,
#screen-matchmaking.screen--active,
#screen-results.screen--active,
#screen-leaderboard.screen--active,
#screen-profile.screen--active {
  justify-content: center;
  overflow: hidden;
}

.screen-fit {
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin: auto;
  width: 100%;
}

.panel.card,
.results.card,
.leaderboard.card,
.profile.card {
  padding: clamp(10px, 1.8vh, 18px) clamp(14px, 2vw, 20px);
}

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

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.8);
  padding: var(--card-pad);
}

.card__title {
  margin: 0 0 16px;
  font-size: 1.1rem;
  font-weight: 700;
}

.hero {
  text-align: center;
  margin-bottom: 32px;
}

.hero__badge {
  display: inline-block;
  margin: 0 0 12px;
  padding: 6px 14px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.hero__title {
  margin: 0 0 12px;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.hero__sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 520px;
  margin-inline: auto;
}

.hero--compact {
  text-align: center;
  margin-bottom: 0;
}

.hero__cta {
  margin-top: clamp(10px, 1.6vh, 14px);
  padding: clamp(10px, 1.5vh, 12px) clamp(28px, 4vw, 36px);
}

#screen-home.screen--active {
  gap: var(--gap);
}

.home-layout {
  display: grid;
  grid-template-columns: 1fr min(360px, 36%);
  gap: clamp(12px, 2vh, 20px);
  align-items: stretch;
  margin-bottom: 0;
  flex: 1;
  min-height: 0;
}

.home-layout--single {
  grid-template-columns: 1fr;
}

.home-layout__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.4vh, 14px);
  min-height: 0;
}

.home-progress {
  margin-bottom: clamp(8px, 1.4vh, 14px);
}

.home-progress .card__title {
  margin-bottom: clamp(8px, 1.2vh, 12px);
  font-size: clamp(0.95rem, 1.7vh, 1.05rem);
}

.home-progress__row {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.6vw, 14px);
}

.home-progress__level {
  flex-shrink: 0;
  font-weight: 700;
  font-size: clamp(0.82rem, 1.4vh, 0.92rem);
  color: var(--primary);
}

.home-progress__track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
}

.home-progress__fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}

.home-progress__score {
  flex-shrink: 0;
  font-size: clamp(0.78rem, 1.3vh, 0.86rem);
  color: var(--text-muted);
  white-space: nowrap;
}

.home-lobbies {
  padding: clamp(12px, 2vh, 18px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.home-lobbies__title {
  margin: 0 0 clamp(8px, 1.2vh, 12px);
  font-size: clamp(0.95rem, 2vh, 1.15rem);
  font-weight: 800;
}

.home-lobbies__table-wrap {
  overflow: auto;
  margin-bottom: clamp(8px, 1.2vh, 12px);
  flex: 1;
  min-height: 0;
}

.home-lobbies__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.home-lobbies__table th {
  text-align: left;
  font-weight: 700;
  color: var(--text-muted);
  font-size: clamp(0.65rem, 1.2vh, 0.75rem);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 4px clamp(4px, 0.8vh, 8px);
  border-bottom: 1px solid var(--border);
}

.home-lobbies__table td {
  padding: clamp(5px, 1vh, 9px) 4px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.home-lobbies__row:last-child td {
  border-bottom: none;
}

.home-lobbies__host {
  font-weight: 700;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-lobbies__action {
  text-align: right;
  padding-right: 0;
}

.home-lobbies__action .btn {
  padding: clamp(5px, 1vh, 8px) clamp(10px, 1.4vw, 14px);
  font-size: var(--text-sm);
}

#screen-home .score-rules--compact {
  padding: clamp(12px, 2vh, 18px) clamp(14px, 2vw, 20px);
  flex-shrink: 0;
}

#screen-home .score-rules--compact .card__title {
  margin: 0 0 clamp(6px, 1vh, 10px);
  font-size: clamp(0.95rem, 2vh, 1.1rem);
}

#screen-home .score-rules__grid {
  gap: clamp(8px, 1.4vh, 16px) clamp(12px, 2vw, 20px);
  grid-template-columns: repeat(3, 1fr);
}

#screen-home .score-rules__label {
  margin: 0 0 clamp(2px, 0.5vh, 6px);
  font-size: clamp(0.68rem, 1.25vh, 0.8rem);
}

#screen-home .score-rules__list li {
  padding: 0;
  font-size: clamp(0.78rem, 1.45vh, 0.92rem);
  line-height: 1.35;
}

#screen-home .btn--wide {
  padding: clamp(8px, 1.4vh, 12px) clamp(12px, 1.8vw, 16px);
  font-size: var(--text-sm);
}


.mode-card--duel {
  border-color: rgba(14, 165, 233, 0.3);
  background: linear-gradient(135deg, #fff 0%, #f0f9ff 100%);
}

.mode-card--friend {
  border-color: rgba(100, 116, 139, 0.35);
  background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
}

.setup-badge {
  display: inline-block;
  margin: 0 0 12px;
  padding: 5px 12px;
  background: rgba(14, 165, 233, 0.12);
  color: #0369a1;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

@media (max-width: 860px) {
  .home-layout {
    grid-template-columns: 1fr;
  }

  .home-lobbies {
    position: static;
  }

  .mode-grid--duo {
    grid-template-columns: 1fr;
    max-width: none;
  }
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 0;
}

.mode-grid--solo {
  grid-template-columns: 1fr;
  max-width: 420px;
}

.mode-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: clamp(10px, 1.6vh, 14px);
}

@media (max-width: 720px) {
  .mode-grid--three { grid-template-columns: 1fr; }
}

.mode-section {
  margin-bottom: 20px;
}

.mode-section__title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 800;
}

.mode-section__sub {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 640px;
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.mode-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(37, 99, 235, 0.25);
}

.mode-card--accent {
  border-color: rgba(37, 99, 235, 0.35);
  background: linear-gradient(135deg, #fff 0%, #f0f6ff 100%);
}

.mode-card.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2), var(--shadow);
}

.mode-card__icon { font-size: 1.6rem; }

.mode-card__title {
  font-weight: 700;
  font-size: 1.05rem;
}

.mode-card__desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.score-rules__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}

.score-rules__label {
  margin: 0 0 8px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.score-rules__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.score-rules__list li {
  padding: 4px 0;
  font-size: 0.95rem;
}

.score-rules__list strong {
  color: var(--primary);
  font-weight: 800;
}

.panel {
  max-width: min(720px, 96vw);
  width: 100%;
  margin: auto;
}

.panel--center { text-align: center; }

.panel__title {
  margin: 0 0 clamp(4px, 0.7vh, 8px);
  font-size: clamp(1.05rem, 2.2vh, 1.4rem);
  font-weight: 800;
  flex-shrink: 0;
}

.panel__text {
  margin: 0 0 clamp(6px, 1vh, 12px);
  color: var(--text-muted);
  font-size: clamp(0.85rem, 1.5vh, 0.95rem);
  flex-shrink: 0;
}

.back-btn {
  border: none;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: clamp(0.82rem, 1.4vh, 0.9rem);
  cursor: pointer;
  padding: 0;
  margin-bottom: clamp(2px, 0.5vh, 6px);
  flex-shrink: 0;
}

.back-btn:hover { color: var(--primary); }

#screen-game.screen--active {
  position: relative;
}

.game-back-btn {
  position: absolute;
  top: clamp(8px, 1.2vh, 12px);
  left: clamp(12px, 2vw, 20px);
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

#screen-matchmaking .back-btn {
  align-self: flex-start;
  margin-bottom: clamp(8px, 1vh, 12px);
}

#screen-matchmaking .panel--center {
  align-items: stretch;
}

#screen-results .back-btn {
  margin-bottom: clamp(4px, 0.8vh, 8px);
}

.setup-options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 1.6vh, 18px);
  flex: 1;
  min-height: 0;
}

.setup-options-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#screen-setup-solo .option-group__label,
#screen-setup-multi .option-group__label {
  margin: 0 0 clamp(4px, 0.7vh, 6px);
  font-size: clamp(0.68rem, 1.2vh, 0.78rem);
}

.option-group__label {
  margin: 0 0 8px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.option-group__label:not(:first-of-type) {
  margin-top: 20px;
}

#screen-setup-solo .option-group__label:not(:first-of-type),
#screen-setup-multi .option-group__label:not(:first-of-type) {
  margin-top: 0;
}

.option-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

#screen-setup-solo .option-list,
#screen-setup-multi .option-list {
  gap: clamp(5px, 0.85vh, 8px);
  margin-bottom: 0;
  flex: 1;
  min-height: 0;
}

.option-chip {
  display: flex;
  align-items: center;
  padding: clamp(12px, 2vh, 16px) clamp(14px, 2vw, 18px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: var(--text-base);
}

#screen-setup-solo .option-chip,
#screen-setup-multi .option-chip {
  padding: clamp(7px, 1.15vh, 11px) clamp(10px, 1.4vw, 14px);
  font-size: clamp(0.82rem, 1.45vh, 0.94rem);
  line-height: 1.25;
}

.option-chip:has(input:checked) {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.06);
}

.option-chip--disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.option-chip input { margin-right: 12px; accent-color: var(--primary); }

.option-chip small {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
}

#screen-setup-solo .option-chip small,
#screen-setup-multi .option-chip small {
  font-size: clamp(0.72rem, 1.2vh, 0.8rem);
}

.setup-notice {
  margin: clamp(6px, 1vh, 10px) 0 0;
  padding: clamp(8px, 1.2vh, 10px) clamp(10px, 1.4vw, 12px);
  border-radius: var(--radius-sm);
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.35);
  color: #92400e;
  font-size: clamp(0.82rem, 1.4vh, 0.88rem);
  line-height: 1.35;
  flex-shrink: 0;
}

/* ===== новый каскадный выбор «Что угадывать» (РФ / Мир / Страна) ===== */
.setup-options-grid--single {
  display: block;
  flex: 0 0 auto;
  min-height: auto;
}

.setup-options-grid--single .option-list {
  flex: 0 0 auto;
}

.scope-picker {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  padding-right: 2px;
}

.option-group__label--sub {
  margin-top: clamp(10px, 1.6vh, 16px);
  font-size: clamp(0.7rem, 1.2vh, 0.78rem);
}

.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: clamp(8px, 1.2vh, 12px);
  margin-bottom: clamp(4px, 0.8vh, 8px);
}

.pick-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: clamp(10px, 1.6vh, 14px);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.pick-card:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.35);
}

.pick-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.pick-card__icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--bg-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.pick-card__title {
  font-weight: 700;
  font-size: clamp(0.85rem, 1.5vh, 0.95rem);
}

.pick-card__desc {
  font-size: clamp(0.72rem, 1.2vh, 0.8rem);
  color: var(--text-muted);
  line-height: 1.3;
}

.pick-card__go {
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  width: 100%;
  font-weight: 700;
  font-size: clamp(0.72rem, 1.2vh, 0.8rem);
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.pick-card.is-selected {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.06);
}

.pick-card.is-selected .pick-card__go::after { content: "✓"; }

.pick-card__radio {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.pick-card.is-selected .pick-card__radio {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: inset 0 0 0 3px var(--surface);
}

.setup-notice--info {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.3);
  color: var(--primary-dark);
}

#screen-setup-solo .btn--wide,
#screen-setup-multi .btn--wide {
  flex-shrink: 0;
  margin-top: clamp(8px, 1.2vh, 12px);
  padding: clamp(10px, 1.6vh, 14px);
}

@media (max-width: 640px) {
  .setup-options-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 680px) {
  #screen-setup-solo .panel__text,
  #screen-setup-multi .panel__text {
    display: none;
  }

  #screen-setup-solo .option-chip small,
  #screen-setup-multi .option-chip small {
    display: none;
  }
}

.home-lobbies__row--you .home-lobbies__host {
  color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: clamp(12px, 2vh, 16px) clamp(18px, 2.5vw, 26px);
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--text-base);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
}

.btn--primary:hover { background: var(--primary-dark); }

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn--ghost:hover { background: var(--bg); color: var(--text); }

.btn--wide { width: 100%; }

.btn--small { padding: 8px 16px; font-size: 0.85rem; }

.room-box {
  text-align: center;
  padding: 20px;
  margin-bottom: 20px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.room-box__label {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.room-box__code {
  font-size: clamp(1.5rem, 3.5vh, 2rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--primary);
  margin-bottom: 12px;
}

.friend-wait-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 14px 16px;
  font-size: var(--text-sm);
  color: var(--text-muted);
  background: var(--bg);
  border-radius: var(--radius-sm);
  text-align: center;
}

.spinner--inline {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin: 0;
}

.spinner {
  width: clamp(44px, 6vh, 56px);
  height: clamp(44px, 6vh, 56px);
  margin: 0 auto clamp(16px, 2.5vh, 24px);
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Game */
#screen-game.screen--active {
  overflow: hidden;
  position: relative;
}

.game-countdown {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(238, 242, 247, 0.98);
  backdrop-filter: blur(10px);
}

.game-countdown[hidden] {
  display: none !important;
}

.game-countdown__text {
  margin: 0;
  font-size: clamp(1.75rem, 4.2vh, 2.85rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text);
  text-align: center;
}

.game-layout--countdown {
  visibility: hidden;
  pointer-events: none;
}

.game-layout {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.3vh, 14px);
  flex: 1;
  min-height: 0;
}

.game-top--compact {
  padding: clamp(10px, 1.6vh, 14px) clamp(12px, 2vw, 18px);
  flex-shrink: 0;
}

.game-top__row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.game-top__progress {
  flex: 1 1 120px;
  min-width: 100px;
}

.question-counter {
  font-size: clamp(0.88rem, 1.5vh, 1rem);
  font-weight: 800;
  color: var(--primary);
  min-width: 4.5em;
  text-align: center;
  flex-shrink: 0;
}

.progress-bar {
  height: clamp(4px, 0.6vh, 6px);
  background: var(--bg);
  border-radius: 999px;
  margin-top: clamp(4px, 0.6vh, 6px);
  overflow: hidden;
}

.game-top__scores {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.score-pill {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: clamp(4px, 0.8vh, 7px) clamp(10px, 1.4vw, 14px);
  border-radius: 999px;
  background: var(--bg);
}

.score-pill--you { border: 1px solid rgba(37, 99, 235, 0.25); }
.score-pill--opp { border: 1px solid rgba(217, 119, 6, 0.25); }

.score-pill__label {
  font-size: clamp(0.72rem, 1.3vh, 0.82rem);
  color: var(--text-muted);
  font-weight: 600;
}

.score-pill__value {
  font-size: clamp(1rem, 2vh, 1.2rem);
  font-weight: 800;
  line-height: 1;
}

.timer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
}

.timer {
  position: relative;
  width: clamp(36px, 5vh, 48px);
  height: clamp(36px, 5vh, 48px);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer__value {
  font-size: clamp(0.72rem, 1.3vh, 0.85rem);
  font-weight: 800;
  z-index: 1;
}

.timer-hints {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}

.timer-hint {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width 0.3s ease;
  width: 0%;
}

.timer__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer__ring circle {
  fill: none;
  stroke: var(--border);
  stroke-width: 3;
}

.timer__ring circle:last-child {
  stroke: var(--primary);
  stroke-dasharray: 113;
  stroke-dashoffset: 0;
  transition: stroke 0.2s;
}

.timer--fast .timer__ring circle:last-child { stroke: var(--success); }
.timer--mid .timer__ring circle:last-child { stroke: var(--warning); }
.timer--slow .timer__ring circle:last-child { stroke: var(--text-muted); }

.timer-hint--fast.timer-hint--active { background: rgba(5, 150, 105, 0.15); color: var(--success); }
.timer-hint--mid.timer-hint--active { background: rgba(217, 119, 6, 0.15); color: var(--warning); }
.timer-hint--slow.timer-hint--active { background: rgba(92, 107, 127, 0.15); color: var(--text-muted); }

.question-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.question-type {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  padding: 3px 8px;
  background: rgba(37, 99, 235, 0.1);
  border-radius: 999px;
}

.demo-switch {
  border: 1px dashed var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
}

.demo-switch:hover { border-color: var(--primary); color: var(--primary); }

.question-card--game {
  padding: clamp(14px, 2.2vh, 22px) clamp(16px, 2.4vw, 24px);
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
}

.question-card__spacer {
  flex: 1 1 auto;
  min-height: 0;
}

.question-card__prompt {
  margin: 0 0 clamp(10px, 1.6vh, 14px);
  font-size: clamp(1rem, 2.2vh, 1.28rem);
  font-weight: 700;
  line-height: 1.3;
  flex-shrink: 0;
}

.question-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: clamp(120px, 26vh, 300px);
  margin-bottom: clamp(10px, 1.6vh, 16px);
  padding: clamp(12px, 2vh, 18px);
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.question-visual--map {
  flex: 0 0 auto;
  height: clamp(240px, 42vh, 380px);
  min-height: clamp(240px, 42vh, 380px);
  max-height: clamp(240px, 42vh, 380px);
  padding: clamp(8px, 1.4vh, 12px) clamp(10px, 1.6vw, 14px) clamp(6px, 1vh, 10px);
  margin-bottom: clamp(10px, 1.4vh, 14px);
  background: #e8f4fb;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  justify-content: flex-start;
}

.question-visual--map .map-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  min-height: 0;
  height: 100%;
}

.question-visual--map .map-fit {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.question-visual--map .map-panzoom {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: 50% 50%;
}

.question-visual--map .map-fit .map-svg {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.question-visual--map .map-wrap--loupe {
  height: 100%;
}

.question-visual--map .map-wrap--loupe .map-svg {
  max-height: 100%;
}

.question-visual--map .map-caption {
  flex: 0 0 auto;
  margin: clamp(4px, 0.8vh, 8px) 0 0;
  font-size: clamp(0.72rem, 1.3vh, 0.85rem);
}

.question-visual--flag {
  flex: 0 0 auto;
  min-height: clamp(100px, 20vh, 240px);
  max-height: min(42vh, 340px);
  padding: clamp(10px, 1.6vh, 16px);
  overflow: visible;
}

.question-visual--code {
  flex: 0 0 auto;
  flex-direction: column;
  min-height: clamp(96px, 18vh, 200px);
  max-height: min(36vh, 240px);
  padding: clamp(12px, 2vh, 18px) 12px;
}

.question-visual--capital {
  flex: 0 0 auto;
  flex-direction: column;
  min-height: clamp(96px, 18vh, 200px);
  max-height: min(36vh, 240px);
  padding: clamp(12px, 2vh, 18px) 12px;
}




.answers {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(8px, 1.2vh, 12px);
  flex: 0 0 auto;
  min-height: calc(2 * clamp(48px, 8.5vh, 64px) + clamp(8px, 1.2vh, 12px));
}

.formula-strip--compact {
  padding: clamp(8px, 1.4vh, 12px) clamp(14px, 2vw, 20px);
  font-size: clamp(0.82rem, 1.55vh, 0.95rem);
  flex-shrink: 0;
}

.formula-strip--compact .formula-strip__note {
  font-size: clamp(0.72rem, 1.35vh, 0.85rem);
}

@media (max-width: 520px) {
  .game-top__row {
    gap: 8px;
  }

  .timer-hints {
    display: none;
  }
}

/* Flag display */
.flag-display {
  --flag-max-w: min(100%, clamp(280px, 48vw, 520px));
  --flag-max-h: min(34vh, 280px);
  flex-shrink: 0;
}

.flag-display__inner {
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

.flag-display:not(.flag-display--photo) {
  width: var(--flag-max-w);
  max-width: var(--flag-max-w);
  aspect-ratio: 3 / 2;
  max-height: var(--flag-max-h);
  display: grid;
  place-items: center;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.flag-display--photo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: var(--flag-max-w);
  max-height: var(--flag-max-h);
  line-height: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.flag-display__img {
  display: block;
  max-width: var(--flag-max-w);
  max-height: var(--flag-max-h);
  width: auto;
  height: auto;
  border-radius: 8px;
}

.flag-display--photo.flag-display--broken::after {
  content: 'Флаг не загрузился';
  display: block;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

/* Plate */
.plate-wrap {
  width: min(100%, clamp(420px, 52vw, 640px));
  margin: 0 auto;
  line-height: 0;
}

.plate-photo {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
  image-rendering: auto;
}

.plate-wrap--missing {
  padding: 24px;
  text-align: center;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.plate-missing {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* Map */
.map-wrap {
  width: 100%;
  max-width: 100%;
}

.map-wrap > .map-svg {
  width: auto;
  height: auto;
  display: block;
}

.map-caption {
  margin: 10px 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.map-wrap svg .map-landmass {
  fill: #9fb0c4;
  stroke: none;
  pointer-events: none;
}

.map-wrap svg .map-region--base {
  fill: #fbfcfd;
  stroke: #8b97a4;      /* границы стран и регионов: темнее прежних #aeb7bf, но тонкие */
  stroke-width: 0.3px;
  vector-effect: non-scaling-stroke;
  shape-rendering: geometricPrecision;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: 1;
}

.map-wrap svg .map-region--context {
  fill: #d8dde1;
  stroke: #aeb7bf;      /* серые страны других континентов — прежние тонкие светлые границы (усилены только белые: .map-region--base) */
  stroke-width: 0.12px;
  vector-effect: non-scaling-stroke;
  shape-rendering: geometricPrecision;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: 1;
}

.map-wrap--placing .map-panzoom { visibility: hidden; }

.map-wrap.map-wrap--country-world svg .map-region--base { stroke-width: calc(0.5px * var(--zk, 1)); }
.map-wrap.map-wrap--country-world svg .map-region--context { stroke-width: calc(0.25px * var(--zk, 1)); }
.map-wrap.map-wrap--country-world svg .map-region--highlight { stroke-width: calc(0.5px * var(--zk, 1)); }

.map-wrap svg .map-region--highlight {
  fill: #f3c94d;
  stroke: #f3c94d;     /* тот же цвет, что и заливка: тёмной обводки у выбранной страны нет */
  stroke-width: 0.5px;
  vector-effect: non-scaling-stroke;
  opacity: 1;
  filter: none;
}

.map-wrap svg .map-region-label[data-mode="hidden"] { display: none; }

.map-wrap svg .map-region-label {
  display: block;
  visibility: hidden;   /* скрыта до ответа, но размеры уже измеряются (см. fitMapRegionLabels) */
  fill: #243746;
  font-size: 22px;
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 5px;
  stroke-linejoin: round;
  pointer-events: none;
}

.map-wrap svg .map-neighbor-label {
  display: none;
}

.map-wrap--world-context svg .map-region-label {
  font-size: 10px;
  stroke-width: 2.5px;
}

.map-wrap--world-context svg .map-sea-label {
  fill: #2f7188;
  font-size: 2.8px;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.01em;
  opacity: 1;
  paint-order: stroke;
  stroke: rgba(145, 201, 223, 0.92);
  stroke-width: 0.45px;
  stroke-linejoin: round;
  pointer-events: none;
}

.map-context {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
  min-height: 22px;
  padding: 0 2px 4px;
}

.map-context__continent {
  color: #334155;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.is-game .map-context__continent {
  color: #29485a;
}

.question-visual--map-revealed .map-wrap svg .map-region-label[data-mode="normal"],
.question-visual--map-revealed .map-wrap svg .map-inset-name {
  display: block;
  visibility: visible;
  fill: #1d2b38;
  stroke: rgba(255, 255, 255, 0.85);   /* тонкая светлая подложка только под текстом — для читаемости на границах стран */
}

.map-wrap--full .map-region--highlight {
  stroke-width: 0.5px;
  filter: none;
}

.map-marker {
  fill: rgba(22, 113, 168, 0.18);
  stroke: #1671a8;
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.map-marker--pulse {
  animation: map-marker-pulse 1.6s ease-in-out infinite;
}

@keyframes map-marker-pulse {
  0%, 100% { opacity: 0.55; stroke-width: 2; }
  50% { opacity: 1; stroke-width: 3; }
}

.map-loupe__ring {
  fill: #ffffff;
  stroke: #2563eb;
  stroke-width: 3.5;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 4px 14px rgba(37, 99, 235, 0.35));
}

.map-loupe .map-region--base {
  opacity: 0.55;
}

.map-loupe .map-region--highlight {
  stroke-width: 3;
}

.map-error {
  color: var(--danger);
  text-align: center;
}

.flag-display--moscow .flag-moscow {
  background: #D52B1E;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.flag-moscow__svg {
  width: 56%;
  height: auto;
  opacity: 0.95;
}

.answer-btn {
  padding: clamp(12px, 2vh, 18px) clamp(12px, 1.6vw, 16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: clamp(0.9rem, 1.8vh, 1.05rem);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  min-height: clamp(48px, 8.5vh, 64px);
  box-sizing: border-box;
}

.answer-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.04);
}

.answer-btn:disabled { cursor: default; opacity: 0.85; }

.answer-btn--correct {
  border-color: var(--success);
  background: rgba(5, 150, 105, 0.1);
  color: var(--success);
}

.answer-btn--wrong {
  border-color: var(--danger);
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
}

.answer-btn--revealed {
  border-color: var(--success);
  background: rgba(5, 150, 105, 0.06);
}

.attempt-info {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  flex-shrink: 0;
}

.game-status {
  flex: 0 0 auto;
  height: clamp(88px, 12vh, 104px);
}

.feedback {
  margin-top: 12px;
  height: clamp(44px, 6.5vh, 52px);
  flex: 0 0 clamp(44px, 6.5vh, 52px);
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
}

.feedback.feedback--visible {
  opacity: 1;
  pointer-events: auto;
}

.feedback--success { background: rgba(5, 150, 105, 0.12); color: var(--success); }
.feedback--error { background: rgba(220, 38, 38, 0.1); color: var(--danger); }
.feedback--neutral { background: var(--bg); color: var(--text-muted); }

.formula-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 20px;
  font-size: 0.9rem;
}

.formula-strip strong { color: var(--primary); }

.formula-strip__note {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Results */
.results {
  max-width: min(620px, 96vw);
  width: 100%;
  margin: 0 auto;
  text-align: center;
  padding: 0;
}

.results__lead {
  margin: 0 0 2px;
  color: var(--text-muted);
  font-size: clamp(0.8rem, 1.4vh, 0.9rem);
  flex-shrink: 0;
}

.results__xp {
  margin: 0 0 clamp(6px, 1vh, 10px);
  font-size: clamp(1.9rem, 4.2vh, 2.5rem);
  font-weight: 800;
  color: var(--primary);
  flex-shrink: 0;
}

.results__record {
  display: inline-block;
  margin: 0 auto clamp(10px, 1.6vh, 14px);
  padding: clamp(3px, 0.5vh, 4px) clamp(10px, 1.4vw, 12px);
  background: rgba(217, 119, 6, 0.12);
  color: var(--warning);
  border-radius: 999px;
  font-size: clamp(0.78rem, 1.35vh, 0.85rem);
  font-weight: 700;
  flex-shrink: 0;
}

.results-level {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 clamp(10px, 1.6vh, 14px);
  flex-shrink: 0;
}

.results-level__track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
}

.results-level__fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}

.results-level__label {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.results-streak {
  margin: 0 0 clamp(10px, 1.6vh, 14px);
  font-size: clamp(0.8rem, 1.4vh, 0.88rem);
  color: var(--text-muted);
  flex-shrink: 0;
}

.results__players {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.4vw, 22px);
  margin-bottom: clamp(14px, 2vh, 18px);
  flex-shrink: 0;
}

.results-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.results-player__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.results-player__name {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.results-player__score {
  font-size: 1.2rem;
  font-weight: 800;
}

.results-player__vs {
  font-size: 1rem;
  color: var(--text-muted);
}

.results-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: clamp(14px, 2vh, 18px);
  flex: 1;
  min-height: 0;
}

.results-stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: clamp(10px, 1.6vh, 14px) 8px;
  text-align: center;
}

.results-stat-card__value {
  font-size: clamp(1rem, 1.9vh, 1.2rem);
  font-weight: 800;
  margin-bottom: 4px;
}

.results-stat-card__label {
  font-size: clamp(0.68rem, 1.15vh, 0.76rem);
  color: var(--text-muted);
}

.results__actions {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1vh, 8px);
  flex-shrink: 0;
}

.results__actions .btn {
  padding: clamp(10px, 1.5vh, 13px) clamp(16px, 2vw, 20px);
}

.results__actions-row {
  display: flex;
  gap: clamp(6px, 1vh, 8px);
}

.results__actions-row .btn { flex: 1; }

.question-visual--map .map-wrap--full .map-fit,
.question-visual--map .map-wrap--zoom .map-fit {
  flex: 1 1 auto;
}

.question-visual--map .map-wrap--zoom .map-fit {
  position: relative;
}

.map-overview {
  position: absolute;
  right: clamp(6px, 1.2vw, 10px);
  bottom: clamp(6px, 1vh, 10px);
  z-index: 2;
  width: clamp(112px, 28vw, 158px);
  padding: 6px 7px 5px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.55);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  pointer-events: none;
}

.map-overview__svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
  flex: none;
}

.map-overview__land {
  filter: drop-shadow(0 1px 0 rgba(15, 23, 42, 0.12));
}

.map-overview__silhouette,
.map-overview__base {
  fill: #8fa3b8;
  stroke: none;
}

.map-overview__focus .map-overview__hi {
  fill: #2563eb;
  stroke: #fff;
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}

.map-overview__frame {
  fill: none;
  stroke: #2563eb;
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 4 3;
  opacity: 0.85;
}

.map-overview__label {
  display: block;
  margin-top: 3px;
  text-align: center;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.profile {
  max-width: min(680px, 96vw);
  width: 100%;
  margin: 0 auto;
}

.profile__title {
  margin: 0 0 4px;
  font-size: clamp(1.1rem, 2.2vh, 1.45rem);
  font-weight: 800;
}

.profile__note {
  margin: 0 0 clamp(10px, 1.4vh, 14px);
  color: var(--text-muted);
  font-size: clamp(0.78rem, 1.35vh, 0.88rem);
}

.profile__section-title {
  margin: clamp(10px, 1.6vh, 16px) 0 clamp(8px, 1.2vh, 10px);
  font-size: clamp(0.92rem, 1.6vh, 1.02rem);
  font-weight: 700;
}

.profile-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.profile-stat {
  padding: clamp(10px, 1.4vh, 12px);
  background: var(--bg);
  border-radius: var(--radius-sm);
  text-align: center;
}

.profile-stat__label {
  display: block;
  font-size: clamp(0.7rem, 1.2vh, 0.78rem);
  color: var(--text-muted);
  margin-bottom: 4px;
}

.profile-stat__value {
  font-size: clamp(1.1rem, 2vh, 1.35rem);
  font-weight: 800;
  color: var(--primary);
}

.profile-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.profile-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: clamp(10px, 1.4vh, 12px);
  background: var(--bg);
  border-radius: var(--radius-sm);
  text-align: center;
}

.profile-type-card__icon { font-size: 1.25rem; }

.profile-type-card__name {
  font-weight: 700;
  font-size: clamp(0.82rem, 1.4vh, 0.92rem);
}

.profile-type-card__meta {
  font-size: clamp(0.72rem, 1.2vh, 0.8rem);
  color: var(--text-muted);
}

.profile-mode-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-mode-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: clamp(10px, 1.4vh, 12px);
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: clamp(0.82rem, 1.4vh, 0.92rem);
}

.profile-mode-row strong {
  text-align: right;
  font-weight: 700;
}

@media (max-width: 520px) {
  .profile-summary,
  .profile-type-grid {
    grid-template-columns: 1fr;
  }

  .profile-mode-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-mode-row strong { text-align: left; }
}

/* Профиль — состояние «ещё не играл» */
.profile-empty {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: clamp(24px, 4vh, 36px) clamp(16px, 3vw, 24px);
  text-align: center;
}

.profile-empty__title {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: clamp(0.95rem, 1.7vh, 1.05rem);
}

.profile-empty__note {
  margin: 0 0 clamp(14px, 2.2vh, 18px);
  color: var(--text-muted);
  font-size: clamp(0.8rem, 1.35vh, 0.88rem);
}

.profile-empty .btn { width: auto; padding-left: 24px; padding-right: 24px; }

/* Профиль — уровень и полоса опыта (визуальная заглушка, см. КОНТЕКСТ.md) */
.profile-level {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 clamp(10px, 1.6vh, 14px);
}

.profile-level__icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.profile-level__pill {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
}

.profile-xp {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: clamp(14px, 2.2vh, 20px);
}

.profile-xp__track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
}

.profile-xp__fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}

.profile-xp__label {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Профиль — карточки метрик (по типам заданий / по режимам) */
.profile-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.profile-metric-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  text-align: center;
}

.profile-metric-card__value {
  padding: clamp(12px, 1.8vh, 16px) 8px clamp(8px, 1.2vh, 10px);
  font-size: clamp(1.05rem, 2vh, 1.3rem);
  font-weight: 800;
}

.profile-metric-card__label {
  padding: clamp(8px, 1.2vh, 10px) 8px;
  border-top: 1px solid var(--border);
  font-size: clamp(0.72rem, 1.2vh, 0.8rem);
  color: var(--text-muted);
}


/* Leaderboard */
.leaderboard {
  max-width: min(680px, 96vw);
  width: 100%;
  margin: 0 auto;
  padding: 0;
}

.leaderboard__title {
  margin: 0 0 clamp(4px, 0.7vh, 6px);
  font-size: clamp(1.1rem, 2.2vh, 1.45rem);
  font-weight: 800;
  flex-shrink: 0;
}

.leaderboard__note {
  margin: 0 0 clamp(8px, 1.2vh, 12px);
  color: var(--text-muted);
  font-size: clamp(0.78rem, 1.35vh, 0.88rem);
  flex-shrink: 0;
}

.level-bar {
  margin-bottom: clamp(8px, 1.2vh, 12px);
  padding: clamp(10px, 1.5vh, 14px);
  background: var(--bg);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.level-bar span:first-child {
  font-size: clamp(0.78rem, 1.3vh, 0.85rem);
  color: var(--text-muted);
}

.level-bar__track {
  height: clamp(6px, 0.9vh, 8px);
  background: var(--border);
  border-radius: 999px;
  margin: clamp(6px, 0.9vh, 8px) 0;
  overflow: hidden;
}

.level-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
}

.level-bar__label {
  font-size: clamp(0.78rem, 1.3vh, 0.85rem);
  font-weight: 700;
  color: var(--primary);
}

.leaderboard__table-wrap {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.leaderboard__table-wrap .lb-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(0.78rem, 1.35vh, 0.88rem);
}

.lb-table th {
  text-align: left;
  padding: clamp(6px, 1vh, 8px) clamp(6px, 0.8vw, 8px);
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: clamp(0.68rem, 1.15vh, 0.75rem);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lb-table td {
  padding: clamp(6px, 1vh, 9px) clamp(6px, 0.8vw, 8px);
  border-bottom: 1px solid var(--border);
}

@media (max-height: 680px) {
  .leaderboard__note {
    display: none;
  }
}

.lb-table tr:first-child td { font-weight: 700; }
.lb-table tr:nth-child(2) td,
.lb-table tr:nth-child(3) td { color: var(--text); }

.lb-rank {
  font-weight: 800;
  color: var(--text-muted);
  width: 32px;
}

.lb-rank--gold { color: #ca8a04; }
.lb-rank--silver { color: #64748b; }
.lb-rank--bronze { color: #b45309; }

.lb-you {
  background: rgba(37, 99, 235, 0.06);
}

/* Nick modal */
.nick-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.45);
}

.nick-modal[hidden] { display: none; }

.confirm-modal__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.confirm-modal__actions .btn {
  min-width: 96px;
}

.hosted-room-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: var(--gap);
  padding: clamp(12px, 1.8vh, 16px) clamp(14px, 2vw, 18px);
  border: 1px solid rgba(37, 99, 235, 0.22);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(14, 165, 233, 0.06));
}

.hosted-room-banner[hidden] { display: none; }

.hosted-room-banner__title {
  margin: 0 0 4px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary);
}

.hosted-room-banner__code {
  margin: 0;
  font-size: clamp(1.1rem, 2.2vh, 1.35rem);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.hosted-room-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-lobbies__yours {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary);
}

.nick-modal__box {
  width: min(100%, 360px);
  padding: var(--card-pad);
  text-align: center;
}

.nick-modal__title {
  margin: 0 0 8px;
  font-size: var(--text-lg);
}

.nick-modal__text {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.nick-modal__input,
.join-code-input {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.join-code-box {
  margin-top: 12px;
}

.home-lobbies__empty {
  text-align: center;
  color: var(--text-muted);
  padding: 16px 8px;
  font-size: var(--text-sm);
}

.opp-status {
  font-size: 0.75rem;
  color: var(--warning);
  font-weight: 600;
  margin-top: 2px;
}

/* Mobile game layout */
@media (max-width: 720px) {
  body:not(.is-home) .main {
    padding: 6px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  #screen-game.screen--active {
    overflow: hidden;
  }

  .game-back-btn {
    position: static;
    align-self: flex-start;
    margin: 0 0 6px;
    padding: 4px 8px;
    box-shadow: none;
    background: transparent;
  }

  .game-layout {
    gap: 6px;
  }

  .game-top--compact {
    padding: 8px 10px;
  }

  .game-top__row {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .game-top__progress {
    flex: 1 1 auto;
    min-width: 0;
  }

  .game-top__scores {
    flex: 0 0 auto;
  }

  .timer-row {
    flex-shrink: 0;
  }

  .question-card--game {
    padding: 10px 10px 8px;
    overflow: hidden;
  }

  .question-card__head {
    margin-bottom: 4px;
  }

  .question-card__prompt {
    margin: 0 0 8px;
    font-size: 0.98rem;
    line-height: 1.25;
  }

  .question-card__spacer {
    display: none;
  }

  .question-visual {
    min-height: 0;
    margin-bottom: 8px;
    padding: 8px;
  }

  .question-visual--map {
    flex: 1 1 auto;
    height: auto;
    min-height: 140px;
    max-height: none;
    padding: 6px 6px 4px;
    margin-bottom: 8px;
  }

  .question-visual--map .map-caption {
    display: none;
  }

  .question-visual--flag,
  .question-visual--code {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    padding: 8px;
    overflow: hidden;
  }

  .flag-display {
    --flag-max-w: min(100%, 420px);
    --flag-max-h: min(28vh, 180px);
  }

  .plate-wrap {
    width: min(100%, 520px);
  }

  .answers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-height: 0;
  }

  .answer-btn {
    min-height: 48px;
    padding: 10px 8px;
    font-size: 0.84rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  .game-status {
    height: auto;
    min-height: 0;
  }

  .attempt-info {
    margin-top: 6px;
    font-size: 0.75rem;
  }

  .feedback {
    margin-top: 6px;
    height: auto;
    min-height: 36px;
    flex: 0 0 auto;
    padding: 6px 10px;
    font-size: 0.82rem;
  }
}

@media (max-width: 720px) and (max-height: 700px) {
  .question-visual--map {
    min-height: 110px;
  }

  .flag-display {
    --flag-max-h: min(22vh, 140px);
  }

  .answer-btn {
    min-height: 42px;
    padding: 8px 7px;
    font-size: 0.78rem;
  }
}

/* Mobile setup screens */
@media (max-width: 720px) {
  #screen-setup-solo.screen--active,
  #screen-setup-multi.screen--active,
  #screen-matchmaking.screen--active {
    justify-content: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .panel {
    max-width: none;
    width: 100%;
  }

  .screen-fit {
    max-height: none;
    overflow: visible;
    margin: 0;
  }

  #screen-setup-solo .panel.card,
  #screen-setup-multi .panel.card,
  #screen-matchmaking .panel.card {
    padding: 10px 10px 12px;
  }

  #screen-setup-solo .back-btn,
  #screen-setup-multi .back-btn,
  #screen-matchmaking .back-btn {
    margin-bottom: 6px;
  }

  .panel__title {
    font-size: 1rem;
    line-height: 1.2;
  }

  .panel__text {
    margin-bottom: 8px;
    font-size: 0.84rem;
    line-height: 1.3;
  }

  .setup-badge {
    margin-bottom: 8px;
    padding: 4px 10px;
    font-size: 0.74rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  .setup-options-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    flex: 0 0 auto;
  }

  .setup-options-col {
    min-height: auto;
  }

  #screen-setup-solo .option-group__label,
  #screen-setup-multi .option-group__label {
    margin-bottom: 5px;
    font-size: 0.7rem;
    line-height: 1.2;
  }

  #screen-setup-solo .option-list,
  #screen-setup-multi .option-list {
    gap: 6px;
    flex: 0 0 auto;
  }

  .option-chip {
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
  }

  #screen-setup-solo .option-chip,
  #screen-setup-multi .option-chip {
    padding: 8px 10px;
    font-size: 0.84rem;
    line-height: 1.2;
  }

  .option-chip input {
    margin: 2px 0 0;
    flex: 0 0 auto;
  }

  .option-chip span {
    display: block;
    min-width: 0;
    flex: 1 1 auto;
    overflow-wrap: anywhere;
  }

  .option-chip small {
    margin-top: 2px;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  .join-code-box {
    margin-top: 8px;
  }

  .join-code-input {
    margin-bottom: 8px;
    padding: 10px 12px;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
  }

  .setup-notice {
    margin-top: 8px;
    font-size: 0.8rem;
    line-height: 1.3;
  }

  #screen-setup-solo .btn--wide,
  #screen-setup-multi .btn--wide {
    margin-top: 8px;
    padding: 10px 12px;
  }

  .room-box {
    padding: 14px 10px;
    margin-bottom: 10px;
  }

  .room-box__code {
    font-size: clamp(1.1rem, 5.5vw, 1.5rem);
    letter-spacing: 0.06em;
    overflow-wrap: anywhere;
  }

  .friend-wait-hint {
    gap: 8px;
    padding: 10px 12px;
    font-size: 0.8rem;
    line-height: 1.3;
  }
}

@media (max-width: 720px) and (max-height: 700px) {
  #screen-setup-solo .panel__text,
  #screen-setup-multi .panel__text,
  #screen-matchmaking .panel__text {
    margin-bottom: 6px;
    font-size: 0.8rem;
  }

  .setup-badge {
    margin-bottom: 6px;
  }

  #screen-setup-solo .option-chip,
  #screen-setup-multi .option-chip {
    padding: 7px 9px;
  }

  .option-chip small {
    font-size: 0.72rem;
  }
}

/* =========================================================================
   ГЛАВНАЯ — ELECTRIC BLUE (2026-09-25)
   Затрагивает ТОЛЬКО #screen-home и шапку в состоянии body.is-home
   (см. showScreen() в app.js — этот класс уже существовал и переключается
   на каждый переход экрана). Остальные экраны (игра/результаты/профиль/
   рейтинг/настройка) продолжают жить на старой светлой теме — здесь их
   правила не трогаем, всё под body.is-home ....
   ========================================================================= */

:root {
  --home-gutter: clamp(16px, 10vw, 144px);
  --home-bg-0: #060a14;
  --home-surface: #101a2c;
  --home-surface-soft: #0c1524;
  --home-border: rgba(122, 156, 218, 0.22);
  --home-border-soft: rgba(122, 156, 218, 0.14);
  --home-primary: #2f7dfd;
  --home-primary-soft: rgba(47, 125, 253, 0.16);
  --home-text: #f4f7fc;
  --home-text-muted: #8b9ab3;
  --home-radius-lg: 22px;
  --home-radius: 20px;
  --home-you: #4a96ff;
  --home-amber: #f3c94d;
  --home-success: #34d399;
  --home-danger: #f87171;
}

body.is-home,
body.is-profile,
body.is-stub-screen,
body.is-setup-round,
body.is-leaderboard,
body.is-results,
body.is-setup,
body.is-game,
body.is-matchmaking,
body.is-friend-room {
  background: var(--home-bg-0);
  color: var(--home-text);
}

body.is-home .app-bg,
body.is-profile .app-bg,
body.is-stub-screen .app-bg,
body.is-setup-round .app-bg,
body.is-leaderboard .app-bg,
body.is-results .app-bg,
body.is-setup .app-bg,
body.is-game .app-bg,
body.is-matchmaking .app-bg,
body.is-friend-room .app-bg {
  background:
    radial-gradient(ellipse 70% 55% at 18% -5%, rgba(47, 125, 253, 0.18), transparent 60%),
    radial-gradient(ellipse 55% 45% at 100% 8%, rgba(47, 125, 253, 0.12), transparent 65%),
    linear-gradient(180deg, #060a14 0%, #070d1a 55%, #060a14 100%);
}

body.is-home .app-bg::before,
body.is-profile .app-bg::before,
body.is-stub-screen .app-bg::before,
body.is-setup-round .app-bg::before,
body.is-leaderboard .app-bg::before,
body.is-results .app-bg::before,
body.is-home .app-bg::after,
body.is-profile .app-bg::after,
body.is-stub-screen .app-bg::after,
body.is-setup-round .app-bg::after,
body.is-leaderboard .app-bg::after,
body.is-results .app-bg::after,
body.is-home .app-bg__map,
body.is-profile .app-bg__map,
body.is-stub-screen .app-bg__map,
body.is-setup-round .app-bg__map,
body.is-leaderboard .app-bg__map,
body.is-results .app-bg__map,
body.is-setup .app-bg::before,
body.is-setup .app-bg::after,
body.is-setup .app-bg__map,
body.is-game .app-bg::before,
body.is-game .app-bg::after,
body.is-game .app-bg__map,
body.is-matchmaking .app-bg::before,
body.is-friend-room .app-bg::before,
body.is-matchmaking .app-bg::after,
body.is-friend-room .app-bg::after,
body.is-matchmaking .app-bg__map,
body.is-friend-room .app-bg__map {
  display: none;
}

/* ---------- шапка (дублирует layout на главной, экране настройки, в игре и на поиске соперника) ---------- */

body.is-home .topbar,
body.is-profile .topbar,
body.is-stub-screen .topbar,
body.is-setup-round .topbar,
body.is-leaderboard .topbar,
body.is-results .topbar,
body.is-setup .topbar,
body.is-game .topbar,
body.is-matchmaking .topbar,
body.is-friend-room .topbar {
  background: rgba(6, 10, 20, 0.92);
  border-bottom: 1px solid var(--home-border-soft);
}

body.is-home .topbar__inner,
body.is-profile .topbar__inner,
body.is-stub-screen .topbar__inner,
body.is-setup-round .topbar__inner,
body.is-leaderboard .topbar__inner,
body.is-results .topbar__inner,
body.is-setup .topbar__inner,
body.is-game .topbar__inner,
body.is-matchmaking .topbar__inner,
body.is-friend-room .topbar__inner {
  max-width: 1440px;
  padding: 14px var(--home-gutter) 11px;
  min-height: 112px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  position: relative;
}

body.is-home .logo__icon,
body.is-profile .logo__icon,
body.is-stub-screen .logo__icon,
body.is-setup-round .logo__icon,
body.is-leaderboard .logo__icon,
body.is-results .logo__icon,
body.is-setup .logo__icon,
body.is-game .logo__icon,
body.is-matchmaking .logo__icon,
body.is-friend-room .logo__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 0;
}

body.is-home .logo__icon img,
body.is-profile .logo__icon img,
body.is-stub-screen .logo__icon img,
body.is-setup-round .logo__icon img,
body.is-leaderboard .logo__icon img,
body.is-results .logo__icon img,
body.is-setup .logo__icon img,
body.is-game .logo__icon img,
body.is-matchmaking .logo__icon img,
body.is-friend-room .logo__icon img {
  width: 100%;
  height: 100%;
  display: block;
}

body.is-home .logo__text,
body.is-profile .logo__text,
body.is-stub-screen .logo__text,
body.is-setup-round .logo__text,
body.is-leaderboard .logo__text,
body.is-results .logo__text,
body.is-setup .logo__text,
body.is-game .logo__text,
body.is-matchmaking .logo__text,
body.is-friend-room .logo__text {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--home-text);
  font-size: 1.05rem;
  line-height: 1;
}

body.is-home .topbar__nav,
body.is-profile .topbar__nav,
body.is-stub-screen .topbar__nav,
body.is-setup-round .topbar__nav,
body.is-leaderboard .topbar__nav,
body.is-results .topbar__nav,
body.is-setup .topbar__nav,
body.is-game .topbar__nav,
body.is-matchmaking .topbar__nav,
body.is-friend-room .topbar__nav {
  gap: 8px;
  flex-wrap: wrap;
}

body.is-home .topbar__link,
body.is-profile .topbar__link,
body.is-stub-screen .topbar__link,
body.is-setup-round .topbar__link,
body.is-leaderboard .topbar__link,
body.is-results .topbar__link,
body.is-setup .topbar__link,
body.is-game .topbar__link,
body.is-matchmaking .topbar__link,
body.is-friend-room .topbar__link {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 0.8125rem;
  line-height: 1;
  color: var(--home-text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--home-border);
  border-radius: 999px;
  padding: 6px 13px 6px 9px;
}

body.is-home .topbar__link:hover,
body.is-profile .topbar__link:hover,
body.is-stub-screen .topbar__link:hover,
body.is-setup-round .topbar__link:hover,
body.is-leaderboard .topbar__link:hover,
body.is-results .topbar__link:hover,
body.is-setup .topbar__link:hover,
body.is-game .topbar__link:hover,
body.is-matchmaking .topbar__link:hover,
body.is-friend-room .topbar__link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--home-text);
}

body.is-home .topbar__link--active,
body.is-profile .topbar__link--active,
body.is-stub-screen .topbar__link--active,
body.is-setup-round .topbar__link--active,
body.is-leaderboard .topbar__link--active,
body.is-results .topbar__link--active,
body.is-setup .topbar__link--active,
body.is-game .topbar__link--active,
body.is-matchmaking .topbar__link--active,
body.is-friend-room .topbar__link--active {
  background: var(--home-primary);
  color: #fff;
  border-color: var(--home-primary);
  box-shadow: 0 0 20px rgba(47, 125, 253, 0.45);
}

body.is-home .topbar__link-num,
body.is-profile .topbar__link-num,
body.is-stub-screen .topbar__link-num,
body.is-setup-round .topbar__link-num,
body.is-leaderboard .topbar__link-num,
body.is-results .topbar__link-num,
body.is-setup .topbar__link-num,
body.is-game .topbar__link-num,
body.is-matchmaking .topbar__link-num,
body.is-friend-room .topbar__link-num {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-size: 11px;
  line-height: 1;
}

body.is-home .topbar__link-label,
body.is-profile .topbar__link-label,
body.is-stub-screen .topbar__link-label,
body.is-setup-round .topbar__link-label,
body.is-leaderboard .topbar__link-label,
body.is-results .topbar__link-label,
body.is-setup .topbar__link-label,
body.is-game .topbar__link-label,
body.is-matchmaking .topbar__link-label,
body.is-friend-room .topbar__link-label {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

/* ---------- прогресс в шапке (виден на всех экранах, кроме главной) ---------- */

.topbar__progress {
  position: absolute;
  right: var(--home-gutter);
  top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar__progress-xp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--home-text);
}

.topbar__progress-xp-icon {
  display: block;
  width: auto;
  height: 16px;
}

.topbar__progress-level {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 10px;
  border: 1px solid var(--home-primary);
  border-radius: 999px;
  background: var(--home-surface);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.78rem;
  line-height: 1.2;
  white-space: nowrap;
}

@media (max-width: 480px) {
  /* молния + XP + тег уровня всегда в одной строке; длинное название сокращается «…» */
  .topbar__progress {
    flex-wrap: nowrap;
    gap: 6px;
    max-width: 100%;
    min-width: 0;
  }

  .topbar__progress-xp {
    flex: 0 0 auto;
  }

  .topbar__progress-level {
    display: block; /* text-overflow: ellipsis не работает у flex-контейнера */
    flex: 0 1 auto;
    min-width: 0;
    padding: 2px 8px;
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ---------- контентная область ---------- */

body.is-home .main,
body.is-profile .main,
body.is-stub-screen .main,
body.is-setup-round .main,
body.is-leaderboard .main,
body.is-results .main,
body.is-setup .main,
body.is-game .main,
body.is-matchmaking .main,
body.is-friend-room .main {
  max-width: 1440px;
  padding-left: var(--home-gutter);
  padding-right: var(--home-gutter);
  padding-top: clamp(16px, 2.4vh, 26px);
  padding-bottom: clamp(16px, 2.4vh, 26px);
  gap: clamp(16px, 2vh, 26px);
}

#screen-home.screen--active {
  overflow-y: auto;
  gap: clamp(16px, 2vh, 26px);
}

/* ---------- hero ---------- */

body.is-home .hero--electric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 397px;
  margin: 0;
  padding: clamp(28px, 4vh, 44px) clamp(24px, 4vw, 48px);
  text-align: left;
  /* фон полупрозрачный: за текстом видна вращающаяся планета (js/home-globe.js) */
  background: linear-gradient(135deg, rgba(48, 67, 104, 0.34), rgba(30, 44, 71, 0.22));
  border: 1px solid rgba(122, 156, 218, 0.18);
  border-radius: var(--home-radius-lg);
  box-shadow: none;
}

body.is-home .hero__col--text {
  max-width: 660px;
}

body.is-home .hero__eyebrow {
  margin: 0 0 clamp(10px, 1.6vh, 16px);
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--home-primary);
  font-size: 0.78rem;
}

body.is-home .hero--electric .hero__title {
  margin: 0 0 clamp(10px, 1.6vh, 16px);
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--home-text);
  font-size: clamp(1.7rem, 3.4vw, 3.125rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

body.is-home .hero--electric .hero__sub {
  margin: 0 0 clamp(18px, 2.6vh, 28px);
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--home-text-muted);
  font-size: 0.98rem;
  line-height: 1.65;
  max-width: 600px;
}

body.is-home .hero--electric .hero__cta {
  width: 308px;
  max-width: 100%;
  height: 51px;
  padding: 0 clamp(20px, 3vw, 32px);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1rem;
  border-radius: 999px;
  background: var(--home-primary);
  box-shadow: 0 0 28px rgba(47, 125, 253, 0.5);
  margin-top: 0;
}

body.is-home .hero--electric .hero__cta:hover {
  background: #2469db;
}

body.is-home .hero__col--art {
  flex-shrink: 0;
  width: auto;
  display: none; /* маленький контурный глобус заменён большой вращающейся планетой на фоне (js/home-globe.js) */
  align-items: center;
  justify-content: center;
}

body.is-home .hero__globe {
  width: auto;
  height: 250px;
  max-width: 100%;
}

/* ---------- прогресс ---------- */

body.is-home .home-progress {
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-bottom: 0;
  background: var(--home-surface);
  border: 1px solid var(--home-border);
  border-radius: var(--home-radius);
  box-shadow: none;
}

body.is-home .home-progress .card__title {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--home-text-muted);
  font-size: 0.78rem;
}

body.is-home .home-progress__row {
  gap: clamp(12px, 1.8vw, 18px);
}

body.is-home .home-progress__icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--home-primary-soft);
  border: 1px solid rgba(47, 125, 253, 0.35);
}

body.is-home .home-progress__icon img {
  width: 20px;
  height: 20px;
}

body.is-home .home-progress__level-pill {
  flex-shrink: 0;
  display: inline-flex;
  background: var(--home-primary);
  border-radius: 999px;
  padding: 7px 18px;
}

body.is-home .home-progress__level {
  font-family: var(--font-display);
  font-weight: 400;
  color: #fff;
  font-size: 0.85rem;
  white-space: nowrap;
}

body.is-home .home-progress__track {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--home-border-soft);
  height: 10px;
}

body.is-home .home-progress__fill {
  background: linear-gradient(90deg, #2f7dfd, #5aa2ff);
  box-shadow: 0 0 12px rgba(47, 125, 253, 0.6);
}

body.is-home .home-progress__xp-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

body.is-home .home-progress__xp-icon img {
  width: auto;
  height: 20px;
}

body.is-home .home-progress__score {
  flex-shrink: 0;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--home-text);
  font-size: 1rem;
}

/* ---------- баннер комнаты (стиль на случай активной комнаты) ---------- */

body.is-home .hosted-room-banner {
  background: var(--home-surface);
  border: 1px solid var(--home-border);
  color: var(--home-text);
}

body.is-home .hosted-room-banner__title {
  font-family: var(--font-body);
  color: var(--home-text-muted);
}

body.is-home .hosted-room-banner__code {
  font-family: var(--font-display);
  color: var(--home-text);
}

/* ---------- три способа играть ---------- */

body.is-home .mode-section {
  min-height: 364px;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  padding: clamp(20px, 3vh, 28px);
  background: var(--home-surface);
  border: 1px solid var(--home-border);
  border-radius: var(--home-radius);
}

body.is-home .mode-section__title {
  margin: 0 0 clamp(14px, 2vh, 20px);
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--home-text-muted);
  font-size: 0.78rem;
}

body.is-home .mode-grid--three {
  gap: 20px;
  margin-bottom: clamp(16px, 2.2vh, 22px);
}

body.is-home .mode-card {
  background: var(--home-surface-soft);
  border: 1px solid var(--home-border);
  border-radius: var(--home-radius);
  box-shadow: none;
  padding: 24px;
}

body.is-home .mode-card:hover {
  transform: translateY(-2px);
  border-color: var(--home-primary);
  box-shadow: 0 0 24px rgba(47, 125, 253, 0.18);
}

body.is-home .mode-card.is-selected {
  border-color: var(--home-primary);
  box-shadow: 0 0 0 2px rgba(47, 125, 253, 0.35), 0 0 24px rgba(47, 125, 253, 0.25);
}

body.is-home .mode-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 4px;
  border-radius: 10px;
  background: rgba(47, 125, 253, 0.12);
  border: 1px solid rgba(47, 125, 253, 0.3);
  font-size: 0;
}

body.is-home .mode-card__icon img {
  width: auto;
  height: auto;
  max-width: 28px;
  max-height: 28px;
}

body.is-home .mode-card--friend .mode-card__icon {
  background: rgba(217, 164, 65, 0.14);
  border-color: rgba(217, 164, 65, 0.4);
}

/* «Случайный соперник»: бирюзово-голубая плитка иконки (по макету: заливка #00FBFF 18%, обводка #38BDF8 32%) */
body.is-home .mode-card--duel .mode-card__icon {
  background: rgba(0, 251, 255, 0.18);
  border-color: rgba(56, 189, 248, 0.32);
}

body.is-home .mode-card__title {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--home-text);
  font-size: 1.05rem;
}

body.is-home .mode-card__desc {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--home-text-muted);
  font-size: 0.85rem;
  line-height: 1.55;
}

body.is-home #btn-mode-continue {
  align-self: flex-start;
  font-family: var(--font-display);
  font-weight: 400;
  border-radius: 999px;
  background: var(--home-primary);
  box-shadow: 0 0 20px rgba(47, 125, 253, 0.4);
}

/* «Войти по коду» — тихая текстовая ссылка под основными кнопками (главная и экран выбора режима) */
.join-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 4px;
  padding: 0 4px;
  background: none;
  border: 0;
  color: var(--home-primary, #2f7dfd);
  font-family: var(--font-body, inherit);
  font-size: 0.85rem; /* как подпись-описание на плашках (.pick-card__desc) */
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.join-link:hover { color: var(--home-text, #fff); }
/* карточка «С другом» и ссылка «Войти по коду» под ней: ссылка выходит за низ карточки (position:absolute), поэтому
   высота карточек в ряду не растёт; под сеткой оставлено место под ссылку */
.pick-col { position: relative; display: flex; flex-direction: column; min-width: 0; }
.pick-col > .pick-card { flex: 1; }
.pick-col > .join-link { position: absolute; left: 0; top: 100%; margin: 4px 0 0; white-space: nowrap; }
@media (min-width: 721px) { body.is-setup #setup-mode-grid { margin-bottom: 52px; } }
@media (max-width: 720px) {
  body.is-setup #setup-mode-grid { padding-bottom: 60px; }
  body.is-setup #setup-mode-grid > .pick-col { flex: 0 0 clamp(200px, 72%, 280px); scroll-snap-align: start; }
}
.join-link:focus-visible { outline: 2px solid var(--home-primary, #2f7dfd); outline-offset: 2px; border-radius: 6px; }

body.is-home #btn-mode-continue:hover:not(:disabled) {
  background: #2469db;
}

body.is-home #btn-mode-continue:disabled {
  opacity: 0.5;
  box-shadow: none;
}

/* ---------- адаптивность ---------- */

@media (max-width: 900px) {
  body.is-home .topbar__inner,
  body.is-setup .topbar__inner {
    padding-left: 16px;
    padding-right: 16px;
  }

  body.is-home .main,
  body.is-setup .main {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar__progress {
    right: 16px;
  }

  body.is-home .hero--electric {
    flex-direction: column;
    text-align: center;
    min-height: auto;
    padding: 28px 20px;
  }

  body.is-home .hero__col--text {
    max-width: none;
  }

  body.is-home .hero__eyebrow,
  body.is-home .hero--electric .hero__sub {
    margin-left: auto;
    margin-right: auto;
  }

  body.is-home .hero--electric .hero__cta {
    width: 100%;
    max-width: 308px;
    margin-inline: auto;
  }

  body.is-home .hero__col--art {
    width: auto;
  }

  body.is-home .hero__globe {
    width: auto;
    height: 158px;
  }

  body.is-home .home-progress__row {
    flex-wrap: wrap;
  }

  body.is-home .home-progress__track {
    order: 5;
    flex-basis: 100%;
  }

  body.is-home .mode-grid--three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  body.is-home .topbar__inner,
  body.is-setup .topbar__inner {
    padding-top: 14px;
    padding-bottom: 12px;
    gap: 10px;
  }

  body.is-home .topbar__link,
  body.is-setup .topbar__link {
    padding: 7px 12px 7px 10px;
    font-size: 0.85rem;
  }

  .topbar__progress {
    position: static;
    margin-top: 8px;
  }
}

/* Старое правило (см. выше по файлу, @media max-width:860px) снимает
   flex/overflow с #screen-home на мобильных, потому что раньше контент
   помещался без скролла. Новый hero с иллюстрацией выше — уже не
   помещается на маленьких экранах, поэтому для главной явно возвращаем
   внутренний скролл (только body.is-home — другие экраны не затронуты,
   у них своя логика "без скролла страницы" остаётся как была). */
@media (max-width: 860px) {
  body.is-home #screen-home.screen--active {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* =========================================================================
   НАСТРОЙКА ИГРЫ — тёмная тема (2026-09-26)
   Затрагивает ТОЛЬКО #screen-setup-solo в состоянии body.is-setup (см.
   showScreen() в app.js). Экраны screen-setup-multi/matchmaking и все
   остальные продолжают жить на старой светлой теме — не трогаем их.
   ========================================================================= */

body.is-setup #screen-setup-solo.screen--active {
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.is-setup #screen-setup-solo .panel.screen-fit {
  max-height: none;
  overflow: visible;
  flex-shrink: 0;
}

body.is-setup .panel {
  max-width: 1200px;
  margin: clamp(16px, 2.4vh, 26px) auto;
  padding: clamp(22px, 3vh, 36px);
  background: var(--home-surface);
  border: 1px solid var(--home-border);
  border-radius: var(--home-radius-lg);
  box-shadow: 0 0 60px rgba(47, 125, 253, 0.08);
  color: var(--home-text);
}

body.is-setup #screen-setup-solo .back-btn {
  display: none;
}

body.is-setup .panel__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  color: var(--home-text);
  margin: 0 0 8px;
}

body.is-setup .panel__text {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--home-text-muted);
  margin: 0 0 clamp(16px, 2.4vh, 24px);
}

/* ---------- пронумерованные блоки «С кем играть» / «Что угадывать» ---------- */

.setup-block {
  border: 1px dashed var(--home-border);
  border-radius: var(--home-radius);
  padding: clamp(16px, 2.4vh, 24px);
  margin-bottom: clamp(14px, 2vh, 20px);
}

.setup-block__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: clamp(14px, 2vh, 20px);
}

.setup-block__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--home-primary);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 0.8rem;
}

.setup-block__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--home-text);
}

.setup-block__note {
  margin: -8px 0 clamp(14px, 2vh, 18px);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--home-text-muted);
}

body.is-setup .scope-picker {
  flex: none;
  min-height: auto;
  overflow: visible;
  padding-right: 0;
}

body.is-setup .setup-options-grid.setup-options-grid--single {
  margin-bottom: clamp(14px, 2vh, 20px);
}

body.is-setup .pick-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 720px) {
  body.is-setup .pick-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================================
   ЦВЕТОВАЯ СХЕМА РЕЖИМОВ: один набор переменных на режим.
   body[data-mode-theme] выставляется при выборе режима (renderSetupModeCards);
   карточки режимов задают те же переменные у себя, поэтому цвет карточки режима и цвет
   блоков «Что угадывать» берутся из одного места. Правка цвета режима — только здесь.
   ========================================================================= */
/* Тона взяты с референса (три плашки: приглушённая рамка, тёмная заливка, мягкое свечение снизу):
   --mode-border / --mode-surface — рамка и заливка плашки, --mode-accent — более яркий тон
   для точки, галочки и подписи, --mode-glow — свечение. */
body[data-mode-theme="solo"],
.pick-card[data-setup-mode="solo"] {
  --mode-accent: #4f86f7;
  --mode-border: #2f4b8f;
  --mode-glow: 0 6px 26px rgba(47, 90, 190, 0.38);
  --mode-surface: #212b44;
  --mode-tile-bg: rgba(47, 125, 253, 0.12);
  --mode-tile-border: rgba(47, 125, 253, 0.3);
}

body[data-mode-theme="duel"],
.pick-card[data-setup-mode="duel"] {
  --mode-accent: #4fb6dc;
  --mode-border: #3e6d8c;
  --mode-glow: 0 6px 26px rgba(62, 130, 170, 0.38);
  --mode-surface: #25383f;
  --mode-tile-bg: rgba(0, 251, 255, 0.18);
  --mode-tile-border: rgba(56, 189, 248, 0.32);
}

body[data-mode-theme="friend"],
.pick-card[data-setup-mode="friend"] {
  --mode-accent: #e0b04a;
  --mode-border: #8a7236;
  --mode-glow: 0 6px 26px rgba(160, 130, 50, 0.38);
  --mode-surface: #3d362b;
  --mode-tile-bg: rgba(217, 164, 65, 0.14);
  --mode-tile-border: rgba(217, 164, 65, 0.4);
}

body.is-setup .pick-card {
  background: var(--home-surface-soft);
  border: 1.5px solid var(--home-border);
  border-radius: 16px;
  padding: 20px;
  gap: 10px;
}

body.is-setup .pick-card:hover {
  transform: translateY(-1px);
  border-color: var(--mode-border, var(--home-primary));
}

/* плитки иконок: цвет режима игры (как на главной) в любом состоянии карточки — и у режимов, и у «Что угадывать» */
body.is-setup .pick-card__icon,
body.is-setup .pick-card:hover .pick-card__icon,
body.is-setup .pick-card.is-selected .pick-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--mode-tile-bg, rgba(47, 125, 253, 0.12));
  border: 1px solid var(--mode-tile-border, rgba(47, 125, 253, 0.3));
}

body.is-setup .pick-card__icon img {
  width: auto;
  height: auto;
  max-width: 24px;
  max-height: 24px;
}

body.is-setup .pick-card__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1rem;
  color: var(--home-text);
}

body.is-setup .pick-card__desc {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--home-text-muted);
  line-height: 1.4;
}

body.is-setup .pick-card__go {
  border-top: 1px solid var(--home-border-soft);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--home-text-muted);
}

body.is-setup .pick-card__radio {
  top: 14px;
  right: 14px;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--home-border);
  background: transparent;
}

body.is-setup .pick-card.is-selected {
  background: var(--home-surface-soft);
  border-color: var(--mode-border, var(--home-primary));
  box-shadow: 0 0 0 1px var(--mode-border, var(--home-primary)), var(--mode-glow, 0 0 24px rgba(47, 125, 253, 0.2));
  background-image: linear-gradient(var(--mode-surface, transparent), var(--mode-surface, transparent));
}

body.is-setup .pick-card.is-selected .pick-card__go,
body.is-setup .pick-card:hover .pick-card__go {
  color: var(--mode-accent, var(--home-primary));
}

body.is-setup .pick-card.is-selected .pick-card__radio {
  border-color: var(--mode-accent, var(--home-primary));
  background: var(--mode-accent, var(--home-primary));
  box-shadow: none;
}

/* ---------- длина раунда ---------- */

body.is-setup .option-group__label {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--home-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

body.is-setup .option-chip {
  border: 1px solid var(--home-border);
  background: var(--home-surface-soft);
  color: var(--home-text);
}

body.is-setup .option-chip:has(input:checked) {
  border-color: var(--home-primary);
  background: rgba(47, 125, 253, 0.1);
}

body.is-setup .option-chip small {
  color: var(--home-text-muted);
}

body.is-setup .join-code-box .option-group__label,
body.is-setup .join-code-input {
  color: var(--home-text);
}

body.is-setup .join-code-input {
  background: var(--home-surface-soft);
  border: 1px solid var(--home-border);
}

/* ---------- кнопка «Далее — настройка игры» ---------- */

body.is-setup #btn-setup-continue {
  align-self: flex-start;
  width: 320px;
  max-width: 100%;
  height: 54px;
  flex-shrink: 0;
  padding: 0 32px;
  margin-top: clamp(18px, 2.4vh, 28px);
  font-family: var(--font-display);
  font-weight: 400;
  border-radius: 999px;
  background: var(--home-primary);
  box-shadow: 0 0 24px rgba(47, 125, 253, 0.45);
}

body.is-setup #btn-setup-continue:hover:not(:disabled) {
  background: #2469db;
}

body.is-setup #btn-setup-continue:disabled {
  box-shadow: none;
}

/* =========================================================================
   ЭКРАН ИГРЫ — тёмная тема «Electric Blue» (body.is-game, #screen-game)
   Перенос визуала по референсу референс: экран игра.png.
   Механика (таймер, счёт, ответы, WS) не трогаем — только переоформление
   существующих элементов и добавление #round-title / #question-dots /
   #mode-icon поверх той же разметки, что использует app.js.
   ========================================================================= */

body.is-game #screen-game {
  --bg: #141d2c;
  --surface: #202c3b;
  --text: #f4f7fc;
  --text-muted: #8b9ab3;
  --primary: #2f7dfd;
  --primary-dark: #2469db;
  --accent: #2f7dfd;
  --success: #34d399;
  --danger: #f87171;
  --warning: #f3c94d;
  --border: rgba(122, 156, 218, 0.22);
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.25);
}

body.is-game .game-back-btn {
  background: rgba(16, 26, 44, 0.85);
  color: var(--home-text-muted);
  border: 1px solid var(--home-border);
}

body.is-game .game-back-btn:hover { color: var(--home-text); }

body.is-game .game-layout {
  margin-top: clamp(28px, 4.5vh, 40px);
}

body.is-game .game-countdown {
  background: rgba(6, 10, 20, 0.92);
}

body.is-game .game-countdown__text {
  color: var(--home-text);
}

/* ---------- внешняя широкая панель раунда ---------- */

body.is-game .game-panel {
  background: #172131;
  border: 1px solid var(--home-border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: clamp(20px, 3vh, 32px) clamp(20px, 3vw, 36px);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.8vh, 18px);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

body.is-game .round-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--home-text-muted);
  flex-shrink: 0;
}

/* ---------- строка счёта ---------- */

body.is-game .game-top {
  background: #111923;
  border: 1px solid var(--home-border);
  border-radius: 14px;
  box-shadow: none;
  flex-shrink: 0;
}

body.is-game .game-top__row {
  justify-content: center;
}

body.is-game .game-top__progress {
  flex: 0 0 auto;
  min-width: 0;
}

body.is-game .game-top__scores {
  flex: 1 1 auto;
  align-items: center;
  justify-content: space-between;
  gap: clamp(12px, 3vw, 32px);
}

body.is-game .game-top--solo .game-top__scores {
  justify-content: center;
}

body.is-game .score-pill {
  background: none;
  border: none !important;
  padding: 0;
  gap: 8px;
}

body.is-game .score-pill__label,
body.is-game .score-pill__value {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(0.95rem, 1.9vh, 1.15rem);
}

body.is-game .score-pill__label::after {
  content: '\2014';
  margin: 0 6px;
  opacity: 0.85;
}

body.is-game .score-pill--you .score-pill__label,
body.is-game .score-pill--you .score-pill__value {
  color: var(--home-you);
}

body.is-game .score-pill--opp .score-pill__label,
body.is-game .score-pill--opp .score-pill__value {
  color: var(--home-amber);
}

body.is-game .game-top__mode-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(47, 125, 253, 0.12);
  border: 1px solid rgba(47, 125, 253, 0.3);
}

body.is-game .game-top__mode-icon[data-mode="duel"] {
  background: rgba(0, 251, 255, 0.18);
  border-color: rgba(56, 189, 248, 0.32);
}

body.is-game .game-top__mode-icon[data-mode="friend"] {
  background: rgba(217, 164, 65, 0.14);
  border-color: rgba(217, 164, 65, 0.4);
}

body.is-game .game-top__mode-icon img {
  width: 16px;
  height: 16px;
  display: block;
}

body.is-game .game-top__mode-icon[hidden] { display: none; }

body.is-game .score-pill[hidden],
body.is-game .game-top__progress[hidden] { display: none; }

/* ---------- индикатор вопросов ---------- */

body.is-game .question-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex-shrink: 0;
}

body.is-game .question-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(122, 156, 218, 0.25);
  transition: background 0.2s, transform 0.2s;
}

/* длинные наборы (больше 40 вопросов: «Все регионы», «Весь мир», «Вся Европа») — те же круглые точки одинакового размера,
   но не в одну строку, а аккуратной сеткой с переносом по центру; размер точек не зависит от числа вопросов */
body.is-game .game-head .question-dots.question-dots--dense {
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  gap: 4px 3px;
}
body.is-game .game-head .question-dots--dense .question-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  min-width: 0;
  aspect-ratio: auto;
}

body.is-game .question-dot--done {
  background: var(--home-primary);
  opacity: 0.55;
}

body.is-game .question-dot--current {
  background: var(--home-primary);
  transform: scale(1.35);
  box-shadow: 0 0 10px rgba(47, 125, 253, 0.7);
}

/* ---------- таймер ---------- */

body.is-game .timer {
  width: 56px;
  height: 56px;
  margin: 0 auto;
  flex-shrink: 0;
}

body.is-game .timer__value {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--home-text);
}

body.is-game .timer__ring circle {
  stroke: rgba(122, 156, 218, 0.25);
}

/* ---------- карточка вопроса ---------- */

body.is-game .question-card {
  background: var(--surface);
  border: 1px solid var(--home-border);
  border-radius: 20px;
  box-shadow: none;
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
}

body.is-game .question-card__spacer {
  flex: 0 0 auto;
  min-height: 0;
}

body.is-game .question-type {
  font-family: var(--font-display);
  font-weight: 400;
  background: rgba(47, 125, 253, 0.14);
  color: var(--home-primary);
}

body.is-game .question-card__prompt {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--home-text);
}

body.is-game .question-visual {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
}

body.is-game .question-visual--map {
  background: #91c9df;
}



body.is-game .map-caption {
  color: var(--home-text-muted);
}

/* ---------- варианты ответа ---------- */

body.is-game .answers {
  gap: clamp(10px, 1.4vh, 14px);
}

body.is-game .answer-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--home-border);
  border-radius: 12px;
  color: var(--home-text);
  font-family: var(--font-body);
}

body.is-game .answer-btn:hover:not(:disabled) {
  border-color: var(--home-primary);
  background: rgba(47, 125, 253, 0.08);
}

body.is-game .answer-btn--correct {
  border-color: var(--home-success);
  background: rgba(52, 211, 153, 0.12);
  color: var(--home-success);
}

body.is-game .answer-btn--wrong {
  border-color: var(--home-danger);
  background: rgba(248, 113, 113, 0.1);
  color: var(--home-danger);
}

body.is-game .answer-btn--revealed {
  border-color: var(--home-success);
  background: rgba(52, 211, 153, 0.08);
}

body.is-game .attempt-info {
  color: var(--home-text-muted);
}

body.is-game .feedback--success { background: rgba(52, 211, 153, 0.12); color: var(--home-success); }
body.is-game .feedback--error { background: rgba(248, 113, 113, 0.1); color: var(--home-danger); }
body.is-game .feedback--neutral { background: rgba(255, 255, 255, 0.03); color: var(--home-text-muted); }

/* ---------- адаптивность ---------- */

/* =========================================================================
   ЭКРАН ПОИСКА СОПЕРНИКА — тёмная тема «Electric Blue» (body.is-matchmaking,
   #screen-matchmaking). Перенос визуала по референсу
   референс: игра с соперником.png. Механика поиска
   (queue:join/leave, match:start, переход в игру) не трогаем — экран
   только переоформлен, а состояние «соперник не найден» добавлено поверх
   существующего runMatchmaking() как таймаут в app.js, без остановки
   реального поиска.
   ========================================================================= */

body.is-matchmaking #screen-matchmaking.screen--active,
body.is-friend-room #screen-setup-multi.screen--active {
  justify-content: flex-start;
}

body.is-matchmaking .mm-panel,
body.is-friend-room .mm-panel {
  background: #172131;
  border: 1px solid var(--home-border);
  border-radius: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  padding: clamp(20px, 3vh, 32px) clamp(20px, 3vw, 36px);
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2.2vh, 22px);
  margin-top: clamp(28px, 4.5vh, 40px);
  overflow-y: auto;
}

body.is-matchmaking .back-btn,
body.is-friend-room .back-btn {
  color: var(--home-text-muted);
  align-self: flex-start;
}

body.is-matchmaking .back-btn:hover,
body.is-friend-room .back-btn:hover { color: var(--home-text); }

/* Компактная кнопка назад — не спорит с заголовком «КОМНАТА СОЗДАНА»:
   тёмная подложка + тонкая синяя обводка вместо голого текста, но
   заметно мельче и тише самого заголовка. */
body.is-friend-room .friend-room-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  min-height: 40px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--home-border);
  font-size: 0.82rem;
  font-weight: 600;
}

body.is-friend-room .friend-room-back:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(47, 125, 253, 0.4);
  color: var(--home-text);
}

body.is-matchmaking .mm-title,
body.is-friend-room .mm-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--home-text-muted);
}

body.is-matchmaking .mm-search-box {
  background: #202c3b;
  border: 1px solid var(--home-border);
  border-radius: 20px;
  padding: clamp(28px, 4vh, 40px) 20px;
  text-align: center;
}

body.is-matchmaking .mm-search-box .spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(122, 156, 218, 0.25);
  border-top-color: var(--home-primary);
  margin: 0 auto clamp(16px, 2.4vh, 22px);
}

body.is-matchmaking .mm-search-box__status {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--home-text);
}

body.is-matchmaking .mm-search-box__hint {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--home-text-muted);
}

body.is-matchmaking .mm-notfound {
  background: #202c3b;
  border: 1px solid var(--home-border);
  border-radius: 20px;
  padding: clamp(24px, 3.5vh, 36px) 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

body.is-matchmaking .mm-notfound__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(0, 251, 255, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.32);
  margin-bottom: 16px;
}

body.is-matchmaking .mm-notfound__icon img {
  width: 24px;
  height: 24px;
  display: block;
}

body.is-matchmaking .mm-notfound__title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.1rem;
  color: var(--home-text);
}

body.is-matchmaking .mm-notfound__hint {
  margin: 0 0 20px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--home-text-muted);
}

body.is-matchmaking .mm-notfound__actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

body.is-matchmaking .mm-notfound__actions .btn {
  width: auto;
  padding-left: 28px;
  padding-right: 28px;
}

body.is-matchmaking .mm-notfound__actions .btn--primary {
  background: var(--home-primary);
  box-shadow: 0 0 24px rgba(47, 125, 253, 0.45);
}

body.is-matchmaking .mm-notfound__actions .btn--primary:hover {
  background: #2469db;
}

body.is-matchmaking .mm-notfound__actions .btn--ghost {
  background: transparent;
  color: var(--home-text-muted);
  border: 1px solid var(--home-border);
}

body.is-matchmaking .mm-notfound__actions .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--home-text);
}

@media (max-width: 640px) {
  body.is-matchmaking .mm-notfound__actions {
    flex-direction: column;
    align-items: stretch;
  }

  body.is-matchmaking .mm-notfound__actions .btn {
    width: 100%;
  }
}

/* =========================================================================
   ЭКРАН «КОМНАТА СОЗДАНА» — тёмная тема «Electric Blue» (body.is-friend-room,
   #screen-setup-multi). Перенос визуала по референсу
   референс: игра с другом.png. Разметка/переходы
   (room:create, room:player_joined, match:start, GameSocket) не трогаем —
   только переоформление + отложенный клиентский переход в игру по кнопке
   «Далее», см. renderFriendRoomSteps()/btn-friend-continue в app.js.
   ========================================================================= */

body.is-friend-room .friend-room-card {
  background: #202c3b;
  border: 1px solid var(--home-border);
  border-radius: 20px;
  box-shadow: none;
  padding: clamp(20px, 3vh, 32px) clamp(18px, 3.5vw, 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 2vh, 20px);
}

body.is-friend-room .setup-badge {
  color: var(--home-text-muted);
  background: rgba(255, 255, 255, 0.04);
}

/* Плашка режима/раунда переехала из внутренней карточки прямо под
   заголовок — спокойный вторичный ярлык, а не яркая заливка, и без
   лишнего отступа перед внутренней карточкой (тянем gap .mm-panel
   отрицательными полями, а не переписываем всю сетку). */
body.is-friend-room .friend-room-badge {
  align-self: flex-start;
  margin-top: -10px;
  margin-bottom: -8px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
}

body.is-friend-room .friend-room-hint {
  color: var(--home-text-muted);
  text-align: center;
  margin: 0;
}

/* ---------- шаги статуса ---------- */

body.is-friend-room .friend-room-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: center;
}

body.is-friend-room .friend-room-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  color: var(--home-text-muted);
}

body.is-friend-room .friend-room-step__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(122, 156, 218, 0.4);
  background: transparent;
  flex-shrink: 0;
}

body.is-friend-room .friend-room-step--active {
  color: var(--home-text);
}

body.is-friend-room .friend-room-step--active .friend-room-step__dot {
  background: var(--home-primary);
  border-color: var(--home-primary);
  box-shadow: 0 0 10px rgba(47, 125, 253, 0.6);
}

/* ---------- код комнаты ---------- */

body.is-friend-room .friend-room-code-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

body.is-friend-room .friend-room-code-row__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(217, 164, 65, 0.14);
  border: 1px solid rgba(217, 164, 65, 0.4);
  flex-shrink: 0;
}

body.is-friend-room .friend-room-code-row__icon img {
  width: 26px;
  height: 26px;
  display: block;
}

body.is-friend-room .room-box {
  margin: 0;
  padding: 14px 28px;
  background: #141d2c;
  border: 2px dashed var(--home-primary);
  border-radius: 14px;
}

body.is-friend-room .room-box__code {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.7rem, 3.6vh, 2.2rem);
  letter-spacing: 0.2em;
  color: var(--home-primary);
}

body.is-friend-room .friend-room-code-row .btn--ghost {
  border-radius: 999px;
  border-color: var(--home-border);
  color: var(--home-text);
  background: transparent;
  padding: 10px 18px;
  font-size: 0.85rem;
}

body.is-friend-room .friend-room-code-row .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* ---------- ссылка на комнату ---------- */

body.is-friend-room .friend-room-link-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 640px;
}

body.is-friend-room .friend-room-link {
  flex: 1 1 260px;
  padding: 14px 18px;
  background: #141d2c;
  border: 1px solid var(--home-border);
  border-radius: 12px;
  color: var(--home-text-muted);
  font-family: var(--font-body);
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.is-friend-room .friend-room-link-row .btn--ghost {
  border-radius: 999px;
  border-color: var(--home-border);
  color: var(--home-text);
  background: transparent;
  flex-shrink: 0;
  padding: 10px 18px;
  font-size: 0.85rem;
}

body.is-friend-room .friend-room-link-row .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.is-friend-room .friend-wait-hint {
  display: none;
}

/* ---------- кнопка «Далее» ---------- */

body.is-friend-room .friend-room-continue {
  align-self: flex-start;
  width: auto;
  padding-left: 28px;
  padding-right: 28px;
  border-radius: 999px;
  background: var(--home-primary);
  box-shadow: 0 0 24px rgba(47, 125, 253, 0.45);
}

body.is-friend-room .friend-room-continue:hover:not(:disabled) {
  background: #2469db;
}

body.is-friend-room .friend-room-continue:disabled {
  box-shadow: none;
  opacity: 0.45;
}

@media (max-width: 640px) {
  /* компактная комната на телефоне: код в одну строку, кнопка «Далее» остаётся в видимой области */
  body.is-friend-room .mm-panel { padding: 12px; gap: 10px; margin-top: 0; border-radius: 20px; }
  body.is-friend-room .friend-room-badge { margin-top: -4px; margin-bottom: -2px; }
  body.is-friend-room .friend-room-back { min-height: 36px; padding: 4px 12px; }
  body.is-friend-room .friend-room-card { padding: 12px; gap: 10px; border-radius: 16px; }
  body.is-friend-room .friend-room-steps { gap: 6px; }
  body.is-friend-room .friend-room-step { font-size: 0.9rem; }
  body.is-friend-room .friend-room-code-row__icon { width: 44px; height: 44px; border-radius: 12px; }
  body.is-friend-room .room-box { padding: 8px 12px; }
  body.is-friend-room .room-box__code { font-size: clamp(1.15rem, 6vw, 1.5rem); letter-spacing: 0.12em; white-space: nowrap; }
  body.is-friend-room .friend-room-code-row .btn--ghost,
  body.is-friend-room .friend-room-link-row .btn--ghost { min-height: 44px; padding: 8px 14px; }
  body.is-friend-room .friend-room-link-row { gap: 8px; }
  body.is-friend-room .friend-room-link { padding: 8px 12px; font-size: 0.8rem; }
  body.is-friend-room .friend-room-continue { min-height: 48px; }

  body.is-friend-room .friend-room-code-row {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  body.is-friend-room .friend-room-code-row .btn--ghost {
    width: 100%;
  }

  body.is-friend-room .friend-room-link-row {
    flex-direction: column;
    align-items: stretch;
  }

  body.is-friend-room .friend-room-link {
    flex: 0 0 auto;
    white-space: normal;
    word-break: break-all;
  }

  body.is-friend-room .friend-room-link-row .btn--ghost {
    width: 100%;
  }

  body.is-friend-room .friend-room-continue {
    align-self: stretch;
    width: 100%;
  }
}

/* =========================================================================
   МОДАЛКИ ПОДТВЕРЖДЕНИЯ ВЫХОДА («Покинуть комнату?», «Остановить поиск
   соперника?», «Выйти из игры?») — тёмная тема Electric Blue поверх ЛЮБОГО
   экрана (главная / setup / игра / поиск / «Комната создана» и т.д.),
   поэтому стили не завязаны на body.is-* — сами оверлеи показываются
   только когда действие реально небезопасно (см. confirmLeaveHostedRoom()/
   confirmStopSearch()/confirmExitGame() в app.js). Специально не трогаем
   .nick-modal целиком — модалка «Выбери имя для игры» должна остаться на своей
   светлой теме.
   ========================================================================= */

#nick-modal,
#contact-modal,
#resume-game-modal,
#leave-room-modal,
#stop-search-modal,
#logout-warning-modal,
#delete-profile-modal,
#vk-merge-modal,
#exit-game-modal {
  background: rgba(6, 10, 20, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#nick-modal .nick-modal__box,
#contact-modal .nick-modal__box,
#resume-game-modal .nick-modal__box,
#leave-room-modal .nick-modal__box,
#stop-search-modal .nick-modal__box,
#logout-warning-modal .nick-modal__box,
#delete-profile-modal .nick-modal__box,
#vk-merge-modal .nick-modal__box,
#exit-game-modal .nick-modal__box {
  background: #172131;
  border: 1px solid var(--home-border);
  border-radius: 24px;
  box-shadow: 0 0 40px rgba(47, 125, 253, 0.22), 0 20px 60px rgba(0, 0, 0, 0.4);
}

#nick-modal .nick-modal__title,
#contact-modal .nick-modal__title,
#resume-game-modal .nick-modal__title,
#leave-room-modal .nick-modal__title,
#stop-search-modal .nick-modal__title,
#logout-warning-modal .nick-modal__title,
#delete-profile-modal .nick-modal__title,
#vk-merge-modal .nick-modal__title,
#exit-game-modal .nick-modal__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.4rem;
  color: var(--home-text);
}

#nick-modal .nick-modal__text,
#leave-room-modal .nick-modal__text,
#stop-search-modal .nick-modal__text,
#logout-warning-modal .nick-modal__text,
#delete-profile-modal .nick-modal__text,
#vk-merge-modal .nick-modal__text,
#exit-game-modal .nick-modal__text {
  font-family: var(--font-body);
  color: var(--home-text-muted);
}

#nick-modal .nick-modal__input {
  background: var(--home-surface-soft);
  border: 1px solid var(--home-border);
  color: var(--home-text);
  border-radius: 12px;
}

#nick-modal .nick-modal__input:focus {
  outline: none;
  border-color: var(--home-primary);
}

#nick-modal #nick-save {
  min-height: 48px;
  font-family: var(--font-display);
  font-weight: 400;
  border-radius: 999px;
}

#nick-modal .setup-notice {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  margin: 0 0 14px;
}

#leave-room-modal .confirm-modal__actions .btn,
#stop-search-modal .confirm-modal__actions .btn,
#logout-warning-modal .confirm-modal__actions .btn,
#delete-profile-modal .confirm-modal__actions .btn,
#vk-merge-modal .confirm-modal__actions .btn,
#exit-game-modal .confirm-modal__actions .btn {
  flex: 1 1 0;
  min-height: 48px;
  font-family: var(--font-display);
  font-weight: 400;
  border-radius: 999px;
}

#leave-room-modal .confirm-modal__actions .btn--primary,
#stop-search-modal .confirm-modal__actions .btn--primary,
#logout-warning-modal .confirm-modal__actions .btn--primary,
#delete-profile-modal .confirm-modal__actions .btn--primary,
#vk-merge-modal .confirm-modal__actions .btn--primary,
#exit-game-modal .confirm-modal__actions .btn--primary {
  background: var(--home-primary);
  box-shadow: 0 0 20px rgba(47, 125, 253, 0.45);
}

#leave-room-modal .confirm-modal__actions .btn--primary:hover,
#stop-search-modal .confirm-modal__actions .btn--primary:hover,
#logout-warning-modal .confirm-modal__actions .btn--primary:hover,
#delete-profile-modal .confirm-modal__actions .btn--primary:hover,
#vk-merge-modal .confirm-modal__actions .btn--primary:hover,
#exit-game-modal .confirm-modal__actions .btn--primary:hover {
  background: #2469db;
}

#leave-room-modal .confirm-modal__actions .btn--ghost,
#stop-search-modal .confirm-modal__actions .btn--ghost,
#logout-warning-modal .confirm-modal__actions .btn--ghost,
#delete-profile-modal .confirm-modal__actions .btn--ghost,
#vk-merge-modal .confirm-modal__actions .btn--ghost,
#exit-game-modal .confirm-modal__actions .btn--ghost {
  background: transparent;
  border: 1px solid var(--home-border);
  color: var(--home-text);
}

#leave-room-modal .confirm-modal__actions .btn--ghost:hover,
#stop-search-modal .confirm-modal__actions .btn--ghost:hover,
#logout-warning-modal .confirm-modal__actions .btn--ghost:hover,
#delete-profile-modal .confirm-modal__actions .btn--ghost:hover,
#vk-merge-modal .confirm-modal__actions .btn--ghost:hover,
#exit-game-modal .confirm-modal__actions .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 420px) {
  #leave-room-modal .confirm-modal__actions,
  #stop-search-modal .confirm-modal__actions,
  #logout-warning-modal .confirm-modal__actions,
  #delete-profile-modal .confirm-modal__actions,
  #vk-merge-modal .confirm-modal__actions,
  #exit-game-modal .confirm-modal__actions {
    flex-direction: column;
  }

  #leave-room-modal .confirm-modal__actions .btn,
  #stop-search-modal .confirm-modal__actions .btn,
  #logout-warning-modal .confirm-modal__actions .btn,
  #delete-profile-modal .confirm-modal__actions .btn,
  #vk-merge-modal .confirm-modal__actions .btn,
  #exit-game-modal .confirm-modal__actions .btn {
    width: 100%;
  }
}

/* =========================================================================
   ЭКРАН «РАУНД ЗАВЕРШЁН» — тёмная тема «Electric Blue» (2026-09-28)
   Затрагивает ТОЛЬКО #screen-results в состоянии body.is-results (см.
   showScreen() в app.js). Переход/данные/обработчики не трогаем — только
   переоформление под референс референс: раунд
   завершен.png. Иллюстрация — assets/globus.svg (та же, что на главной).
   ========================================================================= */

body.is-results #screen-results.screen--active {
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.is-results .results__back {
  display: none;
}

body.is-results .results__title {
  margin: 0 0 clamp(14px, 2.2vh, 20px);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.5rem, 2.8vw, 2rem);
  color: var(--home-text);
}

body.is-results .results {
  max-width: 1160px;
  width: 100%;
  max-height: none;
  overflow: visible;
  flex-shrink: 0;
  margin: 0 auto clamp(16px, 2.4vh, 26px);
  background: var(--home-surface);
  border: 1px solid var(--home-border);
  border-radius: var(--home-radius-lg);
  box-shadow: 0 0 60px rgba(47, 125, 253, 0.08);
  padding: clamp(24px, 4vh, 44px) clamp(20px, 4vw, 48px);
  color: var(--home-text);
}

body.is-results .results__hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 0 clamp(20px, 3vh, 28px);
}

body.is-results .results__globe {
  width: auto;
  height: clamp(140px, 20vh, 210px);
  max-width: 100%;
  margin: 0 0 clamp(14px, 2vh, 20px);
}

body.is-results .results__record {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 clamp(12px, 1.8vh, 16px);
  padding: 6px clamp(12px, 1.6vw, 16px);
  background: rgba(243, 201, 77, 0.14);
  border: 1px solid rgba(243, 201, 77, 0.35);
  color: var(--home-amber);
}

body.is-results .results__lead {
  margin: 0 0 4px;
  color: var(--home-text-muted);
  font-size: 0.9rem;
}

body.is-results .results__xp {
  margin: 0 0 clamp(12px, 1.8vh, 18px);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.1rem, 4.6vh, 2.75rem);
  color: var(--home-primary);
}

body.is-results .results-level {
  width: 100%;
  max-width: 360px;
  margin: 0 auto clamp(10px, 1.6vh, 14px);
}

body.is-results .results-level__track {
  background: rgba(122, 156, 218, 0.16);
}

body.is-results .results-level__fill {
  background: var(--home-primary);
}

body.is-results .results-level__label {
  color: var(--home-text-muted);
  font-family: var(--font-body);
}

body.is-results .results-streak {
  margin: 0;
  color: var(--home-text-muted);
  text-align: center;
}

body.is-results .results__players {
  padding-top: clamp(16px, 2.4vh, 22px);
  border-top: 1px solid var(--home-border-soft);
}

body.is-results .results-player__icon {
  background: var(--home-surface-soft);
  border: 1px solid var(--home-border);
  color: var(--home-text-muted);
  font-size: 0;
}

body.is-results .results-player__name {
  color: var(--home-text-muted);
  font-family: var(--font-body);
}

body.is-results .results-player--opp .results-player__name {
  color: var(--home-amber);
}

body.is-results .results-player__score {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--home-text);
}

body.is-results .results-player:not(.results-player--opp) .results-player__score {
  color: var(--home-primary);
}

/* соперник ещё не закончил: вместо числа — приглушённая подпись, мельче числа */
body.is-results .results-player__score--waiting {
  font-family: var(--font-body);
  font-size: 0.8rem;
  line-height: 1.2;
  color: var(--home-text-muted);
  font-weight: 600;
}

body.is-results .results-player__vs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--home-surface-soft);
  border: 1px solid var(--home-border);
  color: var(--home-text-muted);
}

body.is-results .results-stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(10px, 1.4vw, 16px);
  margin-top: clamp(20px, 3vh, 28px);
  flex: none;
  min-height: auto;
}

body.is-results .results-stat-card {
  background: var(--home-surface-soft);
  border: 1px solid var(--home-border);
  border-radius: 14px;
  padding: clamp(14px, 2vh, 20px) 10px;
}

body.is-results .results-stat-card__value {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.1rem, 2vh, 1.35rem);
  color: var(--home-text);
}

body.is-results .results-stat-card__label {
  color: var(--home-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.68rem;
}

body.is-results .results__actions {
  margin-top: clamp(20px, 3vh, 28px);
}

body.is-results .results__actions .btn {
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 400;
}

body.is-results .results__actions .btn--primary {
  background: var(--home-primary);
  box-shadow: 0 0 28px rgba(47, 125, 253, 0.45);
}

body.is-results .results__actions .btn--primary:hover {
  background: #2469db;
}

body.is-results .results__actions .btn--ghost {
  background: transparent;
  color: var(--home-text);
  border: 1px solid var(--home-border);
}

body.is-results .results__actions .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 720px) {
  body.is-results .results-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  body.is-results .results-stat-grid {
    grid-template-columns: 1fr;
  }

  body.is-results .results__actions-row {
    flex-direction: column;
  }
}

/* =========================================================================
   ЭКРАН «РЕЙТИНГ» — тёмная тема «Electric Blue» (2026-09-28)
   Затрагивает ТОЛЬКО #screen-leaderboard в состоянии body.is-leaderboard
   (см. showScreen() в app.js). Загрузка/сортировка рейтинга, определение
   текущего игрока и переходы не трогаем — только переоформление под
   референс референс: ... "Экрна рейтинг.png".
   Иллюстрация — demo/assets/рейтинг.svg (используется только здесь).
   ========================================================================= */

/* Рамка — как у профиля и «Настрой игру»: тот же max-width, внешний отступ, паддинги, граница */
body.is-leaderboard #screen-leaderboard.screen--active {
  justify-content: flex-start;
}

body.is-leaderboard .leaderboard {
  max-width: 1160px;
  margin: clamp(16px, 2.4vh, 26px) auto;
  /* таблица по-прежнему прокручивается внутри рамки; высота — за вычетом тех же внешних отступов */
  max-height: calc(100% - 2 * clamp(16px, 2.4vh, 26px));
  padding: clamp(24px, 4vh, 44px) clamp(20px, 4vw, 48px);
  background: var(--home-surface);
  border: 1px solid var(--home-border);
  border-radius: var(--home-radius-lg);
  box-shadow: 0 0 60px rgba(47, 125, 253, 0.08);
  color: var(--home-text);
}

body.is-leaderboard .back-btn {
  color: var(--home-text-muted);
  /* как в профиле: кнопка по левому краю, а не растянутая на всю ширину (текст был по центру) */
  align-self: flex-start;
  margin-bottom: clamp(10px, 1.6vh, 16px);
}

body.is-leaderboard .back-btn:hover {
  color: var(--home-text);
}

body.is-leaderboard .leaderboard__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  margin-bottom: clamp(14px, 2vh, 20px);
}

body.is-leaderboard .leaderboard__title {
  margin: 0 0 clamp(4px, 0.8vh, 8px);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  color: var(--home-text);
}

body.is-leaderboard .leaderboard__note {
  margin: 0;
  color: var(--home-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
}

body.is-leaderboard .leaderboard__illustration {
  flex-shrink: 0;
  width: clamp(70px, 8vw, 110px);
  height: auto;
}

body.is-leaderboard .level-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: clamp(10px, 1.6vh, 14px) 0 0;
  padding: 0;
  background: none;
  max-width: 360px;
}

body.is-leaderboard .level-bar span:first-child {
  color: var(--home-text-muted);
  white-space: nowrap;
}

body.is-leaderboard .level-bar__track {
  background: rgba(122, 156, 218, 0.16);
}

body.is-leaderboard .level-bar__fill {
  background: var(--home-primary);
}

body.is-leaderboard .level-bar__label {
  color: var(--home-primary);
  white-space: nowrap;
}

body.is-leaderboard .leaderboard__panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-top: clamp(14px, 2.2vh, 20px);
  border-top: 1px solid var(--home-border-soft);
}

body.is-leaderboard .leaderboard__panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  margin-bottom: 6px;
}

body.is-leaderboard .leaderboard__panel-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--home-text);
}

body.is-leaderboard .leaderboard__scope-badge {
  flex-shrink: 0;
  padding: 6px 16px;
  border: 1px solid var(--home-border);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--home-text-muted);
  background: rgba(255, 255, 255, 0.03);
}

body.is-leaderboard .leaderboard__panel-desc {
  margin: 0 0 clamp(10px, 1.6vh, 16px);
  color: var(--home-text-muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}

body.is-leaderboard .leaderboard__table-wrap {
  flex: 1;
  min-height: 0;
  border: none;
  background: none;
}

body.is-leaderboard .leaderboard__table-wrap .lb-table thead {
  display: none;
}

body.is-leaderboard .lb-table {
  font-size: 0.92rem;
}

body.is-leaderboard .lb-table td {
  padding: clamp(9px, 1.4vh, 12px) 4px;
  border-bottom: 1px solid var(--home-border-soft);
  color: var(--home-text);
}

body.is-leaderboard .lb-table td:first-child {
  width: 1%;
  white-space: nowrap;
  padding-right: 4px;
}

body.is-leaderboard .lb-table td:nth-child(3) {
  display: none;
}

body.is-leaderboard .lb-table td:last-child {
  text-align: right;
  font-family: var(--font-display);
  font-weight: 400;
}

body.is-leaderboard .lb-table td:last-child strong::after {
  content: " XP";
  font-family: var(--font-body);
  font-weight: 400;
}

body.is-leaderboard .lb-rank {
  color: var(--home-text-muted);
}

body.is-leaderboard .lb-rank::after {
  content: ".";
}

body.is-leaderboard .lb-table td.lb-rank--gold { color: #f3c94d; }
body.is-leaderboard .lb-table td.lb-rank--silver { color: #b8c4d9; }
body.is-leaderboard .lb-table td.lb-rank--bronze { color: #d99a5b; }

body.is-leaderboard .lb-you {
  background: none;
  color: var(--home-primary);
  font-weight: 700;
}

body.is-leaderboard .lb-you td {
  color: var(--home-primary);
}

@media (max-width: 640px) {
  body.is-leaderboard .leaderboard__head {
    flex-direction: column;
    align-items: flex-start;
  }

  body.is-leaderboard .leaderboard__illustration {
    align-self: flex-end;
    margin-top: -8px;
  }

  body.is-leaderboard .leaderboard__panel-head {
    flex-wrap: wrap;
  }
}

/* =========================================================================
   ЭКРАН «НАСТРОЙ ИГРУ» — тёмная тема «Electric Blue» (2026-09-28)
   Затрагивает ТОЛЬКО #screen-setup-round в состоянии body.is-setup-round
   (см. showScreen() в app.js). Только соло-режим: после выбора «Что
   угадывать» на #screen-setup-solo пользователь попадает сюда, кнопка
   «Начать игру» теперь здесь (см. continueFromSetup()/
   startGameFromRoundSetup() в app.js). Дуэль/друг/код комнаты этот экран
   не показывают — их поток не менялся.
   Переиспользует реальные радио session-length (10/20/30/all) и реальную
   формулу очков (Scoring.getSessionMultiplier/formatMultiplier). Блок
   «Длительность на вопрос» удалён: таймер в движке — секундомер для
   бонуса за скорость, а не ограничение времени на вопрос.
   ========================================================================= */

body.is-setup-round #screen-setup-round.screen--active {
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.is-setup-round .panel.screen-fit {
  max-height: none;
  overflow: visible;
  flex-shrink: 0;
}

body.is-setup-round .panel {
  max-width: 1200px;
  margin: clamp(16px, 2.4vh, 26px) auto;
  padding: clamp(22px, 3vh, 36px);
  background: var(--home-surface);
  border: 1px solid var(--home-border);
  border-radius: var(--home-radius-lg);
  box-shadow: 0 0 60px rgba(47, 125, 253, 0.08);
  color: var(--home-text);
}

body.is-setup-round .back-btn {
  color: var(--home-text-muted);
  align-self: flex-start;
  margin-bottom: clamp(10px, 1.6vh, 16px);
}

body.is-setup-round .back-btn:hover {
  color: var(--home-text);
}

body.is-setup-round .panel__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  color: var(--home-text);
  margin: 0 0 8px;
}

body.is-setup-round .panel__text {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--home-text-muted);
  line-height: 1.5;
  margin: 0 0 clamp(20px, 3vh, 28px);
}

body.is-setup-round .panel__text strong {
  color: var(--home-text);
  font-weight: 700;
}

body.is-setup-round .round-setup__block {
  margin-bottom: clamp(18px, 2.6vh, 26px);
}

body.is-setup-round .round-setup__label {
  margin: 0 0 clamp(10px, 1.6vh, 14px);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1rem;
  color: var(--home-text);
}

body.is-setup-round .option-list--round {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 0;
}

body.is-setup-round .option-chip--round {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 10px 18px;
  border: 1.5px solid var(--home-border);
  border-radius: 12px;
  background: var(--home-surface-soft);
  color: var(--home-text);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

body.is-setup-round .option-chip--round input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

body.is-setup-round .option-chip--round:hover {
  border-color: rgba(47, 125, 253, 0.5);
}

body.is-setup-round .option-chip--round:has(input:checked) {
  border-color: var(--mode-border, var(--home-primary));
  color: var(--mode-accent, var(--home-primary));
  background: var(--mode-surface, rgba(47, 125, 253, 0.1));
}

body.is-setup-round .round-setup__scoring {
  margin: 0 0 clamp(14px, 2vh, 18px);
  padding: clamp(12px, 1.8vh, 16px) clamp(14px, 2vw, 18px);
  border: 1px solid var(--home-border);
  border-radius: 14px;
}

body.is-setup-round .round-setup__scoring .round-setup__label {
  margin-bottom: 8px;
}

body.is-setup-round .round-setup__rules {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--home-text-muted);
}

body.is-setup-round .round-setup__rules li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

body.is-setup-round .round-setup__rules strong {
  color: var(--home-text);
  font-weight: 700;
  white-space: nowrap;
}

body.is-setup-round .round-setup__subtitle {
  margin: 14px 0 8px;
  padding-top: 12px;
  border-top: 1px solid var(--home-border);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--home-text);
}

body.is-setup-round .round-setup__example {
  margin: 10px 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--home-text-muted);
}

body.is-setup-round .round-setup__summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 clamp(18px, 2.6vh, 26px);
  padding: clamp(12px, 1.8vh, 16px) clamp(14px, 2vw, 18px);
  background: var(--home-surface-soft);
  border: 1px solid var(--home-border);
  border-radius: 14px;
  color: var(--home-text);
}

body.is-setup-round .round-setup__summary-label {
  font-size: 0.9rem;
  color: var(--home-text-muted);
}

body.is-setup-round .round-setup__summary-value {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3.4vh, 1.9rem);
  line-height: 1.2;
  color: var(--home-primary);
}

body.is-setup-round .round-setup__summary-note {
  font-size: 0.8rem;
  color: var(--home-text-muted);
}

body.is-setup-round #btn-round-setup-start {
  align-self: flex-start;
  width: 320px;
  max-width: 100%;
  height: 54px;
  flex-shrink: 0;
  padding: 0 32px;
  font-family: var(--font-display);
  font-weight: 400;
  border-radius: 999px;
  background: var(--home-primary);
  box-shadow: 0 0 24px rgba(47, 125, 253, 0.45);
}

body.is-setup-round #btn-round-setup-start:hover {
  background: #2469db;
}

@media (max-width: 640px) {
  body.is-setup-round #btn-round-setup-start {
    width: 100%;
  }

  body.is-setup-round .option-chip--round {
    flex: 1 1 calc(50% - 10px);
  }

  body.is-setup-round .option-list--single .option-chip--round {
    flex: 0 0 auto;
  }

  body.is-setup-round #round-setup-capital-options .option-chip--round {
    flex: 1 1 auto;
    padding-inline: 12px;
    white-space: nowrap;
  }
}

/* =========================================================================
   ЭКРАНЫ-ЗАГЛУШКИ «БОНУСЫ» / «ИСПЫТАНИЯ» — тёмная тема «Electric Blue»
   (2026-09-28). Затрагивает ТОЛЬКО #screen-bonuses и #screen-challenges в
   состоянии body.is-stub-screen (см. showScreen() в app.js). Разделы пока
   не реализованы — здесь только переоформление уже существующей заглушки
   (заголовок + .setup-notice--info), контент/тексты/ID не трогаем.
   ========================================================================= */

body.is-stub-screen .panel {
  max-width: min(680px, 96vw);
  width: 100%;
  margin: auto;
  padding: clamp(24px, 4vh, 40px) clamp(22px, 4vw, 40px);
  background: var(--home-surface);
  border: 1px solid var(--home-border);
  border-radius: var(--home-radius-lg);
  box-shadow: 0 0 60px rgba(47, 125, 253, 0.08);
  color: var(--home-text);
}

body.is-stub-screen .back-btn {
  color: var(--home-text-muted);
  align-self: flex-start;
  margin-bottom: clamp(10px, 1.6vh, 16px);
}

body.is-stub-screen .back-btn:hover {
  color: var(--home-text);
}

body.is-stub-screen .panel__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  color: var(--home-text);
  margin: 0 0 clamp(14px, 2.2vh, 20px);
}

body.is-stub-screen .setup-notice--info {
  margin: 0;
  padding: clamp(14px, 2vh, 18px) clamp(16px, 2.2vw, 20px);
  background: none;
  border: 1px solid var(--home-border);
  border-radius: 14px;
  color: var(--home-text-muted);
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.5;
}

/* =========================================================================
   ЭКРАН «ТВОЙ ПРОФИЛЬ» — тёмная тема «Electric Blue» (2026-09-28).
   Затрагивает ТОЛЬКО #screen-profile в состоянии body.is-profile (см.
   showScreen() в app.js). Загрузку статистики (renderProfile()), ID и
   структуру не трогаем — только переоформление под референс
   референс: твой профиль.png. Уровень/XP теперь
   считаются по реальной формуле тиров (scoreLevel/levelProgress/
   levelXpTarget), как на главной и в рейтинге — не выдумываем числа.
   ========================================================================= */

body.is-profile #screen-profile.screen--active {
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.is-profile .profile.screen-fit {
  max-height: none;
  overflow: visible;
  flex-shrink: 0;
}

body.is-profile .profile {
  max-width: 1160px;
  margin: clamp(16px, 2.4vh, 26px) auto;
  padding: clamp(24px, 4vh, 44px) clamp(20px, 4vw, 48px);
  background: var(--home-surface);
  border: 1px solid var(--home-border);
  border-radius: var(--home-radius-lg);
  box-shadow: 0 0 60px rgba(47, 125, 253, 0.08);
  color: var(--home-text);
}

body.is-profile .back-btn {
  color: var(--home-text-muted);
  align-self: flex-start;
  margin-bottom: clamp(10px, 1.6vh, 16px);
}

body.is-profile .back-btn:hover {
  color: var(--home-text);
}

body.is-profile .profile__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  color: var(--home-text);
  margin: 0 0 clamp(16px, 2.4vh, 22px);
}

body.is-profile .profile-level {
  margin: 0 0 clamp(16px, 2.4vh, 22px);
}

body.is-profile .profile-level__icon {
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--home-primary);
  color: var(--home-primary);
  background: var(--home-primary-soft);
}

body.is-profile .profile-level__pill {
  color: #fff;
  background: var(--home-primary);
  border: none;
  box-shadow: 0 0 20px rgba(47, 125, 253, 0.35);
  font-family: var(--font-display);
  font-weight: 400;
}

body.is-profile .profile-xp {
  margin-bottom: clamp(20px, 3vh, 28px);
}

body.is-profile .profile-xp__track {
  height: 10px;
  background: rgba(122, 156, 218, 0.16);
}

body.is-profile .profile-xp__fill {
  background: var(--home-primary);
}

body.is-profile .profile-xp__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--home-text);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 0.92rem;
}

body.is-profile .profile-xp__label::before {
  content: "";
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background: var(--home-primary);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 42'%3E%3Cpath d='M12.1667 22.8864H3L15.8333 1.25V13.6136H25L12.1667 35.25V22.8864Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 42'%3E%3Cpath d='M12.1667 22.8864H3L15.8333 1.25V13.6136H25L12.1667 35.25V22.8864Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

body.is-profile .profile__section-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--home-text);
  margin: 0 0 clamp(10px, 1.6vh, 14px);
}

body.is-profile .profile-metric-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 1.4vw, 16px);
  margin-bottom: clamp(20px, 3vh, 28px);
}

body.is-profile .profile-metric-card {
  background: var(--home-surface-soft);
  border: 1px solid var(--home-border);
  border-radius: 14px;
}

body.is-profile .profile-metric-card__value {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.15rem, 2vh, 1.4rem);
  color: var(--home-text);
}

body.is-profile .profile-metric-card__label {
  border-top: 1px solid var(--home-border-soft);
  color: var(--home-text-muted);
}

body.is-profile .profile-empty {
  border: 1px solid var(--home-border);
  border-radius: 16px;
}

body.is-profile .profile-empty__title {
  color: var(--home-text);
}

body.is-profile .profile-empty__note {
  color: var(--home-text-muted);
}

body.is-profile .profile-empty .btn--primary {
  background: var(--home-primary);
  box-shadow: 0 0 24px rgba(47, 125, 253, 0.45);
}

body.is-profile .profile-empty .btn--primary:hover {
  background: #2469db;
}

body.is-profile .back-btn:focus-visible,
body.is-profile .profile-empty .btn:focus-visible,
body.is-profile #btn-profile-start-first:focus-visible {
  outline: 2px solid var(--home-primary);
  outline-offset: 2px;
}

/* Мобильный профиль: три карточки каждого блока всегда в одну строку */
@media (max-width: 720px) {
  body.is-profile .profile-metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  body.is-profile .profile-metric-card {
    min-width: 0;
    border-radius: 12px;
  }

  body.is-profile .profile-metric-card__value {
    padding: 12px 4px 8px;
    font-size: 1.05rem;
  }

  body.is-profile .profile-metric-card__label {
    padding: 8px 4px;
    font-size: 0.7rem;
    line-height: 1.2;
    overflow-wrap: break-word;
    hyphens: auto;
  }
}

/* =========================================================================
   ИГРОВОЙ ЭКРАН — компактный layout (2026-10-01)
   Цель: вопрос, варианты ответов и таймер помещаются в видимую область без
   прокрутки. Высоту области вопроса (флаг/карта/код региона/столица) занимает
   «резиновый» визуал — он сжимается под доступное место, а кнопки ответов
   сохраняют удобный размер. Если места всё же мало (очень низкие окна),
   прокрутка остаётся ТОЛЬКО внутри .game-panel, не у страницы.
   Механика (таймер, попытки, обратная связь, переходы) не затрагивается.
   ========================================================================= */

body.is-game .main {
  padding-top: clamp(6px, 1vh, 12px);
  padding-bottom: clamp(8px, 1.4vh, 16px);
  gap: 0;
}

/* «Назад» — в потоке, а не поверх панели */
body.is-game #screen-game .game-back-btn {
  position: static;
  align-self: flex-start;
  margin: 0 0 6px;
  padding: 4px 10px;
  flex: 0 0 auto;
}

body.is-game .game-layout {
  margin-top: 0;
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
}

body.is-game .game-panel {
  padding: clamp(10px, 1.6vh, 18px) clamp(14px, 2.2vw, 28px);
  gap: clamp(6px, 1vh, 10px);
  min-height: 0;
  overflow-x: hidden;
}

body.is-game .game-top {
  padding: clamp(6px, 1vh, 10px) 14px;
}

body.is-game .timer {
  width: clamp(40px, 5.2vh, 48px);
  height: clamp(40px, 5.2vh, 48px);
}

body.is-game .timer__value {
  font-size: 0.82rem;
}

/* карточка вопроса занимает остаток высоты, визуал — «резиновый» */
body.is-game .question-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(10px, 1.6vh, 18px) clamp(12px, 1.8vw, 22px);
}

body.is-game .question-card__head {
  margin-bottom: 4px;
}

body.is-game .question-card__prompt {
  margin: 0 0 clamp(6px, 1vh, 10px);
  font-size: clamp(0.95rem, 2vh, 1.15rem);
  line-height: 1.25;
}

body.is-game .question-card__spacer {
  display: none;
}

body.is-game .question-visual,
body.is-game .question-visual--flag,
body.is-game .question-visual--code,
body.is-game .question-visual--capital,
body.is-game .question-visual--map {
  flex: 1 1 0;
  height: auto;
  min-height: clamp(96px, 16vh, 150px);
  max-height: none;
  margin-bottom: clamp(8px, 1.2vh, 12px);
  padding: clamp(6px, 1vh, 12px);
  overflow: hidden;
}

/* флаг подгоняется под высоту визуала */
body.is-game .question-visual--flag .flag-display {
  --flag-max-h: clamp(96px, 26vh, 240px);
  height: auto;
  max-height: var(--flag-max-h);
  max-width: min(100%, 520px);
}

body.is-game .question-visual--flag .flag-display:not(.flag-display--photo) {
  width: auto;
  height: var(--flag-max-h);
  aspect-ratio: 3 / 2;
}

/* флаг уменьшен: размер ограничен и по высоте, и по ширине, пропорции файла сохраняются (height:auto) */
body.is-game .question-visual--flag .flag-display__img {
  max-height: var(--flag-max-h);
  max-width: 100%;
  height: auto;
  width: auto;
  object-fit: contain;
}

body.is-game .question-visual--code,
body.is-game .question-visual--capital {
  max-height: none;
}

/* варианты ответов — всегда 2×2, кнопки остаются удобными для нажатия */
body.is-game .answers {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(6px, 1vh, 10px);
  min-height: 0;
  flex: 0 0 auto;
}

body.is-game .answer-btn {
  min-height: 48px;
  padding: 8px 12px;
  font-size: clamp(0.88rem, 1.7vh, 1rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

/* статус: «Попытка N» и обратная связь — компактно, место зарезервировано */
body.is-game .game-status {
  height: auto;
  flex: 0 0 auto;
}

body.is-game .attempt-info {
  margin-top: 6px;
  font-size: 0.78rem;
  line-height: 1.2;
}

body.is-game .feedback {
  margin-top: 6px;
  height: 36px;
  flex: 0 0 36px;
  font-size: 0.88rem;
}

/* телефон: верхнее меню в одну строку, чтобы не съедать высоту у игры */
@media (max-width: 720px) {
  body.is-game .topbar__inner {
    min-height: 0;
    padding-top: 8px;
    padding-bottom: 8px;
    gap: 6px;
  }

  body.is-game .topbar__nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: none;
  }

  body.is-game .topbar__nav::-webkit-scrollbar {
    display: none;
  }

  body.is-game .topbar__link {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

/* строка счёта: длинное имя соперника сокращается, а не вылезает за карточку */
body.is-game .game-top__scores {
  min-width: 0;
}

body.is-game .score-pill {
  min-width: 0;
}

body.is-game .score-pill--opp {
  flex: 0 1 auto;
}

body.is-game .score-pill--opp .score-pill__label {
  min-width: 0;
  max-width: 9em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.is-game .score-pill__value {
  flex: 0 0 auto;
}

/* ответы: слова не рвём посередине, на узких экранах чуть мельче */
body.is-game .answer-btn {
  overflow-wrap: break-word;
  hyphens: auto;
}

/* =========================================================================
   ГЛАВНАЯ — мобильная версия по референсу «главная .png» (2026-10-01)
   Только телефоны (≤520px), только body.is-home: desktop и планшет не
   затронуты. Меню в две строки (4 + 1), hero с глобусом справа внизу и
   компактной кнопкой слева, прогресс «иконка + уровень / полоса + XP»,
   три режима вертикально, «Выбрать режим →» компактная под ними.
   ========================================================================= */
@media (max-width: 520px) {
  /* блоки главной не сжимаются по высоте — длинный контент листается вертикально */
  body.is-home #screen-home > *,
  body.is-home .home-layout__main,
  body.is-home .mode-section {
    flex-shrink: 0;
  }

  body.is-home .mode-section > * {
    flex-shrink: 0;
  }

  /* --- шапка: меню 4 + 1 --- */
  body.is-home .topbar__inner {
    min-height: 0;
    padding-top: 14px;
    padding-bottom: 12px;
    gap: 10px;
  }

  body.is-home .topbar__nav {
    gap: 6px;
    flex-wrap: wrap;
  }

  body.is-home .topbar__link {
    gap: 3px;
    padding: 5px 7px 5px 4px;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.72rem;
    white-space: nowrap;
  }

  body.is-home .topbar__link-label {
    font-family: var(--font-body);
    font-weight: 500;
  }

  body.is-home .topbar__link-num {
    width: 15px;
    height: 15px;
    font-size: 9px;
  }

  /* --- hero: текст слева, глобус справа внизу, кнопка слева внизу --- */
  body.is-home .hero--electric {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    column-gap: 10px;
    row-gap: 0;
    text-align: left;
    align-items: start;
    min-height: 0;
    padding: 20px 20px 22px;
    border-radius: 24px;
  }

  body.is-home .hero__col--text {
    display: contents;
  }

  body.is-home .hero--electric .hero__sub br {
    display: none;
  }

  body.is-home .hero__eyebrow,
  body.is-home .hero--electric .hero__title {
    grid-column: 1 / -1;
    margin-left: 0;
    margin-right: 0;
  }

  body.is-home .hero__eyebrow {
    margin-bottom: 8px;
    font-size: 0.56rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
  }

  body.is-home .hero--electric .hero__title {
    margin-bottom: 10px;
    font-size: clamp(1.1rem, 5.2vw, 1.4rem);
    line-height: 1.15;
  }

  body.is-home .hero--electric .hero__sub {
    grid-column: 1;
    grid-row: 3;
    margin: 0 0 16px;
    font-size: 0.82rem;
    line-height: 1.55;
  }

  body.is-home .hero__col--art {
    grid-column: 2;
    grid-row: 3 / span 2;
    align-self: center;
    justify-self: end;
    width: 100%;
  }

  body.is-home .hero__globe {
    display: block;
    width: 100%;
    height: auto;
    max-width: 118px;
    margin-left: auto;
    margin-right: -8px;
  }

  body.is-home .hero--electric .hero__cta {
    grid-column: 1;
    grid-row: 4;
    justify-self: start;
    width: auto;
    max-width: none;
    height: 40px;
    margin: 0;
    padding: 0 28px;
    font-size: 0.9rem;
  }

  /* --- прогресс: [иконка][уровень] / [полоса][⚡ XP] --- */
  body.is-home .home-progress {
    min-height: 0;
    padding: 16px 18px;
    border-radius: 24px;
  }

  body.is-home .home-progress__row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px 8px;
  }

  body.is-home .home-progress__icon {
    grid-column: 1;
    grid-row: 1;
  }

  body.is-home .home-progress__level-pill {
    grid-column: 2 / -1;
    grid-row: 1;
    justify-self: start;
    padding: 6px 16px;
  }

  body.is-home .home-progress__track {
    grid-column: 1 / 3;
    grid-row: 2;
    order: 0;
    flex-basis: auto;
    min-width: 0;
  }

  body.is-home .home-progress__xp-icon {
    grid-column: 3;
    grid-row: 2;
  }

  body.is-home .home-progress__xp-icon img {
    height: 14px;
  }

  body.is-home .home-progress__score {
    grid-column: 4;
    grid-row: 2;
    font-size: 0.8rem;
    font-weight: 400;
    white-space: nowrap;
  }

  /* --- три способа играть: строго вертикально --- */
  body.is-home .mode-section {
    min-height: 0;
    padding: 18px;
    border-radius: 24px;
  }

  body.is-home .mode-grid--three {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin-bottom: 16px;
  }

  body.is-home .mode-card {
    padding: 16px;
    gap: 6px;
    border-radius: 18px;
  }

  body.is-home .mode-card__title {
    font-size: 1rem;
    overflow-wrap: break-word;
  }

  body.is-home .mode-card__desc {
    font-size: 0.82rem;
    line-height: 1.5;
  }

  body.is-home #btn-mode-continue {
    align-self: flex-start;
    width: auto;
    height: 46px;
    padding: 0 28px;
    font-size: 0.9rem;
  }
}

/* =========================================================================
   ВЫБОР РЕЖИМА — мобильные горизонтальные ряды карточек (2026-10-01)
   Референс: «игровой режим.png». Только ≤720px и только body.is-setup:
   каждый .pick-grid («С кем играть», «Что угадывать», континенты, страны,
   типы вопросов) — горизонтальный scroll-контейнер внутри своей секции,
   с прилипанием к карточкам. Первая карточка видна целиком, следующая
   выглядывает справа. Десктоп остаётся обычной сеткой.
   ========================================================================= */
@media (max-width: 720px) {
  body.is-setup .setup-block {
    padding: 16px;
    overflow: hidden;
  }

  body.is-setup .pick-grid {
    display: flex;
    flex-wrap: nowrap;
    grid-template-columns: none;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* запас под свечение выбранной карточки; ряд доходит до рамки секции */
    padding: 8px 16px 12px 4px;
    margin: -8px -16px 0 -4px;
  }

  body.is-setup .pick-grid::-webkit-scrollbar {
    display: none;
  }

  body.is-setup .pick-grid > .pick-card {
    flex: 0 0 clamp(200px, 72%, 280px);
    min-width: 0;
    scroll-snap-align: start;
  }

  body.is-setup .pick-card__title {
    overflow-wrap: break-word;
  }
}

/* Уровни/XP: длинные подписи («250 000 / 400 000 XP», «600 000 XP · Максимум»)
   на телефоне переносятся под полосу прогресса, а не сжимают её */
@media (max-width: 520px) {
  body.is-profile .profile-xp {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  body.is-profile .profile-xp__track {
    flex: 1 1 100%;
  }

  body.is-profile .profile-xp__label {
    margin-left: auto;
  }
}

/* Профиль: выбор региона (кастомный listbox) и кнопка связи с разработчиком */
body.is-profile .region-picker {
  position: relative;
  max-width: 460px;
  margin: 0 0 clamp(18px, 2.6vh, 24px);
}

body.is-profile .region-picker__label {
  display: block;
  margin: 0 0 8px;
  color: var(--home-text-muted);
  font-size: 0.85rem;
}

body.is-profile .region-picker__button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  background: var(--home-surface-soft);
  border: 1px solid var(--home-border);
  border-radius: 14px;
  color: var(--home-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

body.is-profile .region-picker__button:hover,
body.is-profile .region-picker--open .region-picker__button {
  border-color: var(--home-primary);
}

body.is-profile .region-picker__button:focus-visible {
  outline: 2px solid var(--home-primary);
  outline-offset: 2px;
}

body.is-profile .region-picker--open .region-picker__button {
  box-shadow: 0 0 0 3px var(--home-primary-soft);
}

body.is-profile .region-picker__flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
  width: 28px;
  height: 19px;
}

body.is-profile .region-picker__flag[hidden] { display: none; }

body.is-profile .region-picker__flag img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

body.is-profile .region-picker__value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.is-profile .region-picker__value--placeholder { color: var(--home-text-muted); }

body.is-profile .region-picker__chevron {
  flex-shrink: 0;
  color: var(--home-text-muted);
  transition: transform 0.15s ease;
}

body.is-profile .region-picker--open .region-picker__chevron { transform: rotate(180deg); }

body.is-profile .region-picker__list {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: min(320px, 50vh);
  margin: 0;
  padding: 6px;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--home-surface);
  border: 1px solid var(--home-border);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(47, 125, 253, 0.12);
  scrollbar-width: thin;
  scrollbar-color: rgba(122, 156, 218, 0.4) transparent;
  outline: none;
}

body.is-profile .region-picker__list[hidden] { display: none; }

body.is-profile .region-picker__option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--home-text);
  font-size: 0.95rem;
  line-height: 1.25;
  cursor: pointer;
}

body.is-profile .region-picker__option--none { color: var(--home-text-muted); }

body.is-profile .region-picker__name { min-width: 0; overflow-wrap: anywhere; }

body.is-profile .region-picker__option--active { background: var(--home-primary-soft); }

body.is-profile .region-picker__option[aria-selected="true"] {
  box-shadow: inset 0 0 0 1px var(--home-primary);
}

body.is-profile .profile__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0 0 clamp(16px, 2.4vh, 22px);
}

body.is-profile .profile__head .profile__title { margin: 0; }

/* Ссылка связи с разработчиком: маленький текст с иконкой, без рамки */
body.is-profile .profile-contact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0 auto;
  padding: 4px 2px;
  color: var(--home-text-muted);
  font-size: 0.78rem;
  line-height: 1.2;
  text-decoration: none;
  background: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s ease;
}

body.is-profile .profile-contact:hover { color: var(--home-primary); }

body.is-profile .profile-contact:focus-visible {
  outline: 2px solid var(--home-primary);
  outline-offset: 2px;
  border-radius: 6px;
}

@media (max-width: 720px) {
  body.is-profile .region-picker { max-width: none; }
}

/* Рейтинг: имя игрока и бейдж региона */
body.is-leaderboard .lb-table td:nth-child(2) {
  width: 100%;
  max-width: 0;
}

body.is-leaderboard .lb-player {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

body.is-leaderboard .lb-name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* флаг и номер — одной высоты (22px; 18px на мобильном); ширина флага по его пропорциям (3:2, 2:1…), без обрезки — object-fit: contain */
/* флаг + номер с кодом региона: статичные, без рамки-«таблетки» и без названия региона */
body.is-leaderboard .lb-region {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

body.is-leaderboard .lb-region__flag {
  flex: 0 0 auto;
  width: auto;
  height: 22px;
  max-width: 44px;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

body.is-leaderboard .lb-region__plate {
  flex: 0 0 auto;
  width: 29px;
  height: 22px;
  display: block;
}

@media (max-width: 520px) {
  body.is-leaderboard .lb-player { gap: 6px; }
  body.is-leaderboard .lb-region { gap: 4px; }
  body.is-leaderboard .lb-region__flag { width: auto; height: 18px; max-width: 36px; }
  body.is-leaderboard .lb-region__plate { width: 24px; height: 18px; }
}

body.is-leaderboard .lb-table td:last-child { white-space: nowrap; }

/* =========================================================================
   Компактная шапка (десктоп ≥ 861px): логотип слева, меню по центру,
   XP/уровень справа — всё в одну строку. Мобильные раскладки (≤ 860px)
   остаются прежними (меню переносится/прокручивается по строкам).
   ========================================================================= */
@media (min-width: 861px) {
  body[class] .topbar__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    justify-content: stretch;
    flex-direction: row;
    min-height: 0;
    padding-top: 10px;
    padding-bottom: 10px;
    padding-left: 24px;
    padding-right: 24px;
    gap: 16px;
  }

  body[class] .topbar__inner > .logo {
    justify-self: start;
  }

  body[class] .topbar__nav {
    justify-self: center;
    flex-wrap: nowrap;
    gap: 6px;
  }

  body[class] .topbar__progress {
    position: static;
    justify-self: end;
    margin: 0;
    flex-wrap: nowrap;
  }

  body[class] .logo__icon {
    width: 30px;
    height: 30px;
  }

  body[class] .logo__text {
    font-size: 0.95rem;
    white-space: nowrap;
  }

  body[class] .topbar__link {
    gap: 5px;
    padding: 4px 11px 4px 6px;
    font-size: 0.75rem;
    white-space: nowrap;
  }

  body[class] .topbar__link-num {
    width: 17px;
    height: 17px;
    font-size: 10px;
  }

  body[class] .topbar__progress-xp { font-size: 0.85rem; }
  body[class] .topbar__progress-xp-icon { height: 14px; }
  body[class] .topbar__progress { min-width: 0; max-width: 100%; }
  body[class] .topbar__progress-xp { flex: 0 0 auto; }
  body[class] .topbar__progress-level {
    display: block;
    flex: 0 1 auto;
    min-width: 0;
    padding: 2px 9px;
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (min-width: 1100px) {
  body[class] .topbar__inner {
    padding-left: var(--home-gutter);
    padding-right: var(--home-gutter);
  }
}

/* Мобильная шапка (≤ 860px): меню всегда в одну строку.
   Размер пунктов подстраивается под ширину экрана; если совсем узко — горизонтальная прокрутка меню. */
@media (max-width: 860px) {
  body[class] .topbar__inner {
    min-height: 0;
    padding: 10px 16px;
    gap: 8px;
  }

  body[class] .topbar__nav {
    flex-wrap: nowrap;
    gap: clamp(3px, 1vw, 6px);
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  body[class] .topbar__nav::-webkit-scrollbar { display: none; }

  body[class] .topbar__link {
    flex: 0 0 auto;
    gap: clamp(2px, 0.8vw, 5px);
    padding: clamp(4px, 1.2vw, 6px) clamp(6px, 2.2vw, 12px) clamp(4px, 1.2vw, 6px) clamp(3px, 1vw, 6px);
    font-family: var(--font-display);
    font-size: clamp(0.58rem, 2.7vw, 0.78rem);
    white-space: nowrap;
  }

  body[class] .topbar__link-label { font-family: var(--font-display); font-weight: 400; }

  body[class] .topbar__link-num {
    width: clamp(12px, 3.8vw, 18px);
    height: clamp(12px, 3.8vw, 18px);
    font-size: clamp(7px, 2.2vw, 10px);
  }
}

/* Телефон: чтобы все 5 пунктов уместились в одну строку при читаемом тексте,
   кружки с цифрами скрываем (порядок и подписи остаются). */
@media (max-width: 520px) {
  body[class] .topbar__link-num { display: none; }

  body[class] .topbar__link,
  body[class] .topbar__link-label {
    font-family: var(--font-body);
    font-weight: 500;
  }

  body[class] .topbar__link {
    padding: 6px clamp(6px, 2vw, 11px);
    font-size: clamp(0.68rem, 3vw, 0.82rem);
  }

  body[class] .topbar__nav { gap: clamp(3px, 1vw, 5px); }
}

/* =========================================================================
   ИГРОВОЙ ЭКРАН — максимум места для карты (компактная шапка раунда).
   Меняется только компоновка и размеры; механика, таймер и карта не трогаются.
   .game-head: название раунда · счёт · точки прогресса · таймер — одна строка.
   ========================================================================= */
body.is-game .game-panel {
  padding: clamp(8px, 1.2vh, 12px) clamp(12px, 2vw, 22px);
  gap: clamp(6px, 0.9vh, 8px);
}

body.is-game .game-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "title scores timer"
    "dots  dots   dots";
  align-items: center;
  column-gap: clamp(10px, 1.6vw, 20px);
  row-gap: clamp(3px, 0.6vh, 6px);
  flex: 0 0 auto;
  min-width: 0;
}

body.is-game .game-head .round-title { grid-area: title; margin: 0; white-space: nowrap; font-size: 0.72rem; }
body.is-game .game-head .game-top { grid-area: scores; margin: 0; padding: 3px 12px; min-width: 0; border-radius: 12px; }
body.is-game .game-head .question-dots { grid-area: dots; justify-self: stretch; gap: clamp(2px, 0.5vw, 6px); min-width: 0; flex-wrap: nowrap; }
body.is-game .game-head .timer { grid-area: timer; width: 36px; height: 36px; margin: 0; }
body.is-game .game-head .timer__value { font-size: 0.7rem; }
/* точки сжимаются, если их много (30+ вопросов), и остаются в одной строке внутри контейнера */
body.is-game .game-head .question-dot { flex: 0 1 auto; min-width: 3px; width: 7px; height: auto; aspect-ratio: 1; }
body.is-game .game-head .score-pill__label,
body.is-game .game-head .score-pill__value { font-size: 0.92rem; }

/* карточка вопроса: плашка типа и заголовок в одной строке, меньше отступов */
body.is-game .question-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  column-gap: 10px;
  align-items: center;
  padding: clamp(8px, 1.2vh, 12px) clamp(10px, 1.4vw, 16px);
}

body.is-game .question-card__head { grid-column: 1; margin: 0; }
body.is-game .question-card .question-type { padding: 2px 8px; font-size: 0.68rem; line-height: 1.3; }
body.is-game .question-card__prompt {
  grid-column: 2;
  margin: 0;
  font-size: clamp(0.88rem, 1.7vh, 1rem);
}

body.is-game .question-card .question-visual {
  grid-column: 1 / -1;
  align-self: stretch;
  min-height: clamp(110px, 20vh, 180px);
  margin: clamp(6px, 0.9vh, 8px) 0;
  padding: clamp(4px, 0.7vh, 8px);
}

body.is-game .question-card .answers {
  grid-column: 1 / -1;
  gap: 6px;
}

body.is-game .question-card .game-status { grid-column: 1 / -1; }

/* ответы: компактнее, сетка 2×2, длинные названия переносятся и не вылезают */
body.is-game .answer-btn {
  min-height: 38px;
  padding: 5px 10px;
  font-size: clamp(0.8rem, 1.5vh, 0.92rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
  hyphens: auto;
}

body.is-game .attempt-info { margin-top: 4px; font-size: 0.72rem; }
body.is-game .feedback { margin-top: 4px; height: 28px; flex: 0 0 28px; font-size: 0.82rem; }
body.is-game #screen-game .game-back-btn { margin-bottom: 4px; padding: 2px 8px; }

/* мобильный: две строки — [название · таймер] и [счёт · точки] */
/* =========================================================================
   МОБИЛЬНЫЙ: XP и уровень — в правый верх шапки (в одной строке с логотипом),
   верх игрового блока: [название | таймер справа] / [счёт] / [точки].
   Десктоп (≥ 861px) не затрагивается.
   ========================================================================= */
@media (max-width: 860px) {
  body[class] .topbar__inner { position: relative; }

  body[class] .topbar__progress {
    position: absolute;
    top: 10px;
    right: 16px;
    height: 36px;
    margin: 0;
    max-width: calc(100% - 32px - 170px);
    min-width: 0;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
  }

  body[class] .topbar__progress-xp { flex: 0 0 auto; font-size: 0.85rem; }
  body[class] .topbar__progress-xp-icon { height: 14px; }
  body[class] .topbar__progress-level {
    display: block;
    flex: 0 1 auto;
    min-width: 0;
    padding: 2px 8px;
    font-size: 0.7rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Знак «Код региона» в игре: крупнее на широком экране, пропорции 520:112 сохраняются (height:auto) */
body.is-game .plate-wrap {
  width: min(100%, clamp(300px, 44vw, 620px));
}

body.is-game .plate-photo {
  border-radius: 0;
}

/* =========================================================================
   Карта «Мир → Океания»: общий вид + увеличенный участок для очень маленьких
   стран (map.js → planMapInset). Контуры в увеличенном участке — те же SVG-path.
   Расклад (как в референсе клиента):
     • десктоп/планшет (> 720px): общая карта слева (≈58% ширины), увеличенный участок справа (≈42%);
       у рассыпанной страны (Кирибати) справа два участка друг под другом;
     • телефон (≤ 720px): общая карта сверху, увеличенный участок(и) под ней.
   Блок ответов и остальные элементы игры не затрагиваются: всё лежит внутри .question-visual--map.
   ========================================================================= */
.question-visual--map .map-wrap--inset {
  display: grid;
  grid-template-columns: minmax(0, 58fr) minmax(0, 42fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "ctx ctx"
    "fit insets"
    "cap cap";
  column-gap: 10px;
  row-gap: 6px;
}

.question-visual--map .map-wrap--inset .map-context { grid-area: ctx; }
.question-visual--map .map-wrap--inset .map-caption { grid-area: cap; }

/* Safari/WebKit: процентная высота svg внутри flex-блока (в том числе в ячейке grid) считается неопределённой — карта растягивалась
   по ширине контейнера и обрезалась сверху/снизу: у Палау, Микронезии, Науру пунктирная рамка оказывалась за краем кадра, а у карт без
   увеличенного участка (Африка и др.) стартовый кадр сдвигался. Абсолютное заполнение .map-fit даёт карте определённый размер во всех
   браузерах: в кадре всегда виден весь viewBox. Действует для всех карт вопроса (.map-fit создаётся только в renderRussiaMap). */
.question-visual--map .map-fit { position: relative; }
.question-visual--map .map-fit > .map-panzoom {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* общая карта: пропорции viewBox сохраняются, по высоте — по центру ячейки */
.question-visual--map .map-wrap--inset .map-fit {
  grid-area: fit;
  align-self: center;
  width: 100%;
  height: auto;
  aspect-ratio: var(--map-aspect, 4);
  max-height: 100%;
  flex: none;
}

.map-insets {
  grid-area: insets;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* одна часть: окно со своей пропорцией */
.map-inset {
  position: relative;
  width: 100%;
  max-height: 100%;
  aspect-ratio: var(--inset-aspect, 1.6);
  min-width: 0;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  border: 1.5px dashed #1f3a4d;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
}

/* две части (рассыпанные острова): друг под другом, делят высоту поровну */
.map-insets--2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  align-self: stretch;
  height: 100%;
}

.map-insets--2 .map-inset {
  height: 100%;
  aspect-ratio: auto;
}

@media (max-width: 720px) {
  .question-visual--map .map-wrap--inset {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "ctx"
      "fit"
      "insets"
      "cap";
    row-gap: 6px;
  }

  .question-visual--map .map-wrap--inset .map-fit {
    align-self: stretch;
    max-height: none;
  }
}

.map-inset__svg {
  display: block;
  width: 100%;
  height: 100%;
}

.map-inset__label {
  position: absolute;
  top: 4px;
  left: 8px;
  /* окно бывает и тёмным (море), и светлым (суша): подпись на своей тёмной плашке читается в обоих случаях */
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(11, 18, 32, 0.78);
  color: #e2e8f0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
}

/* пунктирная рамка участка на общей карте; толщина не зависит от масштаба.
   Карта на тёмном фоне: светлая рамка с тёмным контуром видна и на тёмном море, и на светлой суше
   (раньше была тёмно-синей #1f3a4d и у Палау, Микронезии, Науру растворялась в море) */
.map-wrap svg .map-inset-frame {
  fill: none;
  stroke: #ffd21f;      /* тот же жёлтый, что у подсвеченной страны и её увеличенного участка (22.11.2026, по просьбе Марии) */
  stroke-width: 1.8px;
  stroke-dasharray: 5 3;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
  filter: drop-shadow(0 0 1.5px rgba(2, 6, 23, 0.95));
}

/* крошечные острова: жёлтая заливка видна и в увеличенном участке, и на общей карте; штрих того же цвета лишь
   «утолщает» мелкий контур — тёмной обводки и тени нет */
.map-wrap .map-inset svg .map-region--highlight {
  fill: #ffd21f;
  stroke: #ffd21f;
  stroke-width: 1.4px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  filter: none;
}

.map-wrap.map-wrap--inset .map-fit svg .map-region--highlight {
  fill: #ffd21f;
  stroke: #ffd21f;
  stroke-width: 1.4px;
  filter: none;
}

.map-wrap .map-inset svg .map-region--base {
  stroke-width: 0.9px;      /* белые страны выбранной части света — усиленные границы */
}
.map-wrap .map-inset svg .map-region--context {
  stroke-width: 0.8px;      /* серые соседи — как раньше */
}

@media (max-width: 720px) {
  .map-inset__label { font-size: 0.6rem; }
}

/* Окно «Игра не завершена» (восстановление соло-игры) */
.resume-modal__info {
  list-style: none;
  margin: 0 0 18px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--home-border);
  border-radius: 14px;
  font-size: 0.9rem;
  color: var(--home-text-muted);
}

.resume-modal__info li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.resume-modal__info strong {
  color: var(--home-text);
  text-align: right;
}

#resume-game-modal .confirm-modal__actions {
  flex-wrap: wrap;
}

#resume-game-modal .confirm-modal__actions .btn {
  flex: 1 1 140px;
}

/* Статус соперника в онлайн-игре: «Соперник переподключается…» */
.game-opponent-status {
  margin: 0 0 8px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 190, 60, 0.5);
  border-radius: 999px;
  background: rgba(255, 190, 60, 0.1);
  color: #ffd27a;
  font-size: 0.85rem;
  line-height: 1.3;
  text-align: center;
}
.game-opponent-status[hidden] { display: none; }

/* Окно «Написать разработчику» */
.contact-modal__box {
  position: relative;
  width: min(100%, 520px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  text-align: left;
}

.contact-modal__box .nick-modal__title { padding-right: 36px; margin-bottom: 14px; }

.contact-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--home-text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.contact-modal__close:hover { color: var(--home-text); background: var(--home-surface-soft); }

.contact-modal__close:focus-visible,
.contact-modal__text:focus-visible {
  outline: 2px solid var(--home-primary);
  outline-offset: 2px;
}

.contact-modal__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.contact-modal__text {
  display: block;
  width: 100%;
  min-height: 160px;
  max-height: 45dvh;
  padding: 12px 14px;
  background: var(--home-surface-soft);
  border: 1px solid var(--home-border);
  border-radius: 12px;
  color: var(--home-text);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
}

.contact-modal__text::placeholder { color: var(--home-text-muted); opacity: 0.65; }

.contact-modal__text:focus { outline: none; border-color: var(--home-primary); }

.contact-modal__text.is-limit { border-color: var(--warning, #f5a524); }

.contact-modal__counter {
  min-height: 1.2em;
  margin: 6px 2px 14px;
  font-size: 0.78rem;
  color: var(--home-text-muted);
  text-align: right;
}

.contact-modal__counter.is-limit { color: var(--warning, #f5a524); }

#contact-modal #contact-send:not(:disabled) {
  background: var(--home-primary);
  box-shadow: 0 0 18px rgba(47, 125, 253, 0.4);
}

#contact-modal .confirm-modal__actions .btn { flex: 1 1 120px; }

#contact-modal #contact-send:disabled { opacity: 0.45; cursor: not-allowed; }

.contact-modal__status {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.35;
}
.contact-modal__status[hidden] { display: none; }
.contact-modal__status.is-ok { color: #7ee2a8; background: rgba(34, 197, 94, 0.12); border: 1px solid rgba(34, 197, 94, 0.4); }
.contact-modal__status.is-error { color: #ff9b9b; background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.4); }

.contact-modal__note {
  margin: 0 0 8px;
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--home-text-muted);
  opacity: 0.85;
}
.contact-modal__counter { margin-bottom: 8px; }
.contact-modal__note:last-of-type { margin-bottom: 14px; }

/* Профиль: два селектора региона рядом — флаг и номерной знак с кодом */
body.is-profile .region-picker__row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
}

body.is-profile .region-picker__button--flag,
body.is-profile .region-picker__button--plate {
  width: auto;
  min-height: 64px;
  padding: 8px 10px 8px 12px;
  gap: 8px;
  border-radius: 16px;
}

body.is-profile .region-picker__button--flag .region-picker__flag {
  flex: 0 0 auto;
  width: 48px;
  height: 32px;
}

body.is-profile .region-picker__button--flag .region-picker__flag img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 3px;
}

body.is-profile .region-picker__plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 56px;
  height: 43px;
}

body.is-profile .region-picker__badge-img {
  display: block;
  width: 100%;
  height: auto;
}

/* не выбран регион: пустые «окошки» в форме флага и номера */
body.is-profile .region-picker__flag--empty,
body.is-profile .region-picker__plate--empty {
  border: 1.5px dashed var(--home-border);
  border-radius: 6px;
  opacity: 0.8;
}

body.is-profile .region-picker__button--flag .region-picker__flag--empty { height: 32px; }

/* строки списка с номерами */
body.is-profile .region-picker__badge {
  flex: 0 0 44px;
  display: inline-flex;
}

body.is-profile .region-picker__badge-img--list { width: 44px; height: auto; }

body.is-profile .region-picker__name b { font-weight: 700; }

@media (max-width: 380px) {
  body.is-profile .region-picker__button--flag,
  body.is-profile .region-picker__button--plate { padding: 8px 8px 8px 10px; gap: 6px; }
  body.is-profile .region-picker__button--flag .region-picker__flag { width: 40px; height: 27px; }
}

/* подсвечиваем только тот из двух селекторов, чей список открыт */
body.is-profile .region-picker--open .region-picker__button:not([aria-expanded="true"]):not(:hover) {
  border-color: var(--home-border);
  box-shadow: none;
}
body.is-profile .region-picker--open .region-picker__button:not([aria-expanded="true"]) .region-picker__chevron { transform: none; }

/* =========================================================================
   ПРОКРУТКА СТРАНИЦ. Раньше body и .main были «окном» фиксированной высоты, а у каждого
   экрана — своя полоса прокрутки («окно в окне»). Теперь:
   • «Рейтинг» (body.is-leaderboard) и экран раунда (body.is-game, компактный layout без
     прокрутки) остаются на фиксированной высоте; в рейтинге прокручивается только список игроков;
   • все остальные страницы прокручиваются целиком, как обычные страницы; шапка (.topbar)
     остаётся sticky и не перекрывается контентом.
   !important нужен, чтобы перекрыть множество экранных правил с id-селекторами выше по файлу.
   ========================================================================= */
body:not(.is-leaderboard):not(.is-game) {
  height: auto;
  min-height: var(--app-vh);
  overflow: visible;
}

body:not(.is-leaderboard):not(.is-game) .main {
  flex: 1 0 auto;
  min-height: auto;
  overflow: visible !important;
}

body:not(.is-leaderboard):not(.is-game) .screen--active {
  flex: 1 0 auto !important;
  min-height: auto !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

body:not(.is-leaderboard):not(.is-game) .screen-fit {
  max-height: none !important;
  overflow: visible !important;
  flex-shrink: 0;
}

/* «Мой регион»: компактные селекторы флага и номера — одинаковый размер, один аккуратный блок */
body.is-profile .region-picker__row { gap: 8px; flex-wrap: nowrap; }

body.is-profile .region-picker__button--flag,
body.is-profile .region-picker__button--plate {
  box-sizing: border-box;
  flex: 0 0 auto;
  justify-content: center;
  width: 88px;
  height: 48px;
  min-height: 48px;
  padding: 6px 8px;
  gap: 6px;
  border-radius: 12px;
}

body.is-profile .region-picker__button--flag .region-picker__flag { width: 36px; height: 24px; }
body.is-profile .region-picker__button--flag .region-picker__flag--empty { height: 24px; }

body.is-profile .region-picker__plate { width: 44px; height: 34px; }

body.is-profile .region-picker__button--flag .region-picker__chevron,
body.is-profile .region-picker__button--plate .region-picker__chevron { width: 12px; height: 12px; }

@media (max-width: 380px) {
  body.is-profile .region-picker__button--flag,
  body.is-profile .region-picker__button--plate { width: 84px; padding: 6px; gap: 4px; }
  body.is-profile .region-picker__button--flag .region-picker__flag { width: 34px; height: 23px; }
}

/* Стабильная шапка: место под вертикальную полосу прокрутки резервируется всегда, поэтому при
   переходе между страницами (где полоса то появляется, то исчезает) шапка не смещается. */
html { scrollbar-gutter: stable; }

@supports not (scrollbar-gutter: stable) {
  html { overflow-y: scroll; }
}

/* кнопки меню: рамка/свечение активного пункта не меняют размер, фиксированная высота шапки */
.topbar__link { box-sizing: border-box; }

/* =========================================================================
   «РЕЙТИНГ». Десктоп (≥861px): страница не прокручивается (шапка закреплена), рамка занимает всю
   высоту под шапкой, внутри прокручивается только список игроков; заголовок, уровень, «Все игроки»
   и «Общий рейтинг» остаются на месте. Мобильный (≤860px): обычная прокрутка всей страницы,
   список не зажат в маленькое окно.
   ========================================================================= */
@media (min-width: 0px) {
  body.is-leaderboard {
    height: auto;
    min-height: var(--app-vh);
    overflow: visible;
  }

  body.is-leaderboard .main {
    flex: 1 0 auto;
    min-height: auto;
    overflow: visible !important;
  }

  body.is-leaderboard .screen--active {
    flex: 1 0 auto !important;
    min-height: auto !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  body.is-leaderboard .leaderboard {
    height: auto;
    max-height: none !important;
    overflow: visible !important;
    flex-shrink: 0;
  }

  body.is-leaderboard .leaderboard__panel,
  body.is-leaderboard .leaderboard__table-wrap {
    flex: none;
    min-height: auto;
    max-height: none;
    overflow: visible !important;
  }
}

/* =========================================================================
   «РЕЙТИНГ»: полоса прокрутки списка игроков в стиле интерфейса — синий бегунок (--home-primary),
   тёмная дорожка (--home-surface-soft), мягкое синее свечение, как у активных элементов.
   Только .leaderboard__table-wrap; остальные страницы не затронуты.
   ========================================================================= */
body.is-leaderboard .leaderboard__table-wrap::-webkit-scrollbar {
  width: 12px;
}

body.is-leaderboard .leaderboard__table-wrap::-webkit-scrollbar-track {
  background: var(--home-surface-soft);
  border-radius: 999px;
  border: 1px solid var(--home-border-soft);
}

body.is-leaderboard .leaderboard__table-wrap::-webkit-scrollbar-thumb {
  background: var(--home-primary);
  border: 2px solid var(--home-surface-soft);
  border-radius: 999px;
  box-shadow: 0 0 8px rgba(47, 125, 253, 0.55);
  min-height: 44px;
}

body.is-leaderboard .leaderboard__table-wrap::-webkit-scrollbar-thumb:hover,
body.is-leaderboard .leaderboard__table-wrap::-webkit-scrollbar-thumb:active {
  background: var(--home-you);
  box-shadow: 0 0 12px rgba(74, 150, 255, 0.75);
}

body.is-leaderboard .leaderboard__table-wrap::-webkit-scrollbar-corner {
  background: transparent;
}

/* Firefox и браузеры без ::-webkit-scrollbar — стандартные свойства (в Chrome они отменили бы кастомный вид выше) */
@supports not selector(::-webkit-scrollbar) {
  body.is-leaderboard .leaderboard__table-wrap {
    scrollbar-width: thin;
    scrollbar-color: var(--home-primary) var(--home-surface-soft);
  }
}

/* =========================================================================
   ТЕЛЕФОН: профиль компактнее, всё основное на одном экране, без горизонтальной прокрутки (≤ 720px).
   Только мобильный media query — десктоп не затрагивается.
   ========================================================================= */
@media (max-width: 720px) {
  body.is-profile .main {
    padding-left: clamp(8px, 3vw, 14px);
    padding-right: clamp(8px, 3vw, 14px);
    padding-top: 6px;
    padding-bottom: 8px;
  }
  body.is-profile .profile {
    position: relative;
    margin: 4px auto;
    padding: 10px clamp(12px, 4vw, 18px) 12px;
    border-radius: 18px;
  }
  body.is-profile .back-btn { margin-bottom: clamp(6px, 1.2vh, 12px); padding: 2px 0; font-size: 0.8rem; }

  /* «Написать разработчику» — справа, на одном уровне с «← Назад»; заголовок занимает свою строку */
  body.is-profile .profile__head {
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 clamp(12px, 2.2vh, 22px);
  }
  body.is-profile .profile__head .profile__title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: clamp(1.15rem, 5.4vw, 1.4rem);
    line-height: 1.15;
  }
  body.is-profile .profile-contact {
    position: absolute;
    top: 11px;
    right: clamp(12px, 4vw, 18px);
    margin: 0;
    padding: 4px 0 4px 8px;
    font-size: 0.74rem;
    line-height: 1.2;
    white-space: nowrap;
  }
  body.is-profile .profile-contact span { white-space: nowrap; }
  body.is-profile .profile-contact svg { flex: 0 0 auto; width: 13px; height: 13px; }

  /* «Мой регион»: подпись сверху, под ней два компактных селектора (флаг и номер) в одной строке */
  body.is-profile .region-picker {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 clamp(14px, 2.4vh, 24px);
  }
  body.is-profile .region-picker__label { margin: 0; font-size: 0.85rem; }
  body.is-profile .region-picker__row { gap: 6px; margin-left: 0; }
  body.is-profile .region-picker__button--flag,
  body.is-profile .region-picker__button--plate {
    width: 72px;
    height: 40px;
    min-height: 40px;
    padding: 4px 6px;
    gap: 4px;
    border-radius: 10px;
  }
  body.is-profile .region-picker__button--flag .region-picker__flag { width: 30px; height: 20px; }
  body.is-profile .region-picker__button--flag .region-picker__flag--empty { height: 20px; }
  body.is-profile .region-picker__plate { width: 38px; height: 28px; }
  body.is-profile .region-picker__button--flag .region-picker__chevron,
  body.is-profile .region-picker__button--plate .region-picker__chevron { width: 11px; height: 11px; }
  body.is-profile .region-picker__list { flex: 0 0 100%; }

  /* уровень и прогресс */
  body.is-profile .profile-level { margin-bottom: clamp(10px, 1.8vh, 18px); gap: 8px; }
  body.is-profile .profile-level__icon { width: 32px; height: 32px; }
  body.is-profile .profile-level__icon svg { width: 15px; height: 15px; }
  body.is-profile .profile-level__pill { padding: 6px 14px; font-size: 0.85rem; }
  body.is-profile .profile-xp { margin-bottom: clamp(12px, 2.2vh, 24px); row-gap: 8px; }
  body.is-profile .profile-xp__label { font-size: 0.85rem; }

  /* заголовки разделов и карточки статистики */
  body.is-profile .profile__section-title {
    margin: clamp(14px, 2.4vh, 26px) 0 clamp(8px, 1.4vh, 14px);
    font-size: clamp(0.88rem, 4vw, 1rem);
    line-height: 1.2;
  }
  body.is-profile .profile-metric-grid { gap: 8px; }
  body.is-profile .profile-metric-card { border-radius: 10px; }
  body.is-profile .profile-metric-card__value { padding: 7px 3px 5px; font-size: 0.95rem; }
  body.is-profile .profile-metric-card__label { padding: 5px 3px; font-size: 0.66rem; }
  body.is-profile .profile-empty { margin: 4px 0; }
}

/* Низкие телефоны (например 320×568): ещё плотнее, чтобы профиль почти целиком помещался */
@media (max-width: 720px) and (max-height: 700px) {
  body.is-profile .main { padding-top: 4px; padding-bottom: 4px; }
  body.is-profile .profile { padding-top: 6px; padding-bottom: 8px; margin: 2px auto; }
  body.is-profile .profile-contact { top: 7px; }
  body.is-profile .back-btn { margin-bottom: 0; }
  body.is-profile .profile__head { margin-bottom: 6px; }
  body.is-profile .region-picker { margin-bottom: 6px; }
  body.is-profile .profile-level { margin-bottom: 4px; }
  body.is-profile .profile-level__icon { width: 28px; height: 28px; }
  body.is-profile .profile-level__pill { padding: 4px 12px; font-size: 0.8rem; }
  body.is-profile .profile-xp { margin-bottom: 2px; }
  body.is-profile .profile__section-title { margin: 6px 0 4px; }
  body.is-profile .profile-metric-card__value { padding: 5px 3px 3px; font-size: 0.9rem; }
  body.is-profile .profile-metric-card__label { padding: 3px; }
}

/* =========================================================================
   Рейтинг: иллюстрация с кристаллом — в правом верхнем углу карточки .leaderboard.
   Картинка вынута из потока (absolute), заголовок и подпись получают правый отступ
   на её ширину, поэтому ничего не перекрывается; на телефоне размер уменьшается.
   ========================================================================= */
body.is-leaderboard .leaderboard {
  --lb-ill-w: clamp(70px, 8vw, 110px);
  position: relative;
}

body.is-leaderboard .leaderboard__illustration {
  position: absolute;
  top: clamp(24px, 4vh, 44px);
  right: clamp(20px, 4vw, 48px);
  width: var(--lb-ill-w);
  pointer-events: none;
}

body.is-leaderboard .leaderboard__title,
body.is-leaderboard .leaderboard__note {
  margin-right: calc(var(--lb-ill-w) + 12px);
}

@media (max-width: 640px) {
  body.is-leaderboard .leaderboard {
    --lb-ill-w: clamp(52px, 17vw, 72px);
  }

  body.is-leaderboard .leaderboard__illustration {
    top: clamp(14px, 4vw, 24px);
    right: clamp(14px, 4vw, 20px);
    margin-top: 0;
  }
}

/* Телефон, «Настрой игру»: варианты количества вопросов — сетка из 3 равных колонок.
   Первая строка 10 / 20 / 30, «Все регионы» / «Весь мир» / «Вся страна» / «Вся Европа» — следующая строка,
   в одну колонку (той же ширины и высоты, что у «10»). Радио-инпуты, выделение и hover не меняются. */
@media (max-width: 640px) {
  body.is-setup-round #round-setup-length-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 48px;
    gap: 6px;
  }

  body.is-setup-round #round-setup-length-options .option-chip--round {
    flex: none;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 4px 6px;
    text-align: center;
    font-size: clamp(0.72rem, 3.6vw, 0.95rem);
    line-height: 1.1;
    overflow-wrap: normal;
  }

  /* подпись полного набора длиннее («Все регионы», «Вся Европа») — чуть мельче и без разрыва слова посередине */
  body.is-setup-round #round-setup-length-options .option-chip--round:nth-child(n+4) {
    grid-column: auto;
    justify-self: stretch;
    padding: 2px;
    font-size: clamp(0.62rem, 3.2vw, 0.9rem);
  }
}

/* =========================================================================
   Телефон/планшет (≤ 860px): единый вертикальный уровень контента под шапкой на всех разделах.
   Одно правило вместо отдельных отступов: контент прижат к верху (без центрирования в экране),
   одинаковый отступ от шапки до первой карточки. Игровой экран (is-game) своей компоновки не меняет.
   Если контент не помещается — прокрутка остаётся как раньше.
   ========================================================================= */
@media (max-width: 860px) {
  body:not(.is-game) .main { padding-top: 12px; }
  body:not(.is-game) .screen--active { justify-content: flex-start; }
  body:not(.is-game) .screen--active > :first-child { margin-top: 0; }
  /* область нажатия «← Назад» ≥ 44px: увеличена только внутренними отступами, компенсированными отрицательными полями, — вид и раскладка прежние */
  body:not(.is-game) .back-btn:not(.friend-room-back) { padding-top: 12px; padding-bottom: 12px; margin-top: -10px; margin-bottom: -8px; }
}

/* Те же боковые поля, что у главной (--gutter главной = clamp(16px, 2vw, 24px)), для всех разделов:
   одинаковые левый/правый отступы и одинаковая ширина основной карточки; внутренние отступы карточек не меняются. */
@media (max-width: 860px) {
  body:not(.is-game) .main {
    padding-left: clamp(16px, 2vw, 24px);
    padding-right: clamp(16px, 2vw, 24px);
  }
  body:not(.is-game) .screen--active > :first-child {
    width: 100%;
    max-width: none;
  }
}

/* =========================================================================
   ИГРОВОЙ ЭКРАН НА ТЕЛЕФОНЕ — ЕДИНЫЙ ФИНАЛЬНЫЙ БЛОК (#screen-game / body.is-game).
   Все прежние мобильные правила для .game-panel / .game-head / .question-card /
   .question-visual / .answers / .answer-btn / .game-status собраны здесь; в остальных
   местах файла для них остались только базовые (десктопные) правила.
   Раскладка карточки (сверху вниз): вопрос → изображение (занимает остаток высоты) →
   «Попытка»/сообщение → ответы 2×2 внизу (под большой палец). Затрагиваются только
   классы игрового экрана; шапка сайта, главная и другие разделы не меняются.
   ========================================================================= */

/* верх игрового блока: [название | таймер] / [счёт | таймер] / [точки] — до 860px, как раньше */
@media (max-width: 860px) {
  body.is-game .game-head {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title  title"
      "scores timer"
      "dots   dots";
    row-gap: clamp(5px, 1.1vh, 10px);
    column-gap: 8px;
    align-items: center;
  }
  body.is-game .game-head .round-title { font-size: 0.66rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.is-game .game-head .game-top { padding: 1px 10px; align-self: stretch; display: flex; align-items: center; }
  body.is-game .game-head .game-top__row { flex-wrap: nowrap; }
  body.is-game .game-head .game-top__scores { width: 100%; gap: 6px; justify-content: space-between; }
  /* соло: «Ты — 0» по центру плашки */
  body.is-game .game-head .game-top--solo .game-top__scores { justify-content: center; }
  body.is-game .game-head .game-top__row { width: 100%; }
  body.is-game .game-head .score-pill { min-width: 0; }
  body.is-game .game-head .score-pill__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 9em; }
  body.is-game .game-head .score-pill__label,
  body.is-game .game-head .score-pill__value { font-size: 0.9rem; }
  body.is-game .game-head .timer { grid-area: timer; align-self: center; justify-self: end; width: 34px; height: 34px; }
  body.is-game .game-head .question-dots { justify-self: stretch; gap: 3px; }
  body.is-game .game-head .question-dot { width: 6px; height: auto; }
  /* длинные наборы на телефоне: мелкие одинаковые круглые точки в несколько строк */
  body.is-game .game-head .question-dots.question-dots--dense { gap: 3px 2px; }
  body.is-game .game-head .question-dots--dense .question-dot { width: 5px; height: 5px; }
}
@media (max-width: 360px) {
  body.is-game .game-head .question-dots--dense .question-dot { width: 4px; height: 4px; }
}

@media (max-width: 720px) {
  /* боковые поля игрового экрана (только body.is-game): чтобы карточка и кнопки ответов были шире */
  body.is-game .main { padding: 4px clamp(8px, 3vw, 12px) clamp(4px, 1vh, 8px); }

  /* панель и карточка */
  body.is-game #screen-game .game-back-btn { margin: 0 0 clamp(5px, 1vh, 9px); padding: 2px 10px; min-height: 28px; font-size: 0.78rem; line-height: 1.2; }
  body.is-game .game-panel {
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    gap: clamp(5px, 1.1vh, 10px);
    border-radius: 16px;
  }
  body.is-game .question-card {
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    padding: clamp(6px, 1vh, 10px) 8px;
    column-gap: 8px;
    border-radius: 14px;
  }
  body.is-game .question-card .question-type { padding: 2px 7px; font-size: 0.6rem; letter-spacing: 0.02em; }
  body.is-game .question-card__prompt { font-size: clamp(0.8rem, 3.6vw, 0.92rem); line-height: 1.3; }

  /* изображение вопроса — всё свободное место между заголовком и статусом, не скрывается */
  body.is-game .question-card .question-visual { min-height: 88px; margin: 4px 0; padding: 3px; }
  body.is-game .plate-wrap { width: min(100%, 360px); }

  /* «Попытка» и сообщение — над ответами, не перекрывают кнопки */
  body.is-game .question-card .game-status { grid-row: 3; }
  body.is-game .attempt-info { margin-top: 0; font-size: 0.72rem; }
  body.is-game .feedback { margin-top: 2px; height: 30px; min-height: 0; flex: 0 0 30px; padding: 0 6px; font-size: 0.74rem; line-height: 1.1; overflow: hidden; }

  /* ответы 2×2 внизу: одинаковые кнопки, фиксированная высота рядов (ничего не прыгает) */
  body.is-game .question-card .answers {
    grid-row: 4;
    --ans-h: clamp(48px, 7.8vh, 56px);
    grid-auto-rows: var(--ans-h);
    gap: 8px;
    margin-top: 4px;
  }
  body.is-game .answer-btn {
    min-height: 0;
    height: var(--ans-h);
    padding: 4px 10px;
    font-size: clamp(0.8rem, 3.7vw, 0.92rem);
    line-height: 1.12;
    display: flex;
    align-items: center;
    overflow: hidden;
  }

  /* карта с увеличенными участками: карта ≈58%, участки ≈42% высоты изображения */
  body.is-game .question-visual--map .map-wrap--inset { grid-template-rows: auto minmax(0, 58fr) minmax(0, 42fr) auto; row-gap: 4px; }
  body.is-game .question-visual--map .map-wrap--inset .map-fit { aspect-ratio: auto; height: 100%; min-height: 0; align-self: stretch; }
  body.is-game .question-visual--map .map-wrap--inset .map-fit svg { width: 100%; height: 100%; }
  body.is-game .map-insets { height: 100%; min-height: 0; }
  body.is-game .map-inset { width: auto; max-width: 100%; height: 100%; max-height: 100%; aspect-ratio: var(--inset-aspect, 1.6); }
  body.is-game .map-insets--2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 4px; }
  body.is-game .map-insets--2 .map-inset { width: 100%; height: 100%; aspect-ratio: auto; }
  body.is-game .map-inset .map-inset__label { top: 3px; left: 5px; right: 4px; font-size: clamp(0.46rem, 2.3vw, 0.56rem); line-height: 1.1; letter-spacing: 0.02em; }
}

/* высокие телефоны: лишняя высота отдаётся кнопкам ответов (удобнее большому пальцу), а не пустым полям вокруг
   флага / номера — панель изображения облегает картинку. Карта по-прежнему занимает всё свободное место. */
@media (max-width: 720px) and (min-height: 700px) {
  body.is-game .question-card .answers { --ans-h: clamp(56px, 11vh, 88px); gap: 10px; }
  body.is-game .answer-btn { font-size: clamp(0.86rem, 4vw, 1rem); }
}
@media (max-width: 720px) and (min-height: 700px) {
  body.is-game .question-card .question-visual--flag,
  body.is-game .question-card .question-visual--code,
  body.is-game .question-card .question-visual--capital {
    align-self: center;
    height: auto;
    min-height: 0;
    max-height: none;
    padding: 10px;
  }
}

/* очень низкие экраны: кнопки ответов 44px */
@media (max-width: 720px) and (max-height: 560px) {
  body.is-game .question-card .answers { --ans-h: 44px; }
}


/* окно входа: ВК + ник */
.btn--vk { background: #0077ff; color: #fff; border: 1px solid #0077ff; margin-top: 4px; }
.btn--vk:hover { background: #1a86ff; }
#nick-modal .nick-modal__hint { margin: 8px 0 0; font-size: 0.8125rem; text-align: center; color: var(--home-text-muted); }
#nick-modal .nick-modal__or { display: flex; align-items: center; gap: 12px; margin: 16px 0 14px; color: var(--home-text-muted); font-size: 0.8125rem; }
#nick-modal .nick-modal__or::before, #nick-modal .nick-modal__or::after { content: ''; flex: 1; height: 1px; background: var(--home-border); }
#nick-modal .nick-modal__fine { margin: 10px 0 0; font-size: 0.75rem; line-height: 1.35; text-align: center; color: var(--home-text-muted); opacity: 0.8; }
#nick-modal .nick-modal__title { text-wrap: balance; }
/* «Познакомиться с игрой»: второстепенное действие, не конкурирует с «Играть» */
#nick-modal .nick-modal__guest[hidden] { display: none; }
#nick-modal .nick-modal__guest .nick-modal__or { margin: 14px 0 12px; }
#nick-modal .nick-modal__guest-btn {
  min-height: 48px;
  font-family: var(--font-display);
  font-weight: 400;
  background: transparent;
  color: var(--home-text);
  border: 1px solid var(--home-border);
  border-radius: 999px;
}
#nick-modal .nick-modal__guest-btn:hover { background: rgba(47, 125, 253, 0.12); border-color: rgba(47, 125, 253, 0.55); }

/* «Войти в комнату»: шаг «с кем играть» скрыт, поэтому нужна своя кнопка «Назад» (на главную) */
body.is-setup #screen-setup-solo[data-ctx="join"] .back-btn {
  display: inline-block;
  align-self: flex-start;
  color: var(--home-text-muted);
  margin-bottom: clamp(10px, 1.6vh, 16px);
}
body.is-setup #screen-setup-solo[data-ctx="join"] .back-btn:hover { color: var(--home-text); }

/* iOS Safari приближает страницу при фокусе в поле с шрифтом меньше 16px (ник открывался с автофокусом —
   сайт «открывался увеличенным»). Поля ввода на сенсорных экранах — не меньше 16px. */
@media (pointer: coarse), (max-width: 900px) {
  input:not([type="radio"]):not([type="checkbox"]):not([type="range"]),
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* результаты одиночной игры (на любых экранах): блок «иконка + Ты + число» скрыт — тот же результат уже показан в «Ты набрал … XP».
   Элементы остаются в разметке (нужны дуэли и игре с другом); класс is-results-solo ставит showResults() только для режима solo. */
body.is-results.is-results-solo .results__players { display: none; }

/* ответы в игре: слова переносятся целиком по пробелам, без дефисов и разрыва посередине
   (аварийный перенос — только если одно слово длиннее самой кнопки) */
body.is-game .answer-btn {
  white-space: normal;
  hyphens: none;
  -webkit-hyphens: none;
  word-break: normal;
  overflow-wrap: break-word;
}

/* =========================================================================
   ЕДИНАЯ СИСТЕМА КАРТОЧЕК ВЫБОРА — «С кем играть», «Что угадывать», континенты, страны, типы вопросов,
   «Как угадывать» (все это одна и та же .pick-card внутри .pick-grid). Эталон — карточки «РФ / Мир / Страна».
   Общие размеры и отступы заданы переменными ниже; карточки одного вида не должны получать своих отдельных стилей.
   ========================================================================= */
body.is-setup {
  --choice-gap: 12px;                              /* между карточками (по горизонтали и вертикали) */
  --choice-block-gap: clamp(18px, 2.6vh, 24px);    /* между уровнями выбора (ряд «РФ/Мир/Страна» → континенты → типы) */
  --choice-desc-lines: 2;                          /* описание всегда резервирует 2 строки: карточки одной высоты при любом тексте */
}

/* внутренние поля «Что угадывать» симметричны (раньше справа были 0, и сетка выходила шире, чем у «С кем играть») */
body.is-setup .scope-picker { padding-right: clamp(16px, 2.4vh, 24px); }

/* одинаковая сетка у всех рядов: те же столбцы, тот же шаг, строки равной высоты */
body.is-setup .pick-grid {
  gap: var(--choice-gap);
  margin-bottom: 0;
  align-items: stretch;
  grid-auto-rows: 1fr;
}

/* вложенные ряды появляются с тем же отступом, что и между первым и вторым блоком; подпись над рядом — один стиль */
body.is-setup #scope-picker > div[id$="-block"]:not([hidden]) { margin-top: var(--choice-block-gap); }
body.is-setup #scope-picker .option-group__label--sub {
  margin: 0 0 12px;
  font-size: 0.78rem;
  line-height: 1.2;
}

/* карточка: описание резервирует место под 2 строки, поэтому карточка с коротким и с длинным текстом одной высоты,
   нижняя строка «Выбрать» и разделитель всегда на одном уровне */
body.is-setup .pick-card__desc {
  min-height: calc(var(--choice-desc-lines) * 1.4em);
}
body.is-setup .pick-card__title,
body.is-setup .pick-card__desc {
  overflow-wrap: break-word;
  min-width: 0;
  max-width: 100%;
}

/* состояния: фокус с клавиатуры и недоступная карточка — одинаково на всех уровнях */
body.is-setup .pick-card:focus-visible {
  outline: 2px solid var(--home-primary);
  outline-offset: 2px;
}
body.is-setup .pick-card:disabled,
body.is-setup .pick-card[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  border-color: var(--home-border);
}
body.is-setup .pick-card:disabled:hover .pick-card__go,
body.is-setup .pick-card[aria-disabled="true"]:hover .pick-card__go { color: var(--home-text-muted); }

@media (max-width: 720px) {
  body.is-setup .pick-grid { gap: var(--choice-gap); }
  /* поля блоков на телефоне — 16px со всех сторон у обоих блоков (padding .setup-block) */
  body.is-setup .scope-picker { padding-right: 16px; }
  /* ширина карточки в ряду одна на все уровни (раньше 72% — длинные названия и описания переносились на 2–3 строки и карточки
     разных рядов получались разной высоты); следующая карточка по-прежнему выглядывает справа */
  body.is-setup .pick-grid > .pick-card,
  body.is-setup #setup-mode-grid > .pick-col { flex: 0 0 clamp(220px, 80%, 300px); }
}
@media (max-width: 420px) {
  body.is-setup { --choice-desc-lines: 3; }   /* на узких экранах описание «Покажем флаг страны — выбери её столицу» занимает 3 строки */
  body.is-setup .pick-card__title { min-height: 3em; }   /* «Случайный соперник» и подобные названия переносятся на 2 строки: резервируем их у всех карточек */
}

/* карты «Мир»: можно отдалить до целого мира — контуры за пределами кадра континента должны рисоваться
   (контейнер .map-fit с overflow:hidden по-прежнему обрезает всё за своими краями) */
.question-visual--map .map-wrap--world-bounds .map-svg { overflow: visible; }

/* Верхняя и нижняя зоны карты — отдельные широкие плашки интерфейса, а не полосы моря.
   Контейнер вопроса больше не красится в цвет моря и не даёт отступов: море (#91c9df) лежит только на .map-fit / .map-insets,
   сверху и снизу — две одинаковые плашки (тёмно-синий из палитры, тонкая мягкая рамка, скругление 12px, одинаковые отступы).
   Плашки стоят в потоке над/под картой: страны не перекрывают и полезную область карты не уменьшают. */
body.is-game .question-visual--map {
  background: transparent;
  padding: 0;
  overflow: visible;
}
body.is-game .question-visual--map .map-wrap { gap: 6px; }
body.is-game .question-visual--map .map-fit,
body.is-game .question-visual--map .map-insets {
  background: #91c9df;
  border-radius: 12px;
}
body.is-game .question-visual--map .map-context,
body.is-game .question-visual--map .map-caption {
  box-sizing: border-box;
  flex: 0 0 auto;
  width: 100%;
  margin: 0;
  padding: 6px 14px;
  background: #0f1b2e;
  border: 1px solid rgba(122, 156, 218, 0.22);
  border-radius: 12px;
  color: #b9c9e6;
  line-height: 1.25;
  text-align: center;
}
body.is-game .question-visual--map .map-context { min-height: 0; justify-content: flex-start; align-items: center; }
body.is-game .question-visual--map .map-context__continent {
  display: block;
  min-width: 0;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  color: #dbe6fb;
  overflow-wrap: anywhere;
}
body.is-game .question-visual--map .map-caption {
  font-size: clamp(0.72rem, 1.3vh, 0.82rem);
  text-wrap: balance;
}
@media (max-width: 720px) {
  /* подсказка в одну строку: размер шрифта плавно падает с шириной экрана (320px → 8px, 430px → 10.75px) */
  body.is-game .question-visual--map .map-caption { display: block; padding: 5px 4px; font-size: clamp(8px, 2.5vw, 11px); }
  /* длинная подпись карты с увеличенным участком остаётся в две строки, обычная подсказка — одна строка */
  body.is-game .question-visual--map .map-wrap:not(.map-wrap--inset) .map-caption { white-space: nowrap; text-wrap: nowrap; }
  body.is-game .question-visual--map .map-context { padding: 5px 10px; }
}

/* Выноски у Европы/Азии/Америки/Африки: кадр карты почти квадратный или высокий, а не вытянутый, как у Океании.
   На телефоне даём общей карте больше высоты (≈ 63%), увеличенному участку — остальное, чтобы страны читались. */
@media (max-width: 720px) {
  body.is-game .question-visual--map .map-wrap--inset[data-continent]:not([data-continent="oceania"]) {
    grid-template-rows: auto minmax(0, 63fr) minmax(0, 37fr) auto;
  }
}

/* планшет в портрете (521–720px): у высоких кадров части света карта и выноска рядом, как на десктопе,
   иначе общая карта получается лентой ≈ 85 px высотой. На телефонах (≤ 520px) — карта сверху, выноски ниже. */
@media (min-width: 521px) and (max-width: 720px) {
  body.is-game .question-visual--map .map-wrap--inset[data-continent]:not([data-continent="oceania"]) {
    grid-template-columns: minmax(0, 58fr) minmax(0, 42fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "ctx ctx"
      "fit insets"
      "cap cap";
  }
}

/* название страны в увеличенном окне (после ответа); размер и положение задаёт js (placeInsetNames) */
.map-wrap svg .map-inset-name {
  visibility: hidden;
  font-weight: 700;
  paint-order: stroke;
  stroke-linejoin: round;
  pointer-events: none;
}

/* очень низкие экраны (iPhone SE и меньше, ≤ 640 px по высоте): подсказка под картой скрыта, чтобы увеличенному окну хватало места */
@media (max-width: 720px) and (max-height: 640px) {
  body.is-game .question-visual--map .map-caption { display: none; }
  /* в таких экранах карта и окно рядом: стопкой окно получалось размером с почтовую марку */
  body.is-game .question-visual--map .map-wrap--inset {
    grid-template-columns: minmax(0, 58fr) minmax(0, 42fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "ctx ctx"
      "fit insets";
  }
}

/* Океания, правые увеличенные окна: мелкие острова должны быть различимы — штрих того же жёлтого цвета толще
   (vector-effect: non-scaling-stroke: даже островок меньше пикселя виден точкой ≈ толщины штриха). Тёмной обводки и тени нет;
   остальные части света сохраняют прежние 1,4 px. */
.map-wrap[data-continent="oceania"] .map-inset svg .map-region--highlight {
  stroke-width: 5px;
  stroke-linejoin: round;
  stroke-linecap: round;
}
@media (max-width: 720px) {
  .map-wrap[data-continent="oceania"] .map-inset svg .map-region--highlight { stroke-width: 4px; }
  /* подпись окна — в одну строку и мельче, иначе в узком окне она занимает половину высоты и закрывает остров */
  .map-wrap[data-continent="oceania"] .map-inset .map-inset__label { white-space: nowrap; letter-spacing: 0; font-size: clamp(0.4rem, 2vw, 0.5rem); }
}

/* Миниатюры флагов в выборе региона профиля (список и кнопка с выбранным флагом): флаг целиком по принципу contain.
   Рамка контейнера фиксирована (одинаковый размер миниатюр), а сам <img> принимает пропорции флага и вписывается в неё
   (атрибуты width/height и object-fit: cover раньше растягивали/обрезали флаги с пропорцией не 3:2). Стандартные 3:2 выглядят как прежде. */
body.is-profile .region-picker__flag img,
body.is-profile .region-picker__button--flag .region-picker__flag img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Непрямоугольный флаг (Непал): прозрачный вырез между вымпелами не закрывается белой подложкой; тень повторяет форму флага */
.flag-display--photo.flag-display--shaped {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.flag-display--shaped .flag-display__img {
  border-radius: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

/* Привязка ВК в профиле и окно объединения профилей */
body.is-profile .profile-vk-link { margin: 0 0 18px; }
body.is-profile .profile-vk-link[hidden] { display: none; }
body.is-profile .profile-vk-link__btn { min-height: 48px; font-family: var(--font-display); font-weight: 400; border-radius: 999px; }
body.is-profile .profile-vk-link__hint { margin: 8px 0 0; font-size: 0.8125rem; line-height: 1.35; text-align: center; color: var(--home-text-muted); }
body.is-profile .profile-vk-notice {
  margin: 0 0 18px; padding: 10px 14px; border-radius: 12px; font-size: 0.875rem; line-height: 1.4;
  background: var(--home-primary-soft); border: 1px solid var(--home-border); color: var(--home-text);
}
body.is-profile .profile-vk-notice[hidden] { display: none; }
body.is-profile .profile-vk-notice--error { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.35); }

#vk-merge-modal .vk-merge__box { max-width: 460px; }
#vk-merge-modal .vk-merge__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 10px; }
#vk-merge-modal .vk-merge__cols[hidden], #vk-merge-modal .vk-merge__result[hidden], #vk-merge-modal .vk-merge__fine[hidden] { display: none; }
#vk-merge-modal .vk-merge__card {
  display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 12px;
  border: 1px solid var(--home-border); border-radius: 14px; background: var(--home-surface-soft);
}
#vk-merge-modal .vk-merge__tag { font-size: 0.75rem; color: var(--home-text-muted); }
#vk-merge-modal .vk-merge__name { font-size: 1rem; color: var(--home-text); overflow-wrap: anywhere; }
#vk-merge-modal .vk-merge__stats { font-size: 0.8125rem; line-height: 1.4; color: var(--home-text-muted); }
#vk-merge-modal .vk-merge__result { margin: 0 0 8px; font-size: 0.9375rem; line-height: 1.4; color: var(--home-text); text-align: center; }
#vk-merge-modal .vk-merge__fine { margin: 0 0 12px; font-size: 0.75rem; line-height: 1.4; text-align: center; color: var(--home-text-muted); }
#vk-merge-modal .setup-notice { background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.35); color: var(--home-text); }
@media (max-width: 420px) {
  #vk-merge-modal .vk-merge__cols { grid-template-columns: 1fr; }
}

/* Выход и удаление профиля: компактные текстовые кнопки внизу карточки профиля (стиль как у «Написать разработчику») */
body.is-profile .profile-actions {
  display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 2px 18px;
  margin: clamp(18px, 3vh, 28px) 0 0; padding-top: 6px;
}
body.is-profile .profile-actions[hidden] { display: none; }
body.is-profile .profile-action {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 8px 2px;
  color: var(--home-text-muted); font-size: 0.78rem; line-height: 1.2; font-family: inherit;
  background: none; border: 0; cursor: pointer; transition: color 0.15s ease;
}
body.is-profile .profile-action svg { flex: 0 0 auto; }
body.is-profile .profile-action span { white-space: nowrap; }
body.is-profile .profile-action:hover { color: var(--home-primary); }
body.is-profile .profile-action--danger { color: #c98a8a; }
body.is-profile .profile-action--danger:hover { color: #ee8b8b; }
body.is-profile .profile-action:focus-visible { outline: 2px solid var(--home-primary); outline-offset: 2px; border-radius: 6px; }
body.is-profile .profile-action--danger:focus-visible { outline-color: #ee8b8b; }
@media (pointer: coarse) {
  body.is-profile .profile-action { min-height: 44px; padding: 12px 4px; }
}
@media (max-width: 420px) {
  body.is-profile .profile-actions { gap: 0 14px; }
  body.is-profile .profile-action { font-size: 0.74rem; }
}

#logout-warning-modal .btn--vk { min-height: 48px; font-family: var(--font-display); font-weight: 400; border-radius: 999px; margin: 6px 0 14px; }
#delete-profile-modal .delete-profile__fine { margin: 0 0 12px; font-size: 0.8125rem; line-height: 1.4; text-align: center; color: var(--home-text-muted); }
#delete-profile-modal .setup-notice { background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.35); color: var(--home-text); }
#delete-profile-modal .confirm-modal__actions .btn--danger {
  background: #a84444; color: #fff; border: 1px solid #a84444; box-shadow: none;
}
#delete-profile-modal .confirm-modal__actions .btn--danger:hover { background: #bd4f4f; border-color: #bd4f4f; }
#delete-profile-modal .confirm-modal__actions .btn--danger:disabled,
#logout-warning-modal .btn:disabled { opacity: 0.6; cursor: default; }

.app-toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 300; width: max-content; max-width: min(92vw, 420px); padding: 12px 18px; border-radius: 14px;
  background: #172131; color: #f4f7fc; border: 1px solid rgba(122, 156, 218, 0.3);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45); font-size: 0.875rem; line-height: 1.4; text-align: center;
}
.app-toast[hidden] { display: none; }

/* Имя игрока под заголовком «Твой профиль»: тот же шрифт и начертание, размер меньше; длинные имена переносятся */
body.is-profile .profile__name {
  margin: -8px 0 clamp(14px, 2.2vh, 20px);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.02rem, 1.9vw, 1.3rem);
  line-height: 1.2;
  color: var(--home-text);
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}
body.is-profile .profile__name[hidden] { display: none; }
@media (max-width: 720px) {
  body.is-profile .profile__name { margin-top: -4px; font-size: clamp(0.95rem, 4.2vw, 1.1rem); }
}

/* =========================================================================
   ЭКРАН «РЕЙТИНГ»: периоды (месяц / год / всё время), пьедестал, место игрока (2026-11-09)
   Затрагивает только #screen-leaderboard. Данные: /api/leaderboard?period=…, /api/leaderboard/rank.
   ========================================================================= */
body.is-leaderboard .lb-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
  margin-bottom: clamp(12px, 1.8vh, 18px);
}

body.is-leaderboard .lb-tab {
  min-height: 42px;
  padding: 0 clamp(16px, 2.4vw, 24px);
  border: 1px solid var(--home-border);
  border-radius: 999px;
  background: transparent;
  color: var(--home-text-muted);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

body.is-leaderboard .lb-tab:hover { color: var(--home-text); border-color: rgba(74, 150, 255, 0.6); }
body.is-leaderboard .lb-tab[aria-selected="true"] { background: var(--home-primary); border-color: #6aa8ff; color: #fff; }

body.is-leaderboard .lb-tab:focus-visible,
body.is-leaderboard .leaderboard__table-wrap:focus-visible {
  outline: 2px solid #7db4ff;
  outline-offset: 3px;
}

body.is-leaderboard .lb-left { color: var(--home-text-muted); font-size: 0.88rem; font-weight: 600; }
body.is-leaderboard .lb-left[hidden] { display: none; }

/* три первых места: те же строки таблицы, но объёмные — выше, крупнее, с градиентом, бликом сверху и зазором между строками */
body.is-leaderboard .lb-table { border-collapse: separate; border-spacing: 0; }

body.is-leaderboard .lb-top { --t: #e0b94a; }
body.is-leaderboard .lb-top--silver { --t: #b9c6dc; }
body.is-leaderboard .lb-top--bronze { --t: #c98a62; }

body.is-leaderboard .lb-top td {
  padding-top: 10px;
  padding-bottom: 10px;
  border-bottom: 6px solid transparent;   /* зазор до следующей строки; фон под него не заходит */
  background-color: transparent;
  background-image: linear-gradient(180deg, color-mix(in srgb, var(--t) 28%, #101a2c) 0%, color-mix(in srgb, var(--t) 10%, #0c1524) 100%);   /* вертикальный градиент одинаков во всех ячейках строки — швов нет */
  background-clip: padding-box;
  font-weight: 600;
  font-size: 0.95rem;
  --edge: color-mix(in srgb, var(--t) 60%, transparent);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #fff 26%, transparent),
    inset 0 -14px 16px -14px color-mix(in srgb, var(--t) 60%, transparent),
    inset 0 -1px 0 color-mix(in srgb, var(--t) 45%, transparent);
}

/* все три строки одного размера, различие только цветом */

body.is-leaderboard .lb-top td:first-child { padding-left: 12px; border-radius: 12px 0 0 12px; }
body.is-leaderboard .lb-top td:last-child { padding-right: 12px; border-radius: 0 12px 12px 0; color: var(--home-text); }
body.is-leaderboard .lb-top td:first-child { box-shadow:
    inset 0 1px 0 color-mix(in srgb, #fff 26%, transparent),
    inset 0 -14px 16px -14px color-mix(in srgb, var(--t) 60%, transparent),
    inset 0 -1px 0 color-mix(in srgb, var(--t) 45%, transparent),
    inset 1px 0 0 color-mix(in srgb, var(--t) 45%, transparent); }
body.is-leaderboard .lb-top td:last-child { box-shadow:
    inset 0 1px 0 color-mix(in srgb, #fff 26%, transparent),
    inset 0 -14px 16px -14px color-mix(in srgb, var(--t) 60%, transparent),
    inset 0 -1px 0 color-mix(in srgb, var(--t) 45%, transparent),
    inset -1px 0 0 color-mix(in srgb, var(--t) 45%, transparent); }

body.is-leaderboard .lb-top .lb-rank { font-family: var(--font-display); font-size: 1.05rem; color: var(--t); }
body.is-leaderboard .lb-top .lb-name { font-size: 1em; }

/* место игрока: всегда под списком, не прокручивается */
body.is-leaderboard .lb-me {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  margin-top: clamp(10px, 1.6vh, 14px);
  padding: 10px 16px 10px 10px;
  border: 1px solid #4a96ff;
  border-radius: 14px;
  background: rgba(47, 125, 253, 0.1);
}

body.is-leaderboard .lb-me { position: sticky; bottom: 12px; z-index: 2; background: #0f1c33; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); }
body.is-leaderboard .lb-me[hidden] { display: none; }

body.is-leaderboard .lb-me__place {
  display: grid;
  place-items: center;
  flex: none;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--home-primary);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.95rem;
}

body.is-leaderboard .lb-me__text { color: var(--home-text); font-size: 0.92rem; line-height: 1.4; }

@media (max-width: 640px) {
  body.is-leaderboard .lb-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  body.is-leaderboard .lb-tab { padding: 0 4px; font-size: 0.8rem; }
  body.is-leaderboard .lb-me { gap: 10px; padding: 8px 12px 8px 8px; }
  body.is-leaderboard .lb-me__text { font-size: 0.82rem; }
}

body.is-leaderboard .lb-table td.lb-empty { white-space: normal; text-align: left; color: var(--home-text-muted); line-height: 1.5; }

/* Подвал: только на главной, компактный */
.site-foot { display: none; }
body.is-home .site-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 18px;
  width: 100%; max-width: var(--layout-w); margin: 0 auto; box-sizing: border-box;
  padding: 8px clamp(16px, 2vw, 24px) calc(10px + env(safe-area-inset-bottom, 0px));
  color: #8b9ab3; font-size: 0.78rem; line-height: 1.4; position: relative; z-index: 2; flex-shrink: 0;
}
.site-foot__brand { color: #c4cfe3; font-weight: 600; }
.site-foot a { color: #8b9ab3; text-decoration: none; }
.site-foot a:hover, .site-foot a:focus-visible { color: #f4f7fc; text-decoration: underline; }
.site-foot__docs { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 14px; }
@media (max-width: 640px) {
  body.is-home .site-foot { gap: 2px 12px; font-size: 0.68rem; padding-top: 6px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  .site-foot__docs { width: 100%; gap: 0 10px; }
}

/* =========================================================================
   ИГРА НА ТЕЛЕФОНЕ: БОЛЬШЕ МЕСТА КАРТЕ (22.11.2026, по макету prototypes/mobile-map, вариант «А 60 / 40»)
   Проблема: карте (особенно с увеличенным участком маленькой страны) доставалось ≈ 300 px из 844. Что сделано (≤ 720 px):
     • меню вкладок скрыто на время игры (остаются логотип и опыт);
     • подпись части света лежит внутри карты, а не отдельной плашкой; подсказка под картой с увеличенным участком убрана;
     • общая карта ≈ 60 %, увеличенный участок ≈ 40 % высоты, между ними тонкая полоса; два участка листаются свайпом (точки);
     • строка «Попытка» и кнопки ответов компактнее, пустой промежуток под картой убран.
   Десктоп не затронут.
   ========================================================================= */
@media (max-width: 720px) {
  body.is-game .topbar__nav { display: none; }
  body.is-game .game-back-btn { margin-bottom: 0; }
  body.is-game .game-layout { margin-top: 6px; }
  body.is-game .game-panel { padding: 6px 8px; gap: 6px; }

  /* карта с увеличенными участками: 60 / 40, тонкая полоса между ними */
  body.is-game .question-visual--map .map-wrap { position: relative; }
  body.is-game .question-visual--map .map-wrap--inset,
  body.is-game .question-visual--map .map-wrap--inset[data-continent]:not([data-continent="oceania"]) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 60fr) minmax(0, 40fr);
    grid-template-areas: "fit" "insets";
    row-gap: 3px;
  }
  body.is-game .question-visual--map .map-wrap--inset .map-fit { border-radius: 12px 12px 0 0; }
  body.is-game .question-visual--map .map-wrap--inset .map-insets { border-radius: 0 0 12px 12px; overflow: hidden; }
  body.is-game .question-visual--map .map-wrap--inset .map-caption { display: none; }
  body.is-game .map-inset { width: 100%; max-width: none; height: 100%; max-height: 100%; aspect-ratio: auto; border: 0; border-radius: 0; background: transparent; }

  /* подпись части света: чип внутри карты, место не занимает */
  body.is-game .question-visual--map .map-context {
    position: absolute; top: 6px; left: 6px; z-index: 5; width: auto; padding: 2px 8px;
    border: 0; border-radius: 8px; background: rgba(8, 14, 28, 0.78); pointer-events: none;
  }
  body.is-game .question-visual--map .map-context__continent { font-size: 0.6rem; letter-spacing: 0.06em; }
  body.is-game .map-inset .map-inset__label { top: 6px; left: 6px; right: auto; padding: 2px 8px; font-size: 0.6rem; letter-spacing: 0.04em; border-radius: 8px; }
  .map-wrap[data-continent="oceania"] .map-inset .map-inset__label { font-size: 0.6rem; }

  /* два участка (рассыпанные острова): рядом, оба видны сразу, между ними тонкая вертикальная полоса (свайпа нет, решение Марии) */
  body.is-game .map-insets--2 {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 3px; overflow: hidden;
    background: #172131;
  }
  body.is-game .map-insets--2 .map-inset { width: 100%; height: 100%; background: #91c9df; }

  /* строка «Попытка» компактнее, пустого промежутка нет */
  body.is-game .game-status { min-height: 0; margin: 0; padding: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  body.is-game .game-status .attempt-info { font-size: 0.74rem; }
  body.is-game .question-card__spacer { display: none; }

  /* ответы: по 46 px вместо 56–88 */
  body.is-game .question-card .answers { --ans-h: 46px; gap: 6px; margin-top: 2px; }
  body.is-game .answer-btn { font-size: clamp(0.78rem, 3.5vw, 0.88rem); line-height: 1.12; }
}
.map-inset-pager { display: none; }   /* точки свайпа больше не используются */
@media (max-width: 720px) {
  /* строка ответа («Верно» / «Неверно») не должна сжиматься: «Попытка N» слева, сообщение занимает остаток строки в 30 px */
  body.is-game .game-status { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 8px; }
  body.is-game .game-status .attempt-info { margin: 0; white-space: nowrap; }
  body.is-game .game-status .feedback { margin: 0; height: 30px; min-height: 30px; flex: none; min-width: 0; padding: 0 8px; font-size: 0.8rem; line-height: 1.15; white-space: normal; }
}
@media (max-width: 720px) {
  /* два участка рядом: подпись «Увеличенный участок 1 из 2» целиком помещается в половину ширины */
  body.is-game .map-insets--2 .map-inset .map-inset__label,
  .map-wrap[data-continent="oceania"] .map-insets--2 .map-inset .map-inset__label {
    top: 5px; left: 5px; right: auto; max-width: calc(100% - 10px); padding: 2px 6px;
    font-size: clamp(0.44rem, 2.2vw, 0.52rem); letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: clip;
  }
}
@media (max-width: 720px) {
  /* при двух участках рядом подпись короче: «Участок 1 из 2» (слово «Увеличенный» скрыто, рамка и карта это уже показывают) */
  body.is-game .map-insets--2 .map-inset__lead { display: none; }
  body.is-game .map-insets--2 .map-inset .map-inset__label,
  .map-wrap[data-continent="oceania"] .map-insets--2 .map-inset .map-inset__label { font-size: clamp(0.5rem, 2.5vw, 0.58rem); letter-spacing: 0.03em; }
}

/* строка игрока, чей профиль открыт: голубая плашка с рамкой, чтобы легко найти себя среди одинаковых ников */
body.is-leaderboard .lb-table tr.lb-you td {
  background-color: color-mix(in srgb, var(--home-primary) 20%, transparent);
  background-image: none;
  background-clip: padding-box;
  border-bottom: 6px solid transparent;
  color: var(--home-text);
  font-weight: 700;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--home-primary) 75%, transparent),
    inset 0 -1px 0 color-mix(in srgb, var(--home-primary) 75%, transparent);
}
body.is-leaderboard .lb-table tr.lb-you td:first-child {
  padding-left: 12px;
  border-radius: 12px 0 0 12px;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--home-primary) 75%, transparent),
    inset 0 -1px 0 color-mix(in srgb, var(--home-primary) 75%, transparent),
    inset 1px 0 0 color-mix(in srgb, var(--home-primary) 75%, transparent);
}
body.is-leaderboard .lb-table tr.lb-you td:last-child {
  padding-right: 12px;
  border-radius: 0 12px 12px 0;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--home-primary) 75%, transparent),
    inset 0 -1px 0 color-mix(in srgb, var(--home-primary) 75%, transparent),
    inset -1px 0 0 color-mix(in srgb, var(--home-primary) 75%, transparent);
}
body.is-leaderboard .lb-table tr.lb-you td.lb-rank { color: var(--home-primary); }
body.is-leaderboard .lb-table tr.lb-you.lb-top td.lb-rank { color: var(--t); }
