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

:root {
  --bg: #0a0a0a;
  --fg: #33ff33;
  --fg-dim: #1a6b1a;
  --fg-bright: #66ff66;
  --font: 'JetBrains Mono', monospace;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  overflow: hidden;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Terminal */
#terminal {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  cursor: text;
}

#terminal.hidden, #program-container.hidden, #transition-overlay.hidden {
  display: none;
}

#program-container {
  flex: 1;
  overflow: hidden;
}

#output {
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}

#input-line {
  display: flex;
  align-items: center;
  line-height: 1.5;
}

#prompt {
  color: var(--fg);
  user-select: none;
}

#input {
  white-space: pre;
}

#cursor.blink {
  animation: blink 1s step-end infinite;
}

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

#hidden-input {
  position: absolute;
  left: -9999px;
  opacity: 0;
  width: 1px;
  height: 1px;
}

/* Transition overlay */
#transition-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  font-family: var(--font);
  color: var(--fg-dim);
  overflow: hidden;
  white-space: pre;
  line-height: 1.2;
  font-size: 14px;
}

/* CRT effects */
.crt #terminal,
.crt #program-container {
  text-shadow: 0 0 5px var(--fg, #33ff33), 0 0 10px rgba(51, 255, 51, 0.2);
}

.crt::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 255, 0, 0.03) 0px,
    rgba(0, 255, 0, 0.03) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 999;
}

.crt::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.4) 100%);
  pointer-events: none;
  z-index: 998;
}

/* Mobile bar */
#mobile-bar {
  display: none;
  padding: 8px;
  gap: 8px;
  background: #111;
  border-top: 1px solid #333;
}

#mobile-bar button {
  flex: 1;
  padding: 10px 0;
  background: #1a1a1a;
  color: var(--fg);
  border: 1px solid #333;
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
}

#mobile-bar button:active {
  background: #333;
}

@media (max-width: 768px) {
  html { font-size: 12px; }
  #terminal { padding: 12px; }
  #mobile-bar { display: flex; }
  #mobile-bar.hidden { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .crt::after, .crt::before { display: none; }
  .crt #terminal, .crt #program-container { text-shadow: none; }
  #cursor.blink { animation: none; }
}
