:root {
  --bg: #0a0908;
  --bg-soft: #14110f;
  --panel: #1a1714;
  --panel-2: #221d18;
  --line: rgba(255, 240, 220, 0.08);
  --line-strong: rgba(255, 240, 220, 0.14);
  --fg: #f4ece1;
  --fg-2: #cdc1b0;
  --fg-3: #8a7f6f;
  --fg-4: #5a5043;
  --accent: #ff7a59;
  --accent-2: #ffb38a;
  --accent-soft: rgba(255, 122, 89, 0.14);
  --leader: #ffb53d;
  --worker-a: #6ec5ff;
  --worker-b: #b884ff;
  --worker-c: #6fe2b5;
  --worker-d: #ff7a59;
  --good: #6fe2b5;
  --warn: #ffd166;
  --bad: #ff6f6f;

  --sans: "Inter", "Noto Sans JP", system-ui, sans-serif;
  --jp: "Noto Sans JP", "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius: 14px;
  --radius-lg: 20px;

  --maxw: 1240px;
}

[data-theme="light"] {
  --bg: #fbf7f0;
  --bg-soft: #f3ece1;
  --panel: #ffffff;
  --panel-2: #f7efe2;
  --line: rgba(40, 25, 10, 0.08);
  --line-strong: rgba(40, 25, 10, 0.16);
  --fg: #1c1611;
  --fg-2: #4a3f33;
  --fg-3: #7a6e5d;
  --fg-4: #a89c89;
  --accent-soft: rgba(255, 122, 89, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: auto; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
  overflow-x: hidden;
}
[lang="ja"] body, body[data-lang="ja"] { font-family: var(--jp); }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

::selection { background: var(--accent); color: #150b06; }

/* ---------- Top bar ---------- */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  background: linear-gradient(to bottom, rgba(10,9,8,0.7), rgba(10,9,8,0.35));
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s ease, background 0.4s ease;
}
[data-theme="light"] .topbar {
  background: linear-gradient(to bottom, rgba(251,247,240,0.85), rgba(251,247,240,0.5));
}
.topbar.scrolled { border-color: var(--line); }
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.topbar-brand img { width: 28px; height: 28px; border-radius: 7px; }
.topbar-nav {
  display: flex;
  gap: 28px;
  font-size: 13px;
  color: var(--fg-2);
}
.topbar-nav a:hover { color: var(--fg); }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.lang-toggle {
  display: inline-flex;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  font-size: 12px;
  font-weight: 600;
}
.lang-toggle button {
  padding: 5px 11px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--fg-3);
  cursor: pointer;
}
.lang-toggle button.active { background: var(--accent); color: #150b06; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:hover { transform: translateY(-1px); border-color: var(--accent); }
.btn-primary {
  background: var(--accent);
  color: #1a0c06;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { background: transparent; }

@media (max-width: 720px) {
  .topbar-nav { display: none; }
}

/* ---------- Scroll story scaffolding ---------- */
.story {
  position: relative;
  z-index: 1;
}
.scene {
  position: relative;
  width: 100%;
}
/* a "pin scene" reserves N viewport heights; the inner pin-stage sticks */
.pin-scene { /* height set inline */ }
.pin-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.scene-pad {
  width: min(var(--maxw), calc(100% - 48px));
  margin: 0 auto;
  padding: 120px 0;
}

/* ---------- Type ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 16px;
}
.h-display {
  font-size: clamp(40px, 7vw, 96px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 800;
  margin: 0 0 22px;
  text-wrap: balance;
}
.h1 {
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 800;
  margin: 0 0 18px;
  text-wrap: balance;
}
.h2 {
  font-size: clamp(24px, 2.6vw, 32px);
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-weight: 700;
  margin: 0 0 14px;
  text-wrap: balance;
}
.lede {
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.55;
  color: var(--fg-2);
  max-width: 56ch;
  text-wrap: pretty;
}
.gradient-text {
  background: linear-gradient(135deg, #ffd9c5 0%, #ff7a59 60%, #ff5e3a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 120px 24px 80px;
  text-align: center;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 50% 35%, rgba(255, 122, 89, 0.18), transparent 70%),
    radial-gradient(80% 60% at 50% 100%, rgba(255, 122, 89, 0.06), transparent 70%);
}
.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(circle at center, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle at center, black 30%, transparent 70%);
  opacity: 0.6;
}
.hero-content { position: relative; z-index: 2; }
.hero-logo {
  width: clamp(120px, 16vw, 180px);
  height: clamp(120px, 16vw, 180px);
  margin: 0 auto 32px;
  filter: drop-shadow(0 30px 60px rgba(255, 122, 89, 0.35));
}
.hero-title {
  font-size: clamp(54px, 9vw, 132px);
  letter-spacing: -0.045em;
  font-weight: 800;
  line-height: 0.95;
  margin: 0 0 22px;
}
.hero-sub {
  font-size: clamp(17px, 1.6vw, 22px);
  color: var(--fg-2);
  max-width: 36ch;
  margin: 0 auto 36px;
  line-height: 1.45;
  text-wrap: balance;
}
.hero-actions { display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.hero-meta {
  margin-top: 40px;
  display: flex;
  justify-content: center;
  gap: 20px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--fg-3);
  text-transform: uppercase;
}
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.hero-terminal {
  margin: 56px auto 0;
  width: min(720px, 92%);
  text-align: left;
}

.scroll-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--fg-3);
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 3;
}
.scroll-hint .line {
  width: 1px; height: 36px;
  background: linear-gradient(to bottom, transparent, var(--fg-3));
  animation: scroll-hint 1.8s ease-in-out infinite;
}
@keyframes scroll-hint {
  0% { transform: scaleY(0.2); transform-origin: top; opacity: 0.4; }
  50% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(0.2); transform-origin: bottom; opacity: 0.4; }
}

/* ---------- Terminal card ---------- */
.term {
  background: #15110d;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--fg-2);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.45), 0 1px 0 rgba(255,255,255,0.03) inset;
}
.term-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(to bottom, #1f1a14, #15110d);
}
.term-head .dots { display: flex; gap: 6px; }
.term-head .dots span {
  width: 11px; height: 11px; border-radius: 50%;
  background: #3d342a;
}
.term-head .dots span:nth-child(1) { background: #ff5f57; }
.term-head .dots span:nth-child(2) { background: #febc2e; }
.term-head .dots span:nth-child(3) { background: #28c840; }
.term-head .label {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.04em;
}
.term-head .crown {
  display: inline-flex;
  padding: 2px 8px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px;
  background: rgba(255, 181, 61, 0.15);
  color: var(--leader);
  border: 1px solid rgba(255, 181, 61, 0.3);
}
.term-body {
  padding: 16px 18px 18px;
  min-height: 110px;
}
.term-line { white-space: pre-wrap; }
.term-line .prompt { color: var(--accent); margin-right: 8px; }
.term-line .cmd { color: var(--fg); }
.term-line .out { color: var(--fg-3); }
.term-line .ok { color: var(--good); }
.term-line .warn { color: var(--warn); }
.term-line .leader { color: var(--leader); }
.term-line .worker-a { color: var(--worker-a); }
.term-line .worker-b { color: var(--worker-b); }
.term-line .worker-c { color: var(--worker-c); }
.cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: var(--accent);
  vertical-align: -2px;
  margin-left: 2px;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Generic two-up "scene" ---------- */
.split {
  display: grid;
  grid-template-columns: 0.95fr 1.1fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
  width: min(var(--maxw), 100% - 48px);
  margin: 0 auto;
}
.split-text { max-width: 52ch; }
@media (max-width: 880px) {
  .split { grid-template-columns: 1fr; }
}

/* ---------- Problem (8 terminals chaos) ---------- */
.problem-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 12px;
  width: min(var(--maxw), 100% - 48px);
  height: min(70vh, 620px);
  margin: 0 auto;
  perspective: 1200px;
}
.problem-grid .term {
  height: 100%;
  font-size: 11px;
  transform-style: preserve-3d;
}
.problem-grid .term-body { padding: 10px 12px; min-height: 0; }
.problem-grid .term-head { padding: 6px 10px; }
.problem-grid .term-head .label { font-size: 10px; }
.problem-grid .term-head .dots span { width: 8px; height: 8px; }

/* ---------- Comparison ---------- */
.compare {
  width: min(var(--maxw), 100% - 48px);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--panel);
}
.compare table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.compare th, .compare td {
  padding: 16px 14px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.compare th:first-child, .compare td:first-child {
  text-align: left;
  color: var(--fg-2);
  font-weight: 500;
  width: 36%;
}
.compare thead th {
  background: var(--panel-2);
  font-size: 12px;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--fg-3);
  text-transform: uppercase;
}
.compare thead th.us {
  color: var(--accent);
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
}
.compare td.us { background: rgba(255, 122, 89, 0.06); }
.compare tbody tr:last-child th, .compare tbody tr:last-child td { border-bottom: 0; }
.cell-y { color: var(--good); font-size: 18px; }
.cell-n { color: var(--fg-4); font-size: 18px; }
.cell-h { color: var(--warn); font-size: 18px; }
.cell-us {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--accent);
}

/* ---------- Features grid ---------- */
.features {
  width: min(var(--maxw), 100% - 48px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
.feature {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--panel);
  position: relative;
  overflow: hidden;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.feature h3 {
  font-size: 18px;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  font-weight: 700;
}
.feature p {
  margin: 0;
  font-size: 13.5px;
  color: var(--fg-2);
  line-height: 1.5;
}
.feature .feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 16px;
  margin-bottom: 14px;
}
.feature .feature-art {
  margin-top: 18px;
  height: 90px;
  border-radius: 10px;
  background:
    repeating-linear-gradient(45deg, var(--line) 0 1px, transparent 1px 12px),
    var(--panel-2);
  border: 1px solid var(--line);
}
.feature.span-6 { grid-column: span 6; }
.feature.span-4 { grid-column: span 4; }
.feature.span-8 { grid-column: span 8; }
.feature.span-12 { grid-column: span 12; }
@media (max-width: 880px) {
  .feature.span-6, .feature.span-4, .feature.span-8 { grid-column: span 12; }
}

/* ---------- Install ---------- */
.install-stage {
  width: min(900px, 100% - 48px);
  margin: 0 auto;
  text-align: center;
}
.install-card {
  margin-top: 36px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
  display: grid;
  gap: 16px;
}
.install-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0,0,0,0.15);
  text-align: left;
}
[data-theme="light"] .install-row { background: rgba(255,255,255,0.6); }
.install-row .os {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.install-row .os svg { width: 22px; height: 22px; }
.install-row .name { font-weight: 600; }
.install-row .meta { color: var(--fg-3); font-size: 12px; font-family: var(--mono); }

.install-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 14px 16px;
  margin-top: -4px;
  border: 1px solid var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--accent-soft);
  text-align: left;
  color: var(--fg-2);
  font-size: 13px;
  line-height: 1.65;
}
.install-note-badge {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #150b06;
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
}
.install-note-body { min-width: 0; }
.install-note-cmd {
  margin: 8px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(0,0,0,0.35);
  color: var(--fg-1);
  font-family: var(--mono);
  font-size: 12px;
  overflow-x: auto;
  white-space: pre;
}
[data-theme="light"] .install-note-cmd { background: rgba(40,25,10,0.06); }

/* ---------- Footer ---------- */
.footer {
  margin-top: 80px;
  padding: 60px 24px 40px;
  border-top: 1px solid var(--line);
}
.footer-inner {
  width: min(var(--maxw), 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 36px;
}
.footer h4 {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin: 0 0 14px;
}
.footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 14px; color: var(--fg-2); }
.footer-bottom {
  width: min(var(--maxw), 100%);
  margin: 40px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--fg-3);
  font-family: var(--mono);
}
@media (max-width: 720px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

/* ---------- "OneWindow" scene: window collapsing ---------- */
.window-frame {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 60px 120px rgba(0,0,0,0.55), 0 1px 0 rgba(255,255,255,0.04) inset;
}
.window-chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(to bottom, #1c1814, #14110e);
}
.window-chrome .dots { display: flex; gap: 6px; }
.window-chrome .dots span { width: 11px; height: 11px; border-radius: 50%; }
.window-chrome .dots span:nth-child(1) { background: #ff5f57; }
.window-chrome .dots span:nth-child(2) { background: #febc2e; }
.window-chrome .dots span:nth-child(3) { background: #28c840; }
.window-chrome .title {
  flex: 1; text-align: center; font-size: 12px; color: var(--fg-3);
}

/* ---------- Team scene ---------- */
.team-stage {
  width: min(var(--maxw), 100% - 48px);
  margin: 0 auto;
  position: relative;
  height: 70vh;
  max-height: 620px;
}
.node {
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 14px;
  width: 220px;
  font-size: 12px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.4);
  transition: opacity 0.4s ease;
}
.node-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.node-dot {
  width: 10px; height: 10px; border-radius: 50%;
}
.node-name {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  flex: 1;
}
.node-role {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.node-line {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-3);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.node.leader { border-color: rgba(255, 181, 61, 0.4); }
.node.leader .node-dot { background: var(--leader); }
.node.worker-a .node-dot { background: var(--worker-a); }
.node.worker-b .node-dot { background: var(--worker-b); }
.node.worker-c .node-dot { background: var(--worker-c); }
.node.worker-d .node-dot { background: var(--worker-d); }

/* ---------- PTY scene ---------- */
.pty-stage {
  width: min(var(--maxw), 100% - 48px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 36px;
  align-items: center;
}
.pty-col { display: grid; gap: 14px; }
.pty-arrow {
  position: relative;
  width: 200px; height: 60px;
}
.pty-arrow::after {
  content: "";
  position: absolute;
  inset: 50% 0 auto 0;
  height: 1px;
  background: var(--line-strong);
}
.pty-pkt {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(-50%, -50%);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #1a0c06;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 0 24px var(--accent);
}
@media (max-width: 880px) {
  .pty-stage { grid-template-columns: 1fr; }
  .pty-arrow { width: 100%; height: 80px; transform: rotate(90deg); }
}

/* ---------- Canvas scene ---------- */
.canvas-stage {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}
.canvas-grid-bg {
  position: absolute;
  inset: -10%;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 40px 40px;
}
.canvas-card {
  position: absolute;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  overflow: hidden;
}

/* ---------- Tweaks panel: dark glass override ---------- */
.tp-panel {
  background: rgba(20, 17, 15, 0.92) !important;
  backdrop-filter: blur(16px);
  border: 1px solid var(--line-strong) !important;
  color: var(--fg) !important;
}
[data-theme="light"] .tp-panel {
  background: rgba(255, 252, 246, 0.95) !important;
  color: var(--fg) !important;
}

/* utility */
.dim { color: var(--fg-3); }
.center { text-align: center; }
.kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--fg-2);
}
