:root {
  --bg: #050713;
  --panel: rgba(12, 18, 42, 0.62);
  --panel-strong: rgba(10, 14, 34, 0.86);
  --text: #f7fbff;
  --muted: #9ca8d8;
  --cyan: #25e8ff;
  --blue: #4b7dff;
  --violet: #ad50ff;
  --gold: #ffd36a;
  --pink: #ff4fd8;
  --danger: #ff5277;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
  touch-action: manipulation;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  color: var(--text);
}

.cosmos {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgba(77, 126, 255, 0.25), transparent 26rem),
    radial-gradient(circle at 12% 74%, rgba(173, 80, 255, 0.22), transparent 22rem),
    linear-gradient(145deg, #03040b 0%, #090d24 50%, #05040c 100%);
}

.star-layer,
.nebula {
  position: absolute;
  inset: -20%;
  pointer-events: none;
}

.star-layer {
  opacity: 0.8;
  background-image:
    radial-gradient(#fff 0.08rem, transparent 0.09rem),
    radial-gradient(var(--cyan) 0.07rem, transparent 0.08rem);
  background-size: 7rem 7rem, 11rem 11rem;
  animation: driftStars 34s linear infinite;
}

.layer-b {
  opacity: 0.46;
  background-size: 4rem 4rem, 8rem 8rem;
  animation-duration: 22s;
  transform: rotate(14deg);
}

.layer-c {
  opacity: 0.25;
  background-size: 14rem 14rem, 18rem 18rem;
  animation-duration: 52s;
  transform: rotate(-9deg);
}

.nebula {
  filter: blur(28px);
  opacity: 0.65;
  animation: breathe 8s ease-in-out infinite alternate;
}

.nebula-one {
  background: conic-gradient(from 140deg at 48% 48%, transparent, rgba(37, 232, 255, 0.18), rgba(255, 79, 216, 0.2), transparent 70%);
}

.nebula-two {
  background: radial-gradient(ellipse at 72% 40%, rgba(255, 211, 106, 0.14), transparent 32rem);
  animation-delay: -3s;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

body.app-fullscreen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body.app-fullscreen .app-shell {
  height: 100vh;
}

body.app-fullscreen .screen {
  padding: 0.55rem;
}

body.app-fullscreen .game-screen.active {
  padding: 0;
  position: relative;
}

body.app-fullscreen .hud {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 0.55rem;
  width: min(96vw, 58rem);
  transform: translateX(-50%);
  margin: 0;
}

body.app-fullscreen .touch-controls {
  padding-bottom: max(0.9rem, env(safe-area-inset-bottom));
}

body.app-fullscreen .canvas-wrap {
  width: 100vw;
  height: 100vh;
  max-width: none;
  flex: 1 1 auto;
  margin: 0;
  border: 0;
  border-radius: 0;
}

body.app-fullscreen .game-ad {
  display: none;
}

body.app-fullscreen .screen.active {
  min-height: 100vh;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  padding: clamp(1rem, 3vw, 2rem);
  overflow-y: auto;
}

.screen.active {
  display: flex;
  flex-direction: column;
  animation: screenIn 260ms ease-out;
}

.login-panel,
.dialog-panel,
.settings-panel,
.info-panel {
  width: min(100%, 31rem);
  margin: auto;
}

.glass-panel {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius);
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.035));
  box-shadow: 0 1.5rem 5rem rgba(0, 0, 0, 0.42), inset 0 0 2rem rgba(37, 232, 255, 0.045);
  backdrop-filter: blur(20px);
}

.login-panel {
  padding: clamp(1.4rem, 5vw, 2.4rem);
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.14rem;
  text-transform: uppercase;
}

.logo-title {
  margin: 0;
  color: var(--text);
  font-size: clamp(2.8rem, 10vw, 5.8rem);
  line-height: 0.84;
  font-weight: 900;
  text-shadow: 0 0 1rem rgba(37, 232, 255, 0.8), 0 0 2.5rem rgba(173, 80, 255, 0.65);
}

.logo-title span {
  display: block;
  color: var(--cyan);
}

.logo-title.compact {
  font-size: clamp(2rem, 6vw, 3.4rem);
}

.brand-logo {
  display: block;
  inline-size: clamp(4.75rem, 12vw, 7rem);
  block-size: clamp(4.75rem, 12vw, 7rem);
  width: clamp(4.75rem, 12vw, 7rem) !important;
  height: clamp(4.75rem, 12vw, 7rem) !important;
  max-width: 7rem;
  max-height: 7rem;
  margin: 0 auto 0.75rem;
  object-fit: contain;
  filter: drop-shadow(0 0 1rem rgba(37, 232, 255, 0.58)) drop-shadow(0 0 1.6rem rgba(173, 80, 255, 0.38));
}

.compact-logo {
  inline-size: clamp(3rem, 7vw, 4.25rem);
  block-size: clamp(3rem, 7vw, 4.25rem);
  width: clamp(3rem, 7vw, 4.25rem) !important;
  height: clamp(3rem, 7vw, 4.25rem) !important;
  max-width: 4.25rem;
  max-height: 4.25rem;
  margin-bottom: 0.45rem;
}

.screen-copy {
  color: var(--muted);
  line-height: 1.55;
}

.field-label {
  display: block;
  margin: 1rem 0 0.45rem;
  color: #c7d0ff;
  font-size: 0.86rem;
  font-weight: 800;
  text-align: left;
}

.neon-input {
  width: 100%;
  min-height: 3.25rem;
  padding: 0 1rem;
  border: 1px solid rgba(37, 232, 255, 0.35);
  border-radius: var(--radius);
  outline: 0;
  background: rgba(2, 5, 18, 0.72);
  color: var(--text);
  box-shadow: inset 0 0 1.2rem rgba(37, 232, 255, 0.07), 0 0 0 rgba(37, 232, 255, 0);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.neon-input:focus {
  border-color: var(--cyan);
  box-shadow: inset 0 0 1.2rem rgba(37, 232, 255, 0.1), 0 0 1.3rem rgba(37, 232, 255, 0.24);
}

.primary-btn,
.ghost-btn,
.gold-btn,
.danger-btn,
.back-btn,
.tab,
.icon-btn {
  min-height: 3.1rem;
  border-radius: var(--radius);
  font-weight: 900;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--cyan), var(--blue) 52%, var(--violet));
  box-shadow: 0 0.9rem 2rem rgba(37, 232, 255, 0.22), inset 0 0 1.2rem rgba(255, 255, 255, 0.23);
}

.gold-btn {
  background: linear-gradient(135deg, #ffe8a3, var(--gold), #ff9d43);
  color: #1c1020;
  box-shadow: 0 0.9rem 2rem rgba(255, 211, 106, 0.22);
}

.ghost-btn,
.back-btn,
.tab,
.icon-btn {
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.065);
}

.danger-btn {
  background: rgba(255, 82, 119, 0.15);
  border: 1px solid rgba(255, 82, 119, 0.45);
}

.large-btn {
  width: 100%;
  margin-top: 1.2rem;
  min-height: 3.7rem;
  font-size: 1.08rem;
}

button:hover {
  transform: translateY(-0.13rem);
}

button:active {
  transform: translateY(0.05rem) scale(0.99);
}

.top-brand {
  text-align: center;
}

.welcome-text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin: 0.75rem 0 1rem;
  color: #dbe3ff;
  font-weight: 800;
}

.welcome-text .player-title {
  margin-left: 0;
  transform: translateY(-0.02rem);
}

.mobile-performance-note {
  display: none;
  width: min(100%, 38rem);
  margin: -0.25rem auto 0.9rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(255, 211, 106, 0.22);
  border-radius: var(--radius);
  background: rgba(3, 7, 20, 0.86);
  color: #fff4be;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.45;
  box-shadow: 0 0 1.1rem rgba(255, 211, 106, 0.12);
}

.menu-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 24rem);
  gap: 1rem;
  width: min(100%, 64rem);
  margin: 0 auto;
  align-items: stretch;
}

.hero-panel {
  position: relative;
  min-height: 20rem;
  padding: 1.2rem;
  overflow: hidden;
}

.hero-panel h3 {
  margin: 0.5rem 0;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
}

.mission-list {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
  width: min(100%, 23rem);
}

.mission-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.6rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 900;
}

.mission-row span:last-child {
  color: var(--gold);
}

.streak-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  width: min(100%, 25rem);
  margin-top: 0.8rem;
  padding: 0.8rem;
  border: 1px solid rgba(255, 211, 106, 0.18);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 211, 106, 0.12), rgba(37, 232, 255, 0.08)),
    rgba(3, 7, 20, 0.72);
  box-shadow: inset 0 0 1.2rem rgba(255, 211, 106, 0.05), 0 0 1.1rem rgba(37, 232, 255, 0.08);
}

.streak-panel strong,
.streak-panel small {
  display: block;
}

.streak-panel strong {
  color: #fff8d7;
  font-size: 1.05rem;
  text-shadow: 0 0 0.7rem rgba(255, 211, 106, 0.24);
}

.streak-panel small {
  margin-top: 0.18rem;
  color: #cbd4ff;
  font-weight: 750;
  line-height: 1.35;
}

.streak-kicker {
  display: block;
  margin-bottom: 0.12rem;
  color: var(--gold);
  font-size: 0.62rem;
  font-weight: 950;
  letter-spacing: 0.12rem;
  text-transform: uppercase;
}

.streak-actions {
  display: grid;
  gap: 0.4rem;
  min-width: 6.3rem;
}

.streak-actions button {
  min-height: 2.15rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.72rem;
}

.spin-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 7.2rem minmax(0, 1fr);
  gap: 0.85rem;
  align-items: center;
  width: min(100%, 25rem);
  margin-top: 0.8rem;
  padding: 0.85rem;
  border: 1px solid rgba(37, 232, 255, 0.16);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(37, 232, 255, 0.1), rgba(173, 80, 255, 0.08)),
    rgba(3, 7, 20, 0.74);
  box-shadow: inset 0 0 1.1rem rgba(37, 232, 255, 0.05), 0 0 1.1rem rgba(173, 80, 255, 0.1);
}

.spin-wheel-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 6.6rem;
  aspect-ratio: 1;
}

.spin-wheel {
  position: relative;
  width: 100%;
  height: 100%;
  border: 0.2rem solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background:
    repeating-conic-gradient(from -30deg, #25e8ff 0 30deg, #4b7dff 30deg 60deg, #ad50ff 60deg 90deg, #ff4fd8 90deg 120deg, #ffd36a 120deg 150deg, #39ff88 150deg 180deg);
  box-shadow: 0 0 1.4rem rgba(37, 232, 255, 0.28), inset 0 0 1.2rem rgba(0, 0, 0, 0.28);
  transition: transform 1.65s cubic-bezier(0.14, 0.85, 0.22, 1);
}

.spin-wheel::after {
  content: "";
  position: absolute;
  inset: 38%;
  border-radius: 50%;
  background: #f7fbff;
  box-shadow: 0 0 0.9rem rgba(255, 255, 255, 0.65);
}

.spin-wheel span {
  position: absolute;
  left: 50%;
  top: 50%;
  color: #06131a;
  font-size: 0.52rem;
  font-weight: 950;
  text-shadow: 0 0 0.3rem rgba(255, 255, 255, 0.55);
  transform-origin: 0 0;
}

.spin-wheel span:nth-child(1) { transform: rotate(0deg) translate(1.25rem, -0.3rem); }
.spin-wheel span:nth-child(2) { transform: rotate(60deg) translate(1.25rem, -0.3rem); }
.spin-wheel span:nth-child(3) { transform: rotate(120deg) translate(1.25rem, -0.3rem); }
.spin-wheel span:nth-child(4) { transform: rotate(180deg) translate(1.25rem, -0.3rem); }
.spin-wheel span:nth-child(5) { transform: rotate(240deg) translate(1.25rem, -0.3rem); }
.spin-wheel span:nth-child(6) { transform: rotate(300deg) translate(1.25rem, -0.3rem); }

.spin-pointer {
  position: absolute;
  top: -0.35rem;
  left: 50%;
  z-index: 2;
  width: 0;
  height: 0;
  border-left: 0.48rem solid transparent;
  border-right: 0.48rem solid transparent;
  border-top: 0.9rem solid #fff4be;
  filter: drop-shadow(0 0 0.45rem rgba(255, 211, 106, 0.7));
  transform: translateX(-50%);
}

.spin-card strong,
.spin-card small {
  display: block;
}

.spin-card strong {
  color: #fff;
  font-size: 1rem;
}

.spin-card small {
  min-height: 2.2rem;
  margin: 0.18rem 0 0.55rem;
  color: #cbd4ff;
  font-weight: 750;
  line-height: 1.35;
}

.spin-card button {
  width: 100%;
  min-height: 2.35rem;
  font-size: 0.76rem;
}

.energy-core-preview {
  position: absolute;
  right: 9%;
  top: 15%;
  width: 12rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0 8%, var(--cyan) 9% 18%, transparent 19%),
    repeating-conic-gradient(var(--cyan) 0 12deg, transparent 12deg 24deg),
    conic-gradient(var(--cyan), var(--violet), var(--gold), var(--cyan));
  filter: drop-shadow(0 0 2rem rgba(37, 232, 255, 0.8));
  opacity: 0.84;
  animation: spinCore 5s linear infinite;
}

.energy-core-preview::before,
.energy-core-preview::after {
  content: "";
  position: absolute;
  inset: -1.2rem;
  border: 0.12rem solid rgba(37, 232, 255, 0.45);
  border-radius: 50%;
}

.energy-core-preview::after {
  inset: -2.25rem;
  border-color: rgba(255, 211, 106, 0.32);
  transform: rotate(28deg) scaleY(0.62);
}

.menu-actions {
  display: grid;
  gap: 0.65rem;
}

.legal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  width: min(100%, 46rem);
  margin: 0.55rem auto 0;
  padding: 0.5rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius);
  background: rgba(2, 5, 18, 0.82);
  box-shadow: 0 0 1.2rem rgba(0, 0, 0, 0.28);
}

.legal-actions button,
.partner-link {
  appearance: none;
  -webkit-appearance: none;
  min-height: auto;
  padding: 0.2rem 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(3, 7, 20, 0.94) !important;
  color: #f5f7ff !important;
  font-size: 0.68rem;
  font-weight: 850;
  text-shadow: 0 0 0.8rem rgba(37, 232, 255, 0.22);
  text-decoration: underline;
  text-underline-offset: 0.18rem;
}

.legal-actions button:hover,
.partner-link:hover {
  color: var(--cyan);
  transform: none;
}

.ad-slot {
  display: grid;
  place-items: center;
  width: min(100%, 46rem);
  min-height: 4.3rem;
  margin: auto auto 0;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.28);
  color: rgba(255, 255, 255, 0.54);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12rem;
}

.game-screen.active {
  padding: 0.75rem;
  overflow: hidden;
}

.hud {
  display: grid;
  grid-template-columns: 1fr 1.15fr 0.9fr 0.9fr auto auto;
  gap: 0.55rem;
  width: min(100%, 46rem);
  margin: 0 auto 0.55rem;
}

.hud > div,
.icon-btn {
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius);
  background: rgba(8, 12, 28, 0.72);
}

.hud-label {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.hud strong {
  display: block;
  margin-top: 0.1rem;
  font-size: clamp(0.86rem, 2.7vw, 1.12rem);
  white-space: nowrap;
}

.canvas-wrap {
  position: relative;
  width: min(100%, 46rem);
  flex: 1;
  min-height: 0;
  margin: 0 auto;
  border: 1px solid rgba(37, 232, 255, 0.18);
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(145deg, #07112c, #111a45 58%, #040712);
  box-shadow: 0 0 2rem rgba(37, 232, 255, 0.13);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  image-rendering: auto;
  touch-action: none;
}

.game-ad {
  flex: 0 0 4.2rem;
  margin-top: 0.55rem;
}

.cinematic-text {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  width: 100%;
  color: #fff;
  font-size: clamp(2.2rem, 9vw, 5.2rem);
  font-weight: 900;
  text-align: center;
  text-shadow: 0 0 1rem var(--cyan), 0 0 2.5rem var(--violet);
  pointer-events: none;
  animation: titleBurst 1s ease-out both;
}

.touch-controls {
  position: absolute;
  inset: auto 0 0;
  z-index: 4;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  padding: clamp(0.65rem, 2.6vw, 1.1rem);
  pointer-events: none;
}

.action-controls {
  display: grid;
  gap: 0.55rem;
  pointer-events: none;
}

.joystick-base {
  pointer-events: auto;
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(5.9rem, 18vw, 8.25rem);
  aspect-ratio: 1;
  border: 1px solid rgba(37, 232, 255, 0.28);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(37, 232, 255, 0.2), rgba(3, 7, 20, 0.72) 58%),
    rgba(3, 7, 20, 0.74);
  box-shadow: inset 0 0 1.5rem rgba(37, 232, 255, 0.18), 0 0 1.4rem rgba(0, 0, 0, 0.32);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.joystick-base::after {
  content: "";
  position: absolute;
  inset: -1.6rem;
  border-radius: 50%;
}

.joystick-base::before {
  content: "";
  position: absolute;
  inset: 22%;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 50%;
}

.joystick-knob {
  position: relative;
  z-index: 1;
  width: 42%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--cyan) 34%, var(--blue));
  box-shadow: 0 0 1.25rem rgba(37, 232, 255, 0.65);
  transition: transform 70ms linear;
}

.control-btn {
  pointer-events: auto;
  width: clamp(5.6rem, 20vw, 8rem);
  min-height: clamp(3.15rem, 10vw, 4.25rem);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  color: #f7fbff;
  font-size: clamp(0.75rem, 2.8vw, 0.95rem);
  font-weight: 950;
  letter-spacing: 0.04rem;
  text-shadow: 0 0 0.7rem rgba(255, 255, 255, 0.45);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.rotate-device {
  display: none;
}

body.low-power .touch-controls {
  position: fixed;
  display: flex;
  padding: 0.45rem max(0.55rem, env(safe-area-inset-right)) max(0.5rem, env(safe-area-inset-bottom)) max(0.55rem, env(safe-area-inset-left));
}

body.low-power .hud {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: max(0.15rem, env(safe-area-inset-top));
  width: min(99vw, 48rem);
  transform: translateX(-50%);
  grid-template-columns: repeat(4, minmax(3.8rem, 1fr)) auto auto;
  gap: 0.18rem;
  margin: 0;
}

body.low-power .hud > div,
body.low-power .icon-btn {
  min-height: 2rem;
  padding: 0.22rem 0.34rem;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(5, 8, 22, 0.68);
}

body.low-power .hud-label {
  font-size: 0.48rem;
  line-height: 1;
}

body.low-power .hud strong {
  margin-top: 0.05rem;
  font-size: clamp(0.68rem, 2.6vw, 0.9rem);
  line-height: 1.05;
}

body.low-power .icon-btn {
  min-width: 2rem;
}

body.low-power .joystick-base {
  width: clamp(3.9rem, 13vw, 4.8rem);
  opacity: 0.78;
}

body.low-power .joystick-knob {
  width: 34%;
  opacity: 0.92;
}

body.low-power .action-controls {
  gap: 0.36rem;
}

body.low-power .control-btn {
  width: clamp(3.65rem, 12.5vw, 4.45rem);
  min-height: clamp(1.8rem, 6.2vw, 2.18rem);
  font-size: clamp(0.5rem, 1.7vw, 0.6rem);
  opacity: 0.84;
}

body.low-power .control-btn:active,
body.low-power .joystick-base:active {
  opacity: 0.98;
}

@media (pointer: coarse) {
  .touch-controls {
    display: flex;
    padding: 0.45rem max(0.55rem, env(safe-area-inset-right)) max(0.5rem, env(safe-area-inset-bottom)) max(0.55rem, env(safe-area-inset-left));
  }

  .hud {
    position: absolute;
    z-index: 5;
    left: 50%;
    top: max(0.15rem, env(safe-area-inset-top));
    width: min(99vw, 48rem);
    transform: translateX(-50%);
    grid-template-columns: repeat(4, minmax(3.8rem, 1fr)) auto auto;
    gap: 0.18rem;
    margin: 0;
  }

  .hud > div,
  .icon-btn {
    min-height: 2rem;
    padding: 0.22rem 0.34rem;
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(5, 8, 22, 0.68);
  }

  .hud-label {
    font-size: 0.48rem;
    line-height: 1;
  }

  .hud strong {
    margin-top: 0.05rem;
    font-size: clamp(0.68rem, 2.6vw, 0.9rem);
    line-height: 1.05;
  }

  .icon-btn {
    min-width: 2rem;
  }

  .joystick-base {
    width: clamp(4.1rem, 14vw, 5.1rem);
    opacity: 0.58;
  }

  .joystick-knob {
    width: 34%;
    opacity: 0.9;
  }

  .action-controls {
    gap: 0.3rem;
  }

  .control-btn {
    width: clamp(3.75rem, 13.5vw, 4.75rem);
    min-height: clamp(1.9rem, 6.6vw, 2.35rem);
    font-size: clamp(0.52rem, 1.8vw, 0.64rem);
    opacity: 0.72;
  }

  .control-btn:active,
  .joystick-base:active {
    opacity: 0.95;
  }
}

@media (max-width: 920px), (max-height: 620px) {
  .touch-controls {
    display: flex;
  }
}

.boost-control {
  background: linear-gradient(135deg, rgba(37, 232, 255, 0.86), rgba(75, 125, 255, 0.76));
  box-shadow: 0 0 1.2rem rgba(37, 232, 255, 0.34);
}

.shield-control {
  background: linear-gradient(135deg, rgba(255, 211, 106, 0.9), rgba(255, 157, 67, 0.78));
  color: #1b1020;
  box-shadow: 0 0 1.2rem rgba(255, 211, 106, 0.34);
}

.control-btn:active {
  transform: scale(0.96);
}

.hidden {
  display: none !important;
}

body.low-power .nebula {
  filter: blur(16px);
  opacity: 0.42;
}

body.low-power .cosmos {
  background: #07112c;
}

body.low-power .star-layer,
body.low-power .nebula,
body.low-power .energy-core-preview,
body.low-power .skin-preview,
body.low-power .gift-orb {
  animation: none;
}

body.low-power .star-layer,
body.low-power .nebula {
  display: none;
}

body.low-power .glass-panel,
body.low-power .skin-card,
body.low-power .leaderboard-row,
body.low-power .mission-row {
  backdrop-filter: none;
}

body.low-power .glass-panel,
body.low-power .info-panel,
body.low-power .settings-panel {
  background: linear-gradient(155deg, rgba(6, 10, 26, 0.96), rgba(11, 17, 43, 0.92));
}

body.low-power .legal-actions {
  background: rgba(2, 5, 18, 0.96);
}

body.low-power .legal-actions button,
body.low-power .partner-link {
  background: rgba(3, 7, 20, 0.98) !important;
  color: #f7fbff !important;
}

body.low-power .legal-copy section,
body.low-power .guide-card {
  background: rgba(2, 5, 18, 0.78);
}

body.low-power .leaderboard-row::after {
  opacity: 0.45;
}

body.low-power .daily-title::before,
body.low-power .title-rank-1 {
  animation: none;
}

.dialog-panel {
  padding: 1.4rem;
  text-align: center;
}

.dialog-panel h2,
.screen-header h2 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 3.8rem);
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin: 1rem 0;
}

.score-grid div {
  padding: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.2);
}

.score-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.score-grid strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.35rem;
}

.dialog-panel button {
  width: 100%;
  margin-top: 0.55rem;
}

.small-ad {
  min-height: 3.4rem;
  margin-top: 0.85rem;
}

.screen-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  width: min(100%, 55rem);
  margin: 0 auto 1rem;
}

.screen-header h2 {
  grid-column: 2;
  text-align: center;
}

.back-btn {
  min-width: 5rem;
  padding: 0 0.8rem;
}

.skins-grid,
.achievements-grid,
.leaderboard-list {
  display: grid;
  gap: 0.8rem;
  width: min(100%, 55rem);
  margin: 0 auto;
}

.leaderboard-list {
  padding-bottom: 1.5rem;
}

.skins-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.achievements-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.skin-card,
.achievement-card,
.leaderboard-row,
.mission-row {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(18px);
}

.achievement-card {
  position: relative;
  display: grid;
  grid-template-columns: 4.25rem minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
  min-height: 6.2rem;
  padding: 1rem;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(37, 232, 255, 0.07), rgba(173, 80, 255, 0.06)),
    rgba(5, 9, 24, 0.78);
}

.achievement-card::after {
  content: "";
  position: absolute;
  inset: -40% auto auto -15%;
  width: 12rem;
  height: 12rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 232, 255, 0.16), transparent 64%);
  opacity: 0.45;
}

.achievement-card.ready {
  border-color: rgba(255, 211, 106, 0.42);
  box-shadow: 0 0 1.4rem rgba(255, 211, 106, 0.12), inset 0 0 1.4rem rgba(255, 211, 106, 0.04);
}

.achievement-card.claimed {
  border-color: rgba(57, 255, 136, 0.28);
  opacity: 0.82;
}

.achievement-badge {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 3.6rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(37, 232, 255, 0.88), rgba(173, 80, 255, 0.75));
  color: #fff;
  font-weight: 950;
  text-shadow: 0 0 0.7rem rgba(255, 255, 255, 0.48);
  box-shadow: 0 0 1.2rem rgba(37, 232, 255, 0.3);
}

.achievement-card.ready .achievement-badge {
  background: linear-gradient(135deg, #fff4be, #ffd36a 45%, #ff9d43);
  color: #1b1020;
  box-shadow: 0 0 1.3rem rgba(255, 211, 106, 0.45);
}

.achievement-card.claimed .achievement-badge {
  background: linear-gradient(135deg, #d7fff0, #39ff88 48%, #25e8ff);
  color: #06131a;
}

.achievement-card h3,
.achievement-card p {
  position: relative;
  z-index: 1;
  margin: 0;
}

.achievement-card h3 {
  color: #fff;
  font-size: 1rem;
}

.achievement-card p {
  margin-top: 0.25rem;
  color: #cbd4ff;
  font-size: 0.82rem;
  line-height: 1.35;
}

.achievement-card small {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 0.35rem;
  color: var(--gold);
  font-weight: 900;
}

.achievement-progress {
  position: relative;
  z-index: 1;
  height: 0.45rem;
  margin-top: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.achievement-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  box-shadow: 0 0 0.8rem rgba(37, 232, 255, 0.38);
}

.achievement-card button {
  position: relative;
  z-index: 1;
  min-width: 5.5rem;
  min-height: 2.35rem;
  padding: 0.35rem 0.7rem;
  font-size: 0.72rem;
}

.skin-card {
  position: relative;
  display: grid;
  gap: 0.55rem;
  padding: 0.8rem;
  text-align: center;
}

.skin-preview {
  width: 4.5rem;
  aspect-ratio: 1;
  margin: 0.35rem auto;
  border-radius: 50%;
  box-shadow: 0 0 1.6rem currentColor;
  animation: pulseCore 2s ease-in-out infinite;
}

.skin-card h3 {
  margin: 0;
  font-size: 1rem;
}

.skin-card p {
  min-height: 2.4rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.skin-card.selected {
  border-color: var(--cyan);
  box-shadow: 0 0 1.5rem rgba(37, 232, 255, 0.25);
}

.skin-card button {
  min-height: 2.55rem;
}

.leaderboard-meta {
  width: min(100%, 55rem);
  margin: 0 auto 1rem;
  color: #e7dcff;
  text-align: center;
  font-weight: 800;
  text-shadow: 0 0 1rem rgba(37, 232, 255, 0.32);
}

.leaderboard-row {
  position: relative;
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.9rem;
  overflow: hidden;
}

.leaderboard-row::before {
  content: none;
}

.leaderboard-row.featured::before {
  content: "";
  position: absolute;
  inset: -40% auto -40% -35%;
  width: 35%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: skewX(-18deg);
  animation: leaderboardShine 4s ease-in-out infinite;
}

.leaderboard-row::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(circle at 8% 50%, rgba(37, 232, 255, 0.16), transparent 32%),
    radial-gradient(circle at 92% 50%, rgba(255, 211, 106, 0.14), transparent 26%);
  opacity: 0.82;
}

.leaderboard-row strong,
.leaderboard-row div,
.leaderboard-row small {
  overflow-wrap: anywhere;
  position: relative;
  z-index: 1;
}

.leader-score {
  min-width: 4rem;
  text-align: right;
  color: #fff7cf;
  text-shadow: 0 0 0.9rem rgba(255, 211, 106, 0.5);
}

.player-code {
  display: inline-flex;
  align-items: center;
  margin-left: 0.35rem;
  padding: 0.08rem 0.32rem;
  border: 1px solid rgba(37, 232, 255, 0.24);
  border-radius: 999px;
  color: #aeefff;
  background: rgba(37, 232, 255, 0.08);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.03rem;
  vertical-align: middle;
}

.daily-title {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  margin-left: 0.45rem;
  padding: 0.18rem 0.52rem 0.18rem 0.28rem;
  border: 1px solid rgba(255, 211, 106, 0.22);
  border-radius: 999px;
  background:
    radial-gradient(circle at 14% 20%, rgba(255, 255, 255, 0.36), transparent 22%),
    linear-gradient(135deg, rgba(255, 82, 119, 0.28), rgba(255, 211, 106, 0.15), rgba(37, 232, 255, 0.12));
  color: #e9f8ff;
  font-size: 0.66rem;
  font-weight: 950;
  letter-spacing: 0.03rem;
  vertical-align: middle;
  overflow: hidden;
  text-shadow: 0 0 0.55rem currentColor;
  box-shadow:
    inset 0 0 0.8rem rgba(255, 255, 255, 0.06),
    0 0 1rem rgba(255, 121, 60, 0.16),
    0 0 1.4rem rgba(37, 232, 255, 0.1);
}

.daily-title span {
  display: grid;
  place-items: center;
  min-width: 1.25rem;
  min-height: 1.25rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 25%, #fff 0 18%, #ffd36a 19% 45%, #ff5277 46% 100%);
  color: #fff;
  font-size: 0.55rem;
  text-shadow: 0 0 0.45rem rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 0.75rem rgba(255, 111, 58, 0.42);
}

.daily-title::before {
  content: "";
  position: absolute;
  inset: -70% auto -70% -35%;
  width: 35%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: skewX(-18deg);
  animation: titleFlare 3.8s ease-in-out infinite;
}

.daily-title::after {
  content: "";
  position: absolute;
  inset: auto 12% -0.18rem 12%;
  height: 0.24rem;
  border-radius: 999px;
  background: radial-gradient(ellipse, rgba(255, 111, 58, 0.9), rgba(255, 211, 106, 0.35), transparent 72%);
  filter: blur(0.1rem);
  opacity: 0.75;
}

.title-rank-1 {
  border-color: rgba(255, 211, 106, 0.72);
  background:
    radial-gradient(circle at 18% 25%, rgba(255, 255, 255, 0.7), transparent 18%),
    linear-gradient(135deg, #fff1a3, #ff9d43 42%, #ff5277 72%, #6d2cff);
  color: #190d20;
  box-shadow: 0 0 1.6rem rgba(255, 111, 58, 0.58), 0 0 2.6rem rgba(255, 211, 106, 0.34);
  animation: titleFirePulse 1.8s ease-in-out infinite;
}

.title-rank-2 {
  border-color: rgba(37, 232, 255, 0.46);
  background: linear-gradient(135deg, #eff8ff, #6ee8ff 44%, #5177ff);
  color: #07112c;
  box-shadow: 0 0 1.2rem rgba(37, 232, 255, 0.36);
}

.title-rank-3 {
  border-color: rgba(255, 157, 67, 0.52);
  background: linear-gradient(135deg, #ffd0a0, #ff7a43 46%, #ad50ff);
  color: #190d20;
  box-shadow: 0 0 1.2rem rgba(255, 157, 67, 0.34);
}

.title-elite {
  border-color: rgba(255, 211, 106, 0.34);
  color: #fff4be;
}

.title-rift,
.title-nova,
.title-orbit {
  border-color: rgba(37, 232, 255, 0.24);
}

.leaderboard-row.current {
  border-color: var(--gold);
  box-shadow: 0 0 1.4rem rgba(255, 211, 106, 0.18);
}

.rank-badge {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 2.25rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 900;
}

.rank-1 .rank-badge,
.rank-2 .rank-badge,
.rank-3 .rank-badge {
  color: #150d20;
  background: linear-gradient(135deg, #fff4be, var(--gold));
  box-shadow: 0 0 1.2rem rgba(255, 211, 106, 0.52), 0 0 2.2rem rgba(37, 232, 255, 0.18);
  animation: crownPulse 1.8s ease-in-out infinite;
}

.settings-panel,
.info-panel {
  padding: 1.2rem;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.4rem;
  margin-bottom: 0.7rem;
  font-weight: 900;
}

.settings-panel button {
  width: 100%;
  margin-top: 0.65rem;
}

.info-panel {
  width: min(100%, 48rem);
  font-size: 1rem;
  line-height: 1.7;
}

.info-panel a {
  color: var(--cyan);
}

.guide-hero {
  margin: 0 0 1rem;
  color: #dce6ff;
  font-size: 1.05rem;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.guide-card {
  padding: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.2);
}

.guide-card h3 {
  margin: 0 0 0.45rem;
  color: var(--cyan);
  font-size: 0.95rem;
}

.guide-card p {
  margin: 0;
  color: var(--muted);
}

.guide-card strong {
  color: var(--text);
}

.legal-copy {
  display: grid;
  gap: 0.85rem;
}

.legal-copy section {
  padding: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.18);
}

.legal-copy h3 {
  margin: 0 0 0.45rem;
  color: var(--gold);
  font-size: 0.98rem;
}

.legal-copy p {
  margin: 0;
  color: #cbd4ff;
}

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

.ad-overlay,
.gift-overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.72);
}

.ad-modal,
.gift-modal {
  width: min(100%, 24rem);
  padding: 1.35rem;
  text-align: center;
}

.gift-modal {
  border-color: rgba(255, 211, 106, 0.45);
  box-shadow: 0 1.5rem 5rem rgba(0, 0, 0, 0.48), 0 0 3rem rgba(255, 211, 106, 0.18), inset 0 0 2rem rgba(37, 232, 255, 0.08);
}

.gift-modal h2 {
  margin: 0.4rem 0;
  font-size: clamp(2rem, 8vw, 3.1rem);
  text-shadow: 0 0 1rem rgba(255, 211, 106, 0.55);
}

.gift-modal p {
  color: var(--muted);
}

.gift-modal button {
  width: 100%;
  margin-top: 0.8rem;
}

.gift-orb {
  position: relative;
  width: 7rem;
  aspect-ratio: 1;
  margin: 0 auto 0.8rem;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0 10%, var(--gold) 11% 22%, transparent 23%),
    repeating-conic-gradient(from 12deg, var(--cyan) 0 12deg, var(--violet) 12deg 24deg, var(--gold) 24deg 36deg);
  filter: drop-shadow(0 0 1.7rem rgba(255, 211, 106, 0.75));
  animation: giftSpin 2.8s linear infinite;
}

.gift-orb::before,
.gift-orb::after {
  content: "";
  position: absolute;
  inset: -0.7rem;
  border: 0.12rem solid rgba(255, 211, 106, 0.42);
  border-radius: 50%;
}

.gift-orb::after {
  inset: -1.35rem;
  border-color: rgba(37, 232, 255, 0.34);
  transform: rotate(28deg) scaleY(0.58);
}

.ad-loader {
  width: 5rem;
  aspect-ratio: 1;
  margin: 1rem auto;
  border: 0.32rem solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spinCore 900ms linear infinite;
}

@keyframes driftStars {
  to { transform: translate3d(-5rem, 6rem, 0) rotate(5deg); }
}

@keyframes breathe {
  to { transform: scale(1.08) rotate(7deg); opacity: 0.85; }
}

@keyframes screenIn {
  from { opacity: 0; transform: scale(0.985); }
  to { opacity: 1; transform: scale(1); }
}

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

@keyframes pulseCore {
  50% { transform: scale(1.08); }
}

@keyframes titleBurst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); filter: blur(1rem); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.24); filter: blur(0); }
}

@keyframes leaderboardShine {
  0%, 62% { transform: translateX(0) skewX(-18deg); opacity: 0; }
  72% { opacity: 1; }
  100% { transform: translateX(420%) skewX(-18deg); opacity: 0; }
}

@keyframes crownPulse {
  50% { transform: scale(1.06); }
}

@keyframes titleFlare {
  0%, 62% { transform: translateX(0) skewX(-18deg); opacity: 0; }
  72% { opacity: 1; }
  100% { transform: translateX(430%) skewX(-18deg); opacity: 0; }
}

@keyframes titleFirePulse {
  50% {
    transform: translateY(-0.04rem) scale(1.035);
    filter: saturate(1.25);
  }
}

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

@media (max-width: 820px) {
  .menu-layout,
  .skins-grid,
  .achievements-grid {
    grid-template-columns: 1fr;
  }

  .mobile-performance-note {
    display: block;
  }

  .legal-actions {
    margin-top: 0.7rem;
  }

  .hero-panel {
    min-height: 12rem;
  }

  .energy-core-preview {
    width: 8rem;
    right: 1rem;
    top: 1.2rem;
  }

  .screen {
    padding: 0.9rem;
  }
}

@media (max-width: 520px) {
  .star-layer,
  .nebula,
  .energy-core-preview,
  .skin-preview,
  .gift-orb {
    animation: none;
  }

  .cosmos {
    background: #050713;
  }

  .brand-logo {
    inline-size: 4.5rem;
    block-size: 4.5rem;
    width: 4.5rem !important;
    height: 4.5rem !important;
  }

  .compact-logo {
    inline-size: 3rem;
    block-size: 3rem;
    width: 3rem !important;
    height: 3rem !important;
  }

  .star-layer,
  .nebula {
    display: none;
  }

  .nebula {
    filter: blur(16px);
    opacity: 0.42;
  }

  .glass-panel,
  .skin-card,
  .achievement-card,
  .leaderboard-row,
  .mission-row {
    backdrop-filter: none;
  }

  .achievement-card {
    grid-template-columns: 3.5rem minmax(0, 1fr);
  }

  .achievement-card button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .leaderboard-row::after {
    opacity: 0.45;
  }

  .rank-1 .rank-badge,
  .rank-2 .rank-badge,
  .rank-3 .rank-badge {
    animation: none;
  }

  body.app-fullscreen .hud {
    top: max(0.15rem, env(safe-area-inset-top));
    width: calc(100vw - 0.25rem);
  }

  .hud {
    grid-template-columns: repeat(4, minmax(3.2rem, 1fr)) auto auto;
    gap: 0.16rem;
  }

  .hud > div,
  .icon-btn {
    padding: 0.18rem 0.26rem;
  }

  .icon-btn {
    min-width: 1.9rem;
  }

  .game-screen.active {
    padding: 0.45rem;
  }

  .legal-actions {
    gap: 0.15rem 0.3rem;
  }

  .streak-panel {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .streak-actions {
    grid-template-columns: 1fr 1fr;
  }

  .spin-card {
    grid-template-columns: 5.2rem minmax(0, 1fr);
    width: 100%;
  }

  .spin-wheel-wrap {
    width: 4.9rem;
  }

  .spin-wheel span {
    font-size: 0.43rem;
  }

  .legal-actions button,
  .partner-link {
    flex: 0 1 auto;
    min-height: auto;
    font-size: 0.64rem;
  }

  .touch-controls {
    padding: 0.35rem max(0.45rem, env(safe-area-inset-right)) max(0.45rem, env(safe-area-inset-bottom)) max(0.45rem, env(safe-area-inset-left));
  }

  .control-btn {
    width: 4.05rem;
    min-height: 2.1rem;
    font-size: 0.58rem;
    opacity: 0.72;
  }

  .game-ad {
    flex-basis: 3.7rem;
  }

  .score-grid {
    grid-template-columns: 1fr 1fr;
  }

  .leaderboard-meta {
    font-size: 0.82rem;
    line-height: 1.45;
  }

  .leaderboard-row {
    grid-template-columns: 2.75rem minmax(0, 1fr) 3.7rem;
    gap: 0.45rem;
    padding: 0.65rem;
  }

  .daily-title {
    margin: 0.18rem 0.15rem 0;
    max-width: 100%;
    font-size: 0.66rem;
  }

  .rank-badge {
    min-height: 2rem;
    font-size: 0.86rem;
  }

  .leader-score {
    min-width: 0;
    font-size: 0.92rem;
  }
}

@media (pointer: coarse) and (orientation: portrait) {
  .game-screen.active .rotate-device {
    position: absolute;
    inset: 0.55rem 0.55rem auto;
    z-index: 8;
    display: block;
    padding: 0.65rem 0.8rem;
    text-align: center;
    border: 1px solid rgba(37, 232, 255, 0.22);
    border-radius: var(--radius);
    background: rgba(2, 5, 18, 0.78);
    color: #fff;
    pointer-events: none;
  }

  .rotate-device strong {
    display: block;
    font-size: clamp(0.95rem, 4.6vw, 1.35rem);
    text-shadow: 0 0 1rem rgba(37, 232, 255, 0.55);
  }

  .rotate-device span {
    display: block;
    margin-top: 0.15rem;
    color: #cbd4ff;
    font-size: 0.78rem;
    font-weight: 800;
  }

  .game-screen.active {
    padding: 0.45rem;
  }

  .canvas-wrap {
    min-height: min(64dvh, 34rem);
  }
}

@media (pointer: coarse) and (orientation: landscape) and (max-height: 560px) {
  .game-screen.active {
    padding: 0;
  }

  .hud {
    position: absolute;
    z-index: 5;
    left: 50%;
    top: max(0.12rem, env(safe-area-inset-top));
    width: min(98vw, 50rem);
    transform: translateX(-50%);
    grid-template-columns: repeat(4, minmax(4.5rem, 1fr)) auto auto;
    gap: 0.16rem;
    margin: 0;
  }

  .hud > div,
  .icon-btn {
    min-height: 1.75rem;
    padding: 0.16rem 0.3rem;
    background: rgba(5, 8, 22, 0.66);
  }

  .hud-label {
    font-size: 0.44rem;
  }

  .hud strong {
    font-size: 0.68rem;
  }

  .canvas-wrap {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .game-ad {
    display: none;
  }

  .touch-controls {
    padding: 0.32rem max(0.55rem, env(safe-area-inset-right)) max(0.35rem, env(safe-area-inset-bottom)) max(0.55rem, env(safe-area-inset-left));
  }

  .joystick-base {
    width: clamp(3.25rem, 11.5vh, 4.25rem);
    opacity: 0.56;
  }

  .control-btn {
    width: clamp(3.35rem, 11.5vh, 4.2rem);
    min-height: clamp(1.65rem, 5.8vh, 2rem);
    font-size: 0.48rem;
    opacity: 0.66;
  }

  .action-controls {
    gap: 0.25rem;
  }

  .cinematic-text {
    font-size: clamp(1.7rem, 8vh, 3.3rem);
  }
}
