/* ═══════════════════════════════════════════════════════════════
   VOID-SHELL — CRT Terminal Stylesheet
   "The phosphors glow. The void awaits."
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  /* Amber palette (default) */
  --phosphor: #ffb000;
  --phosphor-dim: #cc8d00;
  --phosphor-bright: #ffd866;
  --phosphor-glow: rgba(255, 176, 0, 0.4);
  --phosphor-subtle: rgba(255, 176, 0, 0.08);
  --bg: #0a0800;
  --bg-screen: #0d0b00;
  --scanline-alpha: 0.06;
  
  /* Typography */
  --font-terminal: 'VT323', 'Share Tech Mono', 'Courier New', monospace;
  --font-size: 18px;
  --line-height: 1.35;
  
  /* Timing */
  --flicker-speed: 0.08s;
  --cursor-speed: 0.7s;
  --boot-speed: 0.02s;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
}

/* ── CRT Monitor Frame ────────────────────────────────────── */
#crt-monitor {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--bg-screen);
  overflow: hidden;
  font-family: var(--font-terminal);
  font-size: var(--font-size);
  line-height: var(--line-height);
  color: var(--phosphor);
  display: flex;
  flex-direction: column;
  
  /* CRT screen curvature */
  border-radius: 12px;
  box-shadow: 
    inset 0 0 80px rgba(0, 0, 0, 0.8),
    inset 0 0 200px rgba(0, 0, 0, 0.4),
    0 0 40px var(--phosphor-glow);
}

/* ── Scanline Overlay ──────────────────────────────────────── */
#scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(0, 0, 0, var(--scanline-alpha)) 1px,
    rgba(0, 0, 0, var(--scanline-alpha)) 2px
  );
}

/* ── Screen Flicker ────────────────────────────────────────── */
#flicker {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 99;
  animation: flicker-anim 0.15s infinite;
  opacity: 0;
}

@keyframes flicker-anim {
  0% { opacity: 0.008; }
  5% { opacity: 0.015; }
  10% { opacity: 0; }
  15% { opacity: 0.02; }
  20% { opacity: 0; }
  50% { opacity: 0.005; }
  80% { opacity: 0.01; }
  100% { opacity: 0; }
}

/* ── Vignette Effect ───────────────────────────────────────── */
#vignette {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 98;
  background: radial-gradient(
    ellipse at center,
    transparent 50%,
    rgba(0, 0, 0, 0.5) 80%,
    rgba(0, 0, 0, 0.85) 100%
  );
}

/* ── Status Bar ────────────────────────────────────────────── */
#status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px;
  background: rgba(255, 176, 0, 0.04);
  border-bottom: 1px solid rgba(255, 176, 0, 0.12);
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--phosphor-dim);
  flex-shrink: 0;
  z-index: 10;
  text-shadow: 0 0 8px var(--phosphor-glow);
}

#status-indicator {
  color: #33ff33;
  text-shadow: 0 0 10px rgba(51, 255, 51, 0.5);
}

#status-indicator.disconnected {
  color: #ff3333;
  text-shadow: 0 0 10px rgba(255, 51, 51, 0.5);
  animation: none;
}

.pulse {
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ── Terminal Output ───────────────────────────────────────── */
#terminal-output {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  z-index: 10;
  scrollbar-width: thin;
  scrollbar-color: var(--phosphor-dim) transparent;
}

#terminal-output::-webkit-scrollbar {
  width: 4px;
}

#terminal-output::-webkit-scrollbar-track {
  background: transparent;
}

#terminal-output::-webkit-scrollbar-thumb {
  background: var(--phosphor-dim);
  border-radius: 2px;
}

/* Terminal line styles */
.term-line {
  white-space: pre-wrap;
  word-break: break-all;
  text-shadow: 0 0 6px var(--phosphor-glow);
  animation: line-appear 0.03s ease-out;
  min-height: 1.35em;
}

.term-line.dim {
  color: var(--phosphor-dim);
  opacity: 0.6;
}

.term-line.bright {
  color: var(--phosphor-bright);
  text-shadow: 0 0 12px var(--phosphor-glow);
}

.term-line.error {
  color: #ff4444;
  text-shadow: 0 0 10px rgba(255, 68, 68, 0.4);
}

.term-line.success {
  color: #33ff33;
  text-shadow: 0 0 10px rgba(51, 255, 51, 0.4);
}

.term-line.warning {
  color: #ffaa00;
  text-shadow: 0 0 10px rgba(255, 170, 0, 0.4);
}

.term-line.system {
  color: #6688cc;
  text-shadow: 0 0 10px rgba(102, 136, 204, 0.3);
  font-style: italic;
}

.term-line.crypto {
  color: #cc66ff;
  text-shadow: 0 0 10px rgba(204, 102, 255, 0.3);
}

.term-line.header {
  color: var(--phosphor-bright);
  text-shadow: 0 0 15px var(--phosphor-glow);
  font-size: 1.1em;
}

@keyframes line-appear {
  from { 
    opacity: 0; 
    transform: translateY(2px);
  }
  to { 
    opacity: 1; 
    transform: translateY(0);
  }
}

/* ── Command Input ─────────────────────────────────────────── */
#input-line {
  display: flex;
  align-items: center;
  padding: 10px 20px 16px;
  background: rgba(255, 176, 0, 0.02);
  border-top: 1px solid rgba(255, 176, 0, 0.08);
  flex-shrink: 0;
  z-index: 10;
}

#prompt {
  color: var(--phosphor-bright);
  text-shadow: 0 0 12px var(--phosphor-glow);
  font-family: var(--font-terminal);
  font-size: var(--font-size);
  letter-spacing: 1px;
  white-space: nowrap;
  margin-right: 4px;
}

#command-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--phosphor);
  font-family: var(--font-terminal);
  font-size: var(--font-size);
  caret-color: transparent;
  text-shadow: 0 0 6px var(--phosphor-glow);
  letter-spacing: 0.5px;
}

#command-input:focus {
  outline: none;
}

#command-input::selection {
  background: var(--phosphor);
  color: var(--bg);
}

#cursor {
  color: var(--phosphor-bright);
  text-shadow: 0 0 12px var(--phosphor-glow);
  font-family: var(--font-terminal);
  font-size: var(--font-size);
}

#cursor.blink {
  animation: cursor-blink var(--cursor-speed) step-end infinite;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── Boot Sequence Effect ──────────────────────────────────── */
.boot-line {
  animation: boot-appear 0.05s ease-out forwards;
  opacity: 0;
}

@keyframes boot-appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Glitch Effect (on purge/error) ────────────────────────── */
.glitch {
  animation: glitch-effect 0.3s ease-out;
}

@keyframes glitch-effect {
  0% { transform: translate(0); filter: none; }
  10% { transform: translate(-3px, 1px); filter: hue-rotate(90deg); }
  20% { transform: translate(3px, -1px); filter: hue-rotate(180deg); }
  30% { transform: translate(-2px, 2px); filter: hue-rotate(270deg); }
  40% { transform: translate(2px, -2px); }
  50% { transform: translate(-1px, 1px); filter: hue-rotate(45deg); }
  60% { transform: translate(1px, 0); }
  70% { transform: translate(0, -1px); }
  80% { transform: translate(-1px, 0); }
  90% { transform: translate(1px, 1px); }
  100% { transform: translate(0); filter: none; }
}

/* ── Progress Bar ──────────────────────────────────────────── */
.progress-bar {
  display: inline-block;
  min-width: 200px;
}

.progress-fill {
  display: inline-block;
  background: var(--phosphor);
  height: 2px;
  animation: progress-grow 1.5s ease-out forwards;
}

@keyframes progress-grow {
  from { width: 0; }
  to { width: 100%; }
}

/* ── ASCII Art Glow ────────────────────────────────────────── */
.ascii-art {
  color: var(--phosphor-bright);
  text-shadow: 
    0 0 5px var(--phosphor-glow),
    0 0 15px var(--phosphor-glow),
    0 0 30px rgba(255, 176, 0, 0.2);
  line-height: 1.1;
  font-size: 14px;
}

/* ── Hash/Key Display ──────────────────────────────────────── */
.hash-display {
  color: #cc66ff;
  background: rgba(204, 102, 255, 0.06);
  padding: 2px 6px;
  border-left: 2px solid rgba(204, 102, 255, 0.3);
  display: inline-block;
  word-break: break-all;
  text-shadow: 0 0 8px rgba(204, 102, 255, 0.3);
}

/* ── Table Styling ─────────────────────────────────────────── */
.term-table {
  border-collapse: collapse;
  font-family: var(--font-terminal);
  font-size: var(--font-size);
  color: var(--phosphor);
  margin: 4px 0;
}

.term-table td {
  padding: 0 12px 0 0;
  white-space: nowrap;
}

/* ── Typing Indicator ──────────────────────────────────────── */
.typing-dots {
  display: inline-block;
}

.typing-dots::after {
  content: '';
  animation: typing 1.5s steps(4) infinite;
}

@keyframes typing {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
  100% { content: ''; }
}

/* ── Screen Wipe (for wipe/panic commands) ─────────────────── */
.screen-wipe {
  animation: wipe-effect 0.5s ease-out forwards;
}

@keyframes wipe-effect {
  0% { 
    opacity: 1; 
    transform: scaleY(1); 
    filter: brightness(1);
  }
  50% { 
    opacity: 0.8; 
    transform: scaleY(0.5); 
    filter: brightness(3);
  }
  100% { 
    opacity: 0; 
    transform: scaleY(0); 
    filter: brightness(10);
  }
}

/* ── CRT Turn On Effect ───────────────────────────────────── */
.crt-turn-on {
  animation: crt-on 1.2s ease-out forwards;
}

@keyframes crt-on {
  0% { 
    transform: scaleY(0.005) scaleX(0.2);
    filter: brightness(50);
    opacity: 1;
  }
  10% { 
    transform: scaleY(0.005) scaleX(1);
    filter: brightness(30);
  }
  30% {
    transform: scaleY(1) scaleX(1);
    filter: brightness(5);
  }
  50% {
    filter: brightness(1.5);
  }
  100% {
    transform: scaleY(1) scaleX(1);
    filter: brightness(1);
    opacity: 1;
  }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --font-size: 14px;
  }
  
  #status-bar {
    font-size: 10px;
    padding: 6px 12px;
    flex-wrap: wrap;
    gap: 4px;
  }
  
  #terminal-output {
    padding: 10px 12px;
  }
  
  #input-line {
    padding: 8px 12px 12px;
  }
  
  .ascii-art {
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  :root {
    --font-size: 12px;
  }
  
  .ascii-art {
    font-size: 8px;
  }
}
