@charset "UTF-8";

/* ==========================================================================
   CSS Variables & Retro Palettes
   ========================================================================== */
:root,
body[data-theme="olive"] {
  --bg-color: #070c08;
  --panel-bg: rgba(11, 20, 13, 0.85);
  --panel-border: #1a4724;
  --titlebar-bg: #0e2012;
  --text-primary: #4ade80;
  --text-bright: #86efac;
  --text-dim: #22c55e88;
  --accent: #a3e635;
  --accent-glow: rgba(163, 230, 53, 0.35);
  --glow: rgba(74, 222, 128, 0.45);
  --cursor: #4ade80;
  --scanline-color: rgba(0, 0, 0, 0.35);
  --selection-bg: #166534;
  --selection-color: #ecfccb;
  --badge-bg: #14532d;
  --btn-hover: #15803d;
}

body[data-theme="amber"] {
  --bg-color: #0d0804;
  --panel-bg: rgba(22, 14, 8, 0.88);
  --panel-border: #5a300d;
  --titlebar-bg: #291506;
  --text-primary: #fbbf24;
  --text-bright: #fde68a;
  --text-dim: #f59e0b88;
  --accent: #f59e0b;
  --accent-glow: rgba(245, 158, 11, 0.35);
  --glow: rgba(251, 191, 36, 0.45);
  --cursor: #fbbf24;
  --scanline-color: rgba(0, 0, 0, 0.35);
  --selection-bg: #78350f;
  --selection-color: #fef3c7;
  --badge-bg: #451a03;
  --btn-hover: #92400e;
}

body[data-theme="cyan"] {
  --bg-color: #04090f;
  --panel-bg: rgba(8, 18, 28, 0.88);
  --panel-border: #0e4c68;
  --titlebar-bg: #072636;
  --text-primary: #22d3ee;
  --text-bright: #a5f3fc;
  --text-dim: #06b6d488;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.35);
  --glow: rgba(34, 211, 238, 0.45);
  --cursor: #22d3ee;
  --scanline-color: rgba(0, 0, 0, 0.35);
  --selection-bg: #0e7490;
  --selection-color: #cffafe;
  --badge-bg: #155e75;
  --btn-hover: #0284c7;
}

/* ==========================================================================
   Global Reset & Base Setup
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

::selection {
  background: var(--selection-bg);
  color: var(--selection-color);
}

html, body {
  width: 100%;
  min-height: 100%;
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: 'VT323', 'Courier New', Courier, monospace;
  font-size: 19px;
  line-height: 1.45;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* ==========================================================================
   CRT / Scanline / Vignette Overlays
   ========================================================================== */
.crt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

.crt-scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%,
    var(--scanline-color) 50%
  );
  background-size: 100% 4px;
  opacity: 0.7;
}

.crt-vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.85);
  background: radial-gradient(circle at center, transparent 65%, rgba(0,0,0,0.6) 100%);
}

.crt-glow {
  text-shadow: 0 0 5px var(--glow), 0 0 12px var(--glow);
}

/* Optional CRT subtle flicker */
@keyframes crtFlicker {
  0% { opacity: 0.985; }
  50% { opacity: 1; }
  52% { opacity: 0.96; }
  54% { opacity: 1; }
  100% { opacity: 0.99; }
}

body.scanlines-on .terminal-window {
  animation: crtFlicker 0.15s infinite;
}

/* ==========================================================================
   Matrix Canvas (Full-screen background or in-terminal)
   ========================================================================== */
#matrixCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
  opacity: 0.12;
  transition: opacity 0.5s ease;
}

#matrixCanvas.active {
  opacity: 0.45;
}

/* ==========================================================================
   Main Layout & Terminal Window
   ========================================================================== */
.page-wrapper {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
}

.terminal-window {
  width: 100%;
  max-width: 900px;
  background-color: var(--panel-bg);
  border: 2px solid var(--panel-border);
  box-shadow: 0 0 25px var(--glow), inset 0 0 15px rgba(0,0,0,0.7);
  border-radius: 6px;
  overflow: hidden;
  backdrop-filter: blur(4px);
  position: relative;
}

/* Terminal Title Bar */
.terminal-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--titlebar-bg);
  border-bottom: 2px solid var(--panel-border);
  font-family: 'Share Tech Mono', 'VT323', monospace;
  font-size: 15px;
  user-select: none;
}

.titlebar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.window-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}

.dot.red { background-color: #ef4444; box-shadow: 0 0 5px rgba(239, 68, 68, 0.6); }
.dot.yellow { background-color: #f59e0b; box-shadow: 0 0 5px rgba(245, 158, 11, 0.6); }
.dot.green { background-color: #22c55e; box-shadow: 0 0 5px rgba(34, 197, 94, 0.6); }

.titlebar-title {
  color: var(--text-bright);
  font-weight: bold;
  letter-spacing: 0.5px;
  margin-left: 4px;
}

.titlebar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctrl-btn {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  padding: 2px 7px;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s ease;
}

.ctrl-btn:hover {
  background: var(--btn-hover);
  color: #fff;
  box-shadow: 0 0 8px var(--glow);
}

.ctrl-btn.active {
  background: var(--badge-bg);
  border-color: var(--text-primary);
}

/* ==========================================================================
   Terminal Body
   ========================================================================== */
.terminal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ASCII Banner */
.ascii-banner {
  white-space: pre;
  font-family: 'VT323', monospace;
  font-size: 17px;
  line-height: 1.15;
  color: var(--accent);
  text-shadow: 0 0 8px var(--accent-glow);
  overflow-x: auto;
  padding-bottom: 6px;
}

@media (max-width: 600px) {
  .ascii-banner {
    font-size: 12px;
  }
}

/* System Info Card (Dot Matrix Style) */
.system-card {
  border: 1px dashed var(--panel-border);
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 18px;
}

.system-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
}

.system-label {
  color: var(--text-dim);
  min-width: 140px;
  letter-spacing: 0.5px;
}

.system-value {
  color: var(--text-bright);
  font-weight: 500;
}

.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--badge-bg);
  color: var(--text-bright);
  border: 1px solid var(--panel-border);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 15px;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  letter-spacing: 0.5px;
}

.pulsing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--text-primary);
  box-shadow: 0 0 6px var(--text-primary);
  animation: pulseDot 1.2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* Notice Box */
.notice-box {
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  font-size: 17px;
  color: var(--text-bright);
}

.notice-box p {
  margin-bottom: 4px;
}

.notice-box p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   Interactive Terminal & Shell
   ========================================================================== */
.terminal-interactive {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--panel-border);
  padding-top: 14px;
}

.interactive-hint {
  font-size: 15px;
  color: var(--text-dim);
}

/* Quick command chips */
.command-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 16px;
  padding: 2px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover {
  background: var(--btn-hover);
  color: #fff;
  border-color: var(--text-primary);
  box-shadow: 0 0 8px var(--glow);
  transform: translateY(-1px);
}

/* Terminal Log / Output history */
.terminal-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 6px;
}

.terminal-history::-webkit-scrollbar {
  width: 6px;
}

.terminal-history::-webkit-scrollbar-thumb {
  background: var(--panel-border);
  border-radius: 3px;
}

.history-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-command {
  color: var(--text-dim);
}

.history-response {
  color: var(--text-bright);
  padding-left: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.history-response a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Command Prompt Input Row */
.prompt-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  padding: 6px 12px;
  border-radius: 4px;
}

.prompt-prefix {
  color: var(--text-dim);
  white-space: nowrap;
  user-select: none;
}

.prompt-prefix .user {
  color: var(--accent);
}

.prompt-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 19px;
  color: var(--text-bright);
  caret-color: var(--cursor);
}

/* Blinking Cursor Simulation */
.cursor {
  display: inline-block;
  width: 9px;
  height: 18px;
  background: var(--cursor);
  vertical-align: middle;
  margin-left: 2px;
  animation: blink 1s step-start infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.terminal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--titlebar-bg);
  border-top: 1px solid var(--panel-border);
  font-size: 15px;
  color: var(--text-dim);
  gap: 10px;
}

.footer-left a {
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px dashed var(--text-primary);
  transition: color 0.15s ease;
}

.footer-left a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #f38020;
  font-weight: bold;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */
@media (max-width: 640px) {
  html, body {
    font-size: 17px;
  }
  .terminal-body {
    padding: 16px;
  }
  .system-label {
    min-width: 110px;
  }
  .titlebar-title {
    font-size: 12px;
  }
  .prompt-row {
    font-size: 16px;
  }
  .prompt-input {
    font-size: 16px;
  }
}
