/* =========================================================
   Космосчёт — стили
   ========================================================= */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('assets/fonts/nunito-cyr.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('assets/fonts/nunito-lat.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Comfortaa';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('assets/fonts/comfortaa-700-cyr.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Comfortaa';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('assets/fonts/comfortaa-700-lat.woff2') format('woff2');
  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;
}

:root {
  --bg: #070b1f;
  --bg-soft: #0c1233;
  --surface: rgba(20, 29, 68, 0.65);
  --surface-solid: #151d47;
  --surface-light: rgba(255, 255, 255, 0.065);
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.19);
  --text: #f7f8ff;
  --muted: #a9b3d9;
  --muted-strong: #c5ccec;
  --yellow: #ffd166;
  --orange: #ff9e5a;
  --coral: #ff6b8b;
  --mint: #61e7b4;
  --cyan: #65d8ff;
  --blue: #6b9bff;
  --violet: #b28aff;
  --pink: #ff8ce1;
  --green: #62e39a;
  --danger: #ff7694;
  --font-display: 'Comfortaa', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', 'Trebuchet MS', system-ui, sans-serif;
  --shadow-soft: 0 24px 70px rgba(0, 0, 0, 0.32);
  --shadow-card: 0 18px 48px rgba(2, 6, 24, 0.32);
  --radius-xl: 36px;
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --header-height: 78px;
}

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

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 600;
  background:
    radial-gradient(1100px 700px at 84% 2%, rgba(92, 74, 255, 0.22), transparent 64%),
    radial-gradient(900px 640px at 2% 30%, rgba(0, 201, 255, 0.11), transparent 62%),
    radial-gradient(700px 700px at 52% 100%, rgba(255, 90, 170, 0.08), transparent 60%),
    linear-gradient(180deg, #070b1f 0%, #0a0f2a 46%, #070b1f 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.3;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.74' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.09'/%3E%3C/svg%3E");
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  padding: 0;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:disabled {
  cursor: default;
}

a {
  color: inherit;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

::selection {
  color: #201327;
  background: var(--yellow);
}

[hidden] {
  display: none !important;
}

.noscript-note {
  position: relative;
  z-index: 1000;
  max-width: 560px;
  margin: 24px auto;
  padding: 16px 20px;
  border: 1px solid rgba(255, 209, 102, 0.3);
  border-radius: 16px;
  color: #fff0c4;
  font-weight: 700;
  text-align: center;
  background: rgba(23, 20, 46, 0.95);
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 999;
  padding: 10px 16px;
  border-radius: 12px;
  color: #1d132d;
  font-weight: 900;
  background: var(--yellow);
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}
.skip-link:focus {
  transform: translateY(0);
}

/* ---------- Фон ---------- */
.starfield,
.fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.starfield {
  z-index: 0;
}
.fx-canvas {
  z-index: 180;
}

.aurora {
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(90px);
  opacity: 0.4;
  will-change: transform;
}
.aurora-one {
  top: -180px;
  right: -140px;
  width: 540px;
  height: 540px;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.6), transparent 68%);
  animation: auroraDrift 18s ease-in-out infinite alternate;
}
.aurora-two {
  top: 42%;
  left: -260px;
  width: 620px;
  height: 620px;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.28), transparent 68%);
  animation: auroraDrift 24s ease-in-out infinite alternate-reverse;
}
.aurora-three {
  right: 5%;
  bottom: -300px;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(255, 100, 198, 0.18), transparent 68%);
  animation: auroraDrift 21s ease-in-out infinite alternate;
}

/* ---------- Оболочка ---------- */
.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: calc(12px + env(safe-area-inset-top)) 20px 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  background: linear-gradient(180deg, rgba(7, 11, 31, 0.93), rgba(7, 11, 31, 0.66));
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1180px;
  margin: 0 auto;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 11px;
}

.brand-img {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  box-shadow: 0 8px 24px rgba(110, 92, 255, 0.24);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.05;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.16rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.rank-chip {
  display: flex;
  align-items: center;
  width: 204px;
  min-width: 0;
  gap: 9px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}

.rank-emoji {
  flex: 0 0 auto;
  font-size: 1.28rem;
  filter: drop-shadow(0 0 8px rgba(255, 209, 102, 0.3));
}
.rank-level {
  flex: 0 0 auto;
  padding: 3px 6px;
  border: 1px solid rgba(255, 209, 102, 0.24);
  border-radius: 7px;
  color: var(--yellow);
  font-size: 0.58rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  background: rgba(255, 209, 102, 0.07);
}

.rank-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  gap: 5px;
}

.rank-title {
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 0.69rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-progress {
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.rank-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--yellow));
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  height: 43px;
  padding: 0 13px;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.05);
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}
.stat-pill:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.09);
  transform: translateY(-1px);
}
.stat-icon {
  font-size: 1rem;
}
.stat-pill strong {
  font-size: 0.92rem;
  font-weight: 900;
}
.stat-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.icon-btn {
  display: inline-grid;
  flex: 0 0 auto;
  width: 43px;
  height: 43px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  font-size: 1.08rem;
  background: rgba(255, 255, 255, 0.05);
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}
.icon-btn:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px) rotate(-2deg);
}
.icon-btn:active {
  transform: translateY(1px) scale(0.96);
}

/* ---------- Экраны ---------- */
.screen {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 20px 56px;
  animation: screenIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.screen[hidden] {
  display: none !important;
}

body.in-game .topbar {
  display: none;
}

body.modal-open {
  overflow: hidden;
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 13px 21px;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 17px;
  font-size: 0.96rem;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}
.btn:hover {
  transform: translateY(-2px);
}
.btn:active {
  transform: translateY(1px) scale(0.99);
}
.btn-lg {
  min-height: 58px;
  padding: 17px 27px;
  border-radius: 19px;
  font-size: 1.02rem;
}
.btn-primary {
  color: #2c1c0e;
  background: linear-gradient(135deg, #ffe187 0%, #ffd166 46%, #ffb84d 100%);
  box-shadow:
    0 12px 30px rgba(255, 190, 70, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.btn-primary:hover {
  box-shadow:
    0 17px 38px rgba(255, 190, 70, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.btn-ghost {
  border-color: var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.btn-ghost:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.1);
}
.btn-danger {
  border-color: rgba(255, 118, 148, 0.3);
  color: #ffd6df;
  background: rgba(255, 118, 148, 0.1);
}
.btn-danger:hover {
  border-color: rgba(255, 118, 148, 0.55);
  background: rgba(255, 118, 148, 0.17);
}
.btn-next {
  flex: 0 0 auto;
  min-height: 43px;
  padding: 10px 17px;
  border-radius: 14px;
  color: #09271c;
  font-size: 0.88rem;
  background: linear-gradient(135deg, #8af7c8, #45ddab);
  box-shadow: 0 7px 20px rgba(69, 221, 171, 0.2);
  animation: nextAppear 0.35s ease both;
}
.btn-arrow {
  font-size: 1.12em;
  transition: transform 0.2s ease;
}
.btn-primary:hover .btn-arrow {
  transform: translateX(4px);
}
.btn-block {
  width: 100%;
}

/* ---------- Главная: hero ---------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(330px, 0.9fr);
  align-items: center;
  min-height: 460px;
  padding: 50px 46px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 38px;
  background:
    radial-gradient(620px 420px at 74% 52%, rgba(112, 86, 255, 0.2), transparent 65%),
    radial-gradient(420px 320px at 98% 2%, rgba(97, 231, 180, 0.1), transparent 64%),
    linear-gradient(135deg, rgba(26, 37, 89, 0.87), rgba(12, 18, 48, 0.73));
  box-shadow:
    var(--shadow-soft),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 8% 20%, rgba(255, 255, 255, 0.68) 0 1px, transparent 1.5px),
    radial-gradient(circle at 28% 78%, rgba(255, 255, 255, 0.38) 0 1px, transparent 1.5px),
    radial-gradient(circle at 92% 76%, rgba(255, 255, 255, 0.5) 0 1px, transparent 1.5px);
  background-size: 170px 170px, 230px 230px, 290px 290px;
  opacity: 0.5;
}
.hero::after {
  content: '';
  position: absolute;
  top: -35%;
  right: -10%;
  width: 60%;
  height: 120%;
  pointer-events: none;
  background: conic-gradient(
    from 210deg,
    transparent 0deg,
    rgba(255, 255, 255, 0.055) 20deg,
    transparent 40deg
  );
  transform: rotate(8deg);
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--mint);
  font-size: 0.73rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.eyebrow-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 12px var(--mint);
}

.hero h1 {
  max-width: 690px;
  margin-top: 18px;
  font-size: clamp(2.85rem, 5.3vw, 4.65rem);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.name-highlight {
  color: transparent;
  background: linear-gradient(100deg, #ffe59b 5%, #ffd166 32%, #ff9e5a 68%, #ff8ce1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: none;
}

.hero-sub {
  max-width: 560px;
  margin-top: 20px;
  color: var(--muted-strong);
  font-size: clamp(1rem, 1.45vw, 1.12rem);
  font-weight: 600;
  line-height: 1.58;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 30px;
  gap: 12px;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 34px;
  gap: 14px 24px;
}
.hero-stat {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}
.hero-stat-icon {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  font-size: 1.05rem;
  background: rgba(255, 255, 255, 0.055);
}
.hero-stat div {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.18;
}
.hero-stat strong {
  overflow: hidden;
  max-width: 200px;
  font-size: 0.9rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero-stat small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}
.hero-stat-rank strong {
  max-width: 210px;
  color: var(--yellow);
}

/* ---------- Сцена с Пиком ---------- */
.hero-scene {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 350px;
  place-items: center;
}

.hero-halo {
  position: absolute;
  width: 330px;
  height: 330px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 212, 113, 0.15), transparent 54%),
    radial-gradient(circle at 50% 50%, rgba(120, 104, 255, 0.2), transparent 72%);
  box-shadow:
    inset 0 0 60px rgba(120, 104, 255, 0.08),
    0 0 80px rgba(120, 104, 255, 0.1);
  animation: haloPulse 6s ease-in-out infinite;
}

.hero-orbit {
  position: absolute;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  pointer-events: none;
}
.hero-orbit-one {
  width: 390px;
  height: 176px;
  transform: rotate(-24deg);
  animation: orbitSpin 32s linear infinite;
}
.hero-orbit-two {
  width: 270px;
  height: 330px;
  transform: rotate(42deg);
  border-color: rgba(255, 255, 255, 0.07);
  animation: orbitSpinReverse 40s linear infinite;
}

.orbit-symbol {
  position: absolute;
  z-index: 3;
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 13px;
  color: var(--text);
  font-size: 1.12rem;
  font-weight: 900;
  background: rgba(18, 26, 62, 0.7);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.23);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.orbit-symbol-one {
  top: 13%;
  left: 3%;
  color: var(--mint);
  transform: rotate(-9deg);
  animation: accessoryBob 5.3s ease-in-out infinite;
}
.orbit-symbol-two {
  top: 18%;
  right: 2%;
  color: var(--yellow);
  transform: rotate(8deg);
  animation: accessoryBob 6.1s ease-in-out infinite reverse;
}
.orbit-symbol-three {
  right: 7%;
  bottom: 12%;
  color: var(--pink);
  transform: rotate(-6deg);
  animation: accessoryBob 5.8s ease-in-out infinite 0.8s;
}
.orbit-star {
  position: absolute;
  color: var(--yellow);
  font-size: 1.1rem;
  opacity: 0.8;
  animation: starTwinkle 3.5s ease-in-out infinite;
}
.orbit-star-one {
  top: 7%;
  right: 29%;
}
.orbit-star-two {
  left: 10%;
  bottom: 9%;
  color: var(--cyan);
  font-size: 0.8rem;
  animation-delay: 1.4s;
}

.speech-bubble {
  position: absolute;
  top: 1%;
  right: -2%;
  z-index: 4;
  max-width: 190px;
  padding: 12px 16px 13px;
  border-radius: 18px 18px 18px 5px;
  color: #24182d;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.35;
  background: #fff8e8;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
  transform: rotate(2deg);
  animation: speechFloat 6s ease-in-out infinite;
}
.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 16px;
  width: 16px;
  height: 16px;
  background: #fff8e8;
  clip-path: polygon(0 0, 100% 0, 0 100%);
}
.speech-name {
  display: block;
  margin-bottom: 4px;
  color: #8b5cf6;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero-mascot {
  z-index: 2;
  width: min(330px, 86%);
  animation: mascotFloat 5.6s ease-in-out infinite;
}

.mascot-holder {
  position: relative;
}
.mascot {
  width: 100%;
  filter: drop-shadow(0 24px 26px rgba(0, 0, 0, 0.24));
  transform-origin: 50% 80%;
}
.mascot-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}
.mascot-shadow {
  animation: shadowPulse 5.6s ease-in-out infinite;
  transform-origin: 130px 270px;
}
.mascot .eyes-open {
  transform-box: fill-box;
  transform-origin: center;
  animation: mascotBlink 6.2s ease-in-out infinite;
}
.mascot .eyes-open .eye-shine {
  transform-box: fill-box;
  transform-origin: center;
}
.mascot-sparkles {
  animation: sparklePulse 2.8s ease-in-out infinite;
  transform-origin: 130px 100px;
}
.mascot-question {
  animation: questionBob 3s ease-in-out infinite;
  transform-origin: 220px 50px;
}

.mascot-accessories {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.mascot-accessory {
  position: absolute;
  display: block;
  font-size: 3.8rem;
  line-height: 1;
  filter: drop-shadow(0 7px 10px rgba(0, 0, 0, 0.28));
  transform-origin: 50% 100%;
}
.mascot-accessory--hat {
  top: 4%;
  left: 50%;
  transform: translateX(-50%) rotate(-6deg);
  animation: accessoryBob 4.6s ease-in-out infinite;
}
.mascot-accessory--neck {
  top: 58%;
  left: 50%;
  font-size: 2.9rem;
  transform: translateX(-50%) rotate(2deg);
  animation: accessoryBob 5.2s ease-in-out infinite reverse;
}
.mascot-accessory--buddy {
  top: 31%;
  right: 0;
  font-size: 2.8rem;
  animation: starBuddy 3.4s ease-in-out infinite;
}
.mascot-accessory--companion {
  bottom: 1%;
  left: -5%;
  z-index: 4;
  font-size: 3.2rem;
  animation: companionFloat 4.4s ease-in-out infinite;
}
.aside-mascot .mascot-accessory--companion {
  left: -2%;
  font-size: 1.75rem;
}
.wardrobe-preview .mascot-accessory--companion {
  left: -1%;
  font-size: 1.55rem;
}

/* ---------- Карта ---------- */
.map-section {
  margin-top: 52px;
  scroll-margin-top: 92px;
}
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 22px;
}
.section-heading h2 {
  margin-top: 7px;
  font-size: clamp(2rem, 3.4vw, 2.7rem);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -0.035em;
}
.section-heading p {
  max-width: 610px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-bottom: 3px;
}
.map-legend span {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.035);
}
.map-legend b {
  font-size: 0.8rem;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.level-card {
  position: relative;
  display: flex;
  min-height: 216px;
  padding: 23px;
  gap: 21px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 29px;
  background:
    radial-gradient(300px 180px at 12% 40%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 68%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.022));
  box-shadow: var(--shadow-card);
  transition:
    transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}
.level-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 22px;
  right: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 55%, transparent), transparent);
  opacity: 0.5;
}
.level-card:hover {
  z-index: 2;
  border-color: color-mix(in srgb, var(--accent) 34%, rgba(255, 255, 255, 0.1));
  box-shadow:
    0 22px 56px rgba(0, 0, 0, 0.36),
    0 0 30px color-mix(in srgb, var(--accent) 10%, transparent);
  transform: translateY(-4px);
}
.level-card.is-wide {
  grid-column: 1 / -1;
  min-height: 236px;
}
.level-card.is-mix {
  background:
    radial-gradient(420px 230px at 18% 50%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 68%),
    radial-gradient(420px 260px at 96% 10%, color-mix(in srgb, var(--accent2) 10%, transparent), transparent 70%),
    linear-gradient(135deg, rgba(42, 35, 82, 0.74), rgba(18, 25, 61, 0.82));
}
.level-card.is-final {
  background:
    radial-gradient(420px 230px at 18% 50%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 68%),
    radial-gradient(420px 260px at 96% 10%, color-mix(in srgb, var(--accent2) 12%, transparent), transparent 70%),
    linear-gradient(135deg, rgba(49, 37, 83, 0.72), rgba(18, 25, 61, 0.82));
}
.finale-deco {
  position: absolute;
  top: 50%;
  right: 90px;
  width: 190px;
  height: 190px;
  border: 1px dashed rgba(255, 209, 102, 0.2);
  border-radius: 50%;
  pointer-events: none;
  transform: translateY(-50%) rotate(-12deg);
}
.finale-deco::before,
.finale-deco::after {
  content: '';
  position: absolute;
  border-radius: 50%;
}
.finale-deco::before {
  inset: 26px;
  border: 1px solid rgba(255, 140, 225, 0.16);
}
.finale-deco::after {
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  background: var(--accent);
  box-shadow:
    78px -40px 0 -2px rgba(255, 209, 102, 0.8),
    -68px 34px 0 -2px rgba(97, 231, 180, 0.7),
    20px 82px 0 -3px rgba(255, 140, 225, 0.8);
  transform: translate(-50%, -50%);
}
.finale-deco span {
  position: absolute;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 900;
  background: rgba(18, 26, 62, 0.6);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}
.finale-deco span:nth-child(1) {
  top: 33px;
  right: 20px;
}
.finale-deco span:nth-child(2) {
  bottom: 2px;
  left: 8px;
  color: var(--pink);
}
.finale-deco span:nth-child(3) {
  right: -8px;
  bottom: 42px;
  color: var(--mint);
}
.finale-deco span:nth-child(4) {
  top: -12px;
  left: 28px;
  color: var(--yellow);
}
@media (min-width: 801px) {
  .level-card.is-final .level-meta {
    padding-right: 170px;
  }
}
.level-card.is-final::before {
  content: 'ФИНАЛЬНАЯ МИССИЯ';
  position: absolute;
  top: 19px;
  right: 22px;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--accent) 36%, transparent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  background: color-mix(in srgb, var(--accent) 8%, rgba(8, 12, 34, 0.3));
}
.level-card.is-locked {
  filter: saturate(0.34);
}
.level-card.is-locked:hover {
  transform: translateY(-2px);
  border-color: var(--line);
  box-shadow: var(--shadow-card);
}
.level-card.is-locked .planet {
  opacity: 0.65;
}

.planet-wrap {
  position: relative;
  flex: 0 0 auto;
  align-self: center;
  width: 116px;
  height: 126px;
}
.planet {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 106px;
  height: 106px;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 25%, rgba(255, 255, 255, 0.5), transparent 20%),
    radial-gradient(circle at 62% 72%, rgba(0, 0, 0, 0.2), transparent 40%),
    radial-gradient(circle at 38% 36%, var(--accent) 0%, var(--accent2) 78%);
  box-shadow:
    inset -16px -18px 28px rgba(3, 7, 26, 0.28),
    inset 8px 9px 18px rgba(255, 255, 255, 0.16),
    0 14px 34px color-mix(in srgb, var(--accent2) 24%, transparent);
  transform: translate(-50%, -50%);
  transition: transform 0.3s ease;
}
.planet::before {
  content: '';
  position: absolute;
  width: 146px;
  height: 38px;
  border: 1.5px solid color-mix(in srgb, var(--accent) 42%, transparent);
  border-radius: 50%;
  transform: rotate(-18deg);
  opacity: 0.55;
  pointer-events: none;
}
.planet::after {
  content: '';
  position: absolute;
  top: 17px;
  right: 18px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.13);
  box-shadow:
    -20px 36px 0 -3px rgba(0, 0, 0, 0.12),
    -8px 9px 0 -4px rgba(255, 255, 255, 0.25);
}
.level-card:hover .planet {
  transform: translate(-50%, -50%) scale(1.045) rotate(-2deg);
}
.level-card.is-final .planet {
  width: 122px;
  height: 122px;
}
.level-card.is-final .planet-wrap {
  width: 140px;
  height: 148px;
}
.planet-symbol {
  position: relative;
  z-index: 1;
  color: #fff;
  font-size: 2.8rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
}
.planet-lock {
  position: absolute;
  right: -1px;
  bottom: 3px;
  z-index: 2;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  font-size: 0.85rem;
  background: rgba(9, 14, 35, 0.9);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.level-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  padding-top: 1px;
}
.level-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-height: 26px;
  gap: 8px;
}
.difficulty-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.level-number {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.level-medal {
  margin-left: auto;
  font-size: 1.16rem;
  filter: drop-shadow(0 0 8px rgba(255, 209, 102, 0.28));
}
.level-title {
  margin-top: 8px;
  font-size: clamp(1.16rem, 1.8vw, 1.38rem);
  font-weight: 900;
  line-height: 1.18;
  letter-spacing: -0.02em;
}
.level-desc {
  max-width: 370px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.44;
}
.level-difficulty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
  padding: 6px 8px;
  gap: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}
.level-difficulty.is-locked {
  opacity: 0.55;
}
.level-difficulty-label {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.level-difficulty-options {
  display: flex;
  gap: 4px;
}
.level-difficulty-btn {
  min-width: 34px;
  height: 27px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted-strong);
  font-size: 0.66rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.04);
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}
.level-difficulty-btn:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}
.level-difficulty-btn.is-active {
  border-color: transparent;
  color: #10142f;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent2) 20%, transparent);
}
.level-difficulty-btn:disabled {
  cursor: default;
}
.level-difficulty-caption {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 700;
  white-space: nowrap;
}
.level-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 16px;
  gap: 10px;
}
.level-footer-left {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.level-stars {
  display: flex;
  gap: 3px;
  font-size: 0.94rem;
  letter-spacing: 0.02em;
}
.level-stars .star {
  color: rgba(255, 255, 255, 0.16);
  transition: color 0.2s ease, transform 0.2s ease;
}
.level-stars .star.is-filled {
  color: var(--yellow);
  text-shadow: 0 0 9px rgba(255, 209, 102, 0.4);
}
.level-xp {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
}
.level-play {
  min-height: 39px;
  padding: 9px 15px;
  border-radius: 13px;
  color: #14201a;
  font-size: 0.78rem;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 90%, #fff), var(--accent2));
  box-shadow:
    0 6px 0 color-mix(in srgb, var(--accent2) 70%, #000),
    0 10px 22px color-mix(in srgb, var(--accent2) 18%, transparent);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}
.level-play:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
}
.level-play:active {
  box-shadow: 0 2px 0 color-mix(in srgb, var(--accent2) 70%, #000);
  transform: translateY(3px);
}
.level-play.is-locked {
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.075);
  box-shadow: none;
}
.level-play.is-locked:hover {
  filter: none;
  transform: none;
}

.level-star-burst {
  position: absolute;
  top: 18px;
  right: 18px;
  color: var(--yellow);
  font-size: 1.3rem;
  opacity: 0;
  pointer-events: none;
}
.level-card.is-complete .level-star-burst {
  animation: starBurst 3.4s ease-in-out infinite;
}

/* ---------- Звезда тестов ---------- */
.test-planet-wrap {
  margin: 0 0 18px;
}
.test-planet-card {
  position: relative;
  display: flex;
  align-items: center;
  padding: 25px 28px;
  gap: 28px;
  overflow: hidden;
  border: 1px solid rgba(124, 231, 255, 0.17);
  border-radius: 30px;
  background:
    radial-gradient(520px 240px at 92% -10%, rgba(124, 231, 255, 0.13), transparent 70%),
    radial-gradient(420px 250px at 4% 110%, rgba(255, 209, 102, 0.07), transparent 70%),
    linear-gradient(135deg, rgba(27, 44, 87, 0.8), rgba(12, 18, 48, 0.87));
  box-shadow: var(--shadow-card);
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}
.test-planet-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 25px;
  right: 25px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124, 231, 255, 0.5), transparent);
}
.test-planet-card.is-open {
  border-color: rgba(124, 231, 255, 0.38);
  box-shadow:
    0 22px 60px rgba(0, 0, 0, 0.35),
    0 0 46px rgba(124, 231, 255, 0.12);
}
.test-planet-card.is-closed,
.test-planet-card.is-locked {
  opacity: 0.86;
}
.test-planet-card.is-locked {
  filter: saturate(0.65);
}

.test-planet-visual {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 122px;
  height: 130px;
  place-items: center;
}
.test-orbit {
  position: absolute;
  width: 148px;
  height: 48px;
  border: 1px dashed rgba(124, 231, 255, 0.27);
  border-radius: 50%;
  transform: rotate(-18deg);
}
.test-planet-card.is-open .test-orbit {
  animation: testOrbit 14s linear infinite;
}
.test-core {
  position: relative;
  z-index: 1;
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  color: #fff;
  font-size: 2.7rem;
  font-weight: 900;
  line-height: 1;
  background:
    radial-gradient(circle at 32% 22%, rgba(255, 255, 255, 0.45), transparent 28%),
    radial-gradient(circle at 50% 50%, #8feaff 0%, #4f8eff 62%, #5d55e8 100%);
  box-shadow:
    inset -12px -14px 24px rgba(26, 35, 100, 0.32),
    0 15px 34px rgba(60, 129, 255, 0.25);
}
.test-planet-card.is-open .test-core {
  animation: testCorePulse 2.4s ease-in-out infinite;
}
.test-planet-card.is-closed .test-core,
.test-planet-card.is-locked .test-core {
  filter: saturate(0.35);
}
.test-coin {
  position: absolute;
  right: -4px;
  bottom: 3px;
  z-index: 2;
  display: grid;
  width: 44px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(255, 209, 102, 0.45);
  border-radius: 11px;
  color: #3a2505;
  font-size: 0.82rem;
  font-weight: 900;
  background: linear-gradient(135deg, #ffe58f, #ffc24d);
  box-shadow: 0 7px 18px rgba(255, 190, 70, 0.23);
  transform: rotate(7deg);
}

.test-planet-body {
  min-width: 0;
  flex: 1;
}
.test-planet-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.event-chip {
  display: inline-flex;
  padding: 5px 9px;
  border: 1px solid rgba(124, 231, 255, 0.25);
  border-radius: 999px;
  color: var(--cyan);
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  background: rgba(124, 231, 255, 0.07);
}
.test-multiplier {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  gap: 5px;
  border: 1px solid rgba(255, 209, 102, 0.22);
  border-radius: 999px;
  color: var(--yellow);
  font-size: 0.62rem;
  font-weight: 900;
  background: rgba(255, 209, 102, 0.07);
}
.test-planet-title {
  margin-top: 8px;
  font-size: clamp(1.35rem, 2.2vw, 1.65rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.025em;
}
.test-planet-desc {
  max-width: 680px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.45;
}
.test-status-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 12px;
  gap: 9px 14px;
}
.test-status {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-strong);
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.035);
}
.test-status strong {
  color: var(--text);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}
.test-status.is-open {
  border-color: rgba(97, 231, 180, 0.25);
  color: var(--mint);
  background: rgba(97, 231, 180, 0.06);
}
.test-status.is-open strong {
  color: var(--mint);
}
.test-status.is-locked {
  border-color: rgba(255, 209, 102, 0.2);
  color: var(--yellow);
  background: rgba(255, 209, 102, 0.055);
}
.test-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 10px var(--mint);
  animation: starTwinkle 1.6s ease-in-out infinite;
}
.test-planets-label {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
}
.test-planet-chips {
  display: flex;
  flex-wrap: wrap;
  margin-top: 8px;
  gap: 5px;
}
.test-planet-chip {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--chip-accent, var(--cyan)) 30%, transparent);
  border-radius: 9px;
  color: var(--chip-accent, var(--cyan));
  font-size: 0.82rem;
  font-weight: 900;
  background: color-mix(in srgb, var(--chip-accent, var(--cyan)) 7%, rgba(8, 13, 34, 0.25));
}
.test-planet-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 15px;
  gap: 10px 15px;
}
.test-play {
  min-width: 175px;
}
.test-schedule {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
}

.test-timer-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  gap: 4px;
  border: 1px solid rgba(255, 209, 102, 0.22);
  border-radius: 999px;
  color: var(--yellow);
  font-size: 0.66rem;
  font-weight: 800;
  background: rgba(255, 209, 102, 0.06);
  font-variant-numeric: tabular-nums;
}
.test-timer-chip strong {
  color: var(--yellow);
  font-weight: 900;
}
.test-timer-mult {
  padding-left: 5px;
  border-left: 1px solid rgba(255, 209, 102, 0.2);
  color: var(--mint);
  font-weight: 900;
}
.test-timer-chip.is-ended {
  border-color: rgba(255, 118, 148, 0.25);
  color: var(--danger);
}
.test-timer-chip.is-ended strong {
  color: var(--danger);
}

/* ---------- Главная: подвал ---------- */
.home-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 50px;
  padding-top: 22px;
  gap: 12px 20px;
  border-top: 1px solid var(--line);
}
.offline-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.035);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 8px currentColor;
}
.offline-pill.is-ready {
  color: var(--mint);
  border-color: rgba(97, 231, 180, 0.22);
  background: rgba(97, 231, 180, 0.055);
}
.offline-pill.is-ready .status-dot {
  background: var(--mint);
}
.offline-pill.is-warn {
  color: var(--yellow);
  border-color: rgba(255, 209, 102, 0.2);
}
.offline-pill.is-warn .status-dot {
  background: var(--yellow);
}
.install-link {
  padding: 6px 4px;
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.made-with {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

/* ---------- Уровень игрока и гонка ---------- */
#raceBtn {
  border-color: rgba(255, 154, 90, 0.28);
}
#raceBtn:hover {
  border-color: rgba(255, 154, 90, 0.5);
  background: rgba(255, 154, 90, 0.09);
}

.race-hud {
  margin-top: 13px;
  padding: 12px 15px 13px;
  border: 1px solid rgba(255, 154, 90, 0.22);
  border-radius: 21px;
  background:
    radial-gradient(420px 150px at 20% 0%, rgba(255, 154, 90, 0.08), transparent 70%),
    rgba(19, 27, 63, 0.7);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.race-hud-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.race-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--orange);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}
.race-clock {
  color: var(--muted-strong);
  font-size: 0.72rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.race-lanes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  margin-top: 8px;
  gap: 8px;
}
.race-lane {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 7px 9px;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
}
.race-lane-you {
  border-color: rgba(97, 231, 180, 0.22);
  background: rgba(97, 231, 180, 0.045);
}
.race-lane-opponent {
  border-color: rgba(255, 154, 90, 0.17);
}
.race-avatar {
  flex: 0 0 auto;
  font-size: 1.15rem;
  line-height: 1;
}
.race-lane-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}
.race-lane-name {
  overflow: hidden;
  max-width: 90px;
  font-size: 0.65rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.race-lane-copy small {
  color: var(--muted);
  font-size: 0.52rem;
  font-weight: 700;
}
.race-progress {
  flex: 1;
  min-width: 24px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}
.race-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--yellow));
  transition: width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.race-lane-opponent .race-progress i {
  background: linear-gradient(90deg, var(--orange), var(--coral));
}
.race-counter {
  flex: 0 0 auto;
  color: var(--muted-strong);
  font-size: 0.58rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.race-vs {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 900;
  opacity: 0.65;
}
.race-players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-top: 9px;
  gap: 6px;
}
.race-grid-player {
  display: grid;
  grid-template-areas:
    "avatar copy place"
    "bar bar bar";
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-width: 0;
  padding: 6px 8px 7px;
  gap: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
}
.race-grid-player.is-you {
  border-color: rgba(97, 231, 180, 0.32);
  background: rgba(97, 231, 180, 0.06);
}
.race-grid-player.is-finished {
  border-color: rgba(255, 209, 102, 0.3);
  background: rgba(255, 209, 102, 0.055);
}
.race-grid-avatar {
  grid-area: avatar;
  font-size: 1.05rem;
  line-height: 1;
}
.race-grid-copy {
  display: flex;
  grid-area: copy;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}
.race-grid-copy strong {
  overflow: hidden;
  font-size: 0.64rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.race-grid-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.52rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.race-grid-place {
  grid-area: place;
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1;
}
.race-grid-counter {
  grid-area: place;
  color: var(--muted-strong);
  font-size: 0.58rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.race-grid-progress {
  grid-area: bar;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}
.race-grid-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--yellow));
  transition: width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.race-grid-player.is-finished .race-grid-progress i {
  background: linear-gradient(90deg, var(--yellow), var(--orange));
}

.race-setting {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid rgba(255, 154, 90, 0.18);
  border-radius: 16px;
  background: rgba(255, 154, 90, 0.045);
}
.race-setting-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.race-setting-head strong {
  font-size: 0.76rem;
  font-weight: 900;
}
.race-setting-head small {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 600;
}
.race-count-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 8px;
  gap: 6px;
}
.race-count-chip {
  min-height: 40px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}
.race-count-chip:hover {
  border-color: rgba(255, 154, 90, 0.38);
}
.race-count-chip.is-active {
  border-color: rgba(255, 154, 90, 0.58);
  color: #10142f;
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  box-shadow: 0 6px 16px rgba(255, 154, 90, 0.2);
}

.race-room-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0 8px;
  gap: 7px 10px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
}
.race-room-meta strong {
  color: var(--mint);
  font-size: 0.76rem;
}

.spectator-panel {
  display: grid;
  margin-top: 14px;
  padding: 15px;
  gap: 12px;
  border: 1px solid rgba(255, 209, 102, 0.24);
  border-radius: 21px;
  background:
    radial-gradient(460px 170px at 16% 0%, rgba(255, 209, 102, 0.09), transparent 72%),
    rgba(19, 27, 63, 0.72);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.spectator-panel[hidden] {
  display: none;
}
.spectator-hero {
  display: flex;
  align-items: center;
  gap: 12px;
}
.spectator-flag {
  display: grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255, 209, 102, 0.28);
  border-radius: 16px;
  background: rgba(255, 209, 102, 0.09);
  font-size: 1.45rem;
}
.spectator-hero h2 {
  margin: 2px 0 2px;
  font-size: 1.06rem;
  letter-spacing: -0.01em;
}
.spectator-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}
.spectator-board {
  display: grid;
  gap: 6px;
}
.spectator-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  padding: 8px 10px;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}
.spectator-row.is-you {
  border-color: rgba(97, 231, 180, 0.3);
  background: rgba(97, 231, 180, 0.055);
}
.spectator-row.is-finished {
  border-color: rgba(255, 209, 102, 0.26);
  background: rgba(255, 209, 102, 0.05);
}
.spectator-pos {
  width: 22px;
  color: var(--yellow);
  font-size: 0.92rem;
  font-weight: 900;
  text-align: center;
}
.spectator-avatar {
  font-size: 1.22rem;
  line-height: 1;
}
.spectator-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 4px;
}
.spectator-copy strong {
  overflow: hidden;
  font-size: 0.72rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spectator-progress {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}
.spectator-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--yellow));
  transition: width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.spectator-row.is-finished .spectator-progress i {
  background: linear-gradient(90deg, var(--yellow), var(--orange));
}
.spectator-status {
  color: var(--muted-strong);
  font-size: 0.62rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.spectator-footer {
  padding-top: 4px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}
body.is-spectating .race-hud,
body.is-spectating .progress-row,
body.is-spectating .game-layout {
  display: none !important;
}
body.is-spectating .spectator-panel {
  margin-top: 0;
}

.race-mode .combo-chip,
.race-mode .game-stat,
.race-mode .aside-progress {
  display: none !important;
}
.race-mode .game-topbar {
  border-color: rgba(255, 154, 90, 0.2);
}

.answer-btn.is-hint {
  border-color: rgba(255, 209, 102, 0.8);
  box-shadow:
    0 0 0 3px rgba(255, 209, 102, 0.12),
    0 0 24px rgba(255, 209, 102, 0.14);
  animation: hintPulse 1.2s ease-in-out infinite;
}

.race-countdown {
  position: fixed;
  inset: 0;
  z-index: 190;
  display: grid;
  place-content: center;
  padding: 20px;
  text-align: center;
  background: rgba(4, 7, 20, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.race-countdown[hidden] {
  display: none;
}
.race-countdown-num {
  color: var(--yellow);
  font-size: clamp(7rem, 24vw, 13rem);
  font-weight: 900;
  line-height: 0.9;
  text-shadow:
    0 0 30px rgba(255, 209, 102, 0.4),
    0 12px 0 rgba(127, 78, 0, 0.18);
}
.race-countdown-num.is-pop {
  animation: countdownPop 0.48s cubic-bezier(0.16, 1.4, 0.3, 1) both;
}
.race-countdown p {
  margin-top: 18px;
  color: var(--muted-strong);
  font-size: 1rem;
  font-weight: 800;
}

/* Лобби гонки */
.race-profile-card {
  display: flex;
  align-items: center;
  margin-top: 20px;
  padding: 13px 15px;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.04);
}
.race-profile-avatar,
.race-player-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 39px;
  height: 39px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 1.35rem;
  background: rgba(255, 255, 255, 0.05);
}
.race-profile-copy,
.race-player-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}
.race-profile-copy strong,
.race-player-copy strong {
  overflow: hidden;
  font-size: 0.84rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.race-profile-copy small,
.race-player-copy small {
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 600;
}
.race-profile-pill {
  padding: 5px 8px;
  border: 1px solid rgba(97, 231, 180, 0.22);
  border-radius: 999px;
  color: var(--mint);
  font-size: 0.6rem;
  font-weight: 900;
  background: rgba(97, 231, 180, 0.06);
}
.race-menu-actions {
  display: flex;
  flex-wrap: wrap;
  margin-top: 17px;
  gap: 8px;
}
.race-menu-actions .btn {
  flex: 1 1 190px;
}
.race-note {
  margin-top: 17px;
}
.race-note b {
  color: var(--cyan);
  font-weight: 800;
  overflow-wrap: anywhere;
}
.race-join-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-top: 20px;
  gap: 8px;
}
.race-join-form .field {
  flex: 1 1 220px;
}
.race-join-form input {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 900;
  text-align: center;
}
.race-join-form .btn {
  flex: 0 1 auto;
}
.race-code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding: 14px 16px;
  gap: 12px;
  border: 1px dashed rgba(255, 209, 102, 0.3);
  border-radius: 17px;
  background: rgba(255, 209, 102, 0.04);
}
.race-code-box div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.race-code-box small {
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.race-code-box strong {
  color: var(--yellow);
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 0.22em;
  line-height: 1.1;
}
.race-players {
  display: grid;
  margin-top: 12px;
  gap: 7px;
}
.race-player-row {
  display: flex;
  align-items: center;
  padding: 9px 11px;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}
.race-player-row.is-you {
  border-color: rgba(97, 231, 180, 0.2);
  background: rgba(97, 231, 180, 0.04);
}
.race-player-row.is-empty {
  border-style: dashed;
  opacity: 0.6;
}
.race-player-status {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.57rem;
  font-weight: 700;
}
.race-player-status.is-online {
  color: var(--mint);
}
.race-wait-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 17px;
  gap: 8px;
}
.race-wait-actions .btn {
  flex: 1 1 170px;
}
.race-waiting-text {
  flex: 1 1 200px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
}

@keyframes countdownPop {
  from {
    opacity: 0;
    transform: scale(0.4) rotate(-8deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}
@keyframes hintPulse {
  0%,
  100% {
    box-shadow:
      0 0 0 3px rgba(255, 209, 102, 0.08),
      0 0 18px rgba(255, 209, 102, 0.1);
  }
  50% {
    box-shadow:
      0 0 0 4px rgba(255, 209, 102, 0.16),
      0 0 28px rgba(255, 209, 102, 0.2);
  }
}

/* ---------- Игра ---------- */
.game-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 0 20px;
}

.game-topbar {
  display: flex;
  align-items: center;
  padding: 11px 14px;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(19, 27, 63, 0.69);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.2);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.quit-btn {
  font-size: 1.3rem;
}
.game-level {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}
.game-symbol {
  display: grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 17px;
  color: var(--level-accent, var(--mint));
  font-size: 1.55rem;
  font-weight: 900;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.14), transparent 55%),
    rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.game-level div {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.14;
}
.game-level small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.game-level strong {
  overflow: hidden;
  margin-top: 3px;
  font-size: 0.86rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-hud {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 7px;
}
.combo-chip {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 11px;
  gap: 5px;
  border: 1px solid rgba(255, 158, 90, 0.16);
  border-radius: 12px;
  color: var(--muted-strong);
  font-size: 0.68rem;
  font-weight: 800;
  background: rgba(255, 158, 90, 0.055);
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}
.combo-chip strong {
  color: var(--orange);
  font-size: 0.86rem;
}
.combo-chip.is-hot {
  border-color: rgba(255, 158, 90, 0.4);
  color: #ffd9c3;
  background: rgba(255, 124, 75, 0.16);
  box-shadow: 0 0 18px rgba(255, 124, 75, 0.18);
  animation: comboPulse 0.55s ease;
}
.combo-chip.is-hot strong {
  color: var(--yellow);
}
.game-stat {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 10px;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.74rem;
  background: rgba(255, 255, 255, 0.04);
}
.game-stat strong {
  color: var(--muted-strong);
  font-size: 0.8rem;
  font-weight: 900;
}
.game-topbar .icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 0.92rem;
}

.progress-row {
  margin: 18px 4px;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.025em;
}
.progress-track {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}
.progress-fill {
  position: relative;
  width: 0;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--yellow) 55%, var(--coral));
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.3);
  transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.36), transparent);
  transform: translateX(-100%);
  animation: progressShine 2.4s ease-in-out infinite;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 282px;
  align-items: start;
  gap: 20px;
}

.question-card {
  position: relative;
  scroll-margin-top: 16px;
  min-height: 530px;
  padding: 29px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 34px;
  background:
    radial-gradient(600px 260px at 50% 0%, color-mix(in srgb, var(--level-accent, var(--mint)) 11%, transparent), transparent 70%),
    linear-gradient(160deg, rgba(26, 37, 85, 0.82), rgba(12, 18, 48, 0.83));
  box-shadow:
    0 24px 62px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.question-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--level-accent, var(--mint)), transparent);
  opacity: 0.8;
}
.question-card.is-entering {
  animation: cardIn 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.question-meta {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.question-label {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid color-mix(in srgb, var(--level-accent, var(--mint)) 24%, transparent);
  border-radius: 999px;
  color: var(--level-accent, var(--mint));
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--level-accent, var(--mint)) 7%, transparent);
}
.question-xp {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}
.question-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 205px;
  padding: 28px 0 24px;
  text-align: center;
}
.question-prompt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.question-expression {
  margin-top: 8px;
  font-size: clamp(4rem, 10vw, 6rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.04em;
  text-shadow: 0 10px 32px rgba(0, 0, 0, 0.22);
  animation: expressionIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.question-expression:focus,
.question-expression:focus-visible,
#mapTitle:focus,
#mapTitle:focus-visible {
  outline: none;
}
.question-visual {
  display: grid;
  width: min(230px, 62vw);
  margin-top: 5px;
  place-items: center;
  color: var(--level-accent, var(--mint));
  filter: drop-shadow(0 12px 24px color-mix(in srgb, var(--level-accent, var(--mint)) 18%, transparent));
  animation: expressionIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.question-visual:focus,
.question-visual:focus-visible {
  outline: none;
}
.question-visual svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.geometry-shape {
  fill: color-mix(in srgb, currentColor 16%, transparent);
  stroke: currentColor;
  stroke-width: 6;
  stroke-linejoin: round;
}
.geometry-label {
  fill: var(--text);
  font-family: var(--font-body);
  font-size: 19px;
  font-weight: 800;
}
.question-expression.is-text {
  max-width: 100%;
  font-size: clamp(2rem, 4.7vw, 3.35rem);
  line-height: 1.18;
  letter-spacing: -0.015em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.question-expression sup {
  position: relative;
  top: -0.38em;
  font-size: 0.48em;
  line-height: 0;
  letter-spacing: 0;
}
.question-expression .math-symbol {
  color: var(--level-accent, var(--mint));
}
.question-expression.is-roots {
  color: #fff6d9;
}
.question-expression.is-roots .root-symbol {
  color: var(--yellow);
}

.answers {
  display: grid;
  position: relative;
  z-index: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}
.answer-btn {
  position: relative;
  display: grid;
  animation: answerIn 0.38s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  min-height: 86px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 21px;
  color: var(--text);
  font-size: clamp(1.8rem, 4.4vw, 2.45rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.032));
  box-shadow:
    0 6px 0 rgba(2, 5, 18, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition:
    transform 0.15s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.2s ease;
}
.answer-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 18%;
  right: 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  opacity: 0.7;
}
.answer-btn:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.32);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.145), rgba(255, 255, 255, 0.05));
  box-shadow:
    0 9px 0 rgba(2, 5, 18, 0.32),
    0 0 24px rgba(120, 140, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transform: translateY(-3px);
}
.answer-btn:active:not(:disabled) {
  box-shadow: 0 2px 0 rgba(2, 5, 18, 0.32);
  transform: translateY(4px) scale(0.995);
}
.answer-btn.is-wrong {
  border-color: rgba(255, 153, 173, 0.65);
  color: #fff3f5;
  background: linear-gradient(180deg, rgba(255, 118, 148, 0.86), rgba(201, 48, 82, 0.82));
  box-shadow: 0 5px 0 rgba(100, 15, 40, 0.45);
  animation: answerShake 0.4s ease;
}
.answer-btn.is-eliminated {
  opacity: 0.3;
}
.answer-btn.is-correct,
.answer-btn.is-correct:disabled {
  border-color: rgba(189, 255, 224, 0.85);
  color: #07261c;
  background: linear-gradient(180deg, #9df8d0, #4ce0ae 60%, #20c997);
  box-shadow:
    0 7px 0 rgba(13, 121, 88, 0.42),
    0 0 34px rgba(76, 224, 174, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  animation: correctBounce 0.55s cubic-bezier(0.2, 1.6, 0.3, 1);
}
.answer-btn.is-correct .answer-glow {
  opacity: 1;
}
.answer-glow {
  position: absolute;
  inset: -40%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.38), transparent 60%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.answer-btn:disabled {
  cursor: default;
}

.feedback {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  min-height: 92px;
  margin-top: 21px;
  padding: 13px 15px;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  transition:
    background 0.25s ease,
    border-color 0.25s ease;
}
.feedback.is-success {
  border-color: rgba(97, 231, 180, 0.22);
  background: rgba(97, 231, 180, 0.07);
}
.feedback.is-hint {
  border-color: rgba(255, 209, 102, 0.2);
  background: rgba(255, 209, 102, 0.06);
}
.feedback.is-error {
  border-color: rgba(255, 118, 148, 0.2);
  background: rgba(255, 118, 148, 0.06);
}
.feedback-icon {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  font-size: 1.22rem;
  background: rgba(255, 255, 255, 0.06);
  transition: background 0.25s ease;
}
.feedback.is-success .feedback-icon {
  background: rgba(97, 231, 180, 0.15);
}
.feedback.is-hint .feedback-icon {
  background: rgba(255, 209, 102, 0.15);
}
.feedback.is-error .feedback-icon {
  background: rgba(255, 118, 148, 0.14);
}
.feedback-copy {
  flex: 1;
  min-width: 0;
}
.feedback-copy strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1.22;
}
.feedback-copy p {
  margin-top: 3px;
  color: var(--muted-strong);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
}
.feedback.is-success .feedback-copy strong {
  color: var(--mint);
}
.feedback.is-hint .feedback-copy strong {
  color: var(--yellow);
}
.feedback.is-error .feedback-copy strong {
  color: #ffadbe;
}

/* ---------- Боковая панель игры ---------- */
.game-aside {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.aside-card {
  position: relative;
  padding: 13px 15px 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 27px;
  background:
    radial-gradient(260px 160px at 50% 10%, color-mix(in srgb, var(--level-accent, var(--mint)) 12%, transparent), transparent 72%),
    linear-gradient(160deg, rgba(26, 37, 85, 0.75), rgba(12, 18, 48, 0.8));
  box-shadow: var(--shadow-card);
}
.aside-mascot {
  width: 180px;
  max-width: 82%;
  margin: 0 auto;
  animation: mascotFloat 5.6s ease-in-out infinite;
}
.aside-mascot .mascot-accessory--hat {
  font-size: 2.1rem;
}
.aside-mascot .mascot-accessory--neck {
  font-size: 1.6rem;
}
.aside-mascot .mascot-accessory--buddy {
  font-size: 1.5rem;
}
.aside-speech {
  position: relative;
  margin-top: 5px;
  padding: 12px 13px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px 16px 16px 5px;
  background: rgba(255, 255, 255, 0.065);
}
.aside-name {
  display: block;
  margin-bottom: 3px;
  color: var(--yellow);
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.aside-speech p {
  color: var(--muted-strong);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.42;
}
.aside-progress {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--line);
}
.aside-progress div {
  display: flex;
  flex-direction: column;
  padding: 12px 13px;
  gap: 2px;
  background: rgba(17, 24, 57, 0.9);
}
.aside-progress span {
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
}
.aside-progress strong {
  color: var(--text);
  font-size: 1.04rem;
  font-weight: 900;
}

/* ---------- Модальные окна ---------- */
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  padding: 20px;
  place-items: center;
}
.modal-layer[hidden] {
  display: none !important;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 19, 0.73);
  -webkit-backdrop-filter: blur(11px);
  backdrop-filter: blur(11px);
  animation: fadeIn 0.25s ease both;
}
.modal-sheet {
  position: relative;
  width: min(760px, 100%);
  max-height: min(90dvh, 940px);
  padding: 30px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 31px;
  background:
    radial-gradient(600px 300px at 82% -5%, rgba(124, 92, 255, 0.17), transparent 70%),
    linear-gradient(160deg, #182152, #0c1230);
  box-shadow:
    0 35px 90px rgba(0, 0, 0, 0.52),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: modalIn 0.36s cubic-bezier(0.16, 1, 0.3, 1) both;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted-strong);
  font-size: 1.42rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.055);
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}
.modal-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
  transform: rotate(5deg);
}

.modal-heading {
  padding-right: 38px;
}
.modal-heading h2 {
  margin-top: 7px;
  font-size: clamp(1.65rem, 3.6vw, 2.15rem);
  font-weight: 900;
  line-height: 1.14;
  letter-spacing: -0.03em;
}
.modal-heading p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.48;
}
.modal-balance {
  display: inline-flex;
  align-items: center;
  margin-top: 12px;
  padding: 8px 12px;
  gap: 5px;
  border: 1px solid rgba(255, 209, 102, 0.18);
  border-radius: 999px;
  color: var(--yellow);
  font-size: 0.8rem;
  font-weight: 900;
  background: rgba(255, 209, 102, 0.06);
}

.tabs {
  display: flex;
  padding: 5px;
  margin: 21px 0 22px;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
}
.tab-btn {
  flex: 1;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  transition:
    color 0.2s ease,
    background 0.2s ease;
}
.tab-btn:hover {
  color: var(--text);
}
.tab-btn.is-active {
  color: #20152d;
  background: linear-gradient(135deg, #ffe187, #ffd166);
  box-shadow: 0 5px 15px rgba(255, 190, 70, 0.16);
}

.reward-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 23px;
}
.summary-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 8px;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 17px;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
}
.summary-tile strong {
  font-size: 1.35rem;
  font-weight: 900;
}
.summary-tile span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
}
.summary-tile-icon {
  font-size: 1rem;
}

.sheet-section {
  margin-top: 24px;
}
.sheet-section h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 11px;
  font-size: 0.92rem;
  font-weight: 900;
}
.sheet-section h3 small {
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
}

.medal-list {
  display: grid;
  gap: 7px;
}
.medal-row {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.032);
}
.medal-row.is-empty {
  opacity: 0.58;
}
.medal-symbol {
  display: grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: #20152d;
  font-size: 1rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent, #61e7b4), var(--accent2, #19bfa3));
}
.medal-row-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.medal-row-copy strong {
  overflow: hidden;
  font-size: 0.77rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.medal-row-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 600;
}
.medal-row-badge {
  flex: 0 0 auto;
  font-size: 1.35rem;
  filter: drop-shadow(0 0 7px rgba(255, 209, 102, 0.2));
}
.medal-row-stars {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}
.achievement-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 138px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background:
    radial-gradient(120px 90px at 20% 10%, color-mix(in srgb, var(--badge-color, #6b9bff) 14%, transparent), transparent 70%),
    rgba(255, 255, 255, 0.035);
}
.achievement-card.is-locked {
  opacity: 0.46;
}
.achievement-card.is-locked .achievement-emoji {
  filter: grayscale(1);
  opacity: 0.7;
}
.achievement-emoji {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--badge-color, #6b9bff) 28%, transparent);
  border-radius: 12px;
  font-size: 1.2rem;
  background: color-mix(in srgb, var(--badge-color, #6b9bff) 10%, transparent);
}
.achievement-title {
  margin-top: 8px;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.22;
}
.achievement-desc {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 600;
  line-height: 1.34;
}
.achievement-reward {
  margin-top: auto;
  padding-top: 7px;
  color: var(--yellow);
  font-size: 0.59rem;
  font-weight: 800;
}
.achievement-check {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  color: #06251a;
  font-size: 0.6rem;
  font-weight: 900;
  background: var(--mint);
}

.wardrobe-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}
.wardrobe-preview {
  position: sticky;
  top: 0;
  padding: 14px 10px 16px;
  border: 1px solid var(--line);
  border-radius: 23px;
  text-align: center;
  background:
    radial-gradient(180px 120px at 50% 30%, rgba(255, 209, 102, 0.09), transparent 72%),
    rgba(255, 255, 255, 0.035);
}
.wardrobe-preview .mascot-holder {
  width: 168px;
  max-width: 88%;
  margin: 0 auto;
  animation: mascotFloat 5.6s ease-in-out infinite;
}
.wardrobe-preview .mascot-accessory--hat {
  font-size: 2rem;
}
.wardrobe-preview .mascot-accessory--neck {
  font-size: 1.55rem;
}
.wardrobe-preview .mascot-accessory--buddy {
  font-size: 1.45rem;
}
.wardrobe-preview p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.4;
}
.shop-column {
  min-width: 0;
}
.shop-category {
  display: flex;
  align-items: baseline;
  margin: 0 0 7px;
  gap: 6px;
  color: var(--muted-strong);
  font-size: 0.76rem;
  font-weight: 900;
}
.shop-category + .shop-grid + .shop-category {
  margin-top: 16px;
}
.shop-category small {
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 600;
}
.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.shop-card {
  display: flex;
  flex-direction: column;
  min-height: 154px;
  padding: 12px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.035);
}
.shop-card.is-owned {
  border-color: rgba(97, 231, 180, 0.18);
  background: rgba(97, 231, 180, 0.045);
}
.shop-emoji {
  font-size: 1.65rem;
  line-height: 1;
}
.shop-title {
  margin-top: 3px;
  font-size: 0.73rem;
  font-weight: 900;
  line-height: 1.2;
}
.shop-desc {
  color: var(--muted);
  font-size: 0.59rem;
  font-weight: 600;
  line-height: 1.32;
}
.shop-action {
  min-height: 31px;
  margin-top: auto;
  padding: 6px 8px;
  border-radius: 9px;
  color: #2b1c0e;
  font-size: 0.64rem;
  font-weight: 900;
  background: linear-gradient(135deg, #ffe187, #ffc44d);
}
.shop-action.is-owned {
  color: var(--mint);
  background: rgba(97, 231, 180, 0.1);
}
.shop-action.is-equipped {
  color: #06251a;
  background: linear-gradient(135deg, #8af7c8, #45ddab);
}
.shop-action:disabled {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.07);
}
.shop-action.is-equipped:disabled {
  color: #06251a;
  background: linear-gradient(135deg, #8af7c8, #45ddab);
  opacity: 1;
}
.shop-card.hero-default {
  border-color: rgba(255, 209, 102, 0.16);
  background: rgba(255, 209, 102, 0.035);
}
.not-enough {
  margin-top: 3px;
  color: #ffadbe;
  font-size: 0.57rem;
  font-weight: 700;
}

/* ---------- Настройки ---------- */
.settings-group {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  gap: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.035);
  transition: background 0.2s ease;
}
.toggle-row:hover {
  background: rgba(255, 255, 255, 0.055);
}
.toggle-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.toggle-copy strong {
  font-size: 0.8rem;
  font-weight: 800;
}
.toggle-copy small {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 600;
  line-height: 1.35;
}
.toggle-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.switch {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 27px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  transition: background 0.2s ease;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toggle-row input:checked + .switch {
  background: linear-gradient(135deg, #55e6b1, #2bbf9c);
}
.toggle-row input:checked + .switch::after {
  transform: translateX(19px);
}
.toggle-row input:focus-visible + .switch {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

.name-form {
  display: flex;
  align-items: flex-end;
  margin-top: 20px;
  gap: 8px;
}
.field {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
}
.field label {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
}
.field input {
  width: 100%;
  height: 45px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
  transition: border-color 0.2s ease;
}
.field input:focus {
  border-color: rgba(255, 209, 102, 0.5);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.1);
}
.settings-note {
  margin-top: 21px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.46;
  background: rgba(255, 255, 255, 0.03);
}
.settings-note strong {
  color: var(--muted-strong);
}
.settings-note.is-ready {
  border-color: rgba(97, 231, 180, 0.18);
  background: rgba(97, 231, 180, 0.045);
}
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  margin-top: 20px;
  gap: 8px;
}
.settings-actions .btn {
  flex: 1 1 150px;
}
.install-help {
  display: grid;
  margin: 14px 0 4px;
  gap: 10px;
  color: var(--muted-strong);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.5;
}
.install-help p {
  margin: 0;
}
.install-help b {
  color: var(--mint);
  overflow-wrap: anywhere;
}
.install-help .btn {
  justify-self: start;
  margin-top: 2px;
}
.version {
  margin-top: 19px;
  color: rgba(169, 179, 217, 0.55);
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
}
.confirm-box {
  padding-top: 7px;
}
.confirm-box p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}
.confirm-actions {
  display: flex;
  margin-top: 20px;
  gap: 8px;
}
.confirm-actions .btn {
  flex: 1;
}

/* ---------- Результат ---------- */
.result-layer {
  z-index: 210;
}
.result-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(570px, 100%);
  max-height: min(92dvh, 920px);
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 33px;
  background:
    radial-gradient(500px 270px at 50% -5%, rgba(255, 209, 102, 0.13), transparent 68%),
    radial-gradient(400px 300px at 100% 100%, rgba(124, 92, 255, 0.13), transparent 70%),
    linear-gradient(160deg, #1a2354, #0b112d);
  box-shadow:
    0 38px 100px rgba(0, 0, 0, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.09);
  animation: resultIn 0.48s cubic-bezier(0.16, 1, 0.3, 1) both;
  overscroll-behavior: contain;
}
.result-scroll {
  min-height: 0;
  padding: 31px 31px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.result-hero {
  text-align: center;
}
.result-medal {
  display: inline-grid;
  width: 78px;
  height: 78px;
  place-items: center;
  margin-bottom: 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  font-size: 2.65rem;
  background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.18), transparent 50%);
  box-shadow:
    0 13px 36px rgba(0, 0, 0, 0.22),
    0 0 35px rgba(255, 209, 102, 0.12);
  animation: medalPop 0.6s cubic-bezier(0.2, 1.5, 0.3, 1) both;
}
.result-stars {
  display: flex;
  justify-content: center;
  margin: 1px 0 9px;
  gap: 5px;
}
.result-star {
  color: rgba(255, 255, 255, 0.15);
  font-size: 2.55rem;
  line-height: 1;
  text-shadow: none;
  transform: scale(0.76);
  animation: starPop 0.5s cubic-bezier(0.2, 1.6, 0.3, 1) both;
}
.result-star.is-filled {
  color: var(--yellow);
  text-shadow:
    0 0 18px rgba(255, 209, 102, 0.45),
    0 5px 0 rgba(143, 83, 0, 0.22);
}
.result-star:nth-child(1) {
  animation-delay: 0.08s;
}
.result-star:nth-child(2) {
  animation-delay: 0.19s;
}
.result-star:nth-child(3) {
  animation-delay: 0.3s;
}
.result-card .eyebrow {
  justify-content: center;
}
.result-card h2 {
  margin-top: 8px;
  font-size: clamp(1.8rem, 4.6vw, 2.5rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.035em;
}
.result-sub {
  max-width: 390px;
  margin: 8px auto 0;
  color: var(--muted-strong);
  font-size: 0.79rem;
  font-weight: 600;
  line-height: 1.45;
}
.result-rewards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 20px;
  gap: 8px;
}
.reward-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 7px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
}
.reward-tile-icon {
  font-size: 0.98rem;
}
.reward-tile strong {
  font-size: 1.02rem;
  font-weight: 900;
}
.reward-tile small {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 700;
}
.result-race-board {
  margin: 14px 0 2px;
  padding: 13px;
  border: 1px solid rgba(255, 209, 102, 0.22);
  border-radius: 18px;
  background: rgba(255, 209, 102, 0.045);
}
.result-race-board h3 {
  margin: 0 0 8px;
  color: var(--yellow);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
#resultRaceRows {
  display: grid;
  gap: 4px;
}
.result-race-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  padding: 6px 8px;
  gap: 8px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.03);
}
.result-race-row.is-you {
  background: rgba(97, 231, 180, 0.07);
  box-shadow: inset 0 0 0 1px rgba(97, 231, 180, 0.2);
}
.result-race-pos {
  width: 22px;
  color: var(--yellow);
  font-size: 0.88rem;
  font-weight: 900;
  text-align: center;
}
.result-race-avatar {
  font-size: 1.1rem;
  line-height: 1;
}
.result-race-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}
.result-race-copy strong {
  overflow: hidden;
  font-size: 0.68rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-race-copy small {
  color: var(--muted);
  font-size: 0.55rem;
  font-weight: 700;
}
.result-race-status {
  color: var(--muted-strong);
  font-size: 0.6rem;
  font-weight: 900;
  white-space: nowrap;
}

.rank-up {
  display: flex;
  align-items: center;
  margin-top: 11px;
  padding: 11px 13px;
  gap: 11px;
  border: 1px solid rgba(255, 209, 102, 0.24);
  border-radius: 16px;
  background: linear-gradient(100deg, rgba(255, 209, 102, 0.1), rgba(255, 140, 225, 0.06));
  animation: rewardReveal 0.4s ease both;
}
.rank-up-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  font-size: 1.2rem;
  background: rgba(255, 209, 102, 0.12);
}
.rank-up div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.rank-up small {
  color: var(--yellow);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.rank-up strong {
  font-size: 0.82rem;
  font-weight: 900;
}
.unlock-box {
  display: flex;
  align-items: center;
  margin-top: 11px;
  padding: 11px 13px;
  gap: 9px;
  border: 1px solid rgba(97, 231, 180, 0.2);
  border-radius: 16px;
  color: var(--mint);
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(97, 231, 180, 0.055);
  animation: rewardReveal 0.4s ease both;
}
.unlock-box span:first-child {
  font-size: 1.15rem;
}
.result-achievements {
  margin-top: 19px;
}
.result-achievements h3 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.result-achievement-list {
  display: grid;
  gap: 7px;
}
.result-achievement {
  display: flex;
  align-items: center;
  padding: 9px 11px;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  animation: rewardReveal 0.45s cubic-bezier(0.2, 1.4, 0.3, 1) both;
}
.result-achievement-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  font-size: 1.03rem;
  background: color-mix(in srgb, var(--badge-color, #6b9bff) 14%, transparent);
}
.result-achievement-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
}
.result-achievement-copy strong {
  font-size: 0.72rem;
  font-weight: 900;
}
.result-achievement-copy small {
  color: var(--muted);
  font-size: 0.59rem;
  font-weight: 600;
}
.result-achievement-reward {
  color: var(--yellow);
  font-size: 0.66rem;
  font-weight: 900;
}
.result-actions {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  padding: 14px 31px calc(16px + env(safe-area-inset-bottom));
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(9, 14, 38, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.result-actions .btn {
  flex: 1 1 150px;
}
.result-actions .btn-primary {
  flex-basis: 190px;
}
.more-achievements {
  padding: 7px 2px 2px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

/* ---------- Toast и всплывающие награды ---------- */
.fps-counter {
  position: fixed;
  left: calc(10px + env(safe-area-inset-left));
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 450;
  padding: 4px 7px;
  border: 1px solid rgba(97, 231, 180, 0.22);
  border-radius: 8px;
  color: var(--mint);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.04em;
  pointer-events: none;
  background: rgba(5, 10, 27, 0.66);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.22);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-variant-numeric: tabular-nums;
  opacity: 0.78;
}
.fps-counter[data-level='ok'] {
  border-color: rgba(255, 209, 102, 0.22);
  color: var(--yellow);
}
.fps-counter[data-level='low'] {
  border-color: rgba(255, 118, 148, 0.28);
  color: var(--danger);
}
body.perf-lite .fps-counter {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: rgba(5, 10, 27, 0.88);
}

.update-banner {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 430;
  display: flex;
  align-items: center;
  width: min(500px, calc(100vw - 24px));
  padding: 10px 12px 10px 16px;
  gap: 14px;
  border: 1px solid rgba(97, 231, 180, 0.34);
  border-radius: 16px;
  background: rgba(13, 20, 49, 0.98);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.38);
  transform: translateX(-50%);
}
.update-banner[hidden] {
  display: none;
}
.update-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}
.update-copy strong {
  font-size: 0.78rem;
  font-weight: 900;
}
.update-copy small {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 600;
}
.update-banner .btn {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 11px;
  font-size: 0.7rem;
}
body.perf-lite .update-banner {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
@media (max-width: 480px) {
  .update-banner {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }
  .update-banner .btn {
    width: 100%;
  }
}

.toast {
  position: fixed;
  bottom: calc(22px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 400;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  background: rgba(19, 27, 63, 0.96);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.42);
  transform: translateX(-50%);
  animation: toastIn 0.3s cubic-bezier(0.2, 1.3, 0.3, 1) both;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.toast.is-good {
  border-color: rgba(97, 231, 180, 0.3);
  color: #c9ffe9;
}
.toast.is-warn {
  border-color: rgba(255, 209, 102, 0.3);
  color: #fff0c4;
}
.toast.is-bad {
  border-color: rgba(255, 118, 148, 0.3);
  color: #ffdbe2;
}

.floating-reward {
  position: fixed;
  z-index: 320;
  padding: 5px 10px;
  border: 1px solid rgba(255, 209, 102, 0.24);
  border-radius: 999px;
  color: #ffe89a;
  font-size: 0.9rem;
  font-weight: 900;
  white-space: nowrap;
  pointer-events: none;
  background: rgba(12, 18, 48, 0.88);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  animation: floatingReward 1.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ---------- Анимации ---------- */
@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes auroraDrift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(36px, 28px, 0) scale(1.08);
  }
}
@keyframes mascotFloat {
  0%,
  100% {
    transform: translateY(0) rotate(-0.4deg);
  }
  50% {
    transform: translateY(-10px) rotate(0.6deg);
  }
}
@keyframes mascotBlink {
  0%, 91%, 100% {
    transform: scaleY(1);
  }
  93%, 95% {
    transform: scaleY(0.12);
  }
}
@keyframes shadowPulse {
  0%,
  100% {
    opacity: 0.26;
    transform: scaleX(0.92);
  }
  50% {
    opacity: 0.18;
    transform: scaleX(0.82);
  }
}
@keyframes haloPulse {
  0%,
  100% {
    opacity: 0.8;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}
@keyframes orbitSpin {
  from {
    transform: rotate(-24deg);
  }
  to {
    transform: rotate(336deg);
  }
}
@keyframes orbitSpinReverse {
  from {
    transform: rotate(42deg);
  }
  to {
    transform: rotate(-318deg);
  }
}
@keyframes accessoryBob {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -8px;
  }
}
@keyframes companionFloat {
  0%,
  100% {
    transform: translateY(0) rotate(-5deg) scale(1);
  }
  50% {
    transform: translateY(-8px) rotate(4deg) scale(1.04);
  }
}
@keyframes starBuddy {
  0%,
  100% {
    transform: translateY(0) rotate(-4deg) scale(1);
  }
  50% {
    transform: translateY(-11px) rotate(8deg) scale(1.07);
  }
}
@keyframes speechFloat {
  0%,
  100% {
    transform: rotate(2deg) translateY(0);
  }
  50% {
    transform: rotate(1deg) translateY(-5px);
  }
}
@keyframes starTwinkle {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.12);
  }
}
@keyframes sparklePulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.06);
  }
}
@keyframes questionBob {
  0%,
  100% {
    transform: translateY(0) rotate(-3deg);
  }
  50% {
    transform: translateY(-8px) rotate(5deg);
  }
}
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(15px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes expressionIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes answerIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes answerShake {
  0%,
  100% {
    transform: translateX(0);
  }
  22% {
    transform: translateX(-7px) rotate(-1deg);
  }
  44% {
    transform: translateX(6px) rotate(1deg);
  }
  66% {
    transform: translateX(-4px);
  }
  84% {
    transform: translateX(2px);
  }
}
@keyframes correctBounce {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.98);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes comboPulse {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.08) rotate(-1deg);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes nextAppear {
  from {
    opacity: 0;
    transform: translateX(5px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes progressShine {
  0% {
    transform: translateX(-110%);
  }
  55%,
  100% {
    transform: translateX(110%);
  }
}
@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes resultIn {
  from {
    opacity: 0;
    transform: translateY(26px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes medalPop {
  from {
    opacity: 0;
    transform: scale(0.4) rotate(-16deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}
@keyframes starPop {
  from {
    opacity: 0;
    transform: scale(0.2) rotate(-30deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}
@keyframes rewardReveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes testCorePulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow:
      inset -12px -14px 24px rgba(26, 35, 100, 0.32),
      0 15px 34px rgba(60, 129, 255, 0.25);
  }
  50% {
    transform: scale(1.04);
    box-shadow:
      inset -12px -14px 24px rgba(26, 35, 100, 0.28),
      0 18px 42px rgba(124, 231, 255, 0.38);
  }
}
@keyframes testOrbit {
  from {
    transform: rotate(-18deg);
  }
  to {
    transform: rotate(342deg);
  }
}
@keyframes starBurst {
  0%,
  60%,
  100% {
    opacity: 0;
    transform: scale(0.7) rotate(0);
  }
  75% {
    opacity: 0.9;
    transform: scale(1.15) rotate(20deg);
  }
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}
@keyframes floatingReward {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.8);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -12px) scale(1.08);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -80px) scale(0.95);
  }
}

/* ---------- Адаптивность ---------- */
@media (max-width: 1080px) {
  .rank-chip {
    width: 174px;
  }
  .hero {
    padding: 42px 36px;
  }
  .hero h1 {
    font-size: clamp(2.7rem, 5.4vw, 4.1rem);
  }
}

@media (max-width: 940px) {
  .rank-chip {
    display: none;
  }
  .hero {
    grid-template-columns: 1fr;
    padding: 38px 34px 18px;
  }
  .hero-scene {
    min-height: 340px;
    margin-top: 8px;
  }
  .speech-bubble {
    top: 2%;
    right: 6%;
  }
  .hero-mascot {
    width: min(300px, 72%);
  }
  .game-layout {
    grid-template-columns: minmax(0, 1fr) 250px;
  }
}

@media (max-width: 800px) {
  .topbar {
    padding-right: 14px;
    padding-left: 14px;
  }
  .stat-label {
    display: none;
  }
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .map-legend {
    display: none;
  }
  .level-grid {
    grid-template-columns: 1fr;
  }
  .level-card.is-final,
  .level-card.is-wide {
    grid-column: auto;
    min-height: 0;
  }
  .finale-deco {
    display: none;
  }
  .game-layout {
    grid-template-columns: 1fr;
  }
  .game-aside {
    display: none;
  }
  .race-lanes {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .race-vs {
    display: none;
  }
  .race-lane {
    padding: 6px 8px;
  }
  .race-lane-name {
    max-width: 150px;
  }
  .race-clock {
    font-size: 0.66rem;
  }
  .race-menu-actions .btn,
  .race-wait-actions .btn,
  .race-join-form .btn {
    width: 100%;
    flex-basis: 100%;
  }
  .race-code-box {
    align-items: stretch;
    flex-direction: column;
  }
  .race-code-box .btn {
    width: 100%;
  }
  .race-countdown-num {
    font-size: clamp(6rem, 28vw, 9rem);
  }
  .race-players-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .spectator-panel {
    padding: 12px;
  }
  .question-card {
    min-height: 0;
  }
  .badge-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .brand-sub {
    display: none;
  }
  .brand-img {
    width: 42px;
    height: 42px;
  }
  .brand-name {
    font-size: 1.04rem;
  }
  .topbar-actions {
    gap: 6px;
  }
  .stat-pill {
    height: 40px;
    padding: 0 10px;
  }
  .icon-btn {
    width: 40px;
    height: 40px;
  }
  .screen {
    padding: 16px 14px calc(40px + env(safe-area-inset-bottom));
  }
  .field input,
  .race-join-form input {
    font-size: 16px;
  }
  .hero {
    padding: 28px 22px 10px;
    border-radius: 29px;
  }
  .hero h1 {
    margin-top: 15px;
    font-size: clamp(2.3rem, 10.5vw, 3.2rem);
  }
  .hero-sub {
    margin-top: 14px;
    font-size: 0.93rem;
  }
  .hero-actions {
    margin-top: 23px;
  }
  .hero-actions .btn {
    width: 100%;
  }
  .hero-stats {
    margin-top: 25px;
    gap: 10px 15px;
  }
  .hero-stat-icon {
    width: 34px;
    height: 34px;
  }
  .hero-stat strong {
    max-width: 135px;
    font-size: 0.82rem;
  }
  .hero-stat small {
    font-size: 0.65rem;
  }
  .hero-scene {
    min-height: 330px;
  }
  .hero-halo {
    width: 280px;
    height: 280px;
  }
  .hero-orbit-one {
    width: 320px;
    height: 150px;
  }
  .hero-orbit-two {
    width: 230px;
    height: 285px;
  }
  .hero-mascot {
    width: min(270px, 82%);
  }
  .mascot-accessory--hat {
    font-size: 2.9rem;
  }
  .mascot-accessory--neck {
    font-size: 2.2rem;
  }
  .mascot-accessory--buddy {
    font-size: 2.1rem;
  }
  .mascot-accessory--companion {
    left: -1%;
    font-size: 2.5rem;
  }
  .speech-bubble {
    right: 0;
    max-width: 155px;
    padding: 10px 12px;
    font-size: 0.69rem;
  }
  .orbit-symbol {
    width: 33px;
    height: 33px;
    font-size: 0.98rem;
  }
  .orbit-symbol-one {
    left: 0;
  }
  .orbit-symbol-two {
    right: 0;
  }
  .orbit-symbol-three {
    right: 4%;
  }
  .map-section {
    margin-top: 38px;
  }
  .section-heading h2 {
    font-size: 2rem;
  }
  .level-card {
    align-items: flex-start;
    padding: 15px;
    gap: 12px;
    min-height: 0;
    flex-direction: row;
    border-radius: 22px;
  }
  .level-card.is-final,
  .level-card.is-wide {
    min-height: 0;
  }
  .level-card.is-final::before {
    top: 10px;
    right: 11px;
    padding: 4px 7px;
    font-size: 0.46rem;
  }
  .level-card.is-final .level-meta {
    padding-right: 112px;
  }
  .planet-wrap,
  .level-card.is-final .planet-wrap {
    align-self: center;
    width: 76px;
    height: 86px;
  }
  .planet,
  .level-card.is-final .planet {
    width: 68px;
    height: 68px;
  }
  .planet::before {
    width: 92px;
    height: 26px;
  }
  .planet-symbol {
    font-size: 1.8rem;
  }
  .level-title {
    margin-top: 3px;
    font-size: 1.02rem;
    line-height: 1.2;
  }
  .level-desc {
    max-width: none;
    margin-top: 3px;
    font-size: 0.72rem;
    line-height: 1.35;
  }
  .level-meta {
    gap: 5px 7px;
  }
  .difficulty-chip {
    padding: 4px 7px;
    font-size: 0.56rem;
  }
  .level-number {
    font-size: 0.58rem;
  }
  .level-bottom {
    padding-top: 7px;
    gap: 7px;
  }
  .level-stars {
    font-size: 0.82rem;
  }
  .level-xp {
    font-size: 0.58rem;
  }
  .level-play {
    min-height: 31px;
    padding: 6px 10px;
    font-size: 0.68rem;
    border-radius: 10px;
  }
  .test-planet-card {
    flex-direction: column;
    align-items: stretch;
    padding: 19px;
    gap: 13px;
    border-radius: 24px;
  }
  .test-planet-visual {
    align-self: center;
    width: 104px;
    height: 108px;
  }
  .test-core {
    width: 78px;
    height: 78px;
    font-size: 2.15rem;
  }
  .test-orbit {
    width: 124px;
    height: 40px;
  }
  .test-coin {
    right: 6px;
    bottom: 0;
    width: 39px;
    height: 28px;
    font-size: 0.72rem;
  }
  .test-planet-title {
    font-size: 1.35rem;
  }
  .test-planet-footer {
    align-items: stretch;
    flex-direction: column;
  }
  .test-play {
    width: 100%;
  }
  .test-schedule {
    text-align: center;
  }
  .home-footer {
    margin-top: 34px;
  }
  .made-with {
    width: 100%;
    margin-left: 0;
  }
  .game-shell {
    padding-top: 8px;
  }
  .game-topbar {
    padding: 9px;
    border-radius: 20px;
    gap: 8px;
  }
  .game-symbol {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    font-size: 1.3rem;
  }
  .game-level small {
    display: none;
  }
  .game-level strong {
    max-width: 135px;
    font-size: 0.76rem;
  }
  .game-stat {
    display: none;
  }
  .combo-chip {
    height: 35px;
    padding: 0 9px;
    font-size: 0.62rem;
  }
  .combo-label {
    display: none;
  }
  .game-level strong {
    max-width: 165px;
    white-space: normal;
    line-height: 1.1;
    text-overflow: clip;
  }
  .game-topbar .icon-btn {
    width: 35px;
    height: 35px;
  }
  .progress-row {
    margin: 13px 2px;
  }
  .question-card {
    padding: 18px;
    border-radius: 25px;
  }
  .question-stage {
    min-height: 168px;
    padding: 22px 0 18px;
  }
  .question-expression {
    font-size: clamp(3.6rem, 18vw, 5rem);
  }
  .question-expression.is-text {
    font-size: clamp(1.55rem, 7.6vw, 2.4rem);
  }
  .question-visual {
    width: min(190px, 58vw);
  }
  .answers {
    gap: 9px;
  }
  .answer-btn {
    min-height: 72px;
    border-radius: 16px;
  }
  .feedback {
    align-items: flex-start;
    min-height: 84px;
    padding: 11px 12px;
    gap: 9px;
    border-radius: 16px;
  }
  .feedback-icon {
    width: 37px;
    height: 37px;
    border-radius: 11px;
    font-size: 1.02rem;
  }
  .feedback-copy strong {
    font-size: 0.79rem;
  }
  .feedback-copy p {
    font-size: 0.69rem;
  }
  .feedback .btn-next {
    align-self: center;
    min-height: 38px;
    padding: 8px 11px;
    font-size: 0.72rem;
  }
  .modal-layer {
    padding: 10px;
  }
  .modal-sheet {
    padding: 23px 17px;
    border-radius: 25px;
    max-height: 94dvh;
  }
  .result-card {
    border-radius: 25px;
    max-height: 94dvh;
  }
  .result-scroll {
    padding: 23px 17px 0;
  }
  .result-actions {
    padding: 12px 17px calc(13px + env(safe-area-inset-bottom));
  }
  .modal-close {
    top: 11px;
    right: 11px;
    width: 35px;
    height: 35px;
    border-radius: 11px;
    font-size: 1.2rem;
  }
  .modal-heading {
    padding-right: 32px;
  }
  .badge-grid {
    gap: 7px;
  }
  .achievement-card {
    min-height: 132px;
    padding: 10px;
  }
  .wardrobe-layout {
    grid-template-columns: 1fr;
  }
  .wardrobe-preview {
    position: relative;
    display: flex;
    align-items: center;
    gap: 13px;
    text-align: left;
  }
  .wardrobe-preview .mascot-holder {
    flex: 0 0 120px;
    width: 120px;
    margin: 0;
  }
  .wardrobe-preview p {
    margin-top: 0;
    font-size: 0.65rem;
  }
  .shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .result-rewards {
    gap: 6px;
  }
  .reward-tile {
    padding: 10px 4px;
  }
  .reward-tile strong {
    font-size: 0.88rem;
  }
  .result-star {
    font-size: 2.15rem;
  }
  .result-medal {
    width: 67px;
    height: 67px;
    font-size: 2.25rem;
  }
  .result-actions .btn {
    min-height: 46px;
  }
  .name-form {
    align-items: stretch;
    flex-direction: column;
  }
  .name-form .btn {
    width: 100%;
  }
  .settings-actions {
    flex-direction: column;
  }
  .confirm-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .result-actions .btn {
    flex: 1 1 120px;
    min-height: 46px;
  }
  .result-actions .btn-primary {
    flex-basis: 100%;
  }
}

@media (max-height: 680px) and (max-width: 640px) {
  .game-shell {
    padding-top: 4px;
  }
  .game-topbar {
    padding: 7px 8px;
    gap: 7px;
  }
  .game-symbol {
    width: 36px;
    height: 36px;
    font-size: 1.16rem;
  }
  .game-level strong {
    font-size: 0.7rem;
  }
  .combo-chip,
  .game-topbar .icon-btn {
    height: 33px;
  }
  .game-topbar .icon-btn {
    width: 33px;
  }
  .progress-row {
    margin: 9px 2px;
  }
  .race-hud {
    margin-top: 6px;
    padding: 8px 10px;
  }
  .race-hud-head {
    display: none;
  }
  .race-lanes {
    margin-top: 0;
    gap: 4px;
  }
  .race-lane {
    padding: 5px 7px;
  }
  .race-avatar {
    font-size: 0.95rem;
  }
  .question-card {
    padding: 14px;
  }
  .question-meta {
    gap: 4px 8px;
  }
  .question-label {
    padding: 5px 9px;
    font-size: 0.6rem;
  }
  .question-xp {
    font-size: 0.6rem;
  }
  .question-stage {
    min-height: 125px;
    padding: 14px 0 11px;
  }
  .question-expression {
    margin-top: 3px;
    font-size: clamp(3rem, 17vw, 4.2rem);
  }
  .question-expression.is-text {
    font-size: clamp(1.4rem, 7.4vw, 2.1rem);
  }
  .question-visual {
    width: min(148px, 48vw);
    margin-top: 0;
  }
  .answer-btn {
    min-height: 60px;
    font-size: clamp(1.6rem, 8vw, 2rem);
  }
  .feedback {
    min-height: 68px;
    margin-top: 13px;
    padding: 9px 10px;
    gap: 8px;
  }
  .feedback-icon {
    width: 34px;
    height: 34px;
    font-size: 0.92rem;
  }
  .feedback-copy strong {
    font-size: 0.74rem;
  }
  .feedback-copy p {
    font-size: 0.64rem;
  }
  .feedback .btn-next {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 0.66rem;
  }
}

@media (max-width: 390px) {
  .brand-copy {
    display: none;
  }
  .topbar-actions {
    margin-left: auto;
  }
  .stats-pill {
    padding: 0 8px;
  }
  .hero {
    padding: 24px 18px 6px;
  }
  .hero-scene {
    min-height: 300px;
  }
  .hero-mascot {
    width: min(240px, 82%);
  }
  .hero-halo {
    width: 240px;
    height: 240px;
  }
  .hero-orbit-one {
    width: 280px;
    height: 135px;
  }
  .hero-orbit-two {
    width: 205px;
    height: 250px;
  }
  .speech-bubble {
    max-width: 140px;
    font-size: 0.64rem;
  }
  .stat-pill strong {
    font-size: 0.84rem;
  }
  .game-level strong {
    max-width: 105px;
  }
  .combo-chip {
    font-size: 0.57rem;
  }
  .question-meta {
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
  }
  .result-card h2 {
    font-size: 1.7rem;
  }
}

/* ---------- Мобильный perf-lite профиль ---------- */
body.perf-lite {
  background-attachment: scroll;
}
body.perf-lite::after {
  display: none;
}
body.perf-lite .aurora {
  display: none;
}
body.perf-lite .hero::after {
  display: none;
}
body.perf-lite .topbar {
  background: rgba(7, 11, 31, 0.985);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
body.perf-lite .game-topbar,
body.perf-lite .race-hud,
body.perf-lite .spectator-panel,
body.perf-lite .aside-card {
  background-color: rgba(19, 27, 63, 0.96);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
body.perf-lite .modal-sheet,
body.perf-lite .result-card {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
body.perf-lite .modal-backdrop,
body.perf-lite .race-countdown {
  background: rgba(3, 6, 19, 0.84);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
body.perf-lite .toast,
body.perf-lite .result-actions {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
body.perf-lite .hero-orbit,
body.perf-lite .hero-halo,
body.perf-lite .orbit-symbol,
body.perf-lite .orbit-star,
body.perf-lite .speech-bubble,
body.perf-lite .mascot-sparkles,
body.perf-lite .mascot-question,
body.perf-lite .hero-mascot,
body.perf-lite .aside-mascot,
body.perf-lite .mascot .eyes-open,
body.perf-lite .mascot-shadow,
body.perf-lite .mascot-accessory,
body.perf-lite .test-status-dot,
body.perf-lite .level-star-burst,
body.perf-lite .progress-fill::after,
body.perf-lite .test-core {
  animation: none !important;
}
body.perf-lite .mascot {
  filter: drop-shadow(0 8px 11px rgba(0, 0, 0, 0.2));
}
body.perf-lite .level-card:hover {
  transform: none;
}
body.perf-lite .level-card:hover .planet {
  transform: translate(-50%, -50%);
}
body.perf-lite .planet {
  box-shadow:
    inset -16px -18px 28px rgba(3, 7, 26, 0.24),
    inset 8px 9px 18px rgba(255, 255, 255, 0.1);
}

/* ---------- Уменьшение движения ---------- */
body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

@media (orientation: landscape) and (max-height: 560px) and (min-width: 560px) {
  .in-game .screen {
    padding-bottom: 6px;
  }
  .game-shell {
    padding-top: 4px;
    padding-bottom: 0;
  }
  .game-topbar {
    padding: 6px 9px;
    gap: 7px;
    border-radius: 16px;
  }
  .game-symbol {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 1.05rem;
  }
  .game-level small {
    display: none;
  }
  .game-level strong {
    font-size: 0.72rem;
  }
  .game-topbar .icon-btn {
    width: 33px;
    height: 33px;
    border-radius: 10px;
  }
  .progress-row {
    margin: 7px 2px;
  }
  .progress-meta {
    margin-bottom: 5px;
  }
  .race-hud {
    margin-top: 5px;
    padding: 6px 10px;
    border-radius: 15px;
  }
  .race-hud-head {
    display: none;
  }
  .race-players-grid {
    margin-top: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .race-grid-player {
    padding: 4px 6px 5px;
  }
  .race-grid-avatar {
    font-size: 0.9rem;
  }
  .spectator-panel {
    margin-top: 0;
    padding: 10px 12px;
  }
  .spectator-hero {
    gap: 9px;
  }
  .spectator-flag {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 1.15rem;
  }
  .spectator-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .spectator-row {
    padding: 6px 8px;
    gap: 7px;
  }
  .race-mode .progress-row {
    display: none;
  }
  .race-mode .game-topbar {
    padding: 4px 8px;
  }
  .race-mode .question-card {
    padding: 10px;
  }
  .race-mode .question-stage {
    min-height: 68px;
    padding: 3px 0 4px;
  }
  .race-mode .question-expression {
    font-size: clamp(2.2rem, 5.6vw, 3.2rem);
  }
  .race-mode .answer-btn {
    min-height: 50px;
    font-size: clamp(1.3rem, 2.2vw, 1.75rem);
  }
  .race-mode .feedback {
    min-height: 46px;
    margin-top: 6px;
    padding: 6px 9px;
  }
  .race-mode .feedback-copy p {
    font-size: 0.6rem;
  }
  .race-mode .feedback .btn-next {
    min-height: 28px;
    padding: 5px 8px;
    font-size: 0.6rem;
  }
  .race-mode .race-lane {
    padding: 4px 6px;
  }
  .race-lanes {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    margin-top: 0;
    gap: 6px;
  }
  .race-vs {
    display: none;
  }
  .race-lane {
    padding: 5px 7px;
  }
  .race-avatar {
    font-size: 0.95rem;
  }
  .race-lane-name {
    max-width: 120px;
  }
  .game-layout {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .game-aside {
    display: none;
  }
  .question-card {
    min-height: 0;
    padding: 13px;
    border-radius: 23px;
  }
  .question-meta {
    gap: 4px 8px;
  }
  .question-label {
    padding: 4px 8px;
    font-size: 0.56rem;
  }
  .question-xp {
    font-size: 0.58rem;
  }
  .question-stage {
    min-height: 90px;
    padding: 5px 0 7px;
  }
  .question-prompt {
    font-size: 0.66rem;
  }
  .question-expression {
    margin-top: 1px;
    font-size: clamp(2.5rem, 6.5vw, 3.7rem);
  }
  .question-expression.is-text {
    font-size: clamp(1.35rem, 3.4vw, 2rem);
  }
  .question-visual {
    width: min(102px, 15vh);
    margin-top: 0;
  }
  .answers {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
  }
  .answer-btn {
    min-height: 58px;
    font-size: clamp(1.35rem, 2.4vw, 1.9rem);
    border-radius: 14px;
  }
  .feedback {
    min-height: 55px;
    margin-top: 8px;
    padding: 8px 10px;
    gap: 8px;
  }
  .feedback-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }
  .feedback-copy strong {
    font-size: 0.72rem;
  }
  .feedback-copy p {
    font-size: 0.63rem;
  }
  .feedback .btn-next {
    min-height: 32px;
    padding: 6px 9px;
    font-size: 0.64rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .mascot,
  .mascot .eyes-open,
  .hero-mascot,
  .aside-mascot,
  .hero-halo,
  .hero-orbit,
  .speech-bubble {
    animation: none !important;
  }
}

/* ---------- Мини-игры ---------- */
.minigames-section {
  margin-top: 50px;
  scroll-margin-top: 92px;
}
.minigame-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}
.minigame-card {
  display: flex;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 209, 102, 0.2);
  border-radius: 24px;
  background:
    radial-gradient(480px 200px at 18% 0%, rgba(255, 209, 102, 0.08), transparent 72%),
    rgba(19, 27, 63, 0.7);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.minigame-visual {
  position: relative;
  flex: 0 0 190px;
  min-height: 220px;
  overflow: hidden;
  border-right: 1px solid rgba(255, 209, 102, 0.12);
  background:
    radial-gradient(120px 120px at 55% 38%, rgba(255, 209, 102, 0.16), transparent 70%),
    linear-gradient(180deg, rgba(12, 18, 48, 0.2), rgba(7, 11, 31, 0.72));
}
.minigame-orbit {
  position: absolute;
  top: 20%;
  left: 50%;
  width: 130px;
  height: 130px;
  border: 1px dashed rgba(255, 209, 102, 0.24);
  border-radius: 50%;
  transform: translateX(-50%) rotate(-16deg);
}
.minigame-runner {
  position: absolute;
  top: 38%;
  left: 50%;
  z-index: 2;
  font-size: 3.1rem;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.32));
  transform: translate(-50%, -50%);
  animation: minigameRunner 2.4s ease-in-out infinite;
}
.minigame-boost {
  position: absolute;
  top: 20%;
  right: 16%;
  color: var(--yellow);
  font-size: 1.2rem;
  animation: minigameBoost 1.8s ease-in-out infinite;
}
.minigame-ground {
  position: absolute;
  right: 8%;
  bottom: 42px;
  left: 8%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 209, 102, 0.12), var(--yellow), rgba(255, 209, 102, 0.12));
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.25);
}
.minigame-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  padding: 20px;
  gap: 7px;
}
.minigame-chip {
  align-self: flex-start;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--yellow);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255, 209, 102, 0.1);
}
.minigame-body h3 {
  margin: 2px 0 0;
  font-size: 1.32rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.minigame-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.45;
}
.minigame-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
}
.minigame-meta b {
  color: var(--yellow);
  font-size: 0.78rem;
}
.minigame-play {
  align-self: flex-start;
  min-height: 40px;
  margin-top: 6px;
  padding: 9px 15px;
  border-radius: 13px;
  color: #14201a;
  font-size: 0.76rem;
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  box-shadow: 0 6px 0 rgba(166, 86, 20, 0.5), 0 10px 22px rgba(255, 154, 90, 0.16);
}
.minigame-play:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
}
.minigame-play:active {
  box-shadow: 0 2px 0 rgba(166, 86, 20, 0.5);
  transform: translateY(3px);
}

/* ---------- Математический паркур ---------- */
.minigame-screen {
  padding-top: 14px;
  padding-bottom: calc(30px + env(safe-area-inset-bottom));
}
.parkour-shell {
  display: flex;
  flex-direction: column;
  width: min(1100px, 100%);
  min-height: calc(100vh - 80px);
  margin: 0 auto;
  gap: 11px;
}
.parkour-topbar {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 9px 11px;
  gap: 10px;
  border: 1px solid rgba(255, 209, 102, 0.18);
  border-radius: 20px;
  background: rgba(19, 27, 63, 0.82);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.parkour-title {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
}
.parkour-title-icon {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 209, 102, 0.2);
  border-radius: 13px;
  background: rgba(255, 209, 102, 0.08);
  font-size: 1.35rem;
}
.parkour-title div {
  min-width: 0;
}
.parkour-title small {
  display: block;
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.parkour-title strong {
  display: block;
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.parkour-hud {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
  gap: 5px;
}
.parkour-hud span {
  display: inline-flex;
  align-items: center;
  padding: 6px 8px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.035);
}
.parkour-hud b {
  color: var(--text);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}
.parkour-stage {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
  min-height: clamp(220px, 35vh, 340px);
  border: 1px solid rgba(124, 216, 255, 0.18);
  border-radius: 24px;
  background: #070b1f;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}
#parkourCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
}
.parkour-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(3, 6, 19, 0.74);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
}
.parkour-overlay[hidden] {
  display: none;
}
.parkour-overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 430px;
  padding: 20px 24px;
  gap: 7px;
  border: 1px solid rgba(255, 209, 102, 0.2);
  border-radius: 20px;
  text-align: center;
  background: rgba(10, 16, 40, 0.9);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
}
.parkour-overlay-emoji {
  font-size: 2.7rem;
  line-height: 1;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.32));
}
.parkour-overlay-card small {
  color: var(--yellow);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.parkour-overlay-card h2 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 900;
  line-height: 1.08;
}
.parkour-overlay-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.45;
}
.parkour-overlay-card .btn {
  margin-top: 5px;
}
.parkour-result-rewards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 3px;
  gap: 6px;
}
.parkour-result-rewards span {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--mint);
  font-size: 0.65rem;
  font-weight: 900;
  background: rgba(97, 231, 180, 0.1);
}
.parkour-result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 5px;
  gap: 7px;
}
.parkour-question-card {
  padding: 13px 16px 15px;
  border: 1px solid rgba(255, 209, 102, 0.17);
  border-radius: 22px;
  background:
    radial-gradient(420px 150px at 15% 0%, rgba(255, 209, 102, 0.06), transparent 70%),
    rgba(19, 27, 63, 0.72);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}
.parkour-question-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.parkour-question-label {
  color: var(--yellow);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.parkour-status {
  min-height: 1em;
  color: var(--mint);
  font-size: 0.64rem;
  font-weight: 800;
  text-align: right;
}
.parkour-status.is-wrong {
  color: var(--danger);
}
.parkour-prompt {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}
.parkour-expression {
  min-height: 1.15em;
  margin: 6px 0 10px;
  font-size: clamp(2rem, 6vw, 3.1rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.03em;
  text-align: center;
}
.parkour-expression.is-text {
  font-size: clamp(1.02rem, 2.7vw, 1.35rem);
  line-height: 1.3;
}
.parkour-expression.is-roots {
  letter-spacing: 0.01em;
}
.parkour-answers {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}
.parkour-answer {
  min-height: 56px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text);
  font-size: clamp(1.18rem, 3.2vw, 1.55rem);
  font-weight: 900;
  background: rgba(255, 255, 255, 0.045);
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    transform 0.16s ease;
}
.parkour-answer:hover:not(:disabled) {
  border-color: rgba(97, 231, 180, 0.4);
  background: rgba(97, 231, 180, 0.07);
  transform: translateY(-1px);
}
.parkour-answer.is-correct {
  border-color: rgba(97, 231, 180, 0.7);
  background: rgba(97, 231, 180, 0.15);
  box-shadow: 0 0 0 3px rgba(97, 231, 180, 0.1);
}
.parkour-answer.is-wrong {
  border-color: rgba(255, 118, 148, 0.6);
  background: rgba(255, 118, 148, 0.12);
}
.parkour-answer:disabled {
  cursor: default;
}
body.perf-lite .parkour-topbar,
body.perf-lite .parkour-question-card {
  background-color: rgba(19, 27, 63, 0.96);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
body.perf-lite .parkour-overlay {
  background: rgba(3, 6, 19, 0.84);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
body.perf-lite .minigame-runner,
body.perf-lite .minigame-boost {
  animation: none !important;
}

@keyframes minigameRunner {
  0%, 100% { transform: translate(-50%, -50%); }
  50% { transform: translate(-50%, calc(-50% - 12px)); }
}
@keyframes minigameBoost {
  0%, 100% { opacity: 0.45; transform: scale(0.9) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.15) rotate(16deg); }
}

@media (max-width: 640px) {
  .minigames-section {
    margin-top: 40px;
  }
  .minigame-card {
    flex-direction: column;
  }
  .minigame-visual {
    flex-basis: 150px;
    min-height: 150px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 209, 102, 0.12);
  }
  .minigame-runner {
    top: 44%;
    font-size: 2.7rem;
  }
  .minigame-ground {
    bottom: 29px;
  }
  .minigame-body {
    padding: 16px;
  }
  .parkour-shell {
    min-height: 0;
  }
  .parkour-title small {
    display: none;
  }
  .parkour-title strong {
    font-size: 0.72rem;
  }
  .parkour-title-icon {
    width: 35px;
    height: 35px;
    border-radius: 11px;
    font-size: 1.1rem;
  }
  .parkour-topbar {
    padding: 7px 8px;
    gap: 7px;
  }
  .parkour-hud span {
    padding: 5px 6px;
    font-size: 0.55rem;
  }
  .parkour-hud b {
    font-size: 0.68rem;
  }
  .parkour-question-card {
    padding: 11px 12px 13px;
  }
  .parkour-answers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .parkour-answer {
    min-height: 52px;
  }
  .parkour-expression {
    margin: 4px 0 8px;
  }
  .parkour-overlay-card {
    padding: 16px 18px;
  }
}

@media (orientation: landscape) and (max-height: 560px) and (min-width: 560px) {
  .minigame-screen {
    padding-top: 6px;
  }
  .parkour-shell {
    min-height: 0;
  }
  .parkour-topbar {
    padding: 5px 8px;
  }
  .parkour-title-icon {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }
  .parkour-stage,
  #parkourCanvas {
    min-height: 160px;
    height: 160px;
  }
  .parkour-question-card {
    padding: 8px 12px 10px;
  }
  .parkour-prompt {
    display: none;
  }
  .parkour-expression {
    min-height: 0;
    margin: 3px 0 6px;
    font-size: 1.6rem;
  }
  .parkour-expression.is-text {
    font-size: 1rem;
  }
  .parkour-answer {
    min-height: 40px;
    font-size: 1.15rem;
  }
}

/* ---------- Паркур: здоровье ---------- */
.parkour-health {
  display: flex;
  align-items: center;
  padding: 7px 11px;
  gap: 8px;
  border: 1px solid rgba(255, 118, 148, 0.2);
  border-radius: 14px;
  background: rgba(19, 27, 63, 0.7);
}
.parkour-health-icon {
  font-size: 0.86rem;
  line-height: 1;
}
.parkour-health-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.parkour-health-track {
  flex: 1;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}
.parkour-health-track i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--yellow));
  transition: width 0.25s ease, background 0.25s ease;
}
.parkour-health-track i.is-low {
  background: linear-gradient(90deg, var(--yellow), var(--danger));
}
.parkour-health b {
  flex: 0 0 auto;
  min-width: 30px;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
body.perf-lite .parkour-health {
  background: rgba(19, 27, 63, 0.96);
}
@media (max-width: 640px) {
  .parkour-health-label {
    display: none;
  }
}

/* ---------- Установка PWA ---------- */
.install-banner {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 429;
  display: flex;
  align-items: center;
  width: min(530px, calc(100vw - 20px));
  padding: 10px 10px 10px 13px;
  gap: 10px;
  border: 1px solid rgba(255, 209, 102, 0.34);
  border-radius: 16px;
  background: rgba(13, 20, 49, 0.98);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.38);
  transform: translateX(-50%);
}
.install-banner[hidden] {
  display: none;
}
.install-banner-icon {
  font-size: 1.35rem;
  line-height: 1;
}
.install-banner-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}
.install-banner-copy strong {
  font-size: 0.76rem;
  font-weight: 900;
}
.install-banner-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.install-banner .btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 0.68rem;
}
.install-banner-close {
  display: grid;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.035);
}
.install-banner-close:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.install-page {
  display: grid;
  min-height: 100vh;
  padding: 24px 16px;
  place-items: center;
  background:
    radial-gradient(520px 360px at 15% 10%, rgba(97, 231, 180, 0.08), transparent 70%),
    radial-gradient(620px 420px at 86% 88%, rgba(185, 156, 255, 0.11), transparent 72%),
    #070b1f;
}
.install-page-card {
  width: min(720px, 100%);
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid rgba(97, 231, 180, 0.18);
  border-radius: 28px;
  background: rgba(16, 24, 58, 0.86);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}
.install-page-brand {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}
.install-page-brand img {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.26);
}
.install-page-brand strong {
  display: block;
  font-size: 1.14rem;
  font-weight: 900;
}
.install-page-brand small {
  display: block;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.install-page h1 {
  margin: 7px 0 0;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.035em;
}
.install-page-lead {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.5;
}
.install-page-warning {
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 209, 102, 0.28);
  border-radius: 12px;
  color: var(--yellow);
  font-size: 0.74rem;
  font-weight: 700;
  background: rgba(255, 209, 102, 0.07);
}
.install-page-steps {
  display: grid;
  margin: 22px 0;
  padding: 0;
  gap: 10px;
  list-style: none;
}
.install-page-steps li {
  display: flex;
  padding: 13px;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.028);
}
.install-step-number {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  color: #10142f;
  font-size: 0.8rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--mint), var(--yellow));
}
.install-page-steps strong {
  display: block;
  font-size: 0.84rem;
  font-weight: 900;
}
.install-page-steps p {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.48;
}
.install-page-steps b {
  color: var(--muted-strong);
}
.install-page-steps .btn {
  min-height: 38px;
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 0.7rem;
}
.install-page-link {
  color: var(--mint);
  font-weight: 800;
  overflow-wrap: anywhere;
}
.install-page-note {
  padding: 12px 14px;
  border: 1px solid rgba(97, 231, 180, 0.2);
  border-radius: 13px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.48;
  background: rgba(97, 231, 180, 0.045);
}
.install-page-back {
  display: inline-block;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: none;
}
.install-page-back:hover {
  color: var(--text);
}
body.perf-lite .install-banner,
body.perf-lite .install-page-card {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

@media (max-width: 480px) {
  .install-banner {
    align-items: stretch;
    flex-wrap: wrap;
    padding: 10px;
    gap: 7px;
  }
  .install-banner-icon {
    display: none;
  }
  .install-banner-copy {
    flex-basis: calc(100% - 38px);
  }
  .install-banner .btn {
    flex: 1 1 auto;
  }
  .install-banner-close {
    order: -1;
    margin-left: auto;
  }
  .install-page {
    align-items: start;
    padding: 12px;
  }
  .install-page-card {
    padding: 20px 16px;
    border-radius: 22px;
  }
}
.install-page-steps li[hidden] {
  display: none;
}
body.install-public .install-page-warning {
  display: none;
}
