/* ==============================
   🎨 VARIABLES Y ESTILOS BASE
   ============================== */
:root {
  --bg: #0b0f14;
  --panel: #0f1620;
  --text: #e8eef7;
  --muted: #9fb3c8;
  --accent: #64b5f6;
  --grid: #111923;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, "Helvetica Neue", Arial;
  color: var(--text);
  background: radial-gradient(1200px 800px at 70% 20%, #122031, var(--bg));
  display: grid; place-items: center;
}

/* ==============================
   LAYOUT PRINCIPAL
   ============================== */
.wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px; align-items: start;
  padding: 16px; width: min(100vw, 1100px);
}

.main-col { display: grid; justify-items: center; gap: 12px; }
.stage-card {
  background: linear-gradient(180deg, #0e1520 0%, #0b111a 100%);
  border: 1px solid #1b2a3b; border-radius: 16px;
  padding: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.02);
  user-select: none;
}
canvas { display: block; image-rendering: pixelated; }
#stage { border-radius: 12px; background: var(--grid); touch-action: none; }

.below-stage {
  display: grid; grid-auto-flow: column;
  gap: 12px; justify-content: center; width: 100%;
}

.sidebar { display: grid; gap: 12px; width: min(38vw, 280px); }
.panel { background: var(--panel); border: 1px solid #1b2a3b; border-radius: 12px; padding: 12px; }
.panel h3 { margin: 0 0 8px; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: #0c1420; border: 1px solid #1b2a3b; border-radius: 10px; padding: 10px; text-align: center; }
.stat .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.stat .value { font-size: 20px; font-weight: 700; margin-top: 2px; }

.controls { font-size: 13px; line-height: 1.5; color: var(--muted); }
kbd { background: #111a24; border: 1px solid #203246; padding: 1px 6px; border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #cfe3ff; }

.badges { display: flex; gap: 8px; align-items: center; }
.badge { padding: 4px 8px; border-radius: 999px; font-size: 12px; border: 1px solid #23415f; background: #0d1a27; color: #bde2ff; }

.footer { text-align: center; margin-top: 4px; font-size: 12px; color: var(--muted); }

/* ==============================
   HUD MÓVIL
   ============================== */
.hud-mobile, .mobile-actions, .touch-help { display: none; }

@media (max-width: 880px) {
  body {
    overflow: hidden; touch-action: none; overscroll-behavior: contain;
  }

  .wrap { grid-template-columns: 1fr; place-items: center; }
  .sidebar { width: min(560px, 92vw); grid-template-columns: 1fr; }
  .sidebar .controls { display: none; }

  .hud-mobile, .mobile-actions { display: flex; }
  .touch-help { display: block; }

  canvas { margin-top: 24px; display: block; }
}