:root {
  color-scheme: dark;
  --ink: #07090c;
  --panel: #0d1117;
  --panel-strong: #121821;
  --line: rgba(102, 196, 255, 0.18);
  --line-hot: rgba(255, 158, 45, 0.42);
  --orange: #ff9e2d;
  --orange-bright: #ffc15a;
  --cyan: #65d8ff;
  --cyan-soft: #aeeaff;
  --text: #f7f4ed;
  --muted: #9aa8b7;
  --danger: #ff726f;
  --radius: 26px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 3%, rgba(255, 147, 34, 0.14), transparent 26rem),
    radial-gradient(circle at 91% 20%, rgba(61, 188, 255, 0.13), transparent 34rem),
    #07090c;
  color: var(--text);
  font-family: "Rajdhani", sans-serif;
}

a { color: inherit; text-decoration: none; }
button, textarea { font: inherit; }
button { color: inherit; }

.ambient-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(93, 204, 255, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(93, 204, 255, 0.09) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

.ambient-grid::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,0.025) 48%, transparent 54%);
  content: "";
}

.page-shell {
  width: min(1560px, calc(100% - 40px));
  margin: 20px auto 42px;
}

.topbar {
  display: flex;
  min-height: 86px;
  padding: 14px 20px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(9, 13, 18, 0.87);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  font-family: "Oxanium", sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.brand > span:last-child { display: grid; }
.brand b { color: var(--orange); }
.brand small { color: var(--muted); font-size: 0.55rem; letter-spacing: 0.18em; }

.brand-mark {
  position: relative;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line-hot);
  border-radius: 16px;
  background: #180b02;
  box-shadow: 0 0 26px rgba(255, 145, 29, 0.15);
}

.brand-mark::after {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 11px;
  height: 11px;
  border: 2px solid #081016;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
  content: "";
}

.brand-mark img { width: 100%; height: 100%; object-fit: cover; }

.topbar nav { display: flex; align-items: center; gap: 10px; }
.topbar nav a, .engine-state {
  padding: 10px 13px;
  border-radius: 999px;
  color: #c3ccd6;
  font-family: "Oxanium", sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.topbar nav a:hover { color: white; background: rgba(101, 216, 255, 0.08); }
.engine-state { border: 1px solid rgba(101, 216, 255, 0.25); color: var(--cyan-soft); }
.engine-state i, .live-dot i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
  animation: signal-pulse 1.8s ease-in-out infinite;
}

main { display: grid; gap: 20px; margin-top: 20px; }

.hero {
  position: relative;
  display: grid;
  min-height: 500px;
  padding: clamp(38px, 6vw, 84px);
  align-items: center;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(120deg, rgba(13, 16, 22, 0.98), rgba(7, 14, 20, 0.9)),
    #0b1015;
}

.hero::before {
  position: absolute;
  inset: 0 52% 0 0;
  opacity: 0.42;
  background: linear-gradient(90deg, rgba(255, 151, 39, 0.12), transparent);
  content: "";
}

.hero-copy { position: relative; z-index: 2; }
.signal-label, .rail-heading > span, .live-dot {
  color: var(--cyan);
  font-family: "Oxanium", sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.13em;
}
.signal-label i {
  display: inline-block;
  width: 28px;
  height: 2px;
  margin-right: 9px;
  vertical-align: middle;
  background: var(--orange);
  box-shadow: 0 0 11px rgba(255, 158, 45, 0.65);
}

.hero h1 {
  max-width: 850px;
  margin: 19px 0 20px;
  font-family: "Oxanium", sans-serif;
  font-size: clamp(3.15rem, 7vw, 6.8rem);
  line-height: 0.94;
  letter-spacing: -0.065em;
}
.hero h1 em { color: var(--orange); font-style: normal; text-shadow: 0 0 28px rgba(255, 158, 45, 0.18); }
.hero-copy > p { max-width: 740px; margin: 0; color: #aeb9c5; font-size: 1.23rem; line-height: 1.55; }

.hero-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.hero-pills span {
  padding: 8px 11px;
  border: 1px solid rgba(255, 158, 45, 0.25);
  border-radius: 7px;
  color: #ffd09a;
  background: rgba(255, 151, 32, 0.045);
  font-family: "Oxanium", sans-serif;
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.signal-orbit {
  position: relative;
  min-height: 390px;
  border: 1px solid rgba(101, 216, 255, 0.24);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(101, 216, 255, 0.13) 50%, transparent 50.2%),
    linear-gradient(transparent 49.8%, rgba(101, 216, 255, 0.13) 50%, transparent 50.2%),
    radial-gradient(circle, rgba(70, 196, 255, 0.16), rgba(7, 10, 14, 0.2) 58%);
  box-shadow: inset 0 0 80px rgba(60, 188, 255, 0.08), 0 0 60px rgba(34, 142, 207, 0.06);
}
.orbit { position: absolute; border: 1px solid rgba(101, 216, 255, 0.16); border-radius: 50%; }
.orbit-one { inset: 17%; }
.orbit-two { inset: 34%; }
.orbit-core {
  position: absolute;
  inset: 50% auto auto 50%;
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 1px solid #b8ebff;
  border-radius: 23px;
  color: #061018;
  background: linear-gradient(145deg, #c6f2ff, #4ec9ff);
  box-shadow: 0 0 42px rgba(101, 216, 255, 0.38);
  font-family: "Oxanium", sans-serif;
  font-size: 2rem;
  font-weight: 800;
}
.node {
  position: absolute;
  padding: 8px 10px;
  border: 1px solid rgba(255, 174, 78, 0.35);
  border-radius: 6px;
  color: #ffd29d;
  background: #100b08;
  font: 700 0.61rem "Oxanium", sans-serif;
  letter-spacing: 0.08em;
}
.node-build { top: 13%; left: 42%; }
.node-debug { right: 6%; bottom: 29%; }
.node-verify { left: 5%; bottom: 26%; }
.scan-line {
  position: absolute;
  inset: 50% 50% auto auto;
  width: 47%;
  height: 1px;
  transform-origin: right center;
  background: linear-gradient(90deg, transparent, var(--cyan));
  animation: scan 6s linear infinite;
}

.workbench {
  display: grid;
  min-height: 780px;
  overflow: hidden;
  grid-template-columns: 360px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 10, 14, 0.94);
}

.tool-rail {
  display: flex;
  padding: 28px;
  flex-direction: column;
  gap: 25px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16, 22, 30, 0.98), rgba(9, 12, 17, 0.98));
}
.rail-heading h2 { margin: 8px 0 0; font-family: "Oxanium", sans-serif; font-size: 1.65rem; }
.prompt-stack { display: grid; gap: 9px; }
.prompt-stack button {
  display: grid;
  width: 100%;
  padding: 15px;
  grid-template-columns: 37px 1fr;
  align-items: start;
  gap: 11px;
  border: 1px solid rgba(101, 216, 255, 0.13);
  border-radius: 15px;
  background: rgba(101, 216, 255, 0.025);
  text-align: left;
  cursor: pointer;
  transition: 160ms ease;
}
.prompt-stack button:hover { transform: translateX(4px); border-color: var(--line-hot); background: rgba(255, 158, 45, 0.06); }
.prompt-stack i { color: rgba(101, 216, 255, 0.5); font: normal 800 0.65rem "Oxanium", sans-serif; }
.prompt-stack span { display: grid; gap: 3px; }
.prompt-stack b { color: #eef5fa; font-family: "Oxanium", sans-serif; font-size: 0.86rem; }
.prompt-stack small { color: var(--muted); font-size: 0.86rem; line-height: 1.35; }

.rail-readout { display: grid; gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; }
.rail-readout div { display: grid; padding: 12px 14px; grid-template-columns: 72px 1fr; gap: 10px; background: rgba(101, 216, 255, 0.035); }
.rail-readout span, .rail-readout b { font-family: "Oxanium", sans-serif; font-size: 0.59rem; letter-spacing: 0.06em; }
.rail-readout span { color: #6f8192; }
.rail-readout b { color: var(--cyan-soft); }

.privacy-callout { margin-top: auto; padding: 18px; border: 1px solid rgba(255, 158, 45, 0.22); border-radius: 16px; background: rgba(255, 143, 22, 0.045); }
.privacy-callout strong { color: #ffc16d; font-family: "Oxanium", sans-serif; }
.privacy-callout p { margin: 7px 0 0; color: #b5a895; font-size: 0.9rem; line-height: 1.45; }

.chat-panel { display: grid; min-width: 0; grid-template-rows: auto minmax(420px, 1fr) auto; }
.chat-header {
  display: flex;
  min-height: 94px;
  padding: 20px 26px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 18, 24, 0.9);
}
.chat-header h2 { margin: 5px 0 0; font-family: "Oxanium", sans-serif; font-size: 1.5rem; }
.chat-actions { display: flex; align-items: center; gap: 10px; }
#connection-state {
  padding: 7px 10px;
  border: 1px solid rgba(101, 216, 255, 0.18);
  border-radius: 999px;
  color: #8b9baa;
  font: 700 0.58rem "Oxanium", sans-serif;
  letter-spacing: 0.08em;
}
#connection-state[data-state="ready"] { color: #8ff0bb; border-color: rgba(92, 229, 151, 0.28); }
#connection-state[data-state="error"] { color: #ff9b98; border-color: rgba(255, 114, 111, 0.34); }
#reset-chat { padding: 8px 11px; border: 0; border-radius: 8px; color: #9eacb9; background: rgba(255,255,255,0.04); cursor: pointer; }
#reset-chat:hover { color: white; background: rgba(255,255,255,0.08); }

.message-stream {
  min-height: 420px;
  max-height: 720px;
  padding: clamp(22px, 4vw, 42px);
  overflow-y: auto;
  background:
    radial-gradient(circle at 100% 0, rgba(53, 170, 231, 0.07), transparent 45%),
    rgba(7, 10, 14, 0.82);
  scrollbar-color: rgba(101, 216, 255, 0.25) transparent;
}

.message { display: grid; max-width: 880px; margin-bottom: 24px; grid-template-columns: 42px minmax(0, 1fr); gap: 12px; animation: message-in 220ms ease-out both; }
.message-user { margin-left: auto; }
.message-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(101, 216, 255, 0.27);
  border-radius: 12px;
  color: #061119;
  background: var(--cyan);
  font: 800 0.67rem "Oxanium", sans-serif;
  box-shadow: 0 0 18px rgba(101, 216, 255, 0.13);
}
.message-user .message-avatar { color: #1d0d00; background: var(--orange); border-color: #ffc06d; }
.message-body { padding: 16px 18px; border: 1px solid rgba(101, 216, 255, 0.14); border-radius: 4px 18px 18px; background: #101821; }
.message-user .message-body { border-color: rgba(255, 158, 45, 0.2); border-radius: 18px 4px 18px 18px; background: #1b120b; }
.message-body > span { color: #6f8495; font: 700 0.58rem "Oxanium", sans-serif; letter-spacing: 0.08em; }
.message-body p { margin: 8px 0 0; color: #e1e8ed; font-size: 1.03rem; line-height: 1.52; white-space: pre-wrap; overflow-wrap: anywhere; }
.copy-answer { margin-top: 12px; padding: 6px 9px; border: 1px solid rgba(101, 216, 255, 0.15); border-radius: 7px; color: #88a4b7; background: transparent; cursor: pointer; }
.copy-answer:hover { color: var(--cyan-soft); border-color: rgba(101, 216, 255, 0.35); }

.thinking-dots { display: flex; height: 24px; align-items: center; gap: 6px; }
.thinking-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); animation: thinking 1.1s ease-in-out infinite; }
.thinking-dots i:nth-child(2) { animation-delay: 150ms; }
.thinking-dots i:nth-child(3) { animation-delay: 300ms; }

.composer-zone { padding: 18px 24px 22px; border-top: 1px solid var(--line); background: #0d1218; }
.composer-status { min-height: 0; color: #a8b7c4; font-size: 0.88rem; }
.composer-status:not(:empty) { min-height: 36px; padding: 8px 10px; margin-bottom: 10px; border-radius: 8px; background: rgba(101, 216, 255, 0.06); }
.composer-status.is-error { color: #ffaaa7; background: rgba(255, 85, 82, 0.08); }
.composer-status.is-warning { color: #ffd085; background: rgba(255, 158, 45, 0.08); }
#chat-form { padding: 14px; border: 1px solid rgba(101, 216, 255, 0.22); border-radius: 17px; background: #080c11; box-shadow: 0 16px 45px rgba(0,0,0,0.22); }
#chat-form:focus-within { border-color: rgba(101, 216, 255, 0.52); box-shadow: 0 0 0 3px rgba(101, 216, 255, 0.05); }
#chat-form label { display: block; margin-bottom: 7px; color: var(--cyan); font: 800 0.58rem "Oxanium", sans-serif; letter-spacing: 0.1em; }
#prompt { width: 100%; min-height: 74px; padding: 0; resize: vertical; border: 0; outline: 0; color: white; background: transparent; font-size: 1.05rem; line-height: 1.45; }
#prompt::placeholder { color: #53616f; }
.composer-footer { display: flex; padding-top: 10px; align-items: center; gap: 14px; border-top: 1px solid rgba(101, 216, 255, 0.1); color: #687989; }
.composer-footer > span { font: 700 0.63rem "Oxanium", sans-serif; }
.composer-footer small { margin-right: auto; }
#send-button {
  display: flex;
  padding: 11px 15px;
  align-items: center;
  gap: 16px;
  border: 0;
  border-radius: 10px;
  color: #1a0b00;
  background: linear-gradient(180deg, #ffc05c, #ff9020);
  box-shadow: 0 10px 30px rgba(255, 139, 22, 0.16);
  font: 800 0.67rem "Oxanium", sans-serif;
  cursor: pointer;
}
#send-button:disabled { opacity: 0.55; cursor: wait; }
#send-button i { font-style: normal; font-size: 1rem; }
.accuracy-note { margin: 11px 4px 0; color: #71808e; font-size: 0.84rem; line-height: 1.4; }
.accuracy-note a { color: #9ddfff; }

.scope-strip { display: grid; overflow: hidden; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: #0b1016; }
.scope-strip article { padding: 26px; border-right: 1px solid var(--line); }
.scope-strip article:last-child { border-right: 0; }
.scope-strip span { color: rgba(101, 216, 255, 0.34); font: 800 2.4rem "Oxanium", sans-serif; }
.scope-strip h3 { margin: 11px 0 6px; font-family: "Oxanium", sans-serif; }
.scope-strip p { margin: 0; color: var(--muted); line-height: 1.45; }

footer { display: grid; padding: 28px 8px 0; grid-template-columns: 1fr auto; gap: 14px 30px; color: #788795; }
footer > div { display: flex; gap: 10px; }
footer strong { color: var(--orange); font-family: "Oxanium", sans-serif; }
footer nav { display: flex; gap: 18px; }
footer a:hover { color: white; }
footer p { grid-column: 1 / -1; margin: 0; font-size: 0.84rem; }

@keyframes scan { to { transform: rotate(360deg); } }
@keyframes signal-pulse { 50% { opacity: 0.45; transform: scale(0.72); } }
@keyframes thinking { 50% { opacity: 0.24; transform: translateY(-4px); } }
@keyframes message-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1050px) {
  .hero { grid-template-columns: 1fr; }
  .signal-orbit { min-height: 350px; width: min(100%, 520px); justify-self: center; }
  .workbench { grid-template-columns: 300px minmax(0, 1fr); }
  .tool-rail { padding: 22px; }
  .topbar nav a:nth-child(2), .topbar nav a:nth-child(3) { display: none; }
}

@media (max-width: 780px) {
  .page-shell { width: min(100% - 20px, 1560px); margin-top: 10px; }
  .topbar { min-height: 72px; }
  .topbar nav a { display: none; }
  .hero { min-height: auto; padding: 34px 23px; }
  .hero h1 { font-size: clamp(2.75rem, 14vw, 4.7rem); }
  .signal-orbit { min-height: 290px; }
  .workbench { display: flex; flex-direction: column; }
  .tool-rail { border-right: 0; border-bottom: 1px solid var(--line); }
  .prompt-stack { grid-template-columns: 1fr 1fr; }
  .privacy-callout { margin-top: 0; }
  .message-stream { max-height: 620px; padding: 22px 14px; }
  .composer-zone { padding: 14px; }
  .composer-footer { align-items: flex-start; flex-wrap: wrap; }
  .composer-footer small { width: calc(100% - 80px); order: 3; }
  #send-button { margin-left: auto; }
  .scope-strip { grid-template-columns: 1fr; }
  .scope-strip article { border-right: 0; border-bottom: 1px solid var(--line); }
  footer { grid-template-columns: 1fr; }
  footer nav { flex-wrap: wrap; }
}

@media (max-width: 520px) {
  .brand small, .engine-state { display: none; }
  .topbar { padding: 9px 12px; }
  .brand-mark { width: 47px; height: 47px; }
  .hero-copy > p { font-size: 1.05rem; }
  .signal-orbit { min-height: 250px; }
  .orbit-core { width: 72px; height: 72px; font-size: 1.5rem; }
  .prompt-stack { grid-template-columns: 1fr; }
  .chat-header { padding: 16px; align-items: flex-start; }
  .chat-actions { align-items: flex-end; flex-direction: column; }
  .message { grid-template-columns: 34px minmax(0, 1fr); }
  .message-avatar { width: 34px; height: 34px; font-size: 0.55rem; }
  .message-body { padding: 13px; }
  .composer-footer small { display: none; }
}

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