/*
 * Copyright (C) 2026 Fabiano Braga // 4u-Labs (4u.ia.br)
 * Licensed under GNU AGPL-3.0
 */
:root {
  --bg-room: #0f0b08;
  --wood-1: #5a3216;
  --wood-2: #3c200d;
  --wood-3: #72411d;
  --metal-1: #2a2826;
  --metal-2: #181615;
  --amber: #ffd43b;
  --red-arcade: #e81818;
  --blue-arcade: #2060ff;
  --text: #f5ebd6;
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 15%, #2a1d14 0%, #120d0a 60%, #090605 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* --- Topbar --- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(16, 12, 9, 0.94);
  border-bottom: 1px solid #3c2818;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  height: 22px;
  width: auto;
}

.brand-badge {
  background: var(--red-arcade);
  color: #fff;
  font-weight: 800;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.06em;
}

.brand-title {
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--amber);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.top-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #241c16;
  color: #e6d8c0;
  border: 1px solid #4d3724;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s ease, background 0.15s ease;
}

.top-btn:hover {
  background: #35281e;
  border-color: var(--amber);
}

.top-btn.active {
  border-color: #d97706;
  color: var(--amber);
}

.install-btn {
  display: none;
  background: linear-gradient(135deg, #2060ff, #0ea5e9);
  border-color: #38bdf8;
  color: #fff;
}

.eco-btn {
  border-color: #38bdf8;
  color: #7dd3fc;
}

.donate-btn {
  border-color: #ef4444;
  color: #fca5a5;
}

/* --- Retro Console Stage --- */
.retro-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 10px;
}

.console-cabinet {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 740px;
  background: linear-gradient(180deg, #2d2926 0%, #191716 100%);
  border-radius: 18px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.78),
    inset 0 2px 3px rgba(255, 255, 255, 0.14),
    0 0 0 2px #0f0d0b;
  overflow: hidden;
}

.wood-cheek {
  width: 22px;
  flex-shrink: 0;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.14) 0px,
      rgba(0, 0, 0, 0.14) 2px,
      transparent 2px,
      transparent 6px
    ),
    linear-gradient(180deg, var(--wood-3) 0%, var(--wood-1) 45%, var(--wood-2) 100%);
  border-right: 1px solid #120c08;
  border-left: 1px solid #120c08;
}

.cabinet-core {
  flex: 1;
  min-width: 0;
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Marquee */
.marquee-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #110f0d;
  border: 2px solid #3a342e;
  border-radius: 10px;
  padding: 7px 10px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.85);
}

.speaker-grille {
  width: 44px;
  height: 22px;
  border-radius: 4px;
  background: repeating-linear-gradient(
    0deg,
    #060505 0px,
    #060505 2px,
    #2b2622 2px,
    #2b2622 4px
  );
  opacity: 0.9;
  flex-shrink: 0;
}

.marquee-sign {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(90deg, #b91c1c, #ea580c, #eab308, #ea580c, #b91c1c);
  border-radius: 6px;
  padding: 4px 10px;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.25);
  overflow: hidden;
}

.marquee-title {
  font-family: 'Courier New', monospace;
  font-weight: 900;
  font-size: 1.25rem;
  letter-spacing: 0.14em;
  color: #111;
  text-shadow: 0 1px 0 #fef08a;
}

.marquee-sub {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #1e1206;
  white-space: nowrap;
}

.marquee-checkers {
  width: 24px;
  height: 14px;
  background-image:
    linear-gradient(45deg, #111 25%, transparent 25%),
    linear-gradient(-45deg, #111 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #111 75%),
    linear-gradient(-45deg, transparent 75%, #111 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
  flex-shrink: 0;
}

/* CRT Bezel & Screen */
.crt-bezel {
  background: linear-gradient(145deg, #1b1918, #0c0b0a);
  padding: 14px;
  border-radius: 16px;
  border: 2px solid #3c3631;
  box-shadow:
    inset 0 6px 20px rgba(0, 0, 0, 0.9),
    0 4px 12px rgba(0, 0, 0, 0.5);
}

.crt-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 288 / 224;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  border: 3px solid #080808;
  box-shadow: 0 0 28px rgba(32, 96, 255, 0.12);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.crt-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.28) 0px,
    rgba(0, 0, 0, 0.28) 1px,
    transparent 1px,
    transparent 3px
  );
  transition: opacity 0.2s ease;
}

.crt-glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.08) 0%, transparent 48%),
    radial-gradient(circle at 50% 50%, transparent 62%, rgba(0, 0, 0, 0.45) 100%);
  transition: opacity 0.2s ease;
}

.crt-screen.crt-on .crt-scanlines,
.crt-screen.crt-on .crt-glare {
  opacity: 1;
}

.crt-off-overlay {
  position: absolute;
  inset: 0;
  background: #050505;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.crt-off-overlay.active {
  opacity: 1;
}

.crt-screen.warmup {
  animation: crtWarmup 0.38s ease-out;
}

@keyframes crtWarmup {
  0% { filter: brightness(2.4) contrast(1.4); transform: scaleY(0.08); }
  50% { filter: brightness(1.6); transform: scaleY(0.95); }
  100% { filter: brightness(1); transform: scaleY(1); }
}

/* --- Control Deck --- */
.control-deck {
  display: grid;
  grid-template-columns: 128px 1fr 116px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #272320 0%, #191614 100%);
  border: 2px solid #40372f;
  border-radius: 14px;
  box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.07);
}

/* 4-Way Joystick */
.deck-left {
  display: flex;
  justify-content: center;
}

.joystick-well {
  position: relative;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: radial-gradient(circle, #0e0c0b 0%, #1d1916 70%, #312a24 100%);
  border: 3px solid #483d34;
  box-shadow: inset 0 8px 18px rgba(0, 0, 0, 0.9);
  touch-action: none;
  user-select: none;
  cursor: pointer;
}

.dir-hint {
  position: absolute;
  font-size: 0.65rem;
  color: rgba(255, 212, 59, 0.42);
  pointer-events: none;
}
.dir-n { top: 6px; left: 50%; transform: translateX(-50%); }
.dir-s { bottom: 6px; left: 50%; transform: translateX(-50%); }
.dir-e { right: 8px; top: 50%; transform: translateY(-50%); }
.dir-w { left: 8px; top: 50%; transform: translateY(-50%); }

.joystick-dustwasher {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #080707;
  border: 2px solid #2b2520;
  pointer-events: none;
}

.joystick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 46px;
  height: 46px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ff6b6b 0%, #e81818 52%, #7f0c0c 100%);
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.85), inset 0 -4px 8px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  transition: transform 0.06s ease-out;
}

.knob-shine {
  position: absolute;
  top: 8px;
  left: 10px;
  width: 12px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.48);
  transform: rotate(-28deg);
}

/* Center Switches & LEDs */
.deck-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.led-strip {
  display: flex;
  gap: 16px;
  background: #100e0d;
  border: 1px solid #352d26;
  border-radius: 999px;
  padding: 4px 12px;
}

.led-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #a89984;
}

.led-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2b1818;
  border: 1px solid #000;
}

.led-dot.on {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.led-dot.led-amber.warn {
  background: #f59e0b;
  box-shadow: 0 0 9px #f59e0b;
  animation: pulseLed 0.45s infinite alternate;
}

@keyframes pulseLed {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

.switches-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.metal-switch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: #d6c5ae;
  cursor: pointer;
  padding: 2px 4px;
}

.sw-lever {
  position: relative;
  width: 24px;
  height: 30px;
  border-radius: 6px;
  background: linear-gradient(180deg, #9ca3af 0%, #4b5563 50%, #1f2937 100%);
  border: 2px solid #111;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.7);
}

.sw-lever::after {
  content: '';
  position: absolute;
  left: 3px;
  right: 3px;
  top: 4px;
  height: 10px;
  border-radius: 3px;
  background: linear-gradient(180deg, #f3f4f6, #9ca3af);
  transition: transform 0.12s ease;
}

.metal-switch.is-off .sw-lever::after,
.metal-switch.is-alt .sw-lever::after {
  transform: translateY(10px);
}

.sw-lbl {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.sw-val {
  font-style: normal;
  color: var(--amber);
}

.arcade-btns-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.coin-btn, .start-btn, .mini-console-btn {
  border: none;
  border-radius: 6px;
  font-weight: 800;
  font-size: 0.7rem;
  padding: 7px 11px;
  cursor: pointer;
  letter-spacing: 0.04em;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.7);
  transition: transform 0.06s ease;
}

.coin-btn:active, .start-btn:active, .mini-console-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}

.coin-btn {
  background: linear-gradient(180deg, #f59e0b, #b45309);
  color: #111;
}

.start-btn {
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
  color: #fff;
}

.mini-console-btn {
  background: #37302a;
  color: #e6d8c0;
  border: 1px solid #57493e;
}

/* Concave Red SMOKE Button */
.deck-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.smoke-button {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 4px solid #120f0d;
  background: radial-gradient(circle, #7f1d1d 0%, #b91c1c 68%, #ef4444 100%);
  box-shadow:
    0 8px 16px rgba(0, 0, 0, 0.8),
    inset 0 6px 12px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}

.smoke-button.pressed,
.smoke-button:active {
  transform: scale(0.95) translateY(2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.8), inset 0 8px 14px rgba(0, 0, 0, 0.65);
}

.smoke-cap {
  color: #fff;
  font-weight: 900;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
}

.smoke-label {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--amber);
}

/* --- Footer --- */
.site-footer {
  padding: 10px 14px 14px;
  text-align: center;
  font-size: 0.75rem;
  color: #9e8a72;
  border-top: 1px solid #2b2017;
  background: rgba(12, 9, 7, 0.85);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 10px;
  margin-bottom: 4px;
}

.site-footer a {
  color: #e6c67c;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* --- Modals --- */
.modal-backdrop[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 540px;
  background: #1d1510;
  border: 2px solid #6b4423;
  border-radius: 14px;
  padding: 18px 20px;
  color: var(--text);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-sm {
  max-width: 360px;
  text-align: center;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #3c2818;
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.02rem;
  color: var(--amber);
}

.modal-close {
  background: #2f2219;
  border: 1px solid #5b402a;
  color: #fff;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  cursor: pointer;
}

.eco-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.eco-col h3 {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: #ff8c42;
}

.eco-col a {
  display: block;
  padding: 5px 8px;
  margin-bottom: 4px;
  border-radius: 6px;
  background: #281d15;
  color: #f5ebd6;
  text-decoration: none;
  font-size: 0.82rem;
}

.eco-col a:hover {
  background: #3a2a1e;
  color: var(--amber);
}

.modal-foot {
  margin-top: 14px;
  text-align: center;
}

.paypal-cta {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
}

.help-list {
  padding-left: 18px;
  margin: 8px 0 14px;
  font-size: 0.86rem;
  line-height: 1.55;
  color: #decbb2;
}

.hs-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
}

.hs-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #35261b;
}

.hs-entry-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}

#hs-initials-input {
  width: 88px;
  text-align: center;
  font-family: 'Courier New', monospace;
  font-size: 1.25rem;
  font-weight: 800;
  text-transform: uppercase;
  background: #0f0b08;
  color: var(--amber);
  border: 2px solid #6b4423;
  border-radius: 8px;
  padding: 6px;
}

/* --- Responsive Mobile --- */
@media (max-width: 680px) {
  .wood-cheek { width: 10px; }
  .cabinet-core { padding: 8px 8px 12px; gap: 8px; }
  .speaker-grille, .marquee-checkers, .marquee-sub { display: none; }
  .crt-bezel { padding: 7px; border-radius: 10px; }
  .control-deck {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "joy smoke"
      "mid mid";
    gap: 10px;
    padding: 10px;
  }
  .deck-left { grid-area: joy; }
  .deck-right { grid-area: smoke; }
  .deck-center { grid-area: mid; }
  .joystick-well { width: 104px; height: 104px; }
  .smoke-button { width: 84px; height: 84px; }
  .eco-grid { grid-template-columns: 1fr; }
}
