@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

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

:root {
  --green: #33ff33;
  --green-dim: #20cc20;
  --green-dark: #0a3a0a;
  --bg: #0a0a0a;
}

body {
  background: var(--bg);
  min-height: 100vh;
  width: 100vw;
}

/* CRT container */
.crt {
  position: relative;
  width: 100%;
  min-height: 100vh;
}

/* Scanline overlay */
.scanlines {
  pointer-events: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.15) 2px,
    rgba(0, 0, 0, 0.15) 4px
  );
}

/* Subtle screen flicker */
.crt::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 11;
  pointer-events: none;
  animation: flicker 0.08s infinite alternate;
  background: transparent;
}

@keyframes flicker {
  0% { opacity: 0.97; }
  100% { opacity: 1; }
}

/* Terminal area */
.terminal {
  font-family: 'VT323', monospace;
  font-size: 1.4rem;
  color: var(--green);
  padding: 40px;
  line-height: 1.6;
  text-shadow: 0 0 8px rgba(51, 255, 51, 0.6);
  max-width: 820px;
  position: relative;
  z-index: 5;
}

/* Blinking block cursor */
.cursor {
  animation: blink 0.8s step-end infinite;
  color: var(--green);
  font-size: 1.4rem;
}

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

/* Output lines */
#output .line {
  white-space: pre-wrap;
  min-height: 1.6em;
}

#output .line.blank {
  min-height: 1.6em;
}

/* Menu items */
.menu-item {
  display: block;
  color: var(--green-dim);
  text-decoration: none;
  padding: 4px 0;
  cursor: pointer;
  transition: text-shadow 0.15s;
}

.menu-item:hover {
  color: #66ff66;
  text-shadow: 0 0 16px rgba(51, 255, 51, 0.9), 0 0 30px rgba(51, 255, 51, 0.4);
}

.menu-item.selected {
  color: var(--green);
  text-shadow: 0 0 12px rgba(51, 255, 51, 0.8);
}

/* Simulation containers */
.sim-container {
  margin-top: 20px;
}

.sim-container canvas {
  cursor: crosshair;
  display: block;
  image-rendering: pixelated;
}

/* Terminal frame around canvas */
.canvas-frame {
  display: inline-block;
  position: relative;
  padding: 6px;
  border: 1px solid var(--green-dim);
  box-shadow: 0 0 8px rgba(51, 255, 51, 0.15), inset 0 0 8px rgba(51, 255, 51, 0.05);
  max-width: 100%;
}

.canvas-frame canvas {
  max-width: 100%;
  height: auto;
}

.canvas-frame .frame-title {
  position: absolute;
  top: -0.7em;
  left: 12px;
  padding: 0 6px;
  background: var(--bg);
  color: var(--green-dim);
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  text-shadow: none;
  letter-spacing: 1px;
}

/* Terminal-style status and help lines below simulations */
.term-status {
  margin-top: 12px;
  color: var(--green);
  text-shadow: none;
}

.term-help {
  margin-top: 4px;
  text-shadow: none;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.term-help span {
  color: var(--green-dim);
  cursor: pointer;
  transition: color 0.15s;
}

.term-help span:hover {
  color: var(--green);
}

/* Info panel */
.info-panel {
  margin-top: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--green-dark);
  text-shadow: none;
}

.info-panel .line {
  color: var(--green-dim);
}

.info-panel .info-header {
  color: var(--green);
}

/* Footer */
.term-footer {
  margin-top: 32px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  text-shadow: none;
}

.term-footer .footer-divider {
  display: block;
  width: 100%;
  color: var(--green-dark);
  margin-bottom: 4px;
}

.term-footer span,
.term-footer a {
  color: var(--green-dark);
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  text-decoration: none;
  transition: color 0.15s;
}

.term-footer a:hover {
  color: var(--green-dim);
}

/* Mobile adjustments */
@media (max-width: 680px) {
  .terminal {
    padding: 16px;
  }
}

/* Glow effect on the whole terminal for atmosphere */
.terminal::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  width: 120%;
  height: 120%;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, rgba(51, 255, 51, 0.015) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}
