:root {
  --bg: #080b10;
  --panel: #0e141b;
  --panel-2: #111a20;
  --paper: #f1f0ea;
  --text: #f1f0ea;
  --muted: #a5acae;
  --lime: #b5ff18;
  --cyan: #42d7ee;
  --coral: #ff5c4d;
  --border: rgba(241, 240, 234, .18);
  --chip: #131d24;
}

html, body { height: auto; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font: 500 16px/1.5 Manrope, Arial, sans-serif;
}
button, textarea, input { font: inherit; }

.portal-bar {
  height: 68px;
  padding: 0 clamp(20px, 3.7vw, 70px);
}
.portal-brand { flex: 0 0 auto; }
.portal-mark { width: 40px; height: 40px; background: var(--lime); }
.lab-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.3vw, 36px);
}
.lab-nav a {
  color: #aeb4b7;
  font-size: 14px;
  text-decoration: none;
}
.lab-nav a:hover, .lab-nav a:focus-visible { color: var(--lime); }
.lab-menu {
  display: none;
  padding: 9px 12px;
  color: var(--paper);
  background: transparent;
  border: 1px solid var(--border);
  font: 700 10px/1 "Courier New", monospace;
}

.sim-hero {
  min-height: clamp(720px, calc(100vh - 68px), 920px);
  padding: clamp(72px, 8vw, 132px) clamp(24px, 5vw, 94px);
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, .55fr);
  align-items: center;
  gap: clamp(50px, 8vw, 150px);
}
.sim-hero-copy, .pipeline-preview { position: relative; z-index: 1; min-width: 0; }
.sim-hero h1 {
  max-width: 1050px;
  margin: 0;
  font-size: clamp(72px, 9.4vw, 172px);
  line-height: .84;
  letter-spacing: -.075em;
}
.sim-hero h1 span { color: var(--lime); }
.sim-hero-copy > p:not(.page-kicker) {
  max-width: 870px;
  margin: 38px 0 0;
  color: #c7ccca;
  font-size: clamp(20px, 2vw, 31px);
  line-height: 1.25;
  letter-spacing: -.025em;
}
.hero-action {
  display: inline-flex;
  margin-top: 35px;
  padding: 15px 18px;
  color: var(--bg);
  background: var(--lime);
  font: 800 11px/1 "Courier New", monospace;
  letter-spacing: .04em;
  text-decoration: none;
}
.pipeline-preview {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid rgba(181,255,24,.42);
  border-left: 1px solid rgba(181,255,24,.42);
}
.pipeline-preview div {
  min-height: 142px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid rgba(181,255,24,.42);
  border-bottom: 1px solid rgba(181,255,24,.42);
  background: rgba(10, 19, 14, .75);
}
.pipeline-preview b { color: var(--lime); font: 800 26px/1 "Courier New", monospace; }
.pipeline-preview span { color: #dce1dc; font-size: 15px; }

.sim-intro {
  padding: clamp(65px, 8vw, 120px) clamp(24px, 5vw, 94px);
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  align-items: end;
  gap: clamp(50px, 9vw, 170px);
  color: #080b10;
  background: #f1f0ea;
}
.section-label {
  margin: 0 0 15px;
  color: #658800;
  font: 800 11px/1.2 "Courier New", monospace;
  letter-spacing: .1em;
}
.sim-intro h2, .results-heading h2, .glossary-heading h2 {
  margin: 0;
  font-size: clamp(40px, 5vw, 78px);
  line-height: .98;
  letter-spacing: -.055em;
}
.sim-intro > p {
  margin: 0;
  color: #495157;
  font-size: 19px;
  line-height: 1.5;
}

.wrap.lab-shell {
  max-width: none;
  margin: 0;
  padding: clamp(64px, 7vw, 108px) clamp(20px, 4vw, 72px);
}
.card {
  margin: 0;
  padding: clamp(24px, 3vw, 46px);
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
}
.control-panel {
  position: relative;
  padding: clamp(28px, 4vw, 62px);
  background:
    linear-gradient(rgba(181,255,24,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(181,255,24,.04) 1px, transparent 1px),
    #0c151b;
  background-size: 90px 90px;
  border-color: rgba(181,255,24,.38);
}
.panel-heading {
  margin-bottom: 36px;
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 30px;
}
.panel-heading h2 { max-width: 900px; margin: 0; font-size: clamp(34px, 4vw, 62px); line-height: 1; letter-spacing: -.05em; }
.run-status { padding: 10px 12px; color: #c9d0ce; border: 1px solid var(--border); font: 700 10px/1 "Courier New", monospace; text-transform: uppercase; white-space: nowrap; }
.run-status span { width: 7px; height: 7px; margin-right: 7px; display: inline-block; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 5px rgba(181,255,24,.1); }
.run-status.is-running span { background: var(--cyan); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.field-label { display: block; margin-bottom: 9px; color: var(--cyan); font: 800 10px/1 "Courier New", monospace; letter-spacing: .08em; }
#prompt {
  width: 100%;
  min-height: 118px;
  padding: 22px;
  resize: vertical;
  color: #fff;
  caret-color: var(--lime);
  background: #080d12;
  border: 1px solid #4c575e;
  border-radius: 0;
  outline: 0;
  font-size: clamp(19px, 2vw, 28px);
  line-height: 1.35;
}
#prompt:focus { border-color: var(--lime); box-shadow: 0 0 0 1px var(--lime); }
.examples-block { margin-top: 24px; }
.row { gap: 8px; }
.examples { align-items: stretch; }
.btn {
  padding: 12px 15px;
  color: var(--bg);
  background: var(--lime);
  border: 1px solid var(--lime);
  border-radius: 0;
  font-weight: 800;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.soft {
  color: #c6cccf;
  background: #111b22;
  border: 1px solid #39454c;
  border-radius: 0;
  font-size: 13px;
  font-weight: 600;
}
.btn.soft:hover, .btn.soft.is-selected { color: var(--bg); background: var(--lime); border-color: var(--lime); }
.parameter-grid {
  margin-top: 30px;
  display: grid;
  grid-template-columns: 1fr 1fr .9fr;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.range-control, .decode-control {
  min-width: 0;
  margin: 0;
  padding: 24px;
  color: #d5d9d8;
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.range-control > span, .decode-control legend { display: block; color: #fff; font-weight: 700; }
.range-control b { color: var(--lime); }
.range-control input { width: 100%; margin: 20px 0 12px; accent-color: var(--lime); }
.range-control small { display: block; min-height: 42px; color: var(--muted); font-size: 13px; }
.decode-control { display: flex; flex-wrap: wrap; align-content: start; gap: 14px; }
.decode-control legend { width: 100%; margin-bottom: 18px; }
.decode-control label { cursor: pointer; }
.decode-control input, .emb-controls input { accent-color: var(--lime); }
.run-button { width: 100%; margin-top: 22px; min-height: 58px; display: flex; justify-content: space-between; align-items: center; font: 800 12px/1 "Courier New", monospace; letter-spacing: .06em; }
.run-button span { font-size: 23px; }
.keyboard-hint { margin: 13px 0 0; color: #818b91; text-align: center; font-size: 12px; }
kbd { padding: 3px 6px; color: #cdd3d2; background: #111a20; border: 1px solid #3a454c; font: 700 10px/1 "Courier New", monospace; }

.results-heading { padding: clamp(78px, 8vw, 125px) 0 34px; }
.results-heading h2 { max-width: 950px; }
.simulator-section { margin-top: 18px; }
.step-heading {
  margin-bottom: 34px;
  padding-bottom: 28px;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 22px;
  align-items: start;
  border-bottom: 1px solid var(--border);
}
.step-number { color: var(--lime); font: 800 22px/1 "Courier New", monospace; }
.step-heading h3 { margin: -6px 0 7px; font-size: clamp(28px, 3vw, 44px); line-height: 1.05; letter-spacing: -.04em; }
.step-heading p { max-width: 900px; margin: 0; color: var(--muted); font-size: 16px; }
.step-state { padding: 8px 10px; color: var(--lime); border: 1px solid rgba(181,255,24,.35); font: 800 9px/1 "Courier New", monospace; letter-spacing: .06em; }

.chips { gap: 10px; }
.chip {
  padding: 11px 14px;
  color: #f4f5ef;
  background: #121e25;
  border: 1px solid #3b4850;
  border-radius: 0;
  font: 700 14px/1 "Courier New", monospace;
}
.chip::before { content: "# "; color: var(--lime); }
.bars { gap: 11px; }
.bar { grid-template-columns: minmax(90px, 160px) minmax(120px, 1fr) 82px; gap: 12px; color: #d9dddb; }
.track { min-height: 14px; background: #081016; border: 1px solid #344149; border-radius: 0; }
.track > div { min-height: 12px; background: linear-gradient(90deg, var(--cyan), var(--lime)) !important; }

.emb-controls {
  margin: 0 0 28px;
  padding: 15px 17px;
  gap: 22px;
  background: #10191f;
  border: 1px solid var(--border);
}
.emb-controls > span { color: var(--cyan); font: 800 10px/1 "Courier New", monospace; text-transform: uppercase; }
.emb-controls label { color: #c1c8c8; cursor: pointer; font-size: 14px; }
.canvas-wrap { position: relative; margin-top: 26px; }
#embPlot {
  width: 100%;
  min-height: 400px;
  background:
    linear-gradient(rgba(181,255,24,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(181,255,24,.035) 1px, transparent 1px),
    #080e13;
  background-size: 48px 48px;
  border: 1px solid #3a474e;
  border-radius: 0;
}
.canvas-tip { position: absolute; left: 14px; top: 14px; padding: 7px 9px; color: #aab2b4; background: rgba(8,14,19,.86); border: 1px solid var(--border); font-size: 11px; pointer-events: none; }
.emb-legend { gap: 24px; margin-top: 15px; }
.legend-item { color: #aeb6b6; }
.legend-color { border-radius: 0; }
.prompt-dot { background: var(--lime); }
.related-dot { background: var(--cyan); }
.other-dot { background: var(--muted); }

.hgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hgrid > .card { padding: 22px; background: #0a1117; }
.hgrid > .card > b { display: block; margin-bottom: 15px; color: var(--cyan); font: 800 11px/1 "Courier New", monospace; text-transform: uppercase; }
.attention-grid { overflow-x: auto; }
.attention-cell { min-width: 62px; min-height: 72px; border: 1px solid rgba(255,255,255,.08); border-radius: 0; }
.attention-token { color: #d7dddc; }

.decoder-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 36px; }
.prediction-panel { padding: 25px; background: #0a1117; border: 1px solid var(--border); }
.prediction-panel h4 { margin: 15px 0 22px; font-size: clamp(23px, 2vw, 34px); line-height: 1.1; }
#opts { align-items: stretch; }
#opts .btn { flex: 1 1 120px; min-height: 45px; }
#beamOut { margin-top: 18px; color: var(--cyan); font: 700 12px/1.5 "Courier New", monospace; }

.glossary {
  margin: clamp(78px, 8vw, 130px) 0 0;
  padding: clamp(28px, 4vw, 60px);
  color: var(--bg);
  background: #f1f0ea;
  border: 0;
  border-radius: 0;
}
.glossary-heading { margin-bottom: 36px; display: flex; align-items: end; justify-content: space-between; gap: 36px; }
.glossary h2 { margin: 0; color: var(--bg); }
.glossary-heading > p { max-width: 380px; margin: 0; color: #5e6668; }
.term-grid { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid rgba(8,11,16,.18); border-left: 1px solid rgba(8,11,16,.18); }
.term {
  margin: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid rgba(8,11,16,.18);
  border-bottom: 1px solid rgba(8,11,16,.18);
}
.term summary { padding: 20px; display: flex; justify-content: space-between; gap: 20px; color: var(--bg); cursor: pointer; font-weight: 800; list-style: none; }
.term summary::-webkit-details-marker { display: none; }
.term summary span { color: #658800; font-size: 20px; }
.term[open] summary span { transform: rotate(45deg); }
.term-description { margin: 0; padding: 0 20px 22px; color: #50585c; line-height: 1.55; }

.tooltip {
  color: #eef1ec;
  background: #0b141a;
  border-color: rgba(181,255,24,.4);
  border-radius: 0;
}
.tooltip-word { color: var(--lime); }
.tooltip-vector { overflow-wrap: anywhere; background: #080e13; border-radius: 0; }
.tooltip-group { color: var(--cyan); }

.sim-footer {
  padding: 34px clamp(20px, 4vw, 72px);
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--paper);
  background: #080b10;
  border-top: 1px solid var(--border);
}
.sim-footer img { width: 58px; height: 58px; object-fit: cover; border: 2px solid var(--lime); border-radius: 50%; }
.sim-footer strong { display: block; }
.sim-footer p { margin: 5px 0 0; color: #939c9e; font-size: 13px; }
.sim-footer-links { margin-left: auto; display: flex; gap: 18px; }
.sim-footer a { color: var(--lime); text-decoration: none; font: 800 10px/1 "Courier New", monospace; }
.visit-count { color: #899294; font: 700 9px/1 "Courier New", monospace; text-transform: uppercase; }

@media (max-width: 1050px) {
  .sim-hero { grid-template-columns: 1fr; min-height: auto; }
  .pipeline-preview { max-width: 720px; }
  .parameter-grid, .decoder-grid { grid-template-columns: 1fr; }
  .decode-control { min-height: 130px; }
}

@media (max-width: 760px) {
  .portal-bar { flex-wrap: wrap; }
  .lab-menu { display: block; margin-left: auto; }
  .lab-nav { order: 3; width: 100%; margin: 0; padding: 14px 0 18px; display: none; flex-direction: column; align-items: stretch; background: #080b10; }
  .lab-nav.is-open { display: flex; }
  .sim-hero { padding-top: 76px; }
  .sim-hero h1 { font-size: clamp(64px, 19vw, 104px); }
  .sim-intro { grid-template-columns: 1fr; align-items: start; }
  .panel-heading, .glossary-heading { flex-direction: column; align-items: start; }
  .step-heading { grid-template-columns: 50px minmax(0, 1fr); }
  .step-state { grid-column: 2; width: max-content; }
  .hgrid, .term-grid { grid-template-columns: 1fr; }
  .bar { grid-template-columns: 90px minmax(80px, 1fr) 62px; font-size: 12px; }
  .sim-footer { flex-wrap: wrap; align-items: start; }
  .sim-footer-links { width: 100%; margin: 8px 0 0; }
}

@media (max-width: 520px) {
  .portal-bar { padding-inline: 14px; }
  .portal-brand > span:last-child { display: none; }
  .sim-hero { padding-inline: 22px; }
  .sim-hero h1 { font-size: 18vw; }
  .pipeline-preview { grid-template-columns: 1fr 1fr; }
  .pipeline-preview div { min-height: 110px; padding: 18px; }
  .wrap.lab-shell { padding-inline: 14px; }
  .control-panel, .simulator-section, .glossary { padding: 22px 18px; }
  .examples .btn { width: 100%; text-align: left; }
  .parameter-grid { grid-template-columns: 1fr; }
  .emb-controls { align-items: start; flex-direction: column; }
  #embPlot { min-height: 330px; height: 330px; }
  .canvas-tip { position: static; display: block; margin-top: 8px; }
  .decoder-grid { gap: 22px; }
}

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