/* ==========================================================================
   KENOMA ARCADE — PROJECTION CHAMBER (THE ANALOG CRT DECK)
   Style Philosophy: Industrial Studio Terminal / Quiet Precision
   ========================================================================== */

:root {
  --bg-deep: #0a0c0b;
  --bg-chassis: #121513;
  --bg-bezel: #181d19;
  --bg-screen: #0b100d;
  --amber: #d99a38;
  --amber-glow: rgba(217, 154, 56, 0.18);
  --verdant: #2bd49e;
  --verdant-glow: rgba(43, 212, 158, 0.16);
  --text-primary: #e6eae7;
  --text-muted: #7c8880;
  --line-dim: #222924;
  --line-bright: #344038;
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-mono: 'DM Mono', monospace;
  --font-sans: 'DM Sans', -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.deck-body {
  display: flex;
  flex-direction: column;
  padding: clamp(14px, 2.5vw, 36px);
}

.deck-shell {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 3vh, 32px);
}

/* ==========================================================================
   HEADER / TOP MASTHEAD
   ========================================================================== */
.deck-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-dim);
  padding-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.deck-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.deck-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  text-decoration: none;
  font-family: var(--font-serif);
  letter-spacing: 0.12em;
  font-size: 15px;
  transition: color 0.2s;
}

.deck-back-link:hover {
  color: var(--amber);
}

.deck-back-arrow {
  color: var(--amber);
  font-size: 16px;
  transition: transform 0.2s;
}

.deck-back-link:hover .deck-back-arrow {
  transform: translateX(-3px);
}

.deck-brand-name small {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  display: block;
}

.deck-divider {
  color: var(--line-bright);
}

.deck-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--amber);
  letter-spacing: 0.18em;
}

.deck-controls {
  display: flex;
  align-items: center;
  gap: 18px;
}

.deck-lang {
  display: inline-flex;
  border: 1px solid var(--line-dim);
  border-radius: 4px;
  overflow: hidden;
}

.dlang-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.dlang-btn.is-active {
  background: var(--line-bright);
  color: var(--text-primary);
}

.deck-power {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--verdant);
  letter-spacing: 0.12em;
}

.crt-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--verdant);
  box-shadow: 0 0 8px var(--verdant);
}

/* ==========================================================================
   MAIN TWO-COLUMN STAGE
   ========================================================================== */
.deck-main {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr);
  gap: clamp(20px, 3.5vw, 44px);
  align-items: stretch;
}

/* --- LEFT COLUMN: CRT MONITOR --- */
.screen-column {
  display: flex;
  flex-direction: column;
}

.monitor-chassis {
  background: var(--bg-chassis);
  border: 1px solid var(--line-dim);
  border-radius: 12px;
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 16px 40px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.monitor-bezel {
  background: var(--bg-bezel);
  border: 1px solid #131715;
  border-radius: 8px;
  padding: 12px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.8);
}

.crt-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--bg-screen);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.9);
  cursor: crosshair;
}

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

/* CRT Shader Visual Overlays */
.crt-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.45) 50%);
  background-size: 100% 4px;
  z-index: 2;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.crt-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.85), inset 0 0 10px rgba(0, 0, 0, 0.95);
  z-index: 3;
}

.crt-noise {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.04;
  background: repeating-radial-gradient(#fff 0 0.0001%, #000 0 0.0002%);
  z-index: 4;
}

.crt-viewport.no-scanlines .crt-scanlines {
  opacity: 0;
}

/* In-Monitor HUD */
.crt-hud {
  position: absolute;
  inset: 12px 14px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--amber);
  text-shadow: 0 0 6px var(--amber-glow);
  z-index: 5;
  user-select: none;
}

.hud-top, .hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* CRT Phosphor modes */
.crt-viewport.phosphor-verdant .crt-hud {
  color: var(--verdant);
  text-shadow: 0 0 6px var(--verdant-glow);
}

.crt-viewport.phosphor-verdant canvas {
  filter: hue-rotate(65deg) saturate(1.2);
}

.crt-viewport.crt-glitch {
  animation: crtGlitchShift 0.15s ease-in-out;
}

@keyframes crtGlitchShift {
  0% { transform: translate(0, 0); filter: invert(0.2) contrast(1.5); }
  25% { transform: translate(-3px, 2px); }
  50% { transform: translate(3px, -2px); filter: brightness(1.6); }
  75% { transform: translate(-1px, 1px); }
  100% { transform: translate(0, 0); filter: none; }
}

/* Chassis Bottom Bar */
.monitor-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
  padding: 0 4px;
  flex-wrap: wrap;
  gap: 8px;
}

.chassis-labels {
  display: flex;
  flex-direction: column;
  gap: 3px;
  letter-spacing: 0.1em;
}

.control-knobs {
  display: flex;
  gap: 8px;
}

.knob-btn {
  background: #191f1b;
  border: 1px solid var(--line-dim);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.knob-btn:hover {
  border-color: var(--amber);
  color: var(--amber);
}

.knob-btn.active {
  background: #252e28;
  color: var(--verdant);
  border-color: var(--verdant);
}

/* --- RIGHT COLUMN: PROJECT DOSSIER --- */
.dossier-column {
  display: flex;
  flex-direction: column;
}

.dossier-card {
  background: var(--bg-chassis);
  border: 1px solid var(--line-dim);
  border-radius: 12px;
  padding: clamp(20px, 3vw, 36px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
}

.dossier-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
}

.dossier-index {
  color: var(--amber);
}

.dossier-badge {
  background: #1a221d;
  color: var(--verdant);
  border: 1px solid #27362d;
  padding: 3px 8px;
  border-radius: 4px;
}

.dossier-title {
  font-family: var(--font-serif);
  font-size: clamp(28px, 3.2vw, 42px);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.1;
}

.dossier-logline {
  font-size: 14.5px;
  line-height: 1.65;
  color: #b0bbb3;
  border-left: 2px solid var(--amber);
  padding-left: 14px;
}

.dossier-specs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--line-dim);
  border-bottom: 1px solid var(--line-dim);
  padding: 16px 0;
}

.spec-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.spec-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

.spec-val {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

.dossier-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.act-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
  min-width: 150px;
}

.act-btn.primary {
  background: var(--amber);
  color: #121008;
  border: 1px solid var(--amber);
  position: relative;
  overflow: hidden;
}

.act-btn.primary:hover {
  background: #e6a745;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(217, 154, 56, 0.35);
}

.act-btn.primary:active,
.act-btn.primary.is-pulsing {
  transform: scale(0.96);
  box-shadow: 0 0 24px rgba(217, 154, 56, 0.6);
}

/* CRT monitor flash effect on button trigger */
.crt-viewport.crt-flash::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 230, 180, 0.35);
  pointer-events: none;
  z-index: 6;
  animation: crtFlashFade 0.28s ease-out forwards;
}

@keyframes crtFlashFade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

.act-btn.secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--line-bright);
}

.act-btn.secondary:hover {
  border-color: var(--text-primary);
  background: #191f1b;
}

.dossier-note {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
  font-style: italic;
  margin-top: auto;
}

/* ==========================================================================
   CARTRIDGE DECK (BOTTOM SHELF)
   ========================================================================== */
.deck-shelf {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-top: 1px solid var(--line-dim);
  padding-top: 20px;
}

.shelf-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
}

.shelf-tag {
  color: var(--amber);
  font-weight: 600;
}

.shelf-sub {
  color: var(--text-muted);
}

.cartridge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.tape-card {
  background: var(--bg-chassis);
  border: 1px solid var(--line-dim);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.tape-card:hover {
  border-color: var(--line-bright);
  background: #161b18;
  transform: translateY(-2px);
}

.tape-card.is-active {
  border-color: var(--amber);
  background: #181d19;
  box-shadow: 0 0 20px rgba(217, 154, 56, 0.15);
}

.tape-header {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
  letter-spacing: 0.12em;
}

.tape-card.is-active .tape-slot {
  color: var(--amber);
  font-weight: 600;
}

.tape-name {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 400;
  color: var(--text-primary);
  margin-top: 2px;
}

.tape-genre {
  font-size: 11.5px;
  color: var(--text-muted);
}

.tape-strip {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: transparent;
  transition: background 0.2s;
}

.tape-card.is-active .tape-strip {
  background: var(--amber);
}

/* ==========================================================================
   FOCUS VISIBILITY (keyboard users)
   ========================================================================== */
.tape-card:focus-visible,
.act-btn:focus-visible,
.knob-btn:focus-visible,
.dlang-btn:focus-visible,
.dossier-card:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

/* ==========================================================================
   RESPONSIVE LAYOUT (<960px & <600px)
   ========================================================================== */
@media (max-width: 960px) {
  .deck-main {
    grid-template-columns: 1fr;
  }
  .cartridge-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .deck-body {
    padding: 12px;
  }
  .deck-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .deck-brand {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  .deck-tag {
    font-size: 9px;
  }
  .deck-controls {
    width: 100%;
    justify-content: space-between;
  }
  .crt-hud {
    font-size: 8.5px;
    inset: 8px 10px;
  }
  .dossier-actions {
    flex-direction: column;
  }
  .monitor-controls {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================================================
   REDUCED MOTION ACCESSIBILITY (WCAG 2.3.3)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .crt-viewport.crt-glitch {
    animation: none;
  }

  .crt-flash {
    animation: none;
  }
}


@media(max-width:850px){
  button.dlang-btn{min-width:40px;min-height:40px}
  button.knob-btn{min-height:40px;padding-top:8px;padding-bottom:8px}
}
