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

:root {
  --phosphor: #62ff7a;
  --bright: #b4ffbd;
  --dim: #3a9d4a;
  --dark: #020804;
  --black: #000302;
  --danger: #ff716d;
}

* { box-sizing: border-box; }
html { color-scheme: dark; background: var(--black); }

body {
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  color: var(--phosphor);
  background: var(--black);
  font-family: "VT323", "Cascadia Mono", Consolas, monospace;
  font-size: 20px;
}

body::after {
  content: "";
  position: fixed;
  z-index: 20;
  inset: 0;
  pointer-events: none;
  background: rgba(18, 16, 16, .05);
  animation: flicker .12s infinite;
}

.boot-loader {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  color: var(--phosphor);
  background: #000;
  font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
  text-shadow: 0 0 6px rgba(98, 255, 122, .55);
  transition: opacity .22s linear, visibility .22s linear;
  cursor: pointer;
}
.boot-loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-loader-inner { width: min(620px, 100%); }
.boot-loader-title { margin-bottom: 34px; color: var(--bright); font-size: clamp(18px, 3vw, 28px); }
.boot-loader-message { min-height: 24px; margin-bottom: 10px; font-size: 14px; }
.boot-progress { height: 14px; padding: 2px; border: 1px solid var(--phosphor); }
.boot-progress i { display: block; width: 0; height: 100%; background: var(--phosphor); box-shadow: 0 0 7px var(--phosphor); transition: width .22s steps(4); }
.boot-loader-meta { display: flex; justify-content: space-between; margin-top: 9px; color: var(--dim); font-size: 11px; }

.machine {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  padding: clamp(18px, 3.5vw, 48px) clamp(18px, 5vw, 78px) clamp(14px, 2vw, 30px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  background:
    radial-gradient(ellipse at center, rgba(35, 145, 58, .10), rgba(0, 12, 4, .5) 62%, #000 100%),
    var(--dark);
  text-shadow: 0 0 6px rgba(98, 255, 122, .48);
}

.machine::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(0,0,0,.65));
}

.machine-header,
.controls {
  position: relative;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  text-transform: uppercase;
}

.machine-header {
  min-height: 58px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--phosphor);
}

.brand-block { display: flex; align-items: center; gap: 13px; line-height: .9; }
.brand-block strong { display: block; font-size: clamp(21px, 2.3vw, 32px); font-weight: 400; letter-spacing: .04em; }
.version-tag { margin-left: 7px; color: var(--dim); font-size: .48em; letter-spacing: .07em; white-space: nowrap; vertical-align: middle; }
.brand-block small { display: block; margin-top: 7px; color: var(--dim); font-size: 16px; letter-spacing: .08em; }
.brand-mark {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: invert(89%) sepia(66%) saturate(1420%) hue-rotate(62deg) brightness(106%) contrast(103%) drop-shadow(0 0 4px rgba(98,255,122,.55));
}

.telemetry { display: flex; align-items: center; gap: 22px; font-size: 18px; white-space: nowrap; }
.telemetry b { font-weight: 400; }
.telemetry em { color: var(--bright); font-style: normal; }
.telemetry button { border: 0; padding: 0 5px; color: var(--black); background: var(--phosphor); font: inherit; cursor: pointer; }
.clock { min-width: 80px; text-align: right; }

.screen-shell, .screen { min-height: 0; }
.screen-shell { position: relative; z-index: 2; }
.screen { position: relative; height: 100%; overflow: hidden; }
.screen::before {
  content: "";
  position: absolute;
  z-index: 9;
  top: -8%;
  left: 0;
  width: 100%;
  height: 7%;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(to bottom, transparent, rgba(124,255,143,.055), transparent);
  animation: tear-band 11s linear infinite;
}
.screen::after {
  content: "";
  position: absolute;
  z-index: 9;
  inset: 0;
  pointer-events: none;
  opacity: .11;
  background: linear-gradient(90deg, rgba(255,80,80,.10), transparent 1px, transparent calc(100% - 1px), rgba(80,160,255,.10));
}

.scanlines {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: .28;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 2px, rgba(0, 0, 0, .7) 3px, rgba(0, 0, 0, .7) 4px);
}

.terminal {
  position: absolute;
  inset: 0 0 58px;
  overflow-y: auto;
  padding: clamp(22px, 3vw, 42px) 1px 22px;
  scrollbar-width: thin;
  scrollbar-color: var(--phosphor) transparent;
}

.terminal-line { max-width: 980px; margin: 0 0 8px; line-height: 1.08; white-space: pre-wrap; overflow-wrap: anywhere; }
.terminal-line.dim { color: var(--dim); }
.terminal-line.warning { color: var(--bright); }
.terminal-line.error { color: var(--danger); }
.terminal-line.command { color: var(--bright); }
.terminal-line.section-title { margin-top: 24px; color: var(--bright); text-decoration: underline; text-underline-offset: 5px; }

.ascii-logo {
  margin: 0 0 22px;
  color: var(--bright);
  font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: clamp(8px, 1.35vw, 17px);
  font-weight: 700;
  font-variant-ligatures: none;
  letter-spacing: 0;
  line-height: 1.12;
  white-space: pre;
  text-rendering: geometricPrecision;
}
.terminal-line:nth-child(6n + 2) { animation: line-drift-a 9.7s steps(1) infinite; }
.terminal-line:nth-child(9n + 4) { animation: line-drift-b 13.1s steps(1) infinite 1.8s; }
.terminal a { color: var(--bright); text-decoration: underline; text-underline-offset: 3px; }
.terminal a:hover, .terminal a:focus { color: var(--black); background: var(--phosphor); outline: 0; text-shadow: none; }

.menu { display: grid; width: min(100%, 720px); margin: 16px 0 0; }
.menu-item {
  display: grid;
  grid-template-columns: 20px minmax(150px, 210px) 1fr;
  gap: 6px;
  width: 100%;
  padding: 3px 6px;
  border: 0;
  color: var(--phosphor);
  background: transparent;
  font: inherit;
  font-size: inherit;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
  text-shadow: inherit;
}
.menu-item:hover, .menu-item.selected { color: var(--black); background: var(--phosphor); text-shadow: none; }
.menu-item .desc { opacity: .8; }
.menu-item .arrow { visibility: hidden; }
.menu-item.selected .arrow { visibility: visible; }
.services-menu { width: min(100%, 900px); }
.service-menu-item { grid-template-columns: 20px minmax(150px, 210px) 1fr; }

.service-row { display: grid; grid-template-columns: 12px minmax(110px, 155px) 1fr; gap: 10px; margin: 5px 0; align-items: baseline; }
.service-row .dot { width: 8px; height: 8px; border: 1px solid currentColor; background: transparent; }
.service-row.loading .dot { background: var(--phosphor); animation: status-pulse .42s steps(2) infinite; }
.service-row.online .dot { background: var(--phosphor); box-shadow: 0 0 6px var(--phosphor); }
.service-row.offline .dot { border-color: var(--danger); }
.status-badge { display: inline-block; min-width: 98px; color: var(--bright); }

.terminal-message-form { display: grid; gap: 13px; width: min(100%, 760px); margin: 20px 0 8px; }
.terminal-message-form label { display: grid; gap: 4px; color: var(--dim); }
.terminal-message-form input,
.terminal-message-form textarea {
  width: 100%;
  border: 1px solid var(--dim);
  border-radius: 0;
  outline: 0;
  padding: 7px 9px;
  color: var(--bright);
  background: rgba(0, 12, 4, .72);
  font: inherit;
  resize: vertical;
  text-shadow: inherit;
}
.terminal-message-form input:focus,
.terminal-message-form textarea:focus { border-color: var(--phosphor); box-shadow: 0 0 7px rgba(98, 255, 122, .22); }
.terminal-message-form button { border: 0; padding: 4px 6px; color: var(--phosphor); background: transparent; font: inherit; cursor: pointer; text-shadow: inherit; }
.terminal-message-form button:hover,
.terminal-message-form button:focus { color: var(--black); background: var(--phosphor); outline: 0; text-shadow: none; }
.terminal-message-form button:disabled { opacity: .5; cursor: wait; }
.message-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.message-result.success { color: var(--bright); }
.message-result.error { color: var(--danger); }
.message-honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }

.command-line { position: absolute; z-index: 11; left: 0; right: 0; bottom: 20px; display: flex; align-items: center; color: var(--bright); }
.prompt { flex: 0 0 auto; }
.prompt span, .prompt b { color: var(--bright); font-weight: 400; }
.command-line input { min-width: 0; flex: 1; border: 0; outline: 0; padding: 0 0 0 8px; color: var(--bright); caret-color: transparent; background: transparent; font: inherit; font-size: inherit; text-shadow: inherit; }
.cursor { width: 11px; height: 22px; margin-left: 1px; background: var(--phosphor); box-shadow: 0 0 7px var(--phosphor); animation: blink .8s steps(1) infinite; }

.controls { padding-top: 11px; border-top: 2px solid var(--phosphor); color: var(--dim); font-size: 16px; }
.key-hints { display: flex; gap: 24px; }
kbd { padding: 0; border: 0; color: var(--bright); background: none; font: inherit; }
.model-label { white-space: nowrap; }
noscript { position: fixed; inset: auto 20px 20px; color: white; }

@keyframes blink { 50% { opacity: 0; } }
@keyframes flicker { 0% { opacity: .97; } 50% { opacity: 1; } 100% { opacity: .98; } }
@keyframes status-pulse { 50% { opacity: .2; } }
@keyframes tear-band {
  0%, 73% { top: -8%; opacity: 0; transform: translateX(0); }
  74% { opacity: .65; transform: translateX(2px); }
  79% { top: 108%; opacity: .1; transform: translateX(-2px); }
  80%, 100% { top: 108%; opacity: 0; transform: translateX(0); }
}
@keyframes line-drift-a {
  0%, 91%, 93%, 100% { transform: translateX(0); }
  91.5% { transform: translateX(2px); }
  92% { transform: translateX(-1px); }
}
@keyframes line-drift-b {
  0%, 84%, 86%, 100% { transform: translateX(0); }
  84.5% { transform: translateX(-2px); }
  85% { transform: translateX(1px); }
}

@media (max-width: 720px) {
  body { font-size: 18px; }
  .machine { padding: 18px 17px 12px; }
  .machine-header { align-items: flex-start; }
  .brand-mark { width: 39px; height: 39px; }
  .brand-block small { display: none; }
  .telemetry { flex-direction: column; align-items: flex-end; gap: 0; font-size: 16px; }
  .telemetry > span:first-child { display: none; }
  .telemetry .clock { display: none; }
  .ascii-logo { font-size: clamp(5px, 1.7vw, 8px); }
  .menu-item { grid-template-columns: 16px minmax(104px, 135px) 1fr; padding-inline: 3px; }
  .menu-item .desc { font-size: 15px; }
  .prompt span { display: none; }
  .prompt::before { content: ">"; color: var(--bright); }
  .key-hints { gap: 13px; }
  .key-hints b, .model-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}
