:root {
  --bg: #020a03;
  --phosphor: #33ff66;
  --phosphor-dim: #1a8f3a;
  --phosphor-faint: #0d3d1a;
  --glow: 0 0 2px #33ff66, 0 0 8px rgba(51, 255, 102, 0.55), 0 0 18px rgba(51, 255, 102, 0.25);
  --font: "VT323", "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--phosphor);
  font-family: var(--font);
  font-size: 22px;
  line-height: 1.15;
}

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

/* ---------- CRT shell ---------- */
.crt {
  min-height: 100vh;
  padding: 16px;
  display: flex;
}

.screen {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at center, #062610 0%, var(--bg) 70%, #000 100%);
  border-radius: 24px;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.9), inset 0 0 12px rgba(51, 255, 102, 0.15),
              0 0 0 2px #111, 0 0 0 10px #1b1b17, 0 0 40px rgba(51, 255, 102, 0.08);
  overflow: hidden;
  text-shadow: var(--glow);
  animation: flicker 6s infinite;
}

/* scanlines */
.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.35) 0, rgba(0, 0, 0, 0.35) 1px, transparent 2px, transparent 3px);
  pointer-events: none;
  z-index: 10;
}

/* rolling refresh band */
.screen::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 120px;
  top: -120px;
  background: linear-gradient(to bottom, transparent, rgba(51, 255, 102, 0.06), transparent);
  pointer-events: none;
  z-index: 11;
  animation: roll 7s linear infinite;
}

@keyframes roll { to { top: 100%; } }

@keyframes flicker {
  0%, 100% { opacity: 1; }
  47% { opacity: 0.97; }
  48% { opacity: 0.9; }
  49% { opacity: 0.98; }
  80% { opacity: 0.96; }
}

/* ---------- bars ---------- */
.topbar, .bottombar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--phosphor-dim);
  flex-wrap: wrap;
}
.bottombar { border-bottom: 0; border-top: 1px solid var(--phosphor-dim); color: var(--phosphor-dim); }

.brand {
  background: var(--phosphor);
  color: var(--bg);
  padding: 0 8px;
  text-shadow: none;
  box-shadow: var(--glow);
}

nav { display: flex; gap: 20px; flex-wrap: wrap; }

a { color: var(--phosphor); text-decoration: none; }
nav a { padding: 0 4px; }
nav a:hover, nav a.active {
  background: var(--phosphor);
  color: var(--bg);
  text-shadow: none;
}

.clock { color: var(--phosphor-dim); }

/* ---------- views ---------- */
main { flex: 1; position: relative; display: flex; min-height: 0; }
.view { display: none; flex: 1; padding: 24px; min-height: 0; }
.view.active { display: flex; flex-direction: column; }

/* ---------- home ---------- */
#view-home { align-items: center; justify-content: center; }

.boot {
  position: absolute;
  top: 24px; left: 24px;
  margin: 0;
  font-size: 18px;
  color: var(--phosphor-dim);
  transition: opacity 1s;
}
.boot.done { opacity: 0; }

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.logo {
  margin: 0;
  font-family: "Courier New", monospace;
  font-size: clamp(5px, 1.45vw, 16px);
  line-height: 1;
  font-weight: bold;
  white-space: pre;
}

.donut {
  margin: 0;
  font-family: "Courier New", monospace;
  font-size: clamp(7px, 1.4vw, 14px);
  line-height: 1;
  font-weight: bold;
  white-space: pre;
}

.tagline { margin: 0; font-size: clamp(16px, 2.4vw, 24px); }

.cursor { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.btn {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--phosphor);
  box-shadow: var(--glow);
}
.btn:hover { background: var(--phosphor); color: var(--bg); text-shadow: none; }

/* ---------- agent terminal ---------- */
.term {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--phosphor-dim);
  padding: 14px 16px;
  min-height: 0;
  cursor: text;
}

.term-out {
  flex: 1;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  scrollbar-width: thin;
  scrollbar-color: var(--phosphor-dim) transparent;
}
.term-out .line { margin: 0 0 4px; }
.term-out .user { color: var(--phosphor); }
.term-out .sys { color: var(--phosphor-dim); }
.term-out .err { color: #ffb000; text-shadow: 0 0 6px rgba(255, 176, 0, 0.6); }

.term-in { display: flex; gap: 10px; margin-top: 8px; }
.prompt { white-space: nowrap; }
.term-in input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--phosphor);
  font: inherit;
  text-shadow: var(--glow);
  caret-color: var(--phosphor);
}

.status { margin-top: 8px; color: var(--phosphor-dim); font-size: 18px; }
.status.online { color: var(--phosphor); }

/* ---------- about ---------- */
.panel { max-width: 760px; }
.panel h2 { font-size: 1.3em; font-weight: normal; margin: 0 0 8px; }
.panel p { margin: 0 0 16px; }
.panel ul { list-style: none; padding: 0; margin: 0; }

@media (max-width: 600px) {
  html, body { font-size: 18px; }
  .crt { padding: 8px; }
  .screen { border-radius: 12px; }
  .topbar, .bottombar { padding: 8px 16px; }
  .view { padding: 16px; }
  nav { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .screen, .screen::after, .cursor { animation: none; }
}
