/* ── BASE ── */
html, body {
  margin: 0;
  height: 100%;
  background: #05060a;
  overflow: hidden;
  cursor: none; /* ship IS the cursor */
  /* PROJECT RULE: the game uses ONLY two fonts — 'Exo 2' (display) and 'Montserrat'
     (body/text). This global default catches any element (e.g. inline-styled popups)
     that doesn't set its own family, so nothing falls back to a serif. */
  font-family: 'Montserrat', 'Exo 2', sans-serif;
}

/* A phone held in portrait keeps one landscape game. The transform is applied
   to body because gameplay, menus and cutscenes all append layers there. */
html.qw-phone-portrait-landscape,
html.qw-phone-portrait-landscape body {
  overflow: hidden;
}

html.qw-phone-portrait-landscape body {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--qw-viewport-width);
  height: var(--qw-viewport-height);
  transform-origin: 0 0;
  transform: rotate(90deg) translateY(-100%) !important;
}

/* ── Z-STACK (canonical 12-layer order, БЛОК 11) ──
   z0   #back-canvas         starfield + nebula + dust + far-ast + clouds + atmosphere
   z1   .space-dim           CSS dim overlay
   z1   #space-three-canvas  Aether GLSL fog (HIGH/CIN)
   z2   #field-canvas        mid/near asteroid field + cosmic + debris
   z2   #over-hud-canvas     over-HUD flyby
   z3   #top-small-canvas    foreground asteroids (blurred)
   z9998 .food-dot           gameplay dots (yellow/red/ghost/cursed + enemies)
   z10000 .cursor-dot        cursor point
   z10001 .ship-sprite-cursor ship sprite
   z10003 .hud2-frame        cockpit HUD
   Canvas z-indexes are set by space-layers.js / space-three.js inline. */
.space-dim {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 18, 0.28);
  pointer-events: none;
  z-index: 1;
}

/* ── SHIP / CURSOR DOT (phase 2) ── */
.cursor-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, #ff6a1a 0%, #e85000 35%, rgba(232, 80, 0, 0.3) 65%, transparent 100%);
  filter: blur(2px);
  box-shadow: 0 0 14px 5px rgba(232, 80, 0, 0.55), 0 0 32px 12px rgba(232, 80, 0, 0.22);
  position: fixed;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%) scale(1);
  transition: opacity 0.3s, width 0.3s ease, height 0.3s ease, box-shadow 0.4s ease;
  will-change: transform;
}

.cursor-dot.eat {
  animation: dot-eat 120ms ease forwards;
}
@keyframes dot-eat {
  0%   { transform: translate(-50%, -50%) scale(1); }
  40%  { transform: translate(-50%, -50%) scale(0.7); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

.cursor-dot.milestone-1 {
  box-shadow: 0 0 14px 5px rgba(255, 200, 0, 0.65), 0 0 32px 12px rgba(255, 180, 0, 0.28);
}

.cursor-dot.milestone-2 {
  box-shadow: 0 0 14px 5px rgba(200, 220, 255, 0.75), 0 0 32px 14px rgba(180, 210, 255, 0.32);
}

.ship-sprite-cursor {
  position: fixed;
  width: 36px;
  height: 36px;
  pointer-events: none;
  z-index: 10001;
  transform: translate(-50%, -50%);
  will-change: left, top;
  image-rendering: auto;
}

/* Three.js plasma-shield sphere canvas (combat/shield3d.js) — wraps the ship,
   sits below the dots/cursor/ship sprite so they render on top. */
#shield3d-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9997;
}

/* Direct touch steering replaces the virtual joystick on coarse-pointer devices. */
body.qw-touch-steering {
  overscroll-behavior: none;
}

#qw-touch-steering-intro {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 10007;
  width: min(calc(var(--qw-viewport-width, 100vw) - 2rem), 28rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1rem;
  box-sizing: border-box;
  color: #fff;
  text-align: center;
  pointer-events: none;
  user-select: none;
  opacity: 0;
  transform: translate(-50%, -46%);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

#qw-touch-steering-intro.visible {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.qw-touch-steering-intro__gesture {
  display: block;
  width: clamp(7rem, 28vmin, 10rem);
  height: clamp(7rem, 28vmin, 10rem);
  object-fit: contain;
  filter: invert(1) brightness(1.35) drop-shadow(0 0 0.75rem rgba(255, 255, 255, 0.28));
  opacity: 0.95;
}

.qw-touch-steering-intro__title {
  font-family: 'Exo 2', sans-serif;
  font-size: clamp(1rem, 3vw, 1.35rem);
  line-height: 1.15;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 0 1rem rgba(255, 255, 255, 0.35);
}

.qw-touch-steering-intro__sub {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.875rem;
  line-height: 1.35;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.72);
}
