/* ================================================================
   COLOSSUS WEB — Retro CRT + X-Ray Dashboard
   ================================================================ */

:root {
  --bg:           #0a0a0f;
  --bg-panel:     #0d0d14;
  --border:       #1a1a2e;
  --border-glow:  #2a2a4e;
  --text:         #c0c0d0;
  --text-dim:     #606078;
  --accent:       #00e5ff;
  --accent-dim:   #005f6b;
  --amber:        #ffb300;
  --green:        #33ff33;
  --green-dim:    #0a3a0a;
  --red:          #ff3333;
  --gold:         #c8a84e;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  height: 100%;
}

body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Mono', monospace;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* ================================================================
   HERO SECTION
   ================================================================ */
#hero {
  text-align: center;
  padding: 1.5rem 1rem 1rem;
  background: linear-gradient(180deg, #0e0e1a 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

/* Subtle grid background */
#hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.15;
  pointer-events: none;
}

.hero-inner { position: relative; z-index: 1; }

.hero-title {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  font-size: clamp(0.6rem, 2.5vw, 1.4rem);
  letter-spacing: 0.08em;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.25);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  overflow-wrap: break-word;
}

.hero-team {
  font-size: 0.8rem;
  color: var(--gold);
  letter-spacing: 0.08em;
  margin-bottom: 0;
}

.panel-description {
  padding: 0.5rem 1rem 0.4rem;
  border-bottom: 1px solid var(--border);
}

.panel-description p {
  font-size: 0.65rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 0.25rem;
}

.panel-description p:last-child {
  margin-bottom: 0;
}

.panel-commands {
  margin-top: 0.15rem;
}

.panel-commands .cmd-label {
  color: var(--text-dim);
  font-weight: 500;
}

.panel-commands code {
  color: var(--accent);
  background: rgba(0,229,255,0.06);
  padding: 0.05rem 0.3rem;
  border-radius: 2px;
  font-size: 0.6rem;
}

/* ================================================================
   MAIN PANELS LAYOUT
   ================================================================ */
#panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.panel-label {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  text-transform: uppercase;
  padding: 0.5rem 1rem 0.3rem;
}

/* ================================================================
   CRT TERMINAL (LEFT PANEL)
   ================================================================ */
#crt-panel {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.crt-bezel {
  flex: 1;
  margin: 0 0.8rem 0.8rem;
  background: linear-gradient(180deg, #1e1e28 0%, #18181f 30%, #131318 70%, #0f0f14 100%);
  border-radius: 10px;
  padding: 16px 16px 0 16px;
  position: relative;
  border: 1px solid #2a2a38;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 -1px 0 rgba(0,0,0,0.4),
    0 4px 16px rgba(0,0,0,0.6),
    0 1px 3px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
}

.crt-screen {
  flex: 1;
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  background: #000;
  border: 2px solid #0a0a0e;
  padding: 8px 10px;
  box-shadow:
    inset 0 0 80px rgba(50, 230, 50, 0.05),
    inset 0 0 25px rgba(40, 200, 40, 0.03),
    inset 0 0 15px rgba(0, 0, 0, 0.8),
    0 0 12px rgba(50, 220, 50, 0.04);
}

/* xterm container fills padded screen area */
#terminal {
  width: 100%;
  height: 100%;
}


/* Green phosphor glow — warm P1 phosphor bloom */
#terminal .xterm-screen {
  filter:
    drop-shadow(0 0 1px rgba(80, 255, 80, 0.5))
    drop-shadow(0 0 3px rgba(60, 230, 50, 0.3))
    drop-shadow(0 0 8px rgba(50, 200, 40, 0.12));
}

/* Scanline overlay */
.crt-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(0, 0, 0, 0.15) 1px,
    rgba(0, 0, 0, 0.15) 2px
  );
  pointer-events: none;
  z-index: 10;
}

/* Vignette overlay */
.crt-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 60%,
    rgba(0, 0, 0, 0.4) 100%
  );
  pointer-events: none;
  z-index: 11;
}

/* Subtle flicker */
.crt-flicker {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
  animation: crtFlicker 0.08s infinite;
  opacity: 0;
}

@keyframes crtFlicker {
  0%   { opacity: 0; }
  50%  { opacity: 0.015; background: rgba(200,255,200,0.02); }
  100% { opacity: 0; }
}

/* CRT chin — physical bezel strip below screen */
.crt-chin {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 12px;
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.03);
}

.crt-chin-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Power LED */
.crt-power-led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #222;
  border: 1px solid #0a0a0e;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
  transition: background 0.5s, box-shadow 0.5s;
}
.crt-power-led.orange {
  background: var(--amber);
  border-color: #6b4a00;
  box-shadow:
    0 0 4px var(--amber),
    0 0 10px rgba(255,179,0,0.25),
    inset 0 -1px 1px rgba(0,0,0,0.2);
  animation: ledPulse 1.2s ease-in-out infinite;
}

@keyframes ledPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}
.crt-power-led.green {
  background: var(--green);
  border-color: #1a6b1a;
  box-shadow:
    0 0 4px var(--green),
    0 0 10px rgba(51,255,51,0.25),
    inset 0 -1px 1px rgba(0,0,0,0.2);
}
.crt-power-led.red {
  background: var(--red);
  border-color: #6b1a1a;
  box-shadow:
    0 0 4px var(--red),
    0 0 10px rgba(255,51,51,0.25),
    inset 0 -1px 1px rgba(0,0,0,0.2);
}

/* Restart button — hidden until emulation ends */
.crt-restart {
  display: none;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #8a8a9a;
  background: linear-gradient(180deg, #1e1e28 0%, #16161e 100%);
  border: 1px solid #2a2a38;
  border-radius: 3px;
  padding: 3px 10px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
  user-select: none;
}
.crt-restart:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
  box-shadow: 0 0 6px rgba(0, 229, 255, 0.15);
}
.crt-restart:active {
  background: linear-gradient(180deg, #16161e 0%, #1e1e28 100%);
}
.crt-restart.visible {
  display: block;
}

/* Bezel logo — embossed into plastic */
.crt-logo {
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: #24242e;
  text-shadow: 0 1px 0 rgba(255,255,255,0.04);
  text-transform: uppercase;
  user-select: none;
}

/* ================================================================
   X-RAY PANEL (RIGHT)
   ================================================================ */
#xray-panel {
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Register Canvas */
#chip-container {
  flex: 1;
  min-height: 200px;
  padding: 0 0.5rem;
}

#chipCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Stats Dashboard */
#stats-dashboard {
  padding: 0.4rem 0.8rem 0.6rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.15rem 1rem;
  border-top: 1px solid var(--border);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.15rem 0;
}

.stat-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stat-value {
  font-size: 0.75rem;
  color: #b0b0c0;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.stat-value.mono {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}


/* ================================================================
   RESPONSIVE
   ================================================================ */

/* Tall / large desktop — give panels more room */
@media (min-height: 900px) {
  #hero { padding: 2rem 1rem 1.2rem; }
}

/* Tablet / narrow desktop — stack vertically, scroll */
@media (max-width: 900px) {
  body { overflow-y: auto; }

  #hero {
    padding: 1rem 0.8rem 0.8rem;
    flex-shrink: 0;
  }

  .hero-title { font-size: clamp(0.8rem, 3vw, 1.1rem); }

  .hero-team { font-size: 0.7rem; }

  #panels {
    grid-template-columns: 1fr;
    flex: none;
    overflow: visible;
  }

  #crt-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
    height: max(50vh, 340px);
  }

  #xray-panel {
    min-height: 420px;
  }

  .panel-description {
    padding: 0.4rem 0.8rem 0.3rem;
  }

  .panel-commands code {
    font-size: 0.55rem;
    padding: 0.05rem 0.2rem;
  }
}

/* Small mobile */
@media (max-width: 520px) {
  #hero { padding: 0.8rem 0.6rem 0.6rem; }

  .hero-title {
    font-size: 0.65rem;
    letter-spacing: 0.02em;
    word-break: break-word;
  }

  .hero-team {
    font-size: 0.55rem;
    letter-spacing: 0.02em;
  }

  .panel-label {
    font-size: 0.5rem;
    padding: 0.3rem 0.6rem 0.2rem;
  }

  .crt-bezel {
    margin: 0 0.4rem 0.4rem;
    padding: 8px 8px 0;
    border-radius: 8px;
  }

  .crt-screen { border-radius: 3px; }

  .crt-chin { padding: 5px 12px 7px; }
  .crt-logo { font-size: 0.45rem; }

  #crt-panel {
    height: max(50vh, 320px);
  }

  #chip-container {
    min-height: 160px;
    padding: 0 0.3rem;
  }

  #stats-dashboard {
    grid-template-columns: 1fr;
    padding: 0.3rem 0.6rem 0.4rem;
  }

  .panel-description {
    padding: 0.3rem 0.6rem 0.25rem;
  }

  .panel-description p { font-size: 0.55rem; }

  .panel-commands code { font-size: 0.5rem; }

  #status-bar {
    font-size: 0.55rem;
    padding: 0.25rem 0.6rem;
  }

  .stat-label { font-size: 0.5rem; }
  .stat-value { font-size: 0.65rem; }
}

/* Short viewport — compact hero */
@media (max-height: 600px) {
  #hero { padding: 0.5rem 0.8rem 0.4rem; }
  .hero-title { font-size: 0.8rem; margin-bottom: 0.2rem; }
  .hero-team { font-size: 0.65rem; }
}
