/**
 * Gorillas Retro Arcade Cabinet Stylesheet
 * Authentic 1991 MS-DOS / QBasic EGA Aesthetic
 */

:root {
  --bg-dark: #070b19;
  --panel-bg: #0d1527;
  --panel-border: #1e293b;
  --ega-yellow: #ffff55;
  --ega-cyan: #55ffff;
  --ega-blue: #0000aa;
  --ega-red: #ef4444;
  --ega-green: #22c55e;
  --text-main: #f8fafc;
  --text-dim: #94a3b8;
  --font-retro: 'Press Start 2P', monospace, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-retro);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Header */
.arcade-header {
  width: 100%;
  max-width: 880px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 2px solid var(--panel-border);
  background: rgba(13, 21, 39, 0.9);
  backdrop-filter: blur(8px);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-back {
  color: var(--ega-cyan);
  text-decoration: none;
  font-size: 0.75rem;
  padding: 6px 10px;
  border: 1px solid rgba(85, 255, 255, 0.4);
  border-radius: 4px;
  background: rgba(85, 255, 255, 0.08);
  transition: all 0.2s ease;
}

.brand-back:hover {
  background: rgba(85, 255, 255, 0.25);
  box-shadow: 0 0 10px rgba(85, 255, 255, 0.4);
}

.brand-title {
  font-size: 1.1rem;
  letter-spacing: 2px;
  color: var(--ega-yellow);
  text-shadow: 0 0 10px rgba(255, 255, 85, 0.6);
}

.header-controls {
  display: flex;
  gap: 8px;
}

.arcade-btn {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  font-family: var(--font-retro);
  font-size: 0.65rem;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.arcade-btn:hover {
  border-color: var(--ega-yellow);
  color: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 85, 0.3);
}

.arcade-btn.active {
  background: rgba(255, 255, 85, 0.15);
  border-color: var(--ega-yellow);
  color: var(--ega-yellow);
}

/* Cabinet Stage */
.cabinet-stage {
  width: 100%;
  max-width: 880px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.cabinet-sub-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.65rem;
  color: var(--text-dim);
  padding: 0 4px;
}

.stage-title {
  color: var(--ega-cyan);
  letter-spacing: 1px;
}

/* Scoreboard HUD */
.scoreboard {
  width: 100%;
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  border-radius: 6px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr 0.8fr 1fr 1.6fr 2fr;
  align-items: center;
  gap: 12px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hud-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hud-label {
  font-size: 0.55rem;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.hud-val {
  font-size: 0.85rem;
  font-weight: bold;
}

.player-score {
  color: #38bdf8;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

.round-val {
  color: #fff;
}

.ai-score {
  color: #f87171;
  text-shadow: 0 0 8px rgba(248, 113, 113, 0.5);
}

.wind-hud {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wind-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wind-dir {
  font-size: 0.7rem;
}

.wind-speed {
  font-size: 0.75rem;
  color: #fff;
}

.wind-meter-container {
  width: 100%;
  height: 6px;
  background: #1e293b;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.wind-meter-fill {
  height: 100%;
  width: 50%;
  background: var(--ega-yellow);
  transition: width 0.3s ease, background-color 0.3s ease;
}

.status-hud {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.turn-status {
  font-size: 0.65rem;
  color: #4ade80;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Cabinet Frame & Canvas */
.cabinet-frame {
  width: 100%;
  background: #000;
  border: 4px solid #1e293b;
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8), inset 0 0 15px rgba(0, 0, 0, 0.9);
}

.canvas-container {
  position: relative;
  width: 100%;
  aspect-ratio: 800 / 550;
  background: #000;
  border-radius: 4px;
  overflow: hidden;
}

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

/* CRT Scanline Filter */
.crt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.25) 50%
  ), linear-gradient(
    90deg,
    rgba(255, 0, 0, 0.03),
    rgba(0, 255, 0, 0.01),
    rgba(0, 0, 255, 0.03)
  );
  background-size: 100% 3px, 6px 100%;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.6);
  z-index: 10;
}

/* Controls Deck */
.controls-deck {
  width: 100%;
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  border-radius: 6px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  gap: 16px;
}

.control-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.control-label-row label {
  font-size: 0.6rem;
  color: var(--text-dim);
}

.control-label-row input[type="number"] {
  width: 60px;
  background: #040711;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  color: var(--ega-yellow);
  font-family: var(--font-retro);
  font-size: 0.75rem;
  padding: 4px 6px;
  text-align: center;
}

.control-label-row input[type="number"]:focus {
  outline: none;
  border-color: var(--ega-yellow);
  box-shadow: 0 0 8px rgba(255, 255, 85, 0.4);
}

.arcade-slider {
  width: 100%;
  accent-color: var(--ega-yellow);
  cursor: pointer;
}

.throw-box {
  align-items: center;
}

.btn-throw {
  width: 100%;
  height: 48px;
  background: linear-gradient(180deg, #facc15, #eab308);
  border: none;
  border-radius: 6px;
  color: #000;
  font-family: var(--font-retro);
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  box-shadow: 0 4px 0 #854d0e, 0 6px 12px rgba(234, 179, 8, 0.4);
  transition: all 0.1s ease;
}

.btn-throw:hover:not(:disabled) {
  background: linear-gradient(180deg, #fde047, #facc15);
  box-shadow: 0 4px 0 #854d0e, 0 8px 16px rgba(234, 179, 8, 0.6);
  transform: translateY(-1px);
}

.btn-throw:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #854d0e, 0 2px 4px rgba(234, 179, 8, 0.3);
}

.btn-throw:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-sub {
  font-size: 0.55rem;
  color: #451a03;
}

.controls-hint {
  font-size: 0.58rem;
  color: var(--text-dim);
  text-align: center;
  letter-spacing: 0.5px;
  line-height: 1.4;
}

/* Responsive */
@media (max-width: 768px) {
  .scoreboard {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .wind-hud {
    grid-column: span 3;
  }
  .status-hud {
    grid-column: span 3;
  }
  .controls-deck {
    grid-template-columns: 1fr;
  }
}
