:root {
  --bg: #07090f;
  --panel: #10141d;
  --panel-2: #161b27;
  --ink: #e8edf7;
  --muted: #8b95ab;
  --faint: #5d677c;
  --line: rgba(140, 190, 255, 0.14);
  --line-strong: rgba(140, 190, 255, 0.38);
  --cyan: #5ce1e6;
  --pink: #ff5ca8;
  --amber: #f5c542;
  --lime: #c6ff6a;
  --sans: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 14px;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(900px 420px at 8% -8%, rgba(92, 225, 230, 0.12), transparent 55%),
    radial-gradient(720px 380px at 100% 0%, rgba(255, 92, 168, 0.1), transparent 48%),
    var(--bg);
  line-height: 1.5;
}

.skip {
  position: absolute;
  left: 12px;
  top: -44px;
  z-index: 40;
  padding: 8px 12px;
  background: var(--lime);
  color: #111;
  font-weight: 700;
  text-decoration: none;
}
.skip:focus { top: 12px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.nav, .hero, .rail, .bench, .timeline, .export, .why, .foot {
  width: min(1120px, calc(100% - 2rem));
  margin-left: auto;
  margin-right: auto;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0 0.4rem;
}
.hub, .source, .foot a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.86rem;
}
.hub:hover, .source:hover, .foot a:hover { color: var(--cyan); }
.brand {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.mark {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background:
    conic-gradient(from 210deg, var(--cyan), var(--pink), var(--amber), var(--cyan));
  box-shadow: 0 0 16px rgba(92, 225, 230, 0.45);
}

.hero { padding: 1.4rem 0 0.4rem; }
.kicker, .badge, .receipt-kicker {
  margin: 0 0 0.45rem;
  font: 600 0.72rem/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
}
h1 {
  margin: 0;
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  letter-spacing: -0.05em;
  line-height: 1.05;
  font-weight: 900;
}
.lede {
  max-width: 46rem;
  color: var(--muted);
  font-size: 1.02rem;
}
.hero-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  margin: 1rem 0;
}
.install {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.6rem 0.55rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(16, 20, 29, 0.8);
}
.install code {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink);
}
.install b { color: var(--lime); font-weight: 600; }
.hero-actions, .pane-actions, .transport { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: center; }
.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font: 700 0.88rem/1 var(--sans);
  padding: 0.62rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
}
.btn.primary {
  background: linear-gradient(90deg, #1d6f74, #5ce1e6);
  color: #061016;
  border-color: transparent;
}
.btn.quiet:hover { border-color: var(--cyan); color: var(--cyan); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
blockquote {
  margin: 0.4rem 0 0;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--pink);
  background: rgba(255, 92, 168, 0.06);
  border-radius: 0 12px 12px 0;
  color: var(--ink);
  max-width: 44rem;
}
blockquote p { margin: 0 0 0.35rem; }
cite { color: var(--faint); font-style: normal; font-size: 0.82rem; }

.rail {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  list-style: none;
  padding: 0.7rem 0 0.55rem;
  margin-top: 1.1rem;
  background: linear-gradient(180deg, rgba(7, 9, 15, 0.96), rgba(7, 9, 15, 0.88) 70%, transparent);
}
.rail li { min-width: 0; }
.stage {
  width: 100%;
  text-align: left;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: inherit;
  cursor: pointer;
  min-height: 5.2rem;
}
.stage b { display: block; font-size: 0.92rem; margin: 0.12rem 0; }
.stage span { color: var(--faint); font-size: 0.74rem; }
.stage .idx { font: 600 0.68rem/1 var(--mono); color: var(--cyan); letter-spacing: 0.08em; }
.stage.is-on {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px rgba(92, 225, 230, 0.25), var(--shadow);
}
.stage.is-done { border-color: rgba(198, 255, 106, 0.45); }
.stage.is-busy { animation: pulse 1.1s ease-in-out infinite; }
.stage[data-stage="export"].is-on { border-color: var(--amber); }

@keyframes pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.18); }
}

.bench {
  display: grid;
  grid-template-columns: 1.15fr 1fr 0.82fr;
  gap: 0.7rem;
  margin-top: 0.4rem;
}
.pane, .timeline, .export, .why article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.pane { padding: 0.9rem; min-width: 0; }
.pane header { margin-bottom: 0.35rem; }
.pane h2, .timeline h2, .export h2, .why h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.hint, .status { margin: 0.2rem 0 0.7rem; color: var(--muted); font-size: 0.82rem; }
.status { margin: 0; }
.presets { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.6rem; }
.chip {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font: 600 0.78rem/1.3 var(--sans);
  cursor: pointer;
}
.chip.is-on { color: var(--ink); border-color: var(--pink); background: rgba(255, 92, 168, 0.12); }
#prompt, #source {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0b0e15;
  color: var(--ink);
  font: 500 0.8rem/1.45 var(--mono);
  padding: 0.55rem 0.7rem;
}
#prompt { margin-bottom: 0.45rem; }
#source { resize: vertical; min-height: 12rem; }
#prompt:focus, #source:focus, #scrub:focus, .stage:focus-visible, .btn:focus-visible, .chip:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.ir {
  margin: 0 0 0.6rem;
  padding: 0.75rem;
  min-height: 12.5rem;
  max-height: 16rem;
  overflow: auto;
  border-radius: 10px;
  background: #0b0e15;
  border: 1px solid var(--line);
  color: var(--lime);
  font: 500 0.72rem/1.5 var(--mono);
  white-space: pre-wrap;
}
.log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-height: 4.5rem;
}
.log li {
  font: 500 0.72rem/1.35 var(--mono);
  color: var(--muted);
  padding-left: 0.7rem;
  border-left: 2px solid var(--faint);
}
.log li.ok { color: var(--lime); border-color: var(--lime); }
.log li.warn { color: var(--amber); border-color: var(--amber); }

.phone {
  width: min(100%, 168px);
  margin: 0 auto 0.7rem;
  padding: 8px;
  border-radius: 22px;
  background: #05070c;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.screen {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: 16px;
  overflow: hidden;
  background: #111;
}
#frame { display: block; width: 100%; height: 100%; }
.cap, .word {
  position: absolute;
  left: 8px;
  right: 8px;
  margin: 0;
  text-align: center;
  text-shadow: 0 1px 4px #000;
}
.cap {
  bottom: 34px;
  font: 800 0.78rem/1.2 var(--sans);
}
.word {
  bottom: 10px;
  font: 600 0.68rem/1 var(--mono);
  color: var(--cyan);
}

.transport { justify-content: space-between; }
#scrub { flex: 1; accent-color: var(--pink); min-width: 0; }
.clock { font: 600 0.75rem/1 var(--mono); color: var(--amber); min-width: 3.2rem; text-align: right; }

.timeline {
  margin-top: 0.7rem;
  padding: 0.9rem;
}
.tl-bar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  margin-bottom: 0.5rem;
}
.tl-bar p { margin: 0; color: var(--muted); font-size: 0.82rem; }
.ruler {
  display: flex;
  font: 500 0.64rem/1 var(--mono);
  color: var(--faint);
  margin-bottom: 0.35rem;
}
.ruler span { flex: 1; border-left: 1px solid var(--line); padding-left: 0.25rem; }
.tracks { display: flex; flex-direction: column; gap: 0.4rem; }
.track {
  display: grid;
  grid-template-columns: 4.6rem 1fr;
  gap: 0.45rem;
  align-items: stretch;
}
.track b {
  font: 600 0.72rem/2.2 var(--mono);
  color: var(--muted);
}
.lane {
  position: relative;
  height: 2.15rem;
  border-radius: 8px;
  background: #0b0e15;
  border: 1px solid var(--line);
  overflow: hidden;
}
.clip {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: 6px;
  border: 0;
  color: #091016;
  font: 700 0.68rem/1.2 var(--sans);
  padding: 0 0.4rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}
.clip.is-on { outline: 2px solid #fff; outline-offset: 0; }
.head {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--amber);
  pointer-events: none;
  z-index: 2;
}

.export {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
  margin-top: 0.7rem;
  padding: 1rem;
}
.export p { color: var(--muted); font-size: 0.9rem; }
.progress {
  margin-top: 0.8rem;
  height: 8px;
  border-radius: 999px;
  background: #0b0e15;
  border: 1px solid var(--line);
  overflow: hidden;
}
.bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--amber));
}
.receipt {
  padding: 0.9rem;
  border-radius: 12px;
  background: #0b0e15;
  border: 1px dashed rgba(245, 197, 66, 0.45);
}
.receipt h3 { margin: 0 0 0.6rem; font-family: var(--mono); font-size: 1rem; color: var(--amber); }
.receipt dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem 0.8rem; }
.receipt div { margin: 0; }
dt { color: var(--faint); font-size: 0.72rem; }
dd { margin: 0; font-weight: 700; }
.hash { margin: 0.7rem 0 0; font: 500 0.68rem/1.4 var(--mono); color: var(--muted); word-break: break-all; }

.why { margin: 1.4rem auto 0; }
.why h2 { margin: 0 0 0.7rem; font-size: 1.2rem; }
.why-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}
.why article { padding: 0.95rem; }
.why .idx { margin: 0 0 0.35rem; font: 600 0.72rem/1 var(--mono); color: var(--pink); letter-spacing: 0.08em; }
.why h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.why p { margin: 0; color: var(--muted); font-size: 0.88rem; }

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.6rem 1.2rem;
  padding: 1.4rem 0 2.2rem;
  color: var(--faint);
  font-size: 0.8rem;
}

@media (max-width: 900px) {
  .rail, .bench, .export, .why-grid { grid-template-columns: 1fr; }
  .rail { position: static; }
  .phone { width: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .stage.is-busy { animation: none; }
}
