/* === DOS TERMINAL - Green Phosphor CRT Theme === */

/* ========================
   CSS CUSTOM PROPERTIES
   ======================== */
:root {
  --terminal-bg: #040d04;
  --phosphor-primary: #33ff33;
  --phosphor-bright: #80ff80;
  --phosphor-dim: #1a6b1a;
  --phosphor-faint: #0d3d0d;
  --terminal-red: #ff4444;
  --terminal-yellow: #ffd700;
  --terminal-cyan: #40e0d0;
  --terminal-purple: #cc66ff;
  --terminal-white: #e8ffe8;
  --cursor-color: #80ff80;
}

/* Reset & Base */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--terminal-bg);
  font-family: 'VT323', 'Share Tech Mono', 'Courier New', monospace;
  color: var(--phosphor-primary);
  font-size: 20px;
  line-height: 1.4;
}

/* === Boot Splash Overlay === */
.boot-splash-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  background: var(--terminal-bg);
  opacity: 0;
  animation: splash-fade-in 0.4s ease-out forwards;
}

.boot-splash-overlay.fade-out {
  animation: splash-fade-out 0.35s ease-in forwards;
}

.boot-splash-overlay img {
  max-width: 78%;
  max-height: 78%;
  object-fit: contain;
}

@keyframes splash-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes splash-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}
/* durations set inline via animation-duration on the element */

/* === Main Screen Container === */
.dos-screen {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: var(--terminal-bg);
  overflow: hidden;
}

/* Subtle center ambient glow */
.dos-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 60% 55% at center,
    rgba(20, 60, 20, 0.08) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}

/* === CRT Scanlines Overlay — two-layer system with slow roll === */
.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.18) 0px,
    rgba(0, 0, 0, 0.18) 1px,
    transparent 1px,
    transparent 4px
  );
  animation: scanline-roll 8s linear infinite;
  pointer-events: none;
  z-index: 10;
}

.scanlines::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.06) 2px,
    rgba(0, 0, 0, 0.06) 3px
  );
}

@keyframes scanline-roll {
  0%   { background-position: 0 0; }
  100% { background-position: 0 100vh; }
}

/* === CRT Vignette === */
.crt-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 11;
  background:
    radial-gradient(
      ellipse 85% 80% at center,
      transparent 50%,
      rgba(0, 8, 0, 0.55) 88%,
      rgba(0, 4, 0, 0.8) 100%
    ),
    radial-gradient(
      ellipse 120% 115% at center,
      transparent 70%,
      rgba(0, 0, 0, 0.3) 100%
    );
  animation: crt-flicker 0.15s infinite;
}

@keyframes crt-flicker {
  0%   { opacity: 0.96; }
  3%   { opacity: 0.99; }
  7%   { opacity: 0.97; }
  12%  { opacity: 1.00; }
  17%  { opacity: 0.97; }
  100% { opacity: 1.00; }
}

/* === Terminal Content Area === */
.terminal-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 20px 32px 60px 32px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 5;
  transition: opacity 3s ease-in;
}

.terminal-content.terminal-idle-dim {
  opacity: 0.75;
  transition: opacity 3s ease-in;
}

/* Green Scrollbar */
.terminal-content::-webkit-scrollbar {
  width: 8px;
}

.terminal-content::-webkit-scrollbar-track {
  background: #0a0a0a;
}

.terminal-content::-webkit-scrollbar-thumb {
  background: var(--phosphor-primary);
  border-radius: 0;
}

.terminal-content::-webkit-scrollbar-thumb:hover {
  background: var(--phosphor-bright);
}

/* === Terminal Text === */
.terminal-text {
  font-family: 'VT323', 'Share Tech Mono', 'Courier New', monospace;
  font-size: 20px;
  line-height: 1.4;
  color: var(--phosphor-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
  padding: 0;
  letter-spacing: 0.05em;
  text-shadow:
    0 0 2px rgba(51, 255, 51, 0.8),
    0 0 6px rgba(51, 255, 51, 0.35),
    0 0 12px rgba(51, 255, 51, 0.1);
}

/* === Input Line === */
.terminal-input-line {
  display: flex;
  align-items: center;
  margin-top: 2px;
}

.terminal-prompt {
  font-family: 'VT323', 'Share Tech Mono', 'Courier New', monospace;
  font-size: 20px;
  color: var(--phosphor-bright);
  white-space: pre;
  text-shadow:
    0 0 2px rgba(128, 255, 128, 0.9),
    0 0 8px rgba(51, 255, 51, 0.4);
  flex-shrink: 0;
  letter-spacing: 0.05em;
}

/* Clickable area wraps input + cursor, takes remaining space */
.terminal-input-area {
  flex: 1;
  display: flex;
  align-items: center;
  cursor: text;
  min-height: 25px;
  margin-left: 4px;
}

.terminal-input {
  font-family: 'VT323', 'Share Tech Mono', 'Courier New', monospace;
  font-size: 20px;
  color: var(--phosphor-primary);
  background: transparent;
  border: none;
  outline: none;
  width: 1ch;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  caret-color: transparent;
  letter-spacing: 0.05em;
  text-shadow:
    0 0 2px rgba(51, 255, 51, 0.8),
    0 0 6px rgba(51, 255, 51, 0.35);
}

.terminal-input::selection {
  background: var(--phosphor-primary);
  color: #000;
}

/* === Blinking Block Cursor === */
.terminal-cursor {
  display: inline-block;
  width: 10px;
  height: 20px;
  background-color: var(--cursor-color);
  vertical-align: text-bottom;
  animation: blink 1.06s ease-in-out infinite;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(128, 255, 128, 0.7);
}

.terminal-input-line.done .terminal-cursor {
  display: none;
}

@keyframes blink {
  0%, 47%  { opacity: 1; }
  50%, 97% { opacity: 0; }
  100%     { opacity: 1; }
}

/* === Matrix Rain Overlay === */
.matrix-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 100;
  background: #000;
}

.matrix-overlay canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.matrix-exit-hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--phosphor-primary);
  font-family: 'VT323', monospace;
  font-size: 16px;
  opacity: 0.5;
  z-index: 101;
  text-shadow: 0 0 6px rgba(51, 255, 51, 0.5);
}

/* === Glitch Effect === */
.glitch-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 200;
  pointer-events: none;
  animation: glitch-anim 0.3s steps(2) infinite;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    rgba(51, 255, 51, 0.05) 2px,
    rgba(51, 255, 51, 0.05) 4px
  );
}

@keyframes glitch-anim {
  0%   { transform: translate(0, 0); clip-path: inset(20% 0 40% 0); }
  25%  { transform: translate(-4px, 2px); clip-path: inset(60% 0 10% 0); }
  50%  { transform: translate(4px, -2px); clip-path: inset(10% 0 70% 0); }
  75%  { transform: translate(-2px, -4px); clip-path: inset(50% 0 20% 0); }
  100% { transform: translate(0, 0); clip-path: inset(30% 0 50% 0); }
}

/* === Screen Shake === */
.screen-shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  10%  { transform: translate(-6px, 4px); }
  20%  { transform: translate(6px, -4px); }
  30%  { transform: translate(-4px, -6px); }
  40%  { transform: translate(4px, 6px); }
  50%  { transform: translate(-6px, -2px); }
  60%  { transform: translate(6px, 2px); }
  70%  { transform: translate(-2px, 6px); }
  80%  { transform: translate(2px, -6px); }
  90%  { transform: translate(-4px, 4px); }
}

/* === Color Utility Classes === */
.text-green  { color: var(--phosphor-primary); }
.text-red    { color: var(--terminal-red); }
.text-cyan   { color: var(--terminal-cyan); }
.text-yellow { color: var(--terminal-yellow); }
.text-white  { color: var(--terminal-white); }
.text-gray   { color: #888888; }
.text-purple { color: var(--terminal-purple); }
.text-orange { color: #ff9933; }

.text-dim {
  color: var(--phosphor-dim);
  text-shadow: none;
}

.text-bright {
  color: var(--phosphor-bright);
  text-shadow:
    0 0 2px rgba(128, 255, 128, 0.9),
    0 0 8px rgba(51, 255, 51, 0.5),
    0 0 18px rgba(51, 255, 51, 0.2);
}

/* === Boot Sequence Styles === */
.boot-highlight {
  color: var(--phosphor-bright);
  text-shadow:
    0 0 2px rgba(128, 255, 128, 0.9),
    0 0 8px rgba(51, 255, 51, 0.5);
}

/* === Rik Unlock Glow === */
.rik-unlock-text {
  color: var(--terminal-purple);
  text-shadow: 0 0 10px rgba(204, 102, 255, 0.8), 0 0 20px rgba(204, 102, 255, 0.4);
  animation: rik-pulse 1.5s ease-in-out infinite alternate;
}

@keyframes rik-pulse {
  0%   { text-shadow: 0 0 10px rgba(204, 102, 255, 0.8), 0 0 20px rgba(204, 102, 255, 0.4); }
  100% { text-shadow: 0 0 16px rgba(204, 102, 255, 1.0), 0 0 30px rgba(204, 102, 255, 0.6); }
}

/* === Fade Transition for EXIT === */
.fade-out {
  animation: fade-out 1s ease-out forwards;
}

@keyframes fade-out {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* === MATRIX: Neo Message Overlay === */
.matrix-neo-msg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 20;
  pointer-events: none;
}

.neo-line {
  font-family: 'VT323', monospace;
  font-size: 52px;
  color: #fff;
  text-shadow: 0 0 20px #33ff33, 0 0 50px #33ff33, 0 0 80px rgba(51,255,51,0.4);
  display: block;
  margin: 16px 0;
  letter-spacing: 3px;
  transition: opacity 1.8s ease-in-out;
}

/* === MATRIX: Subliminal "FOLLOW THE CODE" flash === */
.matrix-follow-msg {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'VT323', monospace;
  font-size: 28px;
  color: #aaffaa;
  letter-spacing: 10px;
  opacity: 0.06;
  z-index: 15;
  pointer-events: none;
  animation: followFlicker 0.5s ease-in-out;
}

@keyframes followFlicker {
  0%   { opacity: 0; }
  25%  { opacity: 0.14; }
  55%  { opacity: 0.03; }
  80%  { opacity: 0.10; }
  100% { opacity: 0.06; }
}

/* === ARCHITECT'S CONSOLE — Pure Efficiency. Zero Waste. === */
.architect-console {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Blueprint grid — faint green lines like a game engine editor viewport */
  background-color: #ffffff;
  background-image:
    linear-gradient(rgba(0, 200, 0, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 200, 0, 0.028) 1px, transparent 1px);
  background-size: 48px 48px;
  color: #000000;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 13px;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  /* No animation. It simply appears. */
}

/* Viewport corner label — like a game engine scene view tab */
.arch-viewport-label {
  position: fixed;
  top: 10px;
  right: 16px;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 9px;
  color: rgba(0, 170, 0, 0.42);
  letter-spacing: 2px;
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
  z-index: 5002;
}

/* Coordinate readout — slowly drifts like you're moving through 3D space */
.arch-coord-readout {
  position: fixed;
  bottom: 14px;
  left: 16px;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 9px;
  color: rgba(0, 170, 0, 0.42);
  letter-spacing: 1px;
  pointer-events: none;
  user-select: none;
  z-index: 5002;
}

/* Matrix ghost — the code world beneath bleeds through the white room */
.arch-matrix-ghost {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5001;
  overflow: hidden;
  font-family: 'VT323', 'IBM Plex Mono', monospace;
  font-size: 13px;
  line-height: 1.1;
  color: #00bb00;
  white-space: pre;
  animation: archMatrixBleed 14s ease-in-out infinite;
}

@keyframes archMatrixBleed {
  0%   { opacity: 0.000; }
  15%  { opacity: 0.000; }
  30%  { opacity: 0.042; }
  45%  { opacity: 0.016; }
  60%  { opacity: 0.050; }
  75%  { opacity: 0.008; }
  85%  { opacity: 0.000; }
  100% { opacity: 0.000; }
}

.architect-header {
  padding: 14px 24px 12px;
  border-bottom: 1px solid #000;
  flex-shrink: 0;
}

.architect-logo {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 6px;
  color: #000;
  text-transform: uppercase;
}

.architect-version {
  font-size: 11px;
  color: #999;
  margin-left: 12px;
  font-weight: 400;
}

.architect-subtitle {
  font-size: 11px;
  color: #999;
  margin-top: 2px;
  letter-spacing: 0;
}

.architect-body {
  flex: 1;
  padding: 0;
  display: flex;
  flex-direction: column;
  max-width: 100%;
}

.architect-section {
  border-bottom: 1px solid #e0e0e0;
  padding: 12px 24px;
  background: #ffffff;
}

.architect-section h3 {
  font-size: 9px;
  letter-spacing: 5px;
  color: #999;
  margin: 0 0 10px 0;
  text-transform: uppercase;
  font-weight: 400;
}

.architect-footer {
  padding: 10px 24px;
  border-top: 1px solid #000;
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* Buttons — invert on hover. Nothing else. */
.arch-btn {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 11px;
  padding: 6px 14px;
  border: 1px solid #000;
  background: #fff;
  color: #000;
  cursor: pointer;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-radius: 0;
  transition: none;
}

.arch-btn:hover:not(:disabled) { background: #000; color: #fff; }
.arch-btn:disabled { opacity: 0.25; cursor: not-allowed; }

.arch-btn-warn { border-color: #000; color: #000; }
.arch-btn-warn:hover:not(:disabled) { background: #000; color: #fff; }

.arch-btn-red { border-color: #000; background: #000; color: #fff; }
.arch-btn-red:hover:not(:disabled) { background: #555; }

.arch-btn-blue { border-color: #000; background: #fff; color: #000; }
.arch-btn-blue:hover:not(:disabled) { background: #000; color: #fff; }

.arch-btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.arch-control-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.arch-control-row label {
  font-size: 11px;
  color: #999;
  letter-spacing: 1px;
}

.arch-control-row select {
  font-family: inherit;
  font-size: 11px;
  padding: 5px 10px;
  border: 1px solid #000;
  background: #fff;
  color: #000;
  border-radius: 0;
  cursor: pointer;
}

/* Flags — black = active, grey = inactive. No color. */
.arch-flag-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.arch-flag {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid #e0e0e0;
  font-size: 10px;
  letter-spacing: 1px;
}

.arch-flag-on  { border-color: #000; color: #000; font-weight: 700; }
.arch-flag-off { color: #ccc; border-color: #eee; }

/* Character Registry */
.arch-stat-block { display: flex; flex-direction: column; }

.arch-char-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 11px;
}

.arch-char-row:last-child { border-bottom: none; }
.arch-char-name { letter-spacing: 3px; }
.status-on  { color: #000; font-weight: 700; font-size: 10px; }
.status-off { color: #ccc; font-size: 10px; }

/* Dev message — plain prose, no decoration */
.arch-flavor {
  font-size: 11px;
  color: #999;
  margin-bottom: 10px;
}

.arch-dev-msg {
  font-size: 12px;
  color: #000;
  line-height: 1.9;
}

.arch-message-section { border-color: #e0e0e0; }

.arch-feedback {
  padding: 6px 24px;
  font-size: 11px;
  color: #000;
  background: #f5f5f5;
  border-top: 1px solid #000;
  letter-spacing: 1px;
}

@media (max-width: 600px) {
  .architect-header { padding: 10px 16px; }
  .architect-section { padding: 10px 16px; }
  .arch-flag-grid { grid-template-columns: 1fr; }
  .architect-footer { padding: 8px 16px; }
}
