/* Void Wings — modern shell UI (menus). In-canvas sprites stay pixel; typography is vector sans. */

:root {
  --vw-bg-deep: #030712;
  --vw-bg-mid: #0f172a;
  --vw-accent: #38bdf8;
  --vw-accent-dim: rgba(56, 189, 248, 0.14);
  --vw-text: #f1f5f9;
  --vw-muted: #64748b;
  --vw-radius-lg: 16px;
  --vw-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  /* Match src/utils/UITheme.ts — Exo 2 UI, Orbitron command lines, Share Tech diegetic */
  --vw-font-ui: "Exo 2", system-ui, sans-serif;
  --vw-font-display: "Orbitron", "Exo 2", sans-serif;
  --vw-font-mono: "Share Tech Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  height: 100dvh;
  color: var(--vw-text);
  background: var(--vw-bg-deep);
  font-family: var(--vw-font-ui);
  -webkit-font-smoothing: antialiased;
}

#app {
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  height: 100dvh;
  min-height: 100dvh;
  margin: 0;
  overflow: hidden;
  position: relative;
}

/* Fills the viewport so Phaser Scale.RESIZE has a real box to scale into */
#game-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* Pure deep space black — no cyan bleed-through into the transparent Phaser canvas */
  background: #020617;
  box-shadow: var(--vw-shadow);
}

#game-container::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ── BootScene: account login (Exo 2 + Orbitron; pairs with Phaser chrome) ── */
.vw-auth-shell {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: min(400px, 91vw);
  pointer-events: auto;
  z-index: 40;
  font-family: var(--vw-font-ui);
  -webkit-font-smoothing: antialiased;
}

/** Login card: centered in `#game-container` (same box as the canvas) — no Phaser px math drift. */
.vw-auth-shell--hangar {
  inset: 0;
  left: auto;
  top: auto;
  transform: none;
  width: auto;
  max-width: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top, 0px)) 14px max(16px, env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  z-index: 60;
  pointer-events: none;
}

.vw-auth-shell--hangar .vw-auth-card {
  pointer-events: auto;
  width: min(440px, 100%);
}

.vw-auth-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 18px 20px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(10px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 24px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.vw-auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.6);
}

.vw-auth-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.vw-auth-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vw-auth-label span {
  font-family: var(--vw-font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(165, 243, 252, 0.88);
  text-shadow:
    0 0 12px rgba(34, 211, 238, 0.25),
    0 1px 2px rgba(0, 0, 0, 0.65);
}

.vw-auth-input {
  padding: 11px 13px;
  border-radius: 8px;
  border: 1px solid rgba(51, 65, 85, 0.95);
  background: rgba(2, 6, 23, 0.65);
  color: #f8fafc;
  font-family: var(--vw-font-ui);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1.4;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.vw-auth-input::placeholder {
  color: rgba(100, 116, 139, 0.95);
}

.vw-auth-input:hover {
  border-color: rgba(71, 85, 105, 0.95);
}

.vw-auth-input:focus {
  border-color: rgba(56, 189, 248, 0.65);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.35),
    0 0 0 3px rgba(56, 189, 248, 0.18);
}

.vw-auth-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
  position: relative;
  z-index: 1;
}

.vw-auth-btn {
  flex: 1;
  min-width: 124px;
  padding: 11px 14px;
  border-radius: 8px;
  font-family: var(--vw-font-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    color 0.15s ease;
}

.vw-auth-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.vw-auth-btn--primary {
  border: 1px solid rgba(14, 165, 233, 0.45);
  color: #f0f9ff;
  background: #0284c7;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.vw-auth-btn--primary:hover:not(:disabled) {
  background: #0369a1;
  border-color: rgba(56, 189, 248, 0.55);
}

.vw-auth-btn--primary:active:not(:disabled) {
  background: #075985;
}

.vw-auth-btn--ghost {
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #e2e8f0;
  font-weight: 500;
  background: transparent;
  box-shadow: none;
}

.vw-auth-btn--ghost:hover:not(:disabled) {
  border-color: rgba(203, 213, 225, 0.45);
  background: rgba(30, 41, 59, 0.55);
}

.vw-auth-btn--ghost:active:not(:disabled) {
  background: rgba(30, 41, 59, 0.75);
}

/* Reusable shell typography (DOM overlays, future modals) */
.vw-type-ui {
  font-family: var(--vw-font-ui);
}

.vw-type-display {
  font-family: var(--vw-font-display);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.vw-type-mono {
  font-family: var(--vw-font-mono);
}

#game-container canvas {
  display: block;
  z-index: 1;
  /*
   * FIT scales this bitmap with CSS; default filtering softens pixel art + strokes.
   * Nearest-neighbor keeps upscaled sprites crisp (esp. when OS DPR is 1).
   * Vector-style Phaser Text may look slightly harder-edged — tradeoff for a sharper overall frame.
   */
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

/* ── Svelte HUD overlay ───────────────────────────────────────────────────── */
/*
 * #hud-root sits above #game-container in z-index.
 * pointer-events: none is set inline on the root Svelte component so clicks
 * fall through to the Phaser canvas by default; individual interactive widgets
 * (buttons, panels) re-enable pointer-events locally with pointer-events: auto.
 */
#hud-root {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

/* Dev-only: opens devtools without Phaser hit-testing (above canvas + auth shells). */
.vw-dev-fab {
  position: fixed;
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  z-index: 100003;
  pointer-events: auto;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: linear-gradient(168deg, rgba(15, 23, 42, 0.96) 0%, rgba(2, 6, 23, 0.98) 100%);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(15, 23, 42, 0.6) inset;
  color: var(--vw-accent);
  font-family: var(--vw-font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.vw-dev-fab:hover {
  border-color: rgba(56, 189, 248, 0.75);
  color: #e0f2fe;
}

.vw-dev-fab:active {
  transform: translateY(1px);
}
