:root {
  color-scheme: dark;
  --ink: #070b16;
  --panel: rgba(6, 12, 28, 0.8);
  --panel-soft: rgba(8, 16, 34, 0.54);
  --text: #f6f7fb;
  --accent: #22c7d7;
  --sun: #ffd44d;
  --danger: #ff4d6d;
  --green: #34d399;
  --glass-line: rgba(255, 255, 255, 0.16);
  --glass-shine: rgba(255, 255, 255, 0.1);
  --deep-shadow: rgba(1, 4, 13, 0.58);
}

html {
  --boot-ui-primary: #38bdf8;
  --boot-ui-secondary: #8b5cf6;
}

html[data-boot-level="2"] { --boot-ui-primary: #67e8f9; --boot-ui-secondary: #a78bfa; }
html[data-boot-level="3"] { --boot-ui-primary: #86efac; --boot-ui-secondary: #facc15; }
html[data-boot-level="4"] { --boot-ui-primary: #bae6fd; --boot-ui-secondary: #60a5fa; }
html[data-boot-level="5"] { --boot-ui-primary: #fbbf24; --boot-ui-secondary: #fb7185; }
html[data-boot-level="6"] { --boot-ui-primary: #22d3ee; --boot-ui-secondary: #f472b6; }
html[data-boot-level="7"] { --boot-ui-primary: #fb923c; --boot-ui-secondary: #facc15; }
html[data-boot-level="8"] { --boot-ui-primary: #a3e635; --boot-ui-secondary: #22c55e; }
html[data-boot-level="9"] { --boot-ui-primary: #fb7185; --boot-ui-secondary: #f97316; }
html[data-boot-level="10"] { --boot-ui-primary: #f43f5e; --boot-ui-secondary: #f59e0b; }
html[data-boot-level="11"] { --boot-ui-primary: #c084fc; --boot-ui-secondary: #22d3ee; }
html[data-boot-level="12"] { --boot-ui-primary: #f472b6; --boot-ui-secondary: #818cf8; }
html[data-boot-level="13"] { --boot-ui-primary: #fb923c; --boot-ui-secondary: #ef4444; }
html[data-boot-level="14"] { --boot-ui-primary: #38bdf8; --boot-ui-secondary: #818cf8; }

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #050815;
  font-family: Inter, "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
}

.game-shell {
  --level-ui-primary: #38bdf8;
  --level-ui-secondary: #8b5cf6;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  transform-origin: center center;
  background:
    radial-gradient(circle at 72% 38%, color-mix(in srgb, var(--level-ui-primary) 12%, transparent), transparent 36%),
    #050815;
}

#game {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  background: #07101f;
}

.boot-loading {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 46%, color-mix(in srgb, var(--boot-ui-primary) 28%, transparent), transparent 30%),
    linear-gradient(125deg, color-mix(in srgb, var(--boot-ui-secondary) 36%, #070b18), #070b18 48%, color-mix(in srgb, var(--boot-ui-primary) 34%, #070b18));
  opacity: 1;
  visibility: visible;
  transition: opacity 220ms ease, visibility 220ms ease;
  pointer-events: auto;
}

body.game-ready .boot-loading {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-loading-mark {
  width: min(74px, 15vw);
  aspect-ratio: 1;
  border: 6px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--boot-ui-secondary);
  border-right-color: var(--boot-ui-primary);
  border-radius: 50%;
  animation: bootSpin 850ms linear infinite;
  box-shadow: 0 0 34px color-mix(in srgb, var(--boot-ui-primary) 34%, transparent);
}

body.game-ready .boot-loading-mark {
  animation: none;
}

.boot-loading-title {
  font-size: clamp(34px, 9vw, 78px);
  font-weight: 950;
  line-height: 1;
  text-shadow:
    0 5px 0 rgba(0, 0, 0, 0.22),
    0 18px 42px rgba(0, 0, 0, 0.35),
    0 0 32px color-mix(in srgb, var(--boot-ui-primary) 32%, transparent);
}

.boot-loading-text {
  min-width: 168px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(16, 19, 31, 0.72);
  padding: 0 18px;
  color: color-mix(in srgb, var(--boot-ui-primary) 48%, white);
  font-size: clamp(15px, 4vw, 20px);
  font-weight: 900;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}

@keyframes bootSpin {
  to {
    transform: rotate(360deg);
  }
}

.space3d-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #050716;
  opacity: 0;
  transition: opacity 240ms ease;
}

.space3d-active .space3d-layer {
  opacity: 1;
}

.space3d-active #game {
  background: transparent;
}

body.force-landscape .game-shell {
  inset: auto;
  top: 50%;
  left: 50%;
  width: 100vh;
  height: 100vw;
  transform: translate(-50%, -50%) rotate(90deg);
}

.hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.brand,
.level-pill,
.hud-stat,
.section-pill,
.icon-button {
  height: 38px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 11px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 42%),
    linear-gradient(145deg, rgba(21, 30, 52, 0.9), rgba(7, 13, 28, 0.78)),
    var(--panel);
  color: var(--text);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 22px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  white-space: nowrap;
}

.brand {
  min-width: 92px;
  padding: 0 13px;
  font-weight: 900;
  letter-spacing: -0.025em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.42);
}

.brand::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--level-ui-primary), var(--level-ui-secondary));
  box-shadow: 0 0 10px color-mix(in srgb, var(--level-ui-primary) 74%, transparent);
  transform: rotate(45deg);
}

.level-pill {
  min-width: 42px;
  padding: 0 10px;
  border-color: color-mix(in srgb, var(--level-ui-primary) 48%, rgba(255, 255, 255, 0.24));
  color: color-mix(in srgb, var(--level-ui-primary) 72%, white);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 22px rgba(0, 0, 0, 0.2),
    0 0 14px color-mix(in srgb, var(--level-ui-primary) 12%, transparent);
  font-size: 13px;
  font-weight: 950;
}

.hud-stat {
  min-width: 92px;
  padding: 0 12px;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
}

.hud-stat span {
  color: var(--sun);
  font-size: 16px;
}

.section-pill {
  min-width: 112px;
  max-width: min(34vw, 230px);
  padding: 0 12px;
  color: color-mix(in srgb, var(--level-ui-primary) 34%, #f8fafc);
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-button {
  width: 42px;
  flex: 0 0 42px;
  pointer-events: auto;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  transition: transform 120ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

@media (hover: hover) {
  .icon-button:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--level-ui-primary) 66%, white);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.14),
      0 10px 24px rgba(0, 0, 0, 0.28),
      0 0 16px color-mix(in srgb, var(--level-ui-primary) 16%, transparent);
  }
}

.icon-button.active {
  border-color: rgba(255, 212, 77, 0.82);
  background: rgba(255, 212, 77, 0.88);
  color: #17120a;
  box-shadow: 0 0 0 4px rgba(255, 212, 77, 0.2), 0 12px 28px rgba(0, 0, 0, 0.22);
}

.icon-button:first-of-type {
  margin-left: auto;
}

.progress-track {
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top)) + 46px);
  left: 50%;
  width: min(440px, calc(100vw - 28px));
  height: 16px;
  transform: translateX(-50%);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(16, 19, 31, 0.82);
  box-shadow:
    0 5px 16px rgba(0, 0, 0, 0.34),
    0 0 14px color-mix(in srgb, var(--level-ui-primary) 14%, transparent),
    inset 0 0 0 1px rgba(0, 0, 0, 0.32);
  pointer-events: none;
  z-index: 21;
}

#progressFill {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--level-ui-primary), var(--level-ui-secondary), var(--level-ui-primary));
  background-size: 200% 100%;
  box-shadow: 0 0 12px color-mix(in srgb, var(--level-ui-primary) 68%, transparent);
  animation: progress-spectrum 2.8s linear infinite;
}

#progressFill::after {
  content: "";
  position: absolute;
  inset: 1px 0 auto;
  height: 42%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.58), transparent);
  transform: translateX(-72%);
  animation: progress-glint 2.2s ease-in-out infinite;
}

@keyframes progress-spectrum {
  to { background-position: 200% 0; }
}

@keyframes progress-glint {
  0%, 28% { transform: translateX(-72%); opacity: 0; }
  48% { opacity: 0.78; }
  70%, 100% { transform: translateX(72%); opacity: 0; }
}

#progressText {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 10px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}

.pause-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  pointer-events: none;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 48%, color-mix(in srgb, var(--level-ui-primary) 22%, transparent), transparent 34%),
    linear-gradient(rgba(16, 19, 31, 0.54), rgba(7, 11, 24, 0.72));
  opacity: 1;
  visibility: visible;
}

.pause-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.pause-mark {
  width: min(132px, 28vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 4px solid color-mix(in srgb, var(--level-ui-primary) 58%, white);
  border-radius: 8px;
  background: rgba(16, 19, 31, 0.78);
  color: color-mix(in srgb, var(--level-ui-secondary) 72%, white);
  font-size: clamp(52px, 14vw, 92px);
  font-weight: 950;
  line-height: 1;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.35),
    0 0 0 8px color-mix(in srgb, var(--level-ui-primary) 14%, transparent),
    0 0 34px color-mix(in srgb, var(--level-ui-primary) 28%, transparent);
  animation: pausePulse 1100ms ease-in-out infinite;
}

.pause-title {
  padding: 8px 16px;
  border-radius: 8px;
  background: rgba(16, 19, 31, 0.78);
  color: #fff;
  font-size: clamp(24px, 8vw, 44px);
  font-weight: 950;
  letter-spacing: 0;
  text-shadow:
    0 4px 0 rgba(0, 0, 0, 0.28),
    0 0 24px color-mix(in srgb, var(--level-ui-primary) 32%, transparent);
}

@keyframes pausePulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--level-ui-primary) 22%, transparent), transparent 28%),
    radial-gradient(circle at 58% 58%, color-mix(in srgb, var(--level-ui-secondary) 17%, transparent), transparent 34%),
    rgba(16, 19, 31, 0.88);
  transition: opacity 180ms ease, background 260ms ease;
}

.overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.overlay.hidden * {
  pointer-events: none;
}

.overlay.hidden *,
.overlay.hidden *::before,
.overlay.hidden *::after {
  animation-play-state: paused !important;
}

.overlay-title {
  font-size: clamp(36px, 8vw, 84px);
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0;
  text-shadow:
    0 6px 0 rgba(0, 0, 0, 0.28),
    0 0 34px color-mix(in srgb, var(--level-ui-primary) 34%, transparent);
}

.scene-transition {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--level-ui-primary) 34%, #07101f) 0 10%, transparent 38%),
    linear-gradient(125deg, color-mix(in srgb, var(--level-ui-secondary) 62%, #070b18), #070b18 48%, color-mix(in srgb, var(--level-ui-primary) 58%, #070b18));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.scene-transition::before,
.scene-transition::after {
  content: "";
  position: absolute;
  width: 150%;
  height: 34%;
  border-block: 1px solid color-mix(in srgb, var(--level-ui-primary) 52%, transparent);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--level-ui-primary) 19%, transparent), transparent);
  transform: rotate(-9deg) translateX(-58%);
}

.scene-transition::after {
  transform: rotate(-9deg) translateX(58%);
}

.scene-transition.active {
  visibility: visible;
  pointer-events: auto;
  animation: scene-transition-veil 560ms ease both;
}

.scene-transition.active::before {
  animation: scene-transition-band-left 560ms cubic-bezier(0.22, 0.8, 0.28, 1) both;
}

.scene-transition.active::after {
  animation: scene-transition-band-right 560ms cubic-bezier(0.22, 0.8, 0.28, 1) both;
}

.scene-transition-ring {
  width: 68px;
  height: 68px;
  border: 2px solid color-mix(in srgb, var(--level-ui-primary) 72%, white);
  border-right-color: var(--level-ui-secondary);
  border-radius: 50%;
  box-shadow: 0 0 28px color-mix(in srgb, var(--level-ui-primary) 42%, transparent);
}

.scene-transition-mark {
  position: absolute;
  color: #fff;
  font-size: 28px;
  text-shadow: 0 0 16px var(--level-ui-primary);
}

.scene-transition strong {
  max-width: min(78vw, 620px);
  overflow: hidden;
  color: #fff;
  font-size: clamp(18px, 4vw, 32px);
  font-weight: 950;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.32), 0 0 24px var(--level-ui-primary);
  white-space: nowrap;
}

.brand::after,
.level-pill::after,
.hud-stat::after,
.section-pill::after,
.icon-button::after {
  content: "";
  position: absolute;
  inset: 0 10px auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--level-ui-primary) 68%, white), transparent);
  opacity: 0.52;
  pointer-events: none;
}

.scene-transition.active .scene-transition-ring {
  animation: scene-transition-ring 560ms ease both;
}

@keyframes scene-transition-veil {
  0% { opacity: 0; }
  32%, 68% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes scene-transition-band-left {
  0% { transform: rotate(-9deg) translateX(-62%); }
  46%, 100% { transform: rotate(-9deg) translateX(0); }
}

@keyframes scene-transition-band-right {
  0% { transform: rotate(-9deg) translateX(62%); }
  46%, 100% { transform: rotate(-9deg) translateX(0); }
}

@keyframes scene-transition-ring {
  0% { opacity: 0; transform: scale(0.55) rotate(-90deg); }
  38%, 68% { opacity: 1; transform: scale(1) rotate(35deg); }
  100% { opacity: 0; transform: scale(1.35) rotate(90deg); }
}

body.capacitor-native .overlay-title {
  display: none;
}

body.test-mode .overlay {
  gap: 10px;
}

body.test-mode .overlay-title {
  font-size: clamp(30px, 6vw, 62px);
}

body.test-mode .results-panel {
  display: none;
}

.level-picker {
  width: min(720px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
  pointer-events: auto;
}

.level-choice {
  min-width: 0;
  min-height: 48px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(16, 19, 31, 0.72);
  color: var(--text);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(10px);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.level-choice b {
  display: grid;
  place-items: center;
  width: 38px;
  height: 34px;
  margin-left: 6px;
  border-radius: 7px;
  background: rgba(255, 212, 77, 0.16);
  color: var(--sun);
  font-size: 13px;
  font-weight: 950;
}

.level-choice span {
  min-width: 0;
  overflow: hidden;
  color: rgba(246, 247, 251, 0.88);
  font-size: 13px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-choice.active {
  border-color: rgba(255, 212, 77, 0.82);
  background: rgba(255, 212, 77, 0.18);
  box-shadow: 0 0 0 4px rgba(255, 212, 77, 0.12), 0 12px 28px rgba(0, 0, 0, 0.2);
}

.meta-map {
  --meta-map-width: 1120px;
  --meta-map-height: 230px;
  position: relative;
  isolation: isolate;
  width: min(1000px, calc(100vw - 24px));
  height: min(292px, calc(100vh - 116px));
  min-height: 220px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 2px solid color-mix(in srgb, var(--level-ui-primary) 42%, rgba(147, 197, 253, 0.28));
  border-radius: 18px;
  background: rgba(6, 21, 39, 0.88);
  box-shadow:
    0 22px 60px rgba(0, 0, 0, 0.38),
    0 0 42px color-mix(in srgb, var(--level-ui-primary) 14%, transparent),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  pointer-events: auto;
}

.meta-map::before {
  content: "";
  position: absolute;
  z-index: 8;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -24px 48px rgba(2, 6, 23, 0.2);
  pointer-events: none;
}

.meta-map-viewport {
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
}

.meta-map-viewport::-webkit-scrollbar {
  display: none;
}

.meta-map-world {
  position: relative;
  width: var(--meta-map-width);
  height: var(--meta-map-height);
  min-height: 100%;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle 2px at 4% 18%, #e0f2fe 0 70%, transparent 74%),
    radial-gradient(circle 1.5px at 12% 62%, #c4b5fd 0 70%, transparent 74%),
    radial-gradient(circle 2px at 24% 12%, #fde68a 0 70%, transparent 74%),
    radial-gradient(circle 1.5px at 37% 48%, #a5f3fc 0 70%, transparent 74%),
    radial-gradient(circle 2px at 51% 15%, #f0abfc 0 70%, transparent 74%),
    radial-gradient(circle 1.5px at 63% 58%, #bae6fd 0 70%, transparent 74%),
    radial-gradient(circle 2px at 76% 18%, #bef264 0 70%, transparent 74%),
    radial-gradient(circle 1.5px at 88% 52%, #fed7aa 0 70%, transparent 74%),
    radial-gradient(circle 2px at 97% 20%, #ddd6fe 0 70%, transparent 74%),
    radial-gradient(ellipse 92px 42px at 6% 80%, rgba(250, 204, 21, 0.28), transparent 72%),
    radial-gradient(circle 66px at 18% 31%, rgba(139, 92, 246, 0.3), transparent 72%),
    radial-gradient(ellipse 96px 48px at 31% 78%, rgba(34, 197, 94, 0.28), transparent 72%),
    radial-gradient(ellipse 92px 40px at 44% 25%, rgba(56, 189, 248, 0.3), transparent 72%),
    radial-gradient(ellipse 96px 46px at 57% 77%, rgba(236, 72, 153, 0.24), transparent 72%),
    radial-gradient(ellipse 88px 40px at 69% 23%, rgba(249, 115, 22, 0.26), transparent 72%),
    radial-gradient(ellipse 92px 46px at 82% 77%, rgba(245, 158, 11, 0.3), transparent 72%),
    radial-gradient(circle 76px at 94% 22%, rgba(163, 230, 53, 0.27), transparent 72%),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(125, 211, 252, 0.055) 32px 33px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(125, 211, 252, 0.045) 40px 41px),
    linear-gradient(180deg, #0b2d47 0%, #061526 58%, #0a2232 100%);
}

.meta-map-world::before,
.meta-map-world::after {
  content: "";
  position: absolute;
  z-index: -1;
  border: 1px solid rgba(186, 230, 253, 0.13);
  border-radius: 50%;
  pointer-events: none;
}

.meta-map-world::before {
  width: 420px;
  height: 150px;
  left: 340px;
  top: 48px;
  transform: rotate(-8deg);
}

.meta-map-world::after {
  width: 260px;
  height: 90px;
  right: 48px;
  bottom: 24px;
  transform: rotate(12deg);
}

.meta-map-route {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: var(--meta-map-width);
  height: var(--meta-map-height);
  overflow: visible;
  pointer-events: none;
}

.meta-map-route-glow,
.meta-map-route-base,
.meta-map-route-progress {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.meta-map-route-glow {
  fill: none;
  stroke: rgba(56, 189, 248, 0.14);
  stroke-width: 22;
  filter: blur(5px);
}

.meta-map-route-base {
  stroke: rgba(186, 230, 253, 0.25);
  stroke-width: 10;
  stroke-dasharray: 2 8;
  animation: meta-route-drift 5s linear infinite;
}

.meta-map-route-progress {
  stroke: var(--level-ui-secondary);
  stroke-width: 4;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  filter: drop-shadow(0 0 7px color-mix(in srgb, var(--level-ui-primary) 82%, transparent));
  transition: stroke-dashoffset 420ms ease;
  animation: meta-route-breathe 1.8s ease-in-out infinite alternate;
}

@keyframes meta-route-drift {
  to { stroke-dashoffset: -20; }
}

@keyframes meta-route-breathe {
  from { filter: drop-shadow(0 0 5px color-mix(in srgb, var(--level-ui-primary) 58%, transparent)); }
  to { filter: drop-shadow(0 0 11px color-mix(in srgb, var(--level-ui-secondary) 88%, transparent)); }
}

.meta-map-decor {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.meta-map-mote {
  position: absolute;
  z-index: 0;
  width: 7px;
  height: 7px;
  border: 1px solid color-mix(in srgb, var(--mote-accent) 70%, white);
  background: color-mix(in srgb, var(--mote-accent) 62%, transparent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--mote-accent) 55%, transparent);
  transform: rotate(45deg);
  animation: meta-map-mote-float 4.8s ease-in-out var(--mote-delay) infinite;
}

.meta-map-mote.terrain-jungle,
.meta-map-mote.terrain-anthill { border-radius: 65% 0 65% 0; }

.meta-map-mote.terrain-orbit,
.meta-map-mote.terrain-mars,
.meta-map-mote.terrain-aurora,
.meta-map-mote.terrain-reactor { border-radius: 50%; }

@keyframes meta-map-mote-float {
  0%, 100% { opacity: 0.25; translate: 0 5px; }
  50% { opacity: 0.86; translate: var(--mote-drift) -10px; }
}

.meta-map-landmark {
  position: absolute;
  width: 116px;
  height: 68px;
  transform: translate(-50%, -50%);
  opacity: 0.54;
  filter: saturate(1.18) drop-shadow(0 7px 8px rgba(0, 0, 0, 0.38));
  transition: opacity 220ms ease, filter 220ms ease, transform 220ms ease;
}

.meta-map-landmark::before {
  content: "";
  position: absolute;
  inset: 15px 7px 5px;
  border: 1px solid color-mix(in srgb, var(--landmark-accent) 64%, white);
  border-radius: 50% 50% 36% 42%;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--landmark-accent) 46%, white), transparent 42%),
    color-mix(in srgb, var(--landmark-accent) 28%, #061526);
  box-shadow: inset 0 -12px 22px rgba(2, 6, 23, 0.42);
}

.meta-map-landmark::after {
  content: attr(data-glyph);
  position: absolute;
  inset: 10px 0 auto;
  color: color-mix(in srgb, var(--landmark-accent) 58%, white);
  font-size: 30px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-shadow: 0 0 14px var(--landmark-accent);
}

.meta-map-landmark i {
  position: absolute;
  z-index: 1;
  left: calc(22px + var(--ridge) * 27px);
  bottom: 8px;
  width: calc(24px - var(--ridge) * 3px);
  height: calc(22px + var(--ridge) * 8px);
  border: 1px solid color-mix(in srgb, var(--landmark-accent) 62%, white);
  background: color-mix(in srgb, var(--landmark-accent) 36%, #071b31);
  opacity: 0.78;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.meta-map-mastery {
  position: absolute;
  z-index: 2;
  inset: 3px 17px;
  border-radius: 50%;
  background: conic-gradient(
    from -90deg,
    color-mix(in srgb, var(--landmark-accent) 82%, white) 0 var(--coin-progress),
    rgba(255, 255, 255, 0.08) var(--coin-progress) 100%
  );
  -webkit-mask: radial-gradient(circle, transparent 57%, #000 59%);
  mask: radial-gradient(circle, transparent 57%, #000 59%);
  opacity: 0.72;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--landmark-accent) 40%, transparent));
}

.meta-map-landmark.mastered .meta-map-mastery {
  opacity: 1;
  animation: meta-map-mastery-pulse 1.7s ease-in-out infinite alternate;
}

@keyframes meta-map-mastery-pulse {
  to { filter: drop-shadow(0 0 13px color-mix(in srgb, var(--landmark-accent) 82%, transparent)); }
}

.meta-map-landmark.selected {
  opacity: 0.9;
  filter: saturate(1.3) brightness(1.18) drop-shadow(0 0 16px color-mix(in srgb, var(--landmark-accent) 52%, transparent));
  transform: translate(-50%, -50%) scale(1.08);
}

.meta-map-landmark.terrain-orbit::before,
.meta-map-landmark.terrain-foundry::before,
.meta-map-landmark.terrain-reactor::before {
  inset: 7px 22px;
  border-radius: 50%;
}

.meta-map-landmark.terrain-city i {
  height: calc(25px + var(--ridge) * 10px);
  clip-path: none;
  border-radius: 3px 3px 0 0;
}

.meta-map-landmark.terrain-jungle i,
.meta-map-landmark.terrain-anthill i {
  border-radius: 58% 42% 54% 46%;
  clip-path: none;
  transform: rotate(calc(-18deg + var(--ridge) * 18deg));
}

.meta-map-landmark.terrain-paper::before {
  border-radius: 5px;
  transform: skewX(-8deg) rotate(-2deg);
}

.meta-map-landmark.terrain-demon::before,
.meta-map-landmark.terrain-extremity::before,
.meta-map-landmark.terrain-cave::before,
.meta-map-landmark.terrain-ice::before {
  border-radius: 8px;
  clip-path: polygon(50% 0, 94% 34%, 80% 100%, 17% 92%, 4% 35%);
}

.meta-map-landmark.terrain-mars::before {
  inset: 22px 6px 2px;
  border-radius: 50% 50% 18% 18%;
}

.meta-map-landmark.terrain-aurora::before {
  inset: 6px 13px 3px;
  border-radius: 50% 50% 16% 16%;
  clip-path: polygon(50% 0, 65% 28%, 91% 14%, 82% 55%, 100% 100%, 0 100%, 18% 55%, 9% 14%, 35% 28%);
  background:
    linear-gradient(118deg, rgba(103, 232, 249, 0.64), rgba(192, 132, 252, 0.2) 48%, rgba(244, 114, 182, 0.58)),
    #071b31;
}

.meta-map-landmark.terrain-aurora i {
  border-radius: 50%;
  clip-path: none;
  height: 9px;
  bottom: 11px;
  box-shadow: 0 -18px 18px color-mix(in srgb, var(--landmark-accent) 64%, transparent);
}

.meta-map .meta-map-nodes {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: var(--meta-map-width);
  height: var(--meta-map-height);
  display: block;
  pointer-events: none;
}

.meta-level-node {
  position: absolute;
  width: 110px;
  min-height: 64px;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f8fafc;
  cursor: pointer;
  font: inherit;
  text-align: center;
  transform: translate(-50%, -50%);
  transform-origin: center;
  pointer-events: auto;
  transition: transform 180ms ease, filter 180ms ease;
}

.meta-level-node::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 94px;
  height: 42px;
  top: 19px;
  border: 2px solid color-mix(in srgb, var(--level-accent) 66%, white);
  border-radius: 48% 52% 42% 58%;
  background:
    radial-gradient(circle at 36% 36%, color-mix(in srgb, var(--level-accent) 46%, white), transparent 28%),
    color-mix(in srgb, var(--level-accent) 30%, #092337);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.34);
  transform: rotate(-4deg);
  opacity: 0.82;
}

.meta-level-node:hover,
.meta-level-node:focus-visible,
.meta-level-node.selected {
  z-index: 5;
  outline: none;
  filter: brightness(1.2);
  transform: translate(-50%, -50%) scale(1.08);
}

.meta-level-node.locked {
  cursor: not-allowed;
  filter: grayscale(0.75) brightness(0.62);
  opacity: 0.72;
}

.meta-level-node.locked:hover,
.meta-level-node.locked:focus-visible {
  transform: translate(-50%, -50%);
  filter: grayscale(0.75) brightness(0.68);
}

.meta-level-node.locked .meta-level-beacon::after {
  content: "🔒";
  position: absolute;
  right: -11px;
  top: -12px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 2px solid #07111f;
  border-radius: 50%;
  background: #cbd5e1;
  font-size: 11px;
  transform: rotate(-45deg);
}

.meta-level-beacon {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 3px solid #07111f;
  border-radius: 11px;
  background: var(--level-accent);
  color: #07111f;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.2),
    0 6px 0 rgba(0, 0, 0, 0.26);
  transform: rotate(45deg);
}

.meta-level-beacon::before {
  content: "";
  position: absolute;
  inset: -8px;
  z-index: -1;
  border-radius: 14px;
  background: conic-gradient(
    #fde047 0 var(--coin-progress, 0%),
    rgba(255, 255, 255, 0.12) var(--coin-progress, 0%) 100%
  );
  -webkit-mask: radial-gradient(circle, transparent 61%, #000 64%);
  mask: radial-gradient(circle, transparent 61%, #000 64%);
  opacity: 0.78;
}

.meta-level-node.all-coins .meta-level-beacon::before {
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(253, 224, 71, 0.8));
}

.meta-level-beacon b {
  font-size: 12px;
  font-weight: 950;
  transform: rotate(-45deg);
}

.meta-level-node.current .meta-level-beacon {
  box-shadow:
    0 0 0 4px #f8fafc,
    0 0 0 8px rgba(255, 212, 77, 0.32),
    0 7px 0 rgba(0, 0, 0, 0.3);
}

.meta-level-node.completed .meta-level-beacon::after {
  content: "✓";
  position: absolute;
  right: -9px;
  top: -10px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 2px solid #07111f;
  border-radius: 50%;
  background: #4ade80;
  color: #07111f;
  font-size: 12px;
  font-weight: 950;
  transform: rotate(-45deg);
}

.meta-level-label,
.meta-level-status {
  position: relative;
  z-index: 2;
  max-width: 108px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 2px 4px #020617;
}

.meta-level-label {
  color: #f8fafc;
  font-size: 11px;
  font-weight: 950;
  min-height: 23px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.05;
}

.meta-level-status {
  color: rgba(226, 232, 240, 0.78);
  font-size: 9px;
  font-weight: 800;
}

.meta-map-player {
  --map-cube-body: linear-gradient(135deg, #67e8f9 0 48%, #2563eb 49% 100%);
  --map-cube-eye: #f8fafc;
  --map-cube-trail: #67e8f9;
  position: absolute;
  z-index: 7;
  width: 22px;
  height: 22px;
  border: 3px solid #06111f;
  border-radius: 4px;
  background: var(--map-cube-body);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.3),
    0 0 18px rgba(103, 232, 249, 0.9);
  transform: translate(-50%, -185%) rotate(9deg);
  transition: left 420ms cubic-bezier(0.22, 0.8, 0.28, 1), top 420ms cubic-bezier(0.22, 0.8, 0.28, 1);
  pointer-events: none;
}

.meta-map-player::before {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  left: 3px;
  top: 5px;
  background: var(--map-cube-eye);
  box-shadow: 9px 0 0 var(--map-cube-eye);
}

.meta-map-player::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: 17px;
  top: 7px;
  width: 38px;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--map-cube-trail));
  box-shadow: 0 0 10px var(--map-cube-trail);
  animation: meta-map-player-trail 0.9s ease-in-out infinite alternate;
}

@keyframes meta-map-player-trail {
  to { width: 52px; opacity: 0.48; }
}

.meta-map-info {
  min-height: 50px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-top: 1px solid rgba(186, 230, 253, 0.18);
  background: rgba(4, 15, 29, 0.92);
}

.meta-map-copy {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  column-gap: 8px;
}

.meta-map-copy span {
  color: color-mix(in srgb, var(--level-ui-primary) 78%, white);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.meta-map-copy strong {
  min-width: 0;
  overflow: hidden;
  color: #f8fafc;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-map-copy small {
  grid-column: 1 / -1;
  min-width: 0;
  overflow: hidden;
  color: rgba(226, 232, 240, 0.72);
  font-size: 10px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-panel-toggle,
.results-back-button,
.privacy-options-button {
  min-height: 34px;
  border: 1px solid rgba(125, 211, 252, 0.38);
  border-radius: 9px;
  background: rgba(14, 48, 74, 0.86);
  color: #e0f2fe;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
}

.meta-panel-toggle {
  padding: 0 11px;
}

.privacy-options-button {
  padding: 0 9px;
}

.privacy-options-button[hidden],
.daily-rewards-panel[hidden],
#rewardsToggle[hidden],
.ad-reward-panel[hidden] {
  display: none;
}

.language-picker {
  min-height: 34px;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid rgba(167, 139, 250, 0.38);
  border-radius: 9px;
  background: rgba(49, 46, 129, 0.62);
  color: #ede9fe;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.language-picker select {
  min-height: 25px;
  border: 0;
  border-radius: 6px;
  padding: 0 5px;
  background: rgba(2, 6, 23, 0.74);
  color: #f8fafc;
  font: inherit;
  cursor: pointer;
}

.results-back-button {
  width: 100%;
  padding: 7px 10px;
}

.overlay:not(.results-expanded) .results-panel {
  display: none;
}

.overlay.results-expanded .meta-map {
  display: none;
}

body.test-mode .meta-map {
  display: none;
}

@media (max-height: 440px) and (orientation: landscape) {
  .overlay:not(.results-expanded) {
    align-content: end;
    gap: 7px;
    padding: 48px 8px 7px;
  }

  .overlay:not(.results-expanded) .overlay-title {
    display: none;
  }

  .meta-map {
    width: min(1000px, calc(100vw - 16px));
    height: calc(100vh - 104px);
    min-height: 230px;
  }

  .meta-map-info {
    min-height: 44px;
    padding: 5px 8px;
  }

  .language-picker {
    padding-inline: 5px;
  }

  .language-picker > span {
    display: none;
  }

  .primary-button {
    min-height: 40px;
    padding-block: 7px;
  }
}

.test-mode-panel {
  width: min(720px, calc(100vw - 28px));
  display: grid;
  gap: 8px;
  pointer-events: auto;
}

.test-mode-panel.hidden {
  display: none;
}

.test-mode-head {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 2px solid rgba(255, 212, 77, 0.32);
  border-radius: 8px;
  background: rgba(255, 212, 77, 0.12);
  color: var(--text);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(10px);
}

.test-mode-head b {
  color: var(--sun);
  font-size: 13px;
  font-weight: 950;
}

.test-mode-head span {
  min-width: 0;
  overflow: hidden;
  color: rgba(246, 247, 251, 0.78);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checkpoint-picker {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.checkpoint-choice {
  min-width: 0;
  min-height: 42px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(16, 19, 31, 0.72);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.checkpoint-choice b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 26px;
  border-radius: 7px;
  background: rgba(34, 199, 215, 0.16);
  color: #dffbff;
  font-size: 11px;
  font-weight: 950;
}

.checkpoint-choice span {
  min-width: 0;
  overflow: hidden;
  color: rgba(246, 247, 251, 0.84);
  font-size: 11px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checkpoint-choice.active {
  border-color: rgba(34, 199, 215, 0.85);
  background: rgba(34, 199, 215, 0.16);
  box-shadow: 0 0 0 3px rgba(34, 199, 215, 0.12);
}

.results-panel {
  width: min(720px, calc(100vw - 28px));
  max-height: min(58vh, 430px);
  display: grid;
  gap: 12px;
  overflow: auto;
  pointer-events: auto;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.result-grid div,
.leaderboards section,
.shop-panel {
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(16, 19, 31, 0.72);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(10px);
}

.result-grid div {
  min-width: 0;
  padding: 10px 12px;
}

.result-grid span {
  display: block;
  margin-bottom: 4px;
  color: rgba(246, 247, 251, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.result-grid b {
  display: block;
  overflow: hidden;
  color: var(--sun);
  font-size: 18px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
}

.leaderboards section {
  min-width: 0;
  min-height: 0;
  padding: 10px;
}

.leaderboards h2,
.shop-panel h2 {
  margin: 0 0 8px;
  color: #dffbff;
  font-size: 13px;
  letter-spacing: 0;
}

.shop-panel {
  min-width: 0;
  padding: 10px;
}

.shop-panel .skin-shop + h2 {
  margin-top: 10px;
}

.ad-reward-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 2px solid rgba(250, 204, 21, 0.38);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(113, 63, 18, 0.72), rgba(16, 19, 31, 0.86));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

.daily-rewards-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.overlay.rewards-expanded .result-grid {
  display: none;
}

.daily-rewards-panel div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(125, 211, 252, 0.4);
  border-radius: 10px;
  background: rgba(14, 48, 74, 0.86);
}

.daily-rewards-panel b {
  color: #e0f2fe;
  font-size: 13px;
}

.daily-rewards-panel span,
#rewardAdQuota,
#rewardBreakdown {
  color: rgba(226, 232, 240, 0.85);
  font-size: 11px;
  line-height: 1.35;
}

#rewardBreakdown {
  display: block;
  margin-top: 4px;
}

#rewardsToggle {
  border-color: rgba(250, 204, 21, 0.55);
  color: #fef08a;
}

.ad-reward-panel div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.ad-reward-panel b {
  color: #fef08a;
  font-size: 14px;
}

.ad-reward-panel span {
  color: rgba(254, 249, 195, 0.78);
  font-size: 11px;
  font-weight: 750;
}

.ad-reward-panel button {
  min-height: 38px;
  border: 1px solid rgba(254, 240, 138, 0.7);
  border-radius: 9px;
  padding: 0 13px;
  background: linear-gradient(135deg, #facc15, #fb923c);
  color: #271404;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 950;
}

.ad-reward-panel button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.45);
  opacity: 0.68;
}

body.capacitor-native.ad-banner-visible .overlay:not(.results-expanded) {
  padding-bottom: calc(54px + env(safe-area-inset-bottom));
}

.shop-showcase-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.skin-feature {
  --item-accent: #38bdf8;
  --cube-body: #2d68ff;
  --cube-mini: #ff4d8f;
  --cube-eye: #20c5d6;
  --trail-color: #ff9e23;
  --trail-swatch: #ff9e23;
  min-width: 0;
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(116px, 1fr) 116px;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  overflow: hidden;
  border: 2px solid color-mix(in srgb, var(--item-accent) 42%, rgba(255, 255, 255, 0.16));
  border-radius: 8px;
  background:
    radial-gradient(circle at 30% 50%, color-mix(in srgb, var(--item-accent) 20%, transparent), transparent 46%),
    rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.skin-feature[data-rarity="epic"] {
  background:
    radial-gradient(circle at 30% 50%, color-mix(in srgb, var(--item-accent) 28%, transparent), transparent 48%),
    linear-gradient(145deg, rgba(139, 92, 246, 0.16), rgba(255, 255, 255, 0.05));
}

.skin-feature[data-rarity="legendary"] {
  border-color: rgba(255, 212, 77, 0.62);
  background:
    radial-gradient(circle at 30% 50%, color-mix(in srgb, var(--item-accent) 32%, transparent), transparent 48%),
    linear-gradient(145deg, rgba(255, 212, 77, 0.16), rgba(244, 114, 182, 0.07));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.11), 0 0 18px rgba(255, 212, 77, 0.1);
}

.skin-feature-stage {
  position: relative;
  min-width: 0;
  height: 54px;
  overflow: hidden;
  border-radius: 7px;
  background:
    linear-gradient(90deg, transparent, color-mix(in srgb, var(--item-accent) 9%, transparent)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 24px);
}

.skin-feature-stage::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 5px;
  height: 2px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--item-accent) 54%, transparent), transparent);
}

.skin-feature-cube {
  position: absolute;
  z-index: 2;
  top: 9px;
  right: 15px;
  width: 34px;
  height: 34px;
  border: 4px solid #11131b;
  border-radius: 5px;
  background: var(--cube-body);
  box-shadow:
    inset 8px 8px 0 rgba(255, 255, 255, 0.18),
    5px 5px 0 color-mix(in srgb, var(--cube-mini) 72%, #11131b),
    0 9px 18px color-mix(in srgb, var(--item-accent) 28%, transparent);
  transform: rotate(-7deg);
  animation: skin-feature-cube-bob 1.8s ease-in-out infinite;
}

.skin-feature-cube i {
  position: absolute;
  top: 8px;
  left: 7px;
  width: 5px;
  height: 6px;
  border-radius: 2px;
  background: var(--cube-eye);
  box-shadow: 11px 0 0 var(--cube-eye);
}

.skin-feature.volumetric .skin-feature-cube {
  border-radius: 3px;
  transform: perspective(90px) rotateX(-12deg) rotateY(-18deg) rotateZ(-7deg);
  box-shadow:
    inset 8px 8px 0 rgba(255, 255, 255, 0.2),
    7px 3px 0 color-mix(in srgb, var(--cube-mini) 62%, #172554),
    4px 8px 0 color-mix(in srgb, var(--cube-mini) 48%, #111827),
    0 11px 20px color-mix(in srgb, var(--item-accent) 34%, transparent);
}

.skin-feature.model-milk-carton .skin-feature-cube {
  width: 29px;
  border-radius: 2px;
  transform: rotate(-4deg) skewY(1deg);
}

.skin-feature.model-milk-carton .skin-feature-cube::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 8px;
  height: 7px;
  background: color-mix(in srgb, var(--cube-mini) 72%, transparent);
}

.skin-feature-trail i {
  position: absolute;
  z-index: 1;
  top: 23px;
  right: 48px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--trail-swatch);
  opacity: 0;
  animation: skin-feature-trail 1.45s linear infinite;
}

.skin-feature-trail i:nth-child(2) { animation-delay: -0.36s; }
.skin-feature-trail i:nth-child(3) { animation-delay: -0.72s; }
.skin-feature-trail i:nth-child(4) { animation-delay: -1.08s; }

.skin-feature-stage.trail-pixel .skin-feature-trail i { border-radius: 2px; }
.skin-feature-stage.trail-bubble .skin-feature-trail i,
.skin-feature-stage.trail-ring .skin-feature-trail i {
  border: 2px solid var(--trail-color);
  background: transparent;
}
.skin-feature-stage.trail-spark .skin-feature-trail i,
.skin-feature-stage.trail-star .skin-feature-trail i {
  border-radius: 0;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}
.skin-feature-stage.trail-comet .skin-feature-trail i {
  width: 20px;
  height: 6px;
  border-radius: 100% 4px 4px 100%;
}

.skin-feature-stage.trail-ribbon .skin-feature-trail i {
  width: 22px;
  height: 5px;
  border-radius: 999px;
}

.skin-feature-stage.trail-ember .skin-feature-trail i {
  border-radius: 0;
  clip-path: polygon(50% 0, 100% 100%, 50% 76%, 0 100%);
}

.skin-feature-stage.trail-crystal .skin-feature-trail i {
  border-radius: 1px;
  transform: rotate(45deg);
}

.skin-feature-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.skin-feature-copy b,
.skin-feature-copy span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skin-feature-copy b {
  color: #f8fafc;
  font-size: 14px;
  font-weight: 950;
}

.skin-feature-copy span {
  color: rgba(246, 247, 251, 0.68);
  font-size: 10px;
  font-weight: 900;
}

@keyframes skin-feature-cube-bob {
  0%, 100% { translate: 0 2px; }
  50% { translate: 0 -3px; }
}

@keyframes skin-feature-trail {
  0% { opacity: 0; transform: translateX(0) scale(0.45); }
  18% { opacity: 0.9; }
  100% { opacity: 0; transform: translateX(-70px) scale(0.18); }
}

.plane-preview {
  min-width: 0;
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 7px 10px;
  border: 2px solid rgba(255, 212, 77, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(56, 189, 248, 0.14), rgba(250, 204, 21, 0.1)),
    rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.plane-preview canvas {
  width: 100%;
  height: 58px;
  display: block;
}

.plane-preview-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.plane-preview-copy b,
.plane-preview-copy span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plane-preview-copy b {
  color: #f8fafc;
  font-size: 14px;
  font-weight: 950;
}

.plane-preview-copy span {
  color: rgba(246, 247, 251, 0.68);
  font-size: 11px;
  font-weight: 900;
}

.skin-shop {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.skin-choice {
  --item-accent: #38bdf8;
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 50px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  isolation: isolate;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.shop-showcase-grid .plane-preview {
  grid-template-columns: minmax(0, 1fr) 92px;
}

.skin-choice::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(115deg, transparent 8%, color-mix(in srgb, var(--item-accent) 22%, transparent) 48%, transparent 72%);
  opacity: 0.58;
  transform: translateX(-72%);
  transition: transform 320ms ease, opacity 160ms ease;
}

.skin-choice:not(:disabled):hover,
.skin-choice:not(:disabled):focus-visible {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--item-accent) 68%, white);
  box-shadow: 0 7px 18px color-mix(in srgb, var(--item-accent) 20%, transparent);
}

.skin-choice:not(:disabled):hover::after,
.skin-choice:not(:disabled):focus-visible::after {
  transform: translateX(48%);
}

.skin-choice[data-rarity="rare"] {
  border-color: color-mix(in srgb, var(--item-accent) 50%, rgba(255, 255, 255, 0.16));
}

.skin-choice[data-rarity="epic"] {
  background: linear-gradient(145deg, rgba(139, 92, 246, 0.16), rgba(255, 255, 255, 0.06));
  border-color: color-mix(in srgb, var(--item-accent) 64%, #a78bfa);
}

.skin-choice[data-rarity="legendary"] {
  background: linear-gradient(145deg, rgba(255, 212, 77, 0.17), rgba(244, 114, 182, 0.08));
  border-color: rgba(255, 212, 77, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 15px rgba(255, 212, 77, 0.08);
}

.skin-choice:disabled {
  cursor: default;
  opacity: 0.62;
}

.skin-choice.active {
  border-color: rgba(255, 212, 77, 0.82);
  background: rgba(255, 212, 77, 0.16);
}

.skin-swatch {
  position: relative;
  width: 28px;
  height: 28px;
  border: 3px solid #11131b;
  border-radius: 7px;
  box-shadow: inset 7px 7px 0 rgba(255, 255, 255, 0.22);
}

.skin-swatch.volumetric {
  width: 23px;
  height: 23px;
  margin-left: 1px;
  border-radius: 3px;
  transform: rotate(-8deg) skewY(2deg);
  box-shadow:
    inset 6px 6px 0 rgba(255, 255, 255, 0.24),
    5px 5px 0 #273270,
    8px 8px 12px rgba(34, 211, 238, 0.34);
}

.skin-swatch.volumetric::before {
  content: "3D";
  position: absolute;
  right: -8px;
  top: -10px;
  padding: 1px 3px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 4px;
  background: #7c3aed;
  color: #fff;
  font-size: 7px;
  line-height: 1;
  transform: skewY(-2deg) rotate(8deg);
}

.trail-swatch {
  border-radius: 50%;
  box-shadow: 0 0 16px color-mix(in srgb, currentColor 42%, transparent);
}

.trail-choice.active .trail-swatch {
  animation: trail-shop-pulse 1.4s ease-in-out infinite alternate;
}

@keyframes trail-shop-pulse {
  to { transform: scale(1.12) rotate(8deg); filter: brightness(1.28); }
}

.plane-swatch {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  box-shadow: inset 5px 5px 0 rgba(255, 255, 255, 0.18);
}

.plane-swatch-flame,
.plane-swatch-craft {
  position: absolute;
  display: block;
}

.plane-swatch-flame {
  left: 2px;
  top: 10px;
  width: 14px;
  height: 8px;
  border-radius: 999px 0 0 999px;
  opacity: 0.95;
}

.plane-swatch-craft {
  right: 4px;
  top: 8px;
  width: 18px;
  height: 11px;
  border: 2px solid #11131b;
  border-radius: 9px 10px 10px 3px;
  transform: skewX(-14deg);
}

.skin-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
  text-align: left;
}

.skin-copy b,
.skin-copy span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skin-copy span {
  color: rgba(246, 247, 251, 0.64);
  font-size: 11px;
}

.leaderboard-list {
  min-height: 86px;
  max-height: 160px;
  margin: 0;
  padding: 0 0 0 24px;
  overflow: hidden auto;
}

.leaderboard-list li {
  margin: 0 0 5px;
  padding-left: 4px;
  color: rgba(246, 247, 251, 0.88);
  font-size: 12px;
  font-weight: 800;
}

.leaderboard-list .empty {
  list-style: none;
  margin-left: -20px;
  color: rgba(246, 247, 251, 0.55);
}

.leaderboard-list strong {
  color: #fff;
}

.leaderboard-list span {
  color: rgba(246, 247, 251, 0.62);
}

.primary-button {
  min-width: 168px;
  height: 52px;
  border: 0;
  border-bottom: 5px solid color-mix(in srgb, var(--level-ui-secondary) 68%, #28150a);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--level-ui-secondary), var(--level-ui-primary));
  color: #18110b;
  font: inherit;
  font-size: 19px;
  font-weight: 900;
  cursor: pointer;
}

.touch-controls {
  position: absolute;
  z-index: 7;
  left: 0;
  right: 0;
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  padding: 0 max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
  pointer-events: none;
}

.touch-right {
  display: flex;
  padding: 0;
}

.touch-button {
  width: 104px;
  aspect-ratio: 1;
  border: 3px solid rgba(255, 255, 255, 0.32);
  border-radius: 8px;
  background: rgba(16, 19, 31, 0.7);
  color: #fff;
  font-size: 48px;
  font-weight: 900;
  pointer-events: auto;
  touch-action: none;
  transition: transform 80ms ease, background 80ms ease, color 80ms ease;
}

.touch-button.jump {
  color: var(--sun);
}

.touch-button.active,
.touch-button:active {
  transform: scale(0.92);
  background: rgba(255, 211, 77, 0.92);
  color: #16120a;
}

@media (pointer: fine) and (min-width: 900px) {
  .touch-controls {
    display: none;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .hud {
    top: max(8px, env(safe-area-inset-top));
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    gap: 6px;
  }

  .brand,
  .level-pill,
  .hud-stat,
  .section-pill,
  .icon-button {
    height: 34px;
  }

  .brand {
    min-width: 82px;
    padding: 0 10px;
  }

  .level-pill {
    min-width: 38px;
    padding: 0 8px;
  }

  .hud-stat {
    min-width: 76px;
    padding: 0 10px;
    font-size: 12px;
  }

  .coins-stat {
    min-width: 82px;
  }

  .section-pill {
    min-width: 92px;
    max-width: min(36vw, 190px);
    font-size: 12px;
  }

  .icon-button {
    width: 38px;
    flex-basis: 38px;
  }

  .progress-track {
    top: calc(max(8px, env(safe-area-inset-top)) + 40px);
    width: min(400px, calc(100vw - 24px));
    height: 14px;
  }

  .touch-controls {
    bottom: max(10px, env(safe-area-inset-bottom));
    padding-right: max(10px, env(safe-area-inset-right));
  }

  .touch-right {
    padding: 0;
  }

  .touch-button {
    width: 90px;
    font-size: 40px;
  }

  .touch-button.jump {
    width: 90px;
  }

  .overlay {
    gap: 12px;
  }

  .overlay-title {
    font-size: clamp(32px, 14vh, 58px);
  }

  .level-picker {
    width: min(620px, calc(100vw - 24px));
    gap: 6px;
  }

  .level-choice {
    min-height: 42px;
    gap: 6px;
  }

  .level-choice b {
    width: 32px;
    height: 30px;
    margin-left: 5px;
    font-size: 12px;
  }

  .level-choice span {
    font-size: 12px;
  }

  .results-panel {
    width: min(620px, calc(100vw - 24px));
    max-height: 60vh;
    gap: 8px;
  }

  .result-grid div {
    padding: 8px 9px;
  }

  .leaderboards section,
  .shop-panel {
    padding: 8px;
  }

  .result-grid b {
    font-size: 15px;
  }

  .skin-shop {
    gap: 6px;
  }

  .plane-preview {
    min-height: 52px;
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 7px;
    margin-bottom: 6px;
    padding: 4px 7px;
  }

  .plane-preview canvas {
    height: 40px;
  }

  .plane-preview-copy b {
    font-size: 12px;
  }

  .plane-preview-copy span {
    font-size: 10px;
  }

  .skin-choice {
    min-height: 44px;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 6px;
    padding: 4px 6px;
  }

  .skin-swatch {
    width: 24px;
    height: 24px;
  }

  .leaderboard-list {
    max-height: 92px;
  }

  .primary-button {
    min-width: 142px;
    height: 46px;
    font-size: 17px;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  body.telegram-webapp {
    --tg-chrome-left: clamp(200px, 19vw, 252px);
    --tg-chrome-right: clamp(148px, 17vw, 222px);
  }

  body.telegram-webapp .hud {
    top: max(8px, env(safe-area-inset-top));
    left: max(var(--tg-chrome-left), env(safe-area-inset-left));
    right: max(var(--tg-chrome-right), env(safe-area-inset-right));
    height: 34px;
    align-items: center;
    gap: 6px;
    padding: 0 8px;
  }

  body.telegram-webapp .brand {
    display: none;
  }

  body.telegram-webapp .icon-button:first-of-type {
    margin-left: auto;
  }

  body.telegram-webapp .icon-button {
    position: static;
    top: auto;
    width: 36px;
    flex-basis: 36px;
    height: 34px;
  }

  body.telegram-webapp #pauseToggle {
    right: 8px;
  }

  body.telegram-webapp #soundToggle {
    right: 50px;
  }

  body.telegram-webapp #menuToggle {
    right: 92px;
  }

  body.telegram-webapp .progress-track {
    top: calc(max(8px, env(safe-area-inset-top)) + 40px);
    left: max(var(--tg-chrome-left), env(safe-area-inset-left));
    right: max(var(--tg-chrome-right), env(safe-area-inset-right));
    width: auto;
    transform: none;
  }
}

@media (orientation: landscape) and (max-height: 620px) and (max-width: 860px) {
  body.telegram-webapp .section-pill {
    display: none;
  }

  body.telegram-webapp .hud-stat {
    min-width: 66px;
    padding: 0 8px;
  }

  body.telegram-webapp .record-stat {
    min-width: 96px;
  }
}

body.force-landscape .hud {
  top: max(8px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  gap: 6px;
}

body.force-landscape .brand,
body.force-landscape .level-pill,
body.force-landscape .hud-stat,
body.force-landscape .section-pill,
body.force-landscape .icon-button {
  height: 34px;
}

body.force-landscape .brand {
  min-width: 82px;
  padding: 0 10px;
}

body.force-landscape .level-pill {
  min-width: 38px;
  padding: 0 8px;
}

body.force-landscape .hud-stat {
  min-width: 76px;
  padding: 0 10px;
  font-size: 12px;
}

body.force-landscape .coins-stat {
  min-width: 82px;
}

body.force-landscape .section-pill {
  min-width: 92px;
  max-width: min(36vw, 190px);
  font-size: 12px;
}

body.force-landscape .icon-button {
  width: 38px;
  flex-basis: 38px;
}

body.force-landscape .progress-track {
  top: calc(max(8px, env(safe-area-inset-top)) + 40px);
  width: min(400px, calc(100vw - 24px));
  height: 14px;
}

body.force-landscape .touch-controls {
  top: max(10px, env(safe-area-inset-top));
  bottom: auto;
  justify-content: flex-end;
  padding-right: max(10px, env(safe-area-inset-right));
}

body.force-landscape .touch-right {
  padding: 0;
}

body.force-landscape .touch-button {
  width: 90px;
  font-size: 40px;
}

body.force-landscape .touch-button.jump {
  width: 90px;
}

body.force-landscape .overlay {
  gap: 12px;
}

body.force-landscape .overlay-title {
  font-size: clamp(32px, 14vh, 58px);
}

body.force-landscape .level-picker {
  width: min(620px, calc(100vw - 24px));
  gap: 6px;
}

body.force-landscape .test-mode-panel {
  width: min(620px, calc(100vw - 24px));
  gap: 6px;
}

body.force-landscape .test-mode-head {
  padding: 7px 9px;
}

body.force-landscape .checkpoint-picker {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

body.force-landscape .checkpoint-choice {
  min-height: 38px;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 5px;
}

body.force-landscape .checkpoint-choice b {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

body.force-landscape .checkpoint-choice span {
  font-size: 10px;
}

body.force-landscape .level-choice {
  min-height: 42px;
  gap: 6px;
}

body.force-landscape .level-choice b {
  width: 32px;
  height: 30px;
  margin-left: 5px;
  font-size: 12px;
}

body.force-landscape .level-choice span {
  font-size: 12px;
}

body.force-landscape .results-panel {
  width: min(620px, calc(100vw - 24px));
  max-height: 60vh;
  gap: 8px;
}

body.force-landscape .result-grid div {
  padding: 8px 9px;
}

body.force-landscape .leaderboards section,
body.force-landscape .shop-panel {
  padding: 8px;
}

body.force-landscape .result-grid b {
  font-size: 15px;
}

body.force-landscape .skin-shop {
  gap: 6px;
}

body.force-landscape .plane-preview {
  min-height: 52px;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 7px;
  margin-bottom: 6px;
  padding: 4px 7px;
}

body.force-landscape .plane-preview canvas {
  height: 40px;
}

body.force-landscape .plane-preview-copy b {
  font-size: 12px;
}

body.force-landscape .plane-preview-copy span {
  font-size: 10px;
}

body.force-landscape .skin-choice {
  min-height: 44px;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 6px;
  padding: 4px 6px;
}

body.force-landscape .skin-swatch {
  width: 24px;
  height: 24px;
}

body.force-landscape .leaderboard-list {
  max-height: 92px;
}

body.force-landscape .primary-button {
  min-width: 142px;
  height: 46px;
  font-size: 17px;
}

@media (max-width: 560px) {
  .hud {
    gap: 6px;
  }

  .brand {
    min-width: 80px;
    padding: 0 9px;
  }

  .hud-stat {
    min-width: 54px;
    padding: 0 9px;
  }

  .hud-stat {
    font-size: 0;
  }

  .hud-stat span {
    font-size: 16px;
  }

  .section-pill {
    min-width: 0;
    flex: 1 1 auto;
  }

  .results-panel {
    width: calc(100vw - 20px);
    max-height: 58vh;
  }

  .level-picker {
    width: calc(100vw - 20px);
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  }

  .test-mode-panel {
    width: calc(100vw - 20px);
  }

  .test-mode-head {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .checkpoint-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .leaderboards {
    grid-template-columns: 1fr;
  }

  .result-grid,
  .skin-shop {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .leaderboard-list {
    max-height: 82px;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .shop-showcase-grid {
    gap: 6px;
    margin-bottom: 6px;
  }

  .skin-feature {
    min-height: 52px;
    grid-template-columns: minmax(96px, 1fr) 92px;
    gap: 6px;
    padding: 4px 7px;
  }

  .skin-feature-stage {
    height: 40px;
  }

  .skin-feature-cube {
    top: 5px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-width: 3px;
  }

  .skin-feature-cube i {
    top: 6px;
    left: 5px;
    width: 4px;
    height: 5px;
    box-shadow: 9px 0 0 var(--cube-eye);
  }

  .skin-feature-trail i {
    top: 17px;
    right: 41px;
  }

  .skin-feature-copy b { font-size: 12px; }
  .skin-feature-copy span { font-size: 9px; }
}

body.force-landscape .shop-showcase-grid {
  gap: 6px;
  margin-bottom: 6px;
}

body.force-landscape .skin-feature {
  min-height: 52px;
  grid-template-columns: minmax(96px, 1fr) 92px;
  gap: 6px;
  padding: 4px 7px;
}

body.force-landscape .skin-feature-stage { height: 40px; }
body.force-landscape .skin-feature-cube {
  top: 5px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-width: 3px;
}
body.force-landscape .skin-feature-cube i {
  top: 6px;
  left: 5px;
  width: 4px;
  height: 5px;
  box-shadow: 9px 0 0 var(--cube-eye);
}
body.force-landscape .skin-feature-trail i { top: 17px; right: 41px; }
body.force-landscape .skin-feature-copy b { font-size: 12px; }
body.force-landscape .skin-feature-copy span { font-size: 9px; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body.reduced-motion .pause-mark,
body.reduced-motion .boot-loading-mark,
body.reduced-motion .meta-map-player,
body.reduced-motion .meta-map-player::after,
body.reduced-motion .meta-map-mote,
body.reduced-motion .meta-map-mastery,
body.reduced-motion .meta-map-route-base,
body.reduced-motion .meta-map-route-progress,
body.reduced-motion #progressFill,
body.reduced-motion .scene-transition,
body.reduced-motion .scene-transition::before,
body.reduced-motion .scene-transition::after,
body.reduced-motion .scene-transition-ring,
body.reduced-motion .skin-feature-cube,
body.reduced-motion .skin-feature-trail i {
  animation: none !important;
  transition: none !important;
}

/* Spectrum visual system: one premium interface language across every world. */
.boot-loading {
  gap: 14px;
  background:
    repeating-linear-gradient(112deg, transparent 0 54px, rgba(255, 255, 255, 0.018) 55px 56px),
    radial-gradient(circle at 50% 46%, color-mix(in srgb, var(--boot-ui-primary) 34%, transparent), transparent 31%),
    linear-gradient(135deg, color-mix(in srgb, var(--boot-ui-secondary) 34%, #030712), #030712 48%, color-mix(in srgb, var(--boot-ui-primary) 28%, #030712));
}

.boot-loading-mark {
  border-radius: 18px;
  transform: rotate(45deg);
}

.hud {
  gap: 3px;
  min-height: 48px;
  padding: 5px;
  overflow: hidden;
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.085), transparent 48%),
    linear-gradient(105deg, rgba(4, 9, 23, 0.92), rgba(10, 18, 38, 0.78));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 14px 36px var(--deep-shadow),
    0 0 24px color-mix(in srgb, var(--level-ui-primary) 10%, transparent);
  backdrop-filter: blur(14px) saturate(1.28);
}

.hud::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--level-ui-primary) 13%, transparent), transparent 34%, transparent 68%, color-mix(in srgb, var(--level-ui-secondary) 11%, transparent));
  pointer-events: none;
}

.records-hint {
  margin: 6px 0 10px;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.45;
}

body.mobile-perf .hud {
  backdrop-filter: none;
}

body.mobile-perf #progressFill,
body.mobile-perf #progressFill::after {
  animation: none;
}

body.mobile-perf .meta-map-mote,
body.mobile-perf .meta-map-mastery,
body.mobile-perf .meta-map-route-base,
body.mobile-perf .meta-map-route-progress {
  animation: none;
}

body.mobile-perf .meta-map-player::after {
  animation: none;
}

body.mobile-perf .meta-map-route-glow,
body.mobile-perf .meta-map-route-progress {
  filter: none;
}

.brand,
.level-pill,
.hud-stat,
.section-pill,
.icon-button {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.brand {
  min-width: 102px;
  color: #fff;
  font-weight: 950;
  letter-spacing: -0.045em;
}

.brand::before {
  border-radius: 3px;
}

.level-pill {
  border-color: color-mix(in srgb, var(--level-ui-primary) 56%, rgba(255, 255, 255, 0.22));
  background: color-mix(in srgb, var(--level-ui-primary) 12%, rgba(6, 12, 28, 0.62));
  color: color-mix(in srgb, var(--level-ui-primary) 58%, white);
}

.hud-stat {
  min-width: 86px;
  padding: 0 10px;
  gap: 5px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  font-size: 10px;
  font-weight: 850;
}

.hud-stat > span:first-child {
  color: rgba(226, 232, 240, 0.62);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.hud-stat > span:last-child {
  color: #fff7cf;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(250, 204, 21, 0.18);
}

.section-pill {
  border-left: 1px solid color-mix(in srgb, var(--level-ui-primary) 54%, transparent);
  background: color-mix(in srgb, var(--level-ui-primary) 8%, transparent);
  color: color-mix(in srgb, var(--level-ui-primary) 28%, #f8fafc);
}

.icon-button {
  border-color: rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), transparent 46%),
    rgba(8, 16, 34, 0.72);
}

.progress-track {
  top: calc(max(12px, env(safe-area-inset-top)) + 54px);
  height: 12px;
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(2, 6, 23, 0.88);
}

#progressFill {
  background: linear-gradient(90deg, var(--level-ui-primary), #ffffff 52%, var(--level-ui-secondary), var(--level-ui-primary));
  background-size: 200% 100%;
}

#progressText {
  font-size: 9px;
}

.progress-track[hidden] {
  display: none;
}

.overlay {
  gap: 16px;
  overflow: hidden;
  background:
    linear-gradient(116deg, transparent 0 42%, color-mix(in srgb, var(--level-ui-primary) 5%, transparent) 42% 43%, transparent 43% 100%),
    repeating-linear-gradient(90deg, transparent 0 54px, rgba(255, 255, 255, 0.014) 55px 56px),
    radial-gradient(circle at 46% 34%, color-mix(in srgb, var(--level-ui-primary) 25%, transparent), transparent 31%),
    radial-gradient(circle at 64% 64%, color-mix(in srgb, var(--level-ui-secondary) 18%, transparent), transparent 38%),
    rgba(3, 8, 22, 0.93);
}

.overlay::before,
.overlay::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.overlay::before {
  inset: -18%;
  border: 1px solid color-mix(in srgb, var(--level-ui-primary) 12%, transparent);
  border-radius: 50%;
  transform: rotate(-9deg) scaleY(0.36);
  box-shadow:
    0 0 0 78px color-mix(in srgb, var(--level-ui-secondary) 2%, transparent),
    0 0 0 156px color-mix(in srgb, var(--level-ui-primary) 2%, transparent);
}

.overlay::after {
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.26), transparent 22%, transparent 78%, rgba(0, 0, 0, 0.4));
}

.overlay > * {
  position: relative;
  z-index: 1;
}

.overlay-title {
  color: transparent;
  font-size: clamp(34px, 7vw, 72px);
  letter-spacing: -0.055em;
  text-shadow: 0 3px 16px rgba(0, 0, 0, 0.3);
  background: linear-gradient(112deg, #ffffff 8%, color-mix(in srgb, var(--level-ui-primary) 58%, white) 48%, color-mix(in srgb, var(--level-ui-secondary) 65%, white));
  background-clip: text;
  -webkit-background-clip: text;
}

.meta-map {
  border-radius: 22px;
  background: rgba(4, 15, 31, 0.9);
  box-shadow:
    0 28px 72px rgba(0, 0, 0, 0.46),
    0 0 52px color-mix(in srgb, var(--level-ui-primary) 17%, transparent),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.meta-map-world {
  background:
    radial-gradient(circle 2px at 4% 18%, #e0f2fe 0 70%, transparent 74%),
    radial-gradient(circle 1.5px at 12% 62%, #c4b5fd 0 70%, transparent 74%),
    radial-gradient(circle 2px at 24% 12%, #fde68a 0 70%, transparent 74%),
    radial-gradient(circle 1.5px at 37% 48%, #a5f3fc 0 70%, transparent 74%),
    radial-gradient(circle 2px at 51% 15%, #f0abfc 0 70%, transparent 74%),
    radial-gradient(circle 1.5px at 63% 58%, #bae6fd 0 70%, transparent 74%),
    radial-gradient(circle 2px at 76% 18%, #bef264 0 70%, transparent 74%),
    radial-gradient(circle 1.5px at 88% 52%, #fed7aa 0 70%, transparent 74%),
    radial-gradient(circle 2px at 97% 20%, #ddd6fe 0 70%, transparent 74%),
    radial-gradient(ellipse 92px 42px at 6% 80%, rgba(250, 204, 21, 0.28), transparent 72%),
    radial-gradient(circle 66px at 18% 31%, rgba(139, 92, 246, 0.3), transparent 72%),
    radial-gradient(ellipse 96px 48px at 31% 78%, rgba(34, 197, 94, 0.28), transparent 72%),
    radial-gradient(ellipse 92px 40px at 44% 25%, rgba(56, 189, 248, 0.3), transparent 72%),
    radial-gradient(ellipse 96px 46px at 57% 77%, rgba(236, 72, 153, 0.24), transparent 72%),
    radial-gradient(ellipse 88px 40px at 69% 23%, rgba(249, 115, 22, 0.26), transparent 72%),
    radial-gradient(ellipse 92px 46px at 82% 77%, rgba(245, 158, 11, 0.3), transparent 72%),
    radial-gradient(circle 76px at 94% 22%, rgba(163, 230, 53, 0.27), transparent 72%),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(125, 211, 252, 0.06) 32px 33px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(125, 211, 252, 0.05) 40px 41px),
    linear-gradient(160deg, #0b314e 0%, #061426 54%, #0b1f3c 100%);
}

.primary-button {
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-bottom: 4px solid color-mix(in srgb, var(--level-ui-secondary) 64%, #12091f);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent 42%),
    linear-gradient(118deg, var(--level-ui-secondary), var(--level-ui-primary));
  color: #050713;
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.32),
    0 0 28px color-mix(in srgb, var(--level-ui-primary) 22%, transparent);
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

@media (hover: hover) {
  .primary-button:hover {
    transform: translateY(-2px) scale(1.015);
    filter: saturate(1.12) brightness(1.08);
    box-shadow:
      0 18px 36px rgba(0, 0, 0, 0.38),
      0 0 36px color-mix(in srgb, var(--level-ui-primary) 31%, transparent);
  }
}

.touch-button {
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 34%, rgba(255, 255, 255, 0.16), transparent 28%),
    rgba(6, 12, 28, 0.76);
  box-shadow:
    inset 0 0 0 7px rgba(255, 255, 255, 0.035),
    0 12px 30px rgba(0, 0, 0, 0.36),
    0 0 28px color-mix(in srgb, var(--level-ui-primary) 22%, transparent);
}

.pause-mark {
  border-width: 1px;
  border-radius: 26px;
  font-size: 0;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent 58%), rgba(6, 13, 29, 0.94);
  animation: none;
}

.pause-mark::before {
  content: "";
  width: 40%;
  height: 42%;
  border-radius: 3px;
  background: linear-gradient(90deg, currentColor 0 30%, transparent 30% 70%, currentColor 70%);
}

.pause-title {
  border-radius: 14px;
  font-size: clamp(24px, 4vw, 36px);
  letter-spacing: -0.035em;
  text-shadow: none;
}

@media (orientation: landscape) and (max-height: 620px), (orientation: portrait) and (max-width: 620px) {
  .overlay.results-expanded,
  body.force-landscape .overlay.results-expanded {
    padding: calc(max(8px, env(safe-area-inset-top)) + 54px) 12px 10px;
    grid-template-rows: auto minmax(0, 1fr) auto;
    align-content: stretch;
    gap: 8px;
  }

  .overlay.results-expanded .overlay-title,
  body.force-landscape .overlay.results-expanded .overlay-title {
    grid-row: 1;
    font-size: 26px;
    line-height: 1.1;
  }

  .overlay.results-expanded .results-panel,
  body.force-landscape .overlay.results-expanded .results-panel {
    grid-row: 2;
    min-height: 0;
    height: 100%;
    max-height: none;
  }

  .overlay.results-expanded .primary-button {
    grid-row: 3;
  }

  .hud,
  body.force-landscape .hud {
    min-height: 42px;
    padding: 4px;
    border-radius: 14px;
  }

  .brand,
  .level-pill,
  .hud-stat,
  .section-pill,
  .icon-button,
  body.force-landscape .brand,
  body.force-landscape .level-pill,
  body.force-landscape .hud-stat,
  body.force-landscape .section-pill,
  body.force-landscape .icon-button {
    height: 32px;
  }

  .brand,
  body.force-landscape .brand {
    min-width: 82px;
    padding-inline: 9px;
  }

  .hud-stat,
  body.force-landscape .hud-stat {
    min-width: 70px;
    padding-inline: 7px;
  }

  .hud-stat > span:first-child {
    font-size: 9px;
  }

  .hud-stat > span:last-child {
    font-size: 13px;
  }

  .icon-button,
  body.force-landscape .icon-button {
    width: 34px;
    flex-basis: 34px;
  }

  .progress-track,
  body.force-landscape .progress-track {
    top: calc(max(8px, env(safe-area-inset-top)) + 48px);
    height: 11px;
  }
}
