:root {
  --case-bg: #1a1d29;
  --case-border: #2e344a;
  --bezel: #0d111a;
  --screen-bg: #090c14;
  --accent: #38bdf8;
  --neon-green: #22c55e;
  --neon-red: #ef4444;
  --neon-yellow: #f59e0b;
  --btn-red: #e11d48;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --card-bg: #111625;
  --input-bg: #06080f;
  --border-dim: #1e263d;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background: #06080d;
  color: var(--text);
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Mono', monospace;
  overflow: hidden;
}

/* CONSOLE CHASSIS */
.console-shell {
  background: var(--case-bg);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 4px 8px;
  padding-bottom: max(4px, env(safe-area-inset-bottom));
  padding-left: max(8px, env(safe-area-inset-left));
  padding-right: max(8px, env(safe-area-inset-right));
  position: relative;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.console-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 4px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #8d99ae;
  flex-shrink: 0;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
}

.brand-domain {
  font-size: 6px;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.power-led {
  display: flex;
  align-items: center;
  gap: 5px;
}

.led-dot {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 6px #22c55e;
  cursor: pointer;
}

.controller-status {
  color: #38bdf8;
  font-size: 7px;
  margin-left: 8px;
  display: none;
}

.hud-btn {
  background: #242b3d;
  color: var(--accent);
  border: 1px solid var(--border-dim);
  padding: 3px 6px;
  border-radius: 4px;
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s;
}

.hud-btn:hover {
  background: #333d54;
  color: #fff;
}

.hud-btn:active {
  background: var(--accent);
  color: #000;
}

.screen-bezel {
  background: var(--bezel);
  flex: 1;
  border-radius: 8px;
  border: 2px solid var(--case-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.game-hud {
  background: #0f1524;
  border-bottom: 2px solid var(--border-dim);
  padding: 4px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  flex-shrink: 0;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--accent);
}

.hud-stats {
  display: flex;
  gap: 10px;
  align-items: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
}

.deck-container {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  background: var(--screen-bg);
  min-height: 0;
}

/* CONTROLLER BAR */
.controller-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 4px 0;
  height: 58px;
  flex-shrink: 0;
}

.dpad-container {
  position: relative;
  width: 56px;
  height: 56px;
}

.dpad-btn {
  position: absolute;
  background: #141724;
  border: 1px solid #334155;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 9px;
  user-select: none;
  transition: background 0.1s;
}

.dpad-btn:active {
  background: var(--accent);
  color: #000;
}

.dpad-up { top: 0; left: 19px; width: 18px; height: 18px; border-radius: 3px 3px 0 0; }
.dpad-down { bottom: 0; left: 19px; width: 18px; height: 18px; border-radius: 0 0 3px 3px; }
.dpad-left { top: 19px; left: 0; width: 18px; height: 18px; border-radius: 3px 0 0 3px; }
.dpad-right { top: 19px; right: 0; width: 18px; height: 18px; border-radius: 0 3px 3px 0; }
.dpad-center { top: 19px; left: 19px; width: 18px; height: 18px; background: #141724; }

.action-cluster {
  display: flex;
  gap: 10px;
  align-items: center;
}

.action-btn-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--btn-red);
  border: none;
  box-shadow: 0 2px 0 #881337;
  cursor: pointer;
  color: white;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  font-weight: bold;
  transition: transform 0.05s, filter 0.05s;
}

.action-btn:active {
  transform: translateY(2px);
  box-shadow: none;
  filter: brightness(1.2);
}

.action-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 5px;
  color: #8d99ae;
}

.utility-cluster {
  display: flex;
  gap: 10px;
  align-items: center;
}

.utility-btn-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.pill-btn {
  width: 34px;
  height: 9px;
  background: #475569;
  border-radius: 6px;
  border: 1px solid #1e293b;
  cursor: pointer;
  transform: rotate(-25deg);
  transition: background 0.1s;
}

.pill-btn:active {
  background: var(--accent);
}

.pill-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 5px;
  color: #8d99ae;
}

/* MODAL OVERLAYS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 7, 12, 0.95);
  z-index: 99990;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.cutscene-dialogue {
  background: #0f172a;
  border: 2px solid var(--accent);
  border-radius: 8px;
  width: 100%;
  max-width: 560px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.25);
}

.cutscene-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--accent);
}

.cutscene-desc {
  font-size: 10px;
  line-height: 1.45;
  color: #cbd5e1;
}

.btn-press-start {
  background: var(--accent);
  color: #000;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  padding: 9px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: filter 0.1s;
}

.btn-press-start:hover {
  filter: brightness(1.1);
}

@media screen and (orientation: portrait) and (max-width: 900px) {
  #rotate-lock { display: flex !important; }
}

/* DESKTOP RESPONSIVE SCALING */
@media (min-width: 1024px) {
  .console-shell {
    max-width: 1600px;
    height: 92vh;
    height: 92dvh;
    border-radius: 20px;
    border: 4px solid var(--case-border);
    box-shadow: 0 25px 60px rgba(0,0,0,0.85);
    padding: 14px 18px;
  }
  .console-topbar { font-size: 10px; padding-bottom: 8px; }
  .brand-domain { font-size: 8px; }
  .power-led .led-dot { width: 8px; height: 8px; }
  .controller-status { font-size: 9px; margin-left: 12px; }
  .hud-btn { font-size: 9px; padding: 5px 10px; }
  .game-hud { padding: 8px 16px; }
  .hud-title { font-size: 11px; }
  .hud-stats { font-size: 10px; gap: 14px; }
  .controller-bar { height: 78px; padding: 8px 10px 0; }
  .dpad-container { width: 72px; height: 72px; }
  .dpad-btn { font-size: 11px; }
  .dpad-up { top: 0; left: 24px; width: 24px; height: 24px; }
  .dpad-down { bottom: 0; left: 24px; width: 24px; height: 24px; }
  .dpad-left { top: 24px; left: 0; width: 24px; height: 24px; }
  .dpad-right { top: 24px; right: 0; width: 24px; height: 24px; }
  .dpad-center { top: 24px; left: 24px; width: 24px; height: 24px; }
  .action-cluster { gap: 14px; }
  .action-btn { width: 42px; height: 42px; font-size: 10px; box-shadow: 0 3px 0 #881337; }
  .action-label { font-size: 7px; }
  .utility-cluster { gap: 16px; }
  .pill-btn { width: 44px; height: 12px; }
  .pill-label { font-size: 7px; }
  .cutscene-dialogue { max-width: 680px; padding: 22px; gap: 14px; }
  .cutscene-title { font-size: 10px; }
  .cutscene-desc { font-size: 12px; line-height: 1.6; }
  .btn-press-start { font-size: 9px; padding: 12px; }
}

@media (min-width: 1800px) {
  .console-shell {
    max-width: 2150px;
    height: 90vh;
    height: 90dvh;
    padding: 18px 24px;
    border-radius: 24px;
  }
  .console-topbar { font-size: 12px; padding-bottom: 12px; }
  .hud-btn { font-size: 10px; padding: 6px 12px; }
  .game-hud { padding: 12px 20px; }
  .hud-title { font-size: 13px; }
  .hud-stats { font-size: 12px; gap: 18px; }
  .controller-bar { height: 95px; padding: 10px 14px 0; }
  .dpad-container { width: 88px; height: 88px; }
  .dpad-btn { font-size: 13px; }
  .dpad-up { top: 0; left: 29px; width: 30px; height: 30px; }
  .dpad-down { bottom: 0; left: 29px; width: 30px; height: 30px; }
  .dpad-left { top: 29px; left: 0; width: 30px; height: 30px; }
  .dpad-right { top: 29px; right: 0; width: 30px; height: 30px; }
  .dpad-center { top: 29px; left: 29px; width: 30px; height: 30px; }
  .action-btn { width: 50px; height: 50px; font-size: 12px; box-shadow: 0 4px 0 #881337; }
  .action-label { font-size: 8px; }
  .pill-btn { width: 52px; height: 14px; }
  .pill-label { font-size: 8px; }
}
