:root {
  color-scheme: dark;
  --ink: #e7fff2;
  --muted: #83a992;
  --green: #68ffa2;
  --green-soft: #26d779;
  --cyan: #78e8ff;
  --amber: #ffd879;
  --red: #ff858d;
  --bg: #020706;
  --panel: rgba(5, 18, 14, 0.88);
  --panel-solid: #06130f;
  --line: rgba(104, 255, 162, 0.2);
  --line-bright: rgba(104, 255, 162, 0.46);
  --radius: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% 10%, rgba(0, 255, 157, 0.1), transparent 28rem),
    radial-gradient(circle at 12% 52%, rgba(69, 201, 255, 0.07), transparent 25rem),
    linear-gradient(180deg, #020706 0%, #030b08 48%, #010403 100%);
  font: 15px/1.65 "Courier New", Courier, monospace;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  content: "";
  opacity: 0.24;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, 0.025) 3px 4px);
  mix-blend-mode: screen;
}

.ambient-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(104, 255, 162, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(104, 255, 162, 0.08) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

a { color: var(--green); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 72px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 2px 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.13em;
  text-decoration: none;
}

.brand span { color: var(--green); }
.nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.nav a { color: var(--muted); text-decoration: none; transition: color 160ms ease; }
.nav a:hover, .nav a:focus-visible { color: var(--green); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: center;
  gap: 42px;
  min-height: 510px;
  padding: 66px 0 52px;
}

.kicker, .micro-label, .suggestion-label {
  color: var(--green);
  font-size: 0.75rem;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
  animation: live-pulse 1.8s ease-in-out infinite;
}

.hero h1 {
  max-width: 740px;
  margin: 20px 0 22px;
  color: #f3fff7;
  font-size: clamp(3.3rem, 8vw, 7.2rem);
  font-weight: 500;
  letter-spacing: -0.09em;
  line-height: 0.78;
  text-shadow: 0 0 38px rgba(104, 255, 162, 0.16);
}

.hero h1 span {
  color: transparent;
  -webkit-text-stroke: 1px var(--green);
  text-shadow: 0 0 28px rgba(104, 255, 162, 0.3);
}

.lede { max-width: 650px; margin: 0; color: var(--muted); font-size: 1rem; }

.principles {
  margin-top: 32px;
  color: var(--green);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
}

.signal-visual {
  position: relative;
  width: 330px;
  aspect-ratio: 1;
  justify-self: end;
  filter: drop-shadow(0 0 30px rgba(104, 255, 162, 0.12));
}

.signal-orbit, .signal-core { position: absolute; border-radius: 50%; }
.signal-orbit { inset: 0; border: 1px solid var(--line); }
.orbit-one { animation: orbit 18s linear infinite; border-top-color: var(--green); border-bottom-style: dashed; }
.orbit-two { inset: 42px; animation: orbit-reverse 12s linear infinite; border-right-color: var(--cyan); border-left-style: dashed; }
.orbit-three { inset: 84px; animation: breathe 3.2s ease-in-out infinite; border-color: rgba(104, 255, 162, 0.5); }
.signal-orbit::before { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 16px var(--green); content: ""; top: 20px; left: 48px; }

.signal-core {
  inset: 112px;
  display: grid;
  place-content: center;
  text-align: center;
  border: 1px solid var(--line-bright);
  background: radial-gradient(circle, rgba(104, 255, 162, 0.18), rgba(2, 7, 6, 0.95) 68%);
  box-shadow: inset 0 0 28px rgba(104, 255, 162, 0.12), 0 0 26px rgba(104, 255, 162, 0.12);
}

.signal-core span { color: var(--ink); font-size: 1.7rem; line-height: 1; }
.signal-core small { color: var(--green); letter-spacing: 0.18em; }
.signal-label { position: absolute; padding: 4px 8px; color: var(--muted); border: 1px solid var(--line); background: var(--bg); font-size: 0.62rem; letter-spacing: 0.1em; }
.label-a { top: 47px; right: -5px; }
.label-b { bottom: 43px; left: -20px; }

.suggestions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 14px;
}

.suggestion-label { margin-right: 6px; color: #5e806d; }
.suggestions button {
  padding: 8px 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(5, 18, 14, 0.7);
  cursor: pointer;
  font-size: 0.72rem;
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.suggestions button:hover, .suggestions button:focus-visible { color: var(--green); border-color: var(--line-bright); transform: translateY(-1px); }

.terminal {
  overflow: hidden;
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.36), inset 0 0 80px rgba(36, 216, 122, 0.025);
  backdrop-filter: blur(14px);
}

.terminal-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  min-height: 50px;
  padding: 0 18px;
  color: #638371;
  border-bottom: 1px solid var(--line);
  background: rgba(1, 8, 5, 0.82);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

.window-lights { display: flex; gap: 7px; }
.window-lights i { width: 7px; height: 7px; border-radius: 50%; background: #21442f; }
.window-lights i:first-child { background: var(--green); box-shadow: 0 0 10px rgba(104, 255, 162, 0.7); }
.terminal-id { grid-column: 2; }
.terminal-actions { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 14px; }
.new-channel { padding: 5px 8px; color: #779b84; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 0.62rem; letter-spacing: 0.1em; }
.new-channel:hover, .new-channel:focus-visible { color: var(--green); border-color: var(--line-bright); }
.new-channel:disabled { opacity: 0.45; cursor: wait; }
.connection { display: flex; align-items: center; color: var(--green); }
.connection i { width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 9px currentColor; }
.connection[data-state="loading"] { color: var(--amber); }
.connection[data-state="connected"] { color: var(--cyan); }
.connection[data-state="error"] { color: var(--red); }

.screen { min-height: 385px; padding: clamp(24px, 5vw, 54px); }
.boot-state { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 28px; min-height: 275px; color: var(--muted); }
.boot-state p { margin: 4px 0; }
.boot-state .command { color: var(--green); }
.boot-state .muted { max-width: 700px; margin-top: 18px; color: #678976; }
.boot-mark { color: transparent; font-size: clamp(4rem, 10vw, 7.5rem); line-height: 1; -webkit-text-stroke: 1px rgba(104, 255, 162, 0.35); }

.loading-state {
  display: grid;
  grid-template-columns: 250px 1fr;
  align-items: center;
  gap: clamp(32px, 6vw, 80px);
  min-height: 275px;
}

.loader-visual { position: relative; width: 220px; aspect-ratio: 1; margin: auto; }
.loader-ring, .loader-core { position: absolute; border-radius: 50%; }
.loader-ring { border: 1px solid var(--line); }
.ring-a { inset: 0; border-top-color: var(--green); animation: orbit 3s linear infinite; }
.ring-b { inset: 28px; border-right-color: var(--cyan); border-style: dashed; animation: orbit-reverse 4.5s linear infinite; }
.ring-c { inset: 56px; border-bottom-color: var(--amber); animation: orbit 2.4s linear infinite; }
.loader-core { inset: 83px; background: var(--green); box-shadow: 0 0 30px rgba(104, 255, 162, 0.75); animation: core-pulse 1.4s ease-in-out infinite; }
.loader-core span { position: absolute; inset: -13px; border: 1px solid rgba(104, 255, 162, 0.4); border-radius: 50%; animation: ping 1.4s ease-out infinite; }
.loader-copy h2 { margin: 10px 0 4px; color: var(--ink); font-size: clamp(1.6rem, 4vw, 3.2rem); font-weight: 400; letter-spacing: -0.04em; }
.loader-copy p { margin: 0; color: var(--muted); }
.stage-pulse { animation: stage-in 350ms ease both; }

.packet-stream { display: flex; align-items: end; gap: 7px; height: 48px; margin: 28px 0 20px; }
.packet-stream i { width: 5px; height: 10px; border-radius: 5px; background: var(--green); box-shadow: 0 0 8px rgba(104, 255, 162, 0.4); animation: packet 1.2s ease-in-out infinite; }
.packet-stream i:nth-child(2) { animation-delay: 0.12s; }
.packet-stream i:nth-child(3) { animation-delay: 0.24s; }
.packet-stream i:nth-child(4) { animation-delay: 0.36s; }
.packet-stream i:nth-child(5) { animation-delay: 0.48s; }
.packet-stream i:nth-child(6) { animation-delay: 0.6s; }
.packet-stream i:nth-child(7) { animation-delay: 0.72s; }
.packet-stream i:nth-child(8) { animation-delay: 0.84s; }
.loader-meta { display: flex; justify-content: space-between; max-width: 530px; color: #54715f; font-size: 0.67rem; letter-spacing: 0.12em; }

.thread-state { animation: result-in 500ms ease both; }
.thread-list { display: grid; gap: 42px; }
.transmission { scroll-margin-top: 24px; }
.transmission + .transmission { padding-top: 42px; border-top: 1px solid var(--line); }
.transmission-head { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 24px; color: #5a7966; font-size: 0.65rem; letter-spacing: 0.15em; }
.transmission-head span:last-child { color: var(--cyan); }
.answer-content { max-width: 920px; color: #d9f7e5; }
.answer-block { margin: 0 0 1.2rem; opacity: 0; transform: translateY(8px); animation: answer-reveal 420ms ease forwards; animation-delay: calc(var(--reveal-order) * 85ms); }
.answer-block strong { color: #f4fff8; font-weight: 700; }
.citation { display: inline-block; margin: 0 1px; color: var(--amber); font-weight: 700; }

.error-state { display: grid; place-content: center; min-height: 275px; text-align: center; }
.error-code { color: var(--red); font-size: clamp(2rem, 7vw, 5rem); letter-spacing: -0.06em; text-shadow: 0 0 30px rgba(255, 133, 141, 0.2); }
.error-state p { color: #eeb6bb; }

.turn-sources { margin-top: 28px; }
.turn-sources ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.turn-sources li { display: grid; grid-template-columns: 34px 1fr; gap: 1px 10px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; opacity: 0; animation: answer-reveal 350ms ease forwards; animation-delay: calc(var(--reveal-order) * 70ms); }
.source-number { grid-row: 1 / 3; color: #4e735e; }
.turn-sources a { overflow: hidden; color: var(--green); text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.turn-sources a:hover { text-decoration: underline; }
.source-meta { overflow: hidden; color: #678672; font-size: 0.7rem; text-overflow: ellipsis; white-space: nowrap; }

.prompt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; min-height: 76px; padding: 12px 14px 12px 22px; border-top: 1px solid var(--line); background: rgba(1, 8, 5, 0.9); }
.prompt > label { color: #5b7b68; font-size: 0.67rem; letter-spacing: 0.15em; }
.input-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.input-wrap > span { color: var(--green); }
.prompt input { width: 100%; min-width: 0; padding: 13px 0; color: var(--ink); border: 0; outline: 0; background: transparent; caret-color: var(--green); }
.prompt input::placeholder { color: #3e5c4a; }
.prompt input:read-only { color: #789683; cursor: wait; }
.prompt button { display: flex; align-items: center; gap: 12px; padding: 12px 17px; color: #001a0c; border: 0; border-radius: 9px; background: var(--green); cursor: pointer; font-weight: 700; transition: transform 160ms ease, box-shadow 160ms ease; }
.prompt button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 0 24px rgba(104, 255, 162, 0.23); }
.prompt button:disabled { color: #3b5646; background: #173525; cursor: wait; }

.notice { max-width: 990px; margin: 18px auto 0; color: #6d8b77; font-size: 0.72rem; text-align: center; }
.notice strong { color: var(--amber); font-weight: 400; }

@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes orbit-reverse { to { transform: rotate(-360deg); } }
@keyframes live-pulse { 50% { opacity: 0.45; transform: scale(0.72); } }
@keyframes breathe { 50% { transform: scale(0.93); opacity: 0.55; } }
@keyframes core-pulse { 50% { transform: scale(0.72); opacity: 0.65; } }
@keyframes ping { to { transform: scale(1.9); opacity: 0; } }
@keyframes packet { 0%, 100% { height: 8px; opacity: 0.25; } 50% { height: 40px; opacity: 1; } }
@keyframes stage-in { from { opacity: 0.25; transform: translateY(4px); } }
@keyframes result-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes answer-reveal { to { opacity: 1; transform: translateY(0); } }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: 0; padding-top: 54px; }
  .signal-visual { display: none; }
  .loading-state { grid-template-columns: 160px 1fr; }
  .loader-visual { width: 150px; }
  .ring-b { inset: 20px; }
  .ring-c { inset: 40px; }
  .loader-core { inset: 58px; }
}

@media (max-width: 650px) {
  body { font-size: 14px; }
  .shell { width: min(100% - 20px, 1180px); padding-top: 10px; }
  .top { align-items: flex-start; }
  .nav { gap: 6px 12px; }
  .hero { padding: 44px 4px 35px; }
  .hero h1 { font-size: clamp(3.2rem, 19vw, 5rem); }
  .suggestion-label { width: 100%; }
  .suggestions { padding: 0 2px; }
  .terminal-bar { grid-template-columns: auto 1fr; padding: 0 13px; }
  .terminal-id { display: none; }
  .terminal-actions { grid-column: 2; gap: 9px; }
  .screen { min-height: 430px; padding: 28px 20px; }
  .boot-state { grid-template-columns: 1fr; gap: 14px; }
  .boot-mark { font-size: 4.5rem; }
  .loading-state { grid-template-columns: 1fr; gap: 22px; text-align: center; }
  .loader-visual { width: 140px; }
  .packet-stream { justify-content: center; }
  .loader-meta { gap: 12px; }
  .turn-sources ol { grid-template-columns: 1fr; }
  .prompt { grid-template-columns: 1fr auto; gap: 8px; padding: 10px; }
  .prompt > label { display: none; }
  .prompt button span { display: none; }
  .prompt button { padding: 12px 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
