/* ============================================
   Design Tokens
============================================ */
:root {
  --red: #c8102e;
  --red-deep: #97091f;
  --red-soft: #fdeeef;
  --red-line: #efc8cc;

  --ink: #1a1a1a;
  --ink-2: #3a4150;
  --ink-3: #5a6577;
  --ink-4: #8a93a0;
  --line: #e5e7eb;
  --line-2: #f0f1f3;
  --bg: #ffffff;
  --bg-soft: #f8f9fa;
  --bg-code: #f6f7f9;
  --bg-term: #1a1a1a;
  --bg-term-text: #e8e8e8;
  --bg-term-dim: #8a8a8a;
  --bg-term-accent: #ff7676;

  --shadow-card: 0 1px 2px rgba(15, 30, 60, 0.04), 0 4px 16px rgba(15, 30, 60, 0.04);
  --shadow-card-hover: 0 1px 3px rgba(15, 30, 60, 0.06), 0 8px 24px rgba(15, 30, 60, 0.08);

  --r-sm: 4px;
  --r: 8px;
  --r-lg: 12px;

  --t: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Reset / Base
============================================ */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Yu Gothic", "游ゴシック", "Hiragino Kaku Gothic ProN", "Hiragino Sans", -apple-system, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
code, pre { font-family: "SF Mono", Menlo, Consolas, monospace; }

/* ============================================
   Layout
============================================ */
.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  max-width: 1400px;
  margin: 0 auto;
}
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 32px 24px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.main {
  padding: 56px 56px 120px;
  min-width: 0;
}

@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; padding: 16px; border-right: none; border-bottom: 1px solid var(--line); }
  .main { padding: 32px 20px 80px; }
  .rail-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
  .rail-item { flex: 0 0 auto; }
  .rail-line { display: none; }
}

/* ============================================
   Rail (sticky timeline)
============================================ */
.rail-brand {
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--red);
  font-weight: 700;
  margin-bottom: 8px;
}
.rail-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 32px;
  line-height: 1.4;
}
.rail-list {
  position: relative;
  list-style: none;
  margin: 0; padding: 0;
}
.rail-line {
  position: absolute;
  left: 11px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--line);
  z-index: 0;
}
.rail-item {
  position: relative;
  padding: 8px 0 8px 36px;
  cursor: pointer;
  z-index: 1;
  transition: color var(--t);
}
.rail-item::before {
  content: "";
  position: absolute;
  left: 4px; top: 14px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--line);
  transition: all var(--t);
}
.rail-item.active::before {
  background: var(--red);
  border-color: var(--red);
  box-shadow: 0 0 0 4px var(--red-soft);
}
.rail-item.passed::before {
  background: var(--red-line);
  border-color: var(--red-line);
}
.rail-num {
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: 0.12em;
  font-weight: 600;
}
.rail-name {
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 500;
  line-height: 1.4;
  margin-top: 2px;
}
.rail-item.active .rail-num { color: var(--red); }
.rail-item.active .rail-name { color: var(--ink); font-weight: 700; }

/* ============================================
   Hero
============================================ */
.hero {
  padding: 16px 0 64px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 64px;
}
.hero-tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--red);
  font-weight: 700;
  padding: 4px 10px;
  border: 1px solid var(--red-line);
  background: var(--red-soft);
  border-radius: 999px;
  margin-bottom: 24px;
}
.hero h1 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}
.hero h1 em {
  font-style: normal;
  color: var(--red);
}
.hero-lead {
  color: var(--ink-3);
  font-size: 15px;
  max-width: 720px;
  margin: 0 0 32px;
}
.scenario {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 32px;
}
.scenario-head {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--ink-4);
  font-weight: 700;
  margin-bottom: 8px;
}
.scenario-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--ink);
}
.scenario-name .industry {
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 500;
  margin-left: 8px;
}
.scenario-brief {
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.75;
}
.scenario-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-content: start;
}
.scenario-meta dt {
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 2px;
}
.scenario-meta dd {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
@media (max-width: 720px) {
  .scenario { grid-template-columns: 1fr; }
}

/* ============================================
   Phase Card
============================================ */
.phase {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: 32px;
  overflow: hidden;
  transition: box-shadow var(--t), border-color var(--t);
}
.phase:hover { box-shadow: var(--shadow-card); }
.phase.active {
  border-color: var(--red-line);
  box-shadow: var(--shadow-card-hover);
}

.phase-head {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--line-2);
}
.phase-row1 {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 12px;
}
.phase-num {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--red);
}
.phase-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.phase-duration {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-3);
  background: var(--bg-soft);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.phase-sub {
  font-size: 14px;
  color: var(--ink-3);
  margin-bottom: 16px;
}
.phase-outcome {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: var(--red-soft);
  border-left: 3px solid var(--red);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.6;
}
.phase-outcome::before {
  content: "成果";
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--red);
  font-weight: 700;
  flex: 0 0 auto;
  padding-top: 2px;
}

/* ============================================
   Flow visualization
============================================ */
.flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 24px 32px;
  border-bottom: 1px solid var(--line-2);
}
.flow-step {
  position: relative;
  padding: 16px 18px;
}
.flow-step + .flow-step { border-left: 1px dashed var(--line); }
.flow-step + .flow-step::before {
  content: "";
  position: absolute;
  left: -7px; top: 50%;
  width: 12px; height: 12px;
  border-top: 2px solid var(--red);
  border-right: 2px solid var(--red);
  transform: translateY(-50%) rotate(45deg);
  background: var(--bg);
}
.flow-step-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--ink-4);
  margin-bottom: 6px;
}
.flow-step:nth-child(2) .flow-step-tag,
.flow-step:nth-child(3) .flow-step-tag {
  color: var(--red);
}
.flow-step-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
  line-height: 1.4;
  word-break: break-word;
}
.flow-step-detail {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.5;
}
@media (max-width: 720px) {
  .flow { grid-template-columns: 1fr; gap: 12px; padding: 20px; }
  .flow-step + .flow-step { border-left: none; border-top: 1px dashed var(--line); padding-top: 16px; }
  .flow-step + .flow-step::before { display: none; }
}

/* ============================================
   Detail toggle / panel
============================================ */
.phase-toggle-wrap {
  padding: 16px 32px 24px;
  text-align: center;
}
.phase-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--ink-2);
  color: var(--ink);
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--t);
}
.phase-toggle:hover {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}
.phase-toggle.is-open {
  background: var(--red);
  border-color: var(--red);
  color: white;
}
.phase-toggle-icon {
  display: inline-block;
  width: 10px; height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--t);
  margin-bottom: 2px;
}
.phase-toggle.is-open .phase-toggle-icon { transform: rotate(-135deg); margin-bottom: -2px; }

.phase-detail {
  display: none;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}
.phase-detail.is-open { display: block; }

/* ============================================
   Tabs
============================================ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  padding: 0 32px;
  overflow-x: auto;
}
.tab {
  flex: 0 0 auto;
  background: none;
  border: none;
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: all var(--t);
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--red);
  border-bottom-color: var(--red);
}

.tab-panel {
  display: none;
  padding: 28px 32px 32px;
}
.tab-panel.active { display: block; }

/* ============================================
   File / Code blocks
============================================ */
.file {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 16px;
  overflow: hidden;
}
.file-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.file-path {
  color: var(--ink-2);
  font-family: "SF Mono", Menlo, monospace;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-lang {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-4);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
  text-transform: uppercase;
  flex: 0 0 auto;
}
.file-copy {
  background: none;
  border: 1px solid var(--line);
  padding: 4px 10px;
  font-size: 11px;
  color: var(--ink-3);
  border-radius: 4px;
  flex: 0 0 auto;
  transition: all var(--t);
}
.file-copy:hover { color: var(--red); border-color: var(--red); }
.file-copy.copied { color: var(--red); border-color: var(--red); }
.file pre {
  margin: 0;
  padding: 16px;
  background: var(--bg-code);
  font-size: 12.5px;
  line-height: 1.65;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}

/* ============================================
   Terminal (execution)
============================================ */
.terminal {
  background: var(--bg-term);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 16px;
}
.terminal-head {
  background: #2a2a2a;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.terminal-dots {
  display: flex; gap: 6px;
}
.terminal-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #555;
}
.terminal-title {
  font-size: 11px;
  color: var(--bg-term-dim);
  font-family: "SF Mono", Menlo, monospace;
}
.terminal-run {
  background: var(--red);
  color: white;
  border: none;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  letter-spacing: 0.06em;
  transition: all var(--t);
}
.terminal-run:hover { background: var(--red-deep); }
.terminal-run:disabled { background: #555; cursor: not-allowed; }
.terminal-body {
  padding: 18px 22px;
  font-family: "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--bg-term-text);
  min-height: 200px;
  white-space: pre-wrap;
  word-break: break-word;
}
.terminal-cmd {
  color: var(--bg-term-accent);
  font-weight: 600;
}
.terminal-prompt {
  color: var(--bg-term-dim);
  margin-right: 6px;
}
.terminal-line { display: block; }
.terminal-line .ok { color: #74e8a4; }
.terminal-line .err { color: #ff8b8b; }
.terminal-line .warn { color: #ffd479; }
.terminal-cursor {
  display: inline-block;
  width: 8px; height: 16px;
  background: var(--bg-term-accent);
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}

/* ============================================
   Review panel
============================================ */
.review-comment {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 8px;
  font-size: 13px;
}
.review-level {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 4px;
  height: fit-content;
}
.review-level.OK { background: #e7f6ec; color: #1f7a3f; }
.review-level.INFO { background: #eaf2ff; color: #1d4ed8; }
.review-level.WARN { background: #fff5e0; color: #a85d00; }
.review-level.ERROR { background: var(--red-soft); color: var(--red-deep); }
.review-target {
  font-family: "SF Mono", Menlo, monospace;
  color: var(--ink-2);
  font-weight: 600;
  margin-right: 8px;
}
.review-body { color: var(--ink-2); line-height: 1.6; }

/* ============================================
   Section labels (in detail panels)
============================================ */
.section-label {
  font-size: 11px;
  letter-spacing: 0.2em;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 12px;
  text-transform: uppercase;
}
.section-desc {
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 16px;
}

/* ============================================
   Config sections (grouped by kind)
============================================ */
.config-section {
  margin-bottom: 28px;
}
.config-section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.config-section-kind {
  font-size: 10px;
  letter-spacing: 0.18em;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 3px;
  background: var(--ink);
  color: white;
  flex: 0 0 auto;
}
.config-section-kind.kind-knowledge { background: #2b3a55; }
.config-section-kind.kind-harness   { background: #444b5a; }
.config-section-kind.kind-hook      { background: var(--red-deep); }
.config-section-kind.kind-subagent  { background: #1b3a3a; }
.config-section-kind.kind-skill     { background: #3a2b55; }
.config-section-kind.kind-mcp       { background: #553a1b; }
.config-section-kind.kind-command   { background: #2b554a; }
.config-section-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

/* ============================================
   Callout (best practices / official refs)
============================================ */
.callout {
  border-radius: var(--r);
  padding: 20px 24px;
  margin-top: 24px;
}
.callout-bp {
  background: var(--red-soft);
  border: 1px solid var(--red-line);
  border-left: 3px solid var(--red);
}
.callout-ref {
  background: var(--bg);
  border: 1px solid var(--line);
}
.callout-head {
  font-size: 12px;
  letter-spacing: 0.18em;
  font-weight: 800;
  color: var(--red);
  margin-bottom: 14px;
  text-transform: none;
}
.callout-ref .callout-head { color: var(--ink-2); }
.callout-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.callout-item {
  position: relative;
  padding: 10px 0 10px 22px;
  border-top: 1px dashed rgba(0,0,0,0.08);
}
.callout-item:first-child { border-top: none; padding-top: 0; }
.callout-item::before {
  content: "";
  position: absolute;
  left: 0; top: 18px;
  width: 12px; height: 2px;
  background: var(--red);
}
.callout-item:first-child::before { top: 8px; }
.callout-ref .callout-item::before { background: var(--ink-3); }
.callout-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
  line-height: 1.5;
}
.callout-body {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.7;
}

/* ============================================
   Footer
============================================ */
.footer {
  margin-top: 80px;
  padding: 40px 0;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-summary {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 24px;
  margin-bottom: 40px;
  padding: 32px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
@media (max-width: 1100px) {
  .footer-summary { grid-template-columns: repeat(3, 1fr); }
}
.footer-summary-item {
  text-align: center;
}
.footer-summary-num {
  font-size: 32px;
  font-weight: 800;
  color: var(--red);
  letter-spacing: -0.02em;
  line-height: 1;
}
.footer-summary-label {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 8px;
  letter-spacing: 0.06em;
}
@media (max-width: 720px) {
  .footer-summary { grid-template-columns: repeat(2, 1fr); padding: 20px; gap: 16px; }
  .footer-summary-num { font-size: 26px; }
}

/* ============================================
   Util
============================================ */
.spacer-sm { height: 8px; }
.spacer { height: 16px; }
