﻿/* =========================================================================
   1. PALETA 32-BIT CONSOLA PORTATIL + REGLAS PIXEL ART (0px BORDER-RADIUS)
   ========================================================================= */
:root {
  --bg-deep: #0b0e1a;
  --bg-tile: #14192d;

  /* Carcasa amarilla dorada biselada */
  --shell-gold: #f5c33b;
  --shell-hi: #ffe875;
  --shell-lo: #c98617;
  --shell-deep: #8c560b;

  /* Paneles interiores gris pizarra y azul marino oscuro */
  --slate: #384364;
  --slate-hi: #4d5b85;
  --slate-lo: #242b42;
  --navy: #141a30;
  --navy-deep: #0b1021;
  --navy-grid: #192242;

  --ink: #0f0d1a;
  --ink-muted: #8b9bb4;

  --cream: #f4f0e0;
  --cream-hi: #ffffff;
  --cream-lo: #d6ccb0;
  --cream-deep: #b8aa88;

  --green: #2fb85b;
  --green-hi: #8cf57a;
  --green-lo: #1b7039;

  --red: #e03c46;
  --red-hi: #ff858d;
  --red-lo: #8f1d28;

  --blue: #1d8cf8;
  --blue-hi: #70c7ff;
  --blue-lo: #0f4f9e;

  --gold: #feae34;
  --gold-hi: #fee761;
  --gold-lo: #c96f14;

  --cyan: #2ce8f5;

  --font-pixel: 'Silkscreen', monospace;
  --font-ui: 'Silkscreen', monospace;
  --font-mono: 'Silkscreen', monospace;
  /* Texto largo (descripciones, diálogos, manual): pixel legible con carácter; sin conexión, monospace */
  --font-body: 'Pixelify Sans', 'Silkscreen', ui-monospace, 'Courier New', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 0 !important;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--cream);
  font-family: var(--font-ui);
}

canvas {
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

.pixel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: var(--bg-deep);
  background-image:
    linear-gradient(45deg, var(--bg-tile) 25%, transparent 25%),
    linear-gradient(-45deg, var(--bg-tile) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--bg-tile) 75%),
    linear-gradient(-45deg, transparent 75%, var(--bg-tile) 75%);
  background-size: 32px 32px;
  background-position: 0 0, 0 16px, 16px -16px, -16px 0;
  animation: scrollTiles 22s linear infinite;
  pointer-events: none;
}

.pixel-scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 4px,
    rgba(0, 0, 0, 0.12) 4px,
    rgba(0, 0, 0, 0.12) 6px
  );
  pointer-events: none;
}

@keyframes scrollTiles {
  from { background-position: 0 0, 0 16px, 16px -16px, -16px 0; }
  to   { background-position: 32px 32px, 32px 48px, 48px 16px, 16px 32px; }
}

/* =========================================================================
   2. CARCASA DE CONSOLA PORTATIL 16:9 CON REMACHES METALICOS
   ========================================================================= */
.console-viewport {
  position: relative;
  z-index: 2;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}

.console-shell {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--navy-deep);
  border: none;
  box-shadow: none;
  padding: 0;
  display: flex;
}

.rivet {
  display: none;
}

#app {
  width: 100%;
  height: 100%;
  background: var(--navy);
  border: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* =========================================================================
   3. BOTONES Y PANELES RETRO 3D
   ========================================================================= */
.px-panel {
  background: var(--cream);
  color: var(--ink);
  border: 4px solid var(--ink);
  box-shadow:
    inset 4px 4px 0 var(--cream-hi),
    inset -4px -4px 0 var(--cream-lo),
    6px 6px 0 var(--ink);
}

.px-btn {
  font-family: var(--font-pixel);
  border: 3px solid var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  text-transform: uppercase;
  letter-spacing: 0;
  transition: transform 0.04s steps(2), box-shadow 0.04s steps(2);
  outline: none;
}

.px-btn:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 2px;
}

.px-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: saturate(0.35);
}

.btn-cream {
  background: var(--cream);
  color: var(--ink);
  box-shadow:
    inset 3px 3px 0 var(--cream-hi),
    inset -3px -3px 0 var(--cream-lo),
    0 4px 0 var(--ink);
}
.btn-cream:hover:not(:disabled) { background: #ffffff; }
.btn-cream:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: inset 3px 3px 0 var(--cream-lo), 0 1px 0 var(--ink);
}

.btn-slate {
  background: var(--slate);
  color: var(--cream);
  box-shadow:
    inset 2px 2px 0 var(--slate-hi),
    inset -2px -2px 0 var(--slate-lo),
    0 3px 0 var(--ink);
}
.btn-slate:hover:not(:disabled) { background: #46537a; }
.btn-slate:active:not(:disabled),
.btn-slate.active {
  transform: translateY(2px);
  background: var(--gold);
  color: var(--ink);
  box-shadow:
    inset 2px 2px 0 var(--gold-hi),
    inset -2px -2px 0 var(--gold-lo),
    0 1px 0 var(--ink);
}

/* Botonera arcade 3D gruesa */
.btn-arcade-green {
  background: var(--green);
  color: #ffffff;
  text-shadow: 2px 2px 0 var(--ink);
  box-shadow:
    inset 4px 4px 0 var(--green-hi),
    inset -4px -4px 0 var(--green-lo),
    0 6px 0 #104222,
    0 8px 0 var(--ink);
}
.btn-arcade-green:hover:not(:disabled) { background: #36cc67; }
.btn-arcade-green:active:not(:disabled) {
  transform: translateY(5px);
  box-shadow:
    inset 4px 4px 0 var(--green-lo),
    inset -4px -4px 0 var(--green-hi),
    0 1px 0 var(--ink);
}

.btn-arcade-red {
  background: var(--red);
  color: #ffffff;
  text-shadow: 2px 2px 0 var(--ink);
  box-shadow:
    inset 4px 4px 0 var(--red-hi),
    inset -4px -4px 0 var(--red-lo),
    0 6px 0 #591118,
    0 8px 0 var(--ink);
}
.btn-arcade-red:hover:not(:disabled) { background: #f24b55; }
.btn-arcade-red:active:not(:disabled) {
  transform: translateY(5px);
  box-shadow:
    inset 4px 4px 0 var(--red-lo),
    inset -4px -4px 0 var(--red-hi),
    0 1px 0 var(--ink);
}

.btn-arcade-blue {
  background: var(--blue);
  color: #ffffff;
  text-shadow: 2px 2px 0 var(--ink);
  box-shadow:
    inset 4px 4px 0 var(--blue-hi),
    inset -4px -4px 0 var(--blue-lo),
    0 6px 0 #093066,
    0 8px 0 var(--ink);
}
.btn-arcade-blue.btn-xs-pad {
  box-shadow:
    inset 2px 2px 0 var(--blue-hi),
    inset -2px -2px 0 var(--blue-lo),
    0 3px 0 var(--ink);
}
.btn-arcade-blue:hover:not(:disabled) { background: #339cff; }
.btn-arcade-blue:active:not(:disabled) {
  transform: translateY(5px);
  box-shadow:
    inset 4px 4px 0 var(--blue-lo),
    inset -4px -4px 0 var(--blue-hi),
    0 1px 0 var(--ink);
}

.btn-gold {
  background: var(--gold);
  color: var(--ink);
  box-shadow:
    inset 3px 3px 0 var(--gold-hi),
    inset -3px -3px 0 var(--gold-lo),
    0 5px 0 var(--ink);
}
.btn-gold:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: inset 3px 3px 0 var(--gold-lo), 0 1px 0 var(--ink);
}

.btn-icon-sq { width: 40px; height: 40px; padding: 0; }
.btn-icon-xs { width: 30px; height: 30px; padding: 0; }
.btn-muted-off { opacity: 0.55; filter: grayscale(0.6); }
.btn-sm-pad { padding: 8px 12px; font-size: 9px; }
.btn-xs-pad { padding: 6px 10px; font-size: 8px; }

.px-icon { display: inline-block; flex-shrink: 0; }
.coin-spin { animation: coinBob 1.1s steps(2) infinite; }
@keyframes coinBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* =========================================================================
   4. VISTAS PRINCIPALES
   ========================================================================= */
.view {
  display: none;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 2;
}
.view.active {
  display: flex;
  animation: viewSlideIn 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes viewSlideIn {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ----- MENU PRINCIPAL ----- */
#view-menu {
  flex-direction: column;
  padding: 8px 16px 10px;
  gap: 8px;
}

.speech-bubble {
  position: relative;
  background: var(--cream);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 7px 10px;
  font-family: var(--font-mono);
  font-size: 20px;
  line-height: 1.05;
  text-align: center;
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.speech-bubble.compact {
  font-size: 18px;
  padding: 4px 6px;
  min-height: 30px;
}

#menu-scene { width: 256px; height: 192px; }

@keyframes feverPulse {
  0%, 100% { border-color: var(--gold-hi); }
  50%      { border-color: var(--red-hi); }
}

.risk-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

