:root {
  --paper: #06080c;
  --paper-2: #0c1018;
  --paper-3: #141c28;
  --ink: #e8ecf4;
  --ink-2: #cdd3e0;
  --ink-3: #8a93a8;
  --rule: rgba(232, 236, 244, 0.1);
  --rule-soft: rgba(232, 236, 244, 0.06);
  --teal: #3eecc8;
  --teal-deep: #22b89a;
  --blue: #6ab0ff;
  --violet: #c5a3ff;
  --coral: #ff9a8b;
  --amber: #ffc46b;
  --green: #7fe3c8;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  --glow: 0 0 60px rgba(62, 204, 200, 0.18);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Consolas, ui-monospace, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--paper); color: var(--ink); font-family: var(--font); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 10%, rgba(62, 204, 200, 0.16), transparent 26rem),
    radial-gradient(circle at 88% 18%, rgba(106, 176, 255, 0.14), transparent 24rem),
    var(--paper);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
body.panel-open { overflow: hidden; }

a { color: inherit; }
img, canvas, video { max-width: 100%; display: block; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: 12px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.page-title {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 50;
  transform: translateY(-160%);
  background: var(--teal);
  color: var(--paper);
  padding: 0.75rem 1rem;
  border-radius: 999px;
  font-weight: 800;
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3.5rem);
  border-bottom: 1px solid var(--rule);
  background: rgba(6, 8, 12, 0.82);
  backdrop-filter: blur(18px);
}
.site-header.compact { background: rgba(6, 8, 12, 0.88); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  min-height: 44px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(62, 204, 200, 0.4);
  border-radius: 14px;
  background: rgba(62, 204, 200, 0.14);
  color: var(--teal);
  font-weight: 900;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 0.95rem; }
.brand small { color: var(--ink-3); font-size: 0.72rem; margin-top: 0.12rem; }

.nav {
  display: flex;
  align-items: center;
  gap: clamp(0.5rem, 2vw, 1.1rem);
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  transition: color 180ms var(--ease), background 180ms var(--ease);
}
.nav a:hover { color: var(--ink); background: rgba(232, 236, 244, 0.08); }

/* Chat shell */
.chat-shell {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 1px;
  min-height: calc(100vh - 68px);
  background: var(--rule);
}
.sidebar {
  background: var(--paper);
  border-right: 1px solid var(--rule);
  padding: clamp(1.4rem, 3vw, 2.2rem) clamp(1rem, 3vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--teal);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.suggested-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.suggested {
  min-height: 42px;
  text-align: left;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: rgba(232, 236, 244, 0.04);
  color: var(--ink-2);
  padding: 0.85rem 1rem;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.45;
  cursor: pointer;
  transition: background 180ms var(--ease), border-color 180ms var(--ease), color 180ms var(--ease);
}
.suggested:hover {
  border-color: rgba(62, 204, 200, 0.35);
  background: rgba(62, 204, 200, 0.1);
  color: var(--ink);
}

.chat-main {
  background: var(--paper-2);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: clamp(1.4rem, 3vw, 2.2rem) clamp(1rem, 3vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.message {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 0.75rem;
  align-items: start;
}
.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 12px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.78rem;
}
.assistant-avatar {
  background: rgba(62, 204, 200, 0.14);
  color: var(--teal);
  border-color: rgba(62, 204, 200, 0.32);
}
.user-avatar {
  background: rgba(106, 176, 255, 0.14);
  color: var(--blue);
  border-color: rgba(106, 176, 255, 0.32);
}

.message-content { min-width: 0; }
.message-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}
.sender {
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}
.timestamp {
  color: var(--ink-3);
  font-size: 0.7rem;
  font-family: var(--mono);
}

.bubble {
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 0.95rem 1.1rem;
  line-height: 1.6;
  color: var(--ink);
  max-width: 72ch;
}
.assistant-bubble { background: rgba(20, 28, 40, 0.82); }
.user-bubble {
  background: rgba(62, 204, 200, 0.1);
  border-color: rgba(62, 204, 200, 0.28);
}
.bubble p { margin: 0; }
.bubble p + p { margin-top: 0.7rem; }
.bubble code {
  background: rgba(232, 236, 244, 0.07);
  color: var(--blue);
  padding: 0.12rem 0.24rem;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.88em;
}

.stream-text {
  display: inline;
}
.stream-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: var(--teal);
  margin-left: 2px;
  vertical-align: middle;
  border-radius: 2px;
  animation: blink 1.2s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.proof-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
  font-size: 0.84rem;
  color: var(--ink-2);
}
.proof-badge .label { margin: 0; }

.message.user .message-header { justify-self: end; }
.message.user .message { grid-template-columns: 1fr 34px; }

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem clamp(1rem, 3vw, 2rem);
  color: var(--ink-3);
  font-size: 0.82rem;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  opacity: 0.6;
  animation: pulse 1.3s ease-in-out infinite;
}
.dot:nth-child(2) { animation-delay: 0.15s; }
.dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

.composer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: clamp(0.8rem, 2vw, 1.2rem) clamp(1rem, 3vw, 2rem);
  border-top: 1px solid var(--rule);
  background: rgba(20, 28, 40, 0.6);
  backdrop-filter: blur(12px);
}
.composer input {
  flex: 1 1 auto;
  min-height: 46px;
  padding: 0.7rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: rgba(232, 236, 244, 0.05);
  color: var(--ink);
  font: inherit;
  font-size: 0.96rem;
}
.composer input::placeholder { color: var(--ink-3); }
.send-button {
  min-width: 42px;
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: rgba(62, 204, 200, 0.12);
  color: var(--teal);
  cursor: pointer;
  transition: background 180ms var(--ease), border-color 180ms var(--ease);
}
.send-button:hover { background: rgba(62, 204, 200, 0.24); border-color: rgba(62, 204, 200, 0.4); }

/* Sections */
.section {
  padding: clamp(4rem, 8vw, 7rem) clamp(1.25rem, 5vw, 6rem);
  background: var(--paper);
}
.section-kicker {
  color: var(--teal);
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
h2 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 5.2rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
}
.section > div > p, .section > div + p { max-width: 72ch; margin-top: 1.1rem; color: var(--ink-2); line-height: 1.65; font-size: 1.04rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-top: 2rem; }

.button, .ghost-button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  padding: 0.85rem 1.05rem;
  font-weight: 800;
  text-decoration: none;
  transition: transform 180ms var(--ease), background 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease);
}
.button:hover, .ghost-button:hover { transform: translateY(-2px); }
.button.primary { background: var(--teal); color: var(--paper); box-shadow: var(--glow); }
.button.secondary, .ghost-button { border: 1px solid var(--rule); color: var(--ink); background: rgba(232, 236, 244, 0.06); }
.ghost-button { cursor: pointer; font: inherit; font-size: 0.86rem; width: fit-content; }
.ghost-button.full { width: 100%; justify-content: center; }

.proof-floor { border-top: 1px solid var(--rule); }
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}
.proof-card {
  border: 1px solid var(--rule);
  border-radius: 22px;
  background: rgba(14, 18, 28, 0.7);
  padding: clamp(1.1rem, 2vw, 1.4rem);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
  min-height: 270px;
  display: flex;
  flex-direction: column;
  transition: transform 220ms var(--ease), border-color 220ms var(--ease), background 220ms var(--ease);
}
.proof-card:hover { transform: translateY(-5px); border-color: rgba(62, 204, 200, 0.32); background: rgba(14, 18, 28, 0.86); }
.proof-card p { color: var(--ink-2); line-height: 1.56; font-size: 0.96rem; }
.proof-card a, .footer a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  color: var(--teal);
  font-weight: 800;
  text-underline-offset: 0.22em;
  margin-top: auto;
}

.label {
  width: max-content;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0.24rem 0.62rem;
  margin-bottom: 1.1rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.real-label { background: rgba(127, 227, 200, 0.12); color: var(--green); border: 1px solid rgba(127, 227, 200, 0.28); }
.concept-label { background: rgba(255, 154, 139, 0.12); color: var(--coral); border: 1px solid rgba(255, 154, 139, 0.32); }
.built-label { background: rgba(255, 196, 107, 0.12); color: var(--amber); border: 1px solid rgba(255, 196, 107, 0.32); }

.closing {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background:
    radial-gradient(circle at 78% 12%, rgba(197, 163, 255, 0.14), transparent 22rem),
    var(--paper-2);
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(280px, 0.54fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}
.closing p { max-width: 72ch; margin-top: 1rem; color: var(--ink-2); line-height: 1.65; font-size: 1.05rem; }

.concept-panel, .detail-panel {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(3, 4, 8, 0.78);
  backdrop-filter: blur(14px);
}
.concept-panel[hidden], .detail-panel[hidden] { display: none; }
.panel-card {
  position: relative;
  width: min(560px, 100%);
  border: 1px solid rgba(62, 204, 200, 0.22);
  border-radius: 26px;
  background: var(--paper-2);
  padding: clamp(1.35rem, 4vw, 2rem);
  box-shadow: var(--shadow);
}
.panel-card p { color: var(--ink-2); line-height: 1.6; }
.panel-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 42px;
  height: 42px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgba(232, 236, 244, 0.07);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.4rem;
}
.panel-list { margin-top: 1.4rem; color: var(--ink-2); line-height: 1.55; list-style: none; padding: 0; }
.panel-list li { margin-top: 0.45rem; }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--rule);
  padding: 1.4rem clamp(1.25rem, 5vw, 6rem);
  color: var(--ink-3);
}
.footer p { margin: 0; }

/* Guide */
.guide-main { padding: clamp(3rem, 7vw, 6rem) clamp(1rem, 5vw, 6rem); }
.guide-article { width: min(920px, 100%); margin: 0 auto; }
.guide-body { background: var(--paper); }
.guide-article h1 { max-width: 11ch; font-size: clamp(3.2rem, 8vw, 7.2rem); }
.guide-article section { border-top: 1px solid var(--rule); padding-top: 2rem; margin-top: 2rem; }
.guide-article code { background: rgba(232, 236, 244, 0.07); color: var(--teal-deep); padding: 0.1rem 0.28rem; border-radius: 6px; }
.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.2rem; }
.pass-list { color: var(--ink-2); line-height: 1.65; }
.pass-list li + li { margin-top: 0.6rem; }

/* Responsive */
@media (max-width: 980px) {
  .chat-shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; gap: 0.8rem; overflow-x: auto; padding-bottom: 0.6rem; }
  .sidebar-header { flex-shrink: 0; }
  .suggested-list { flex-direction: row; }
  .suggested { white-space: nowrap; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-grid { grid-template-columns: 1fr; }
  .closing { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .site-header { align-items: flex-start; flex-direction: column; }
  .nav { justify-content: flex-start; }
  .chat-shell { min-height: calc(100vh - 80px); }
  .card-grid { grid-template-columns: 1fr; }
  .proof-card { min-height: unset; }
  .composer input, .send-button { min-height: 48px; }
}

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