@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=DM+Sans:wght@500;600;700&display=swap');

:root {
  --bg: #f4f6fa;
  --bg-soft: #eef1f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #1a2332;
  --text-secondary: #4a5568;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-light: #eef2f6;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-2: #0ea5e9;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --purple: #7c3aed;
  --purple-soft: #f5f3ff;
  --teal: #0d9488;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 28px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 12px 36px rgba(79, 70, 229, 0.1);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --display: "DM Sans", var(--font);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 70% 50% at 50% -10%, rgba(79, 70, 229, 0.07), transparent 60%),
    radial-gradient(ellipse 40% 30% at 100% 0%, rgba(14, 165, 233, 0.05), transparent 50%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}
a:hover { color: var(--accent-hover); text-decoration: none; }

/* ── Topbar ── */
.topbar {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--border-light);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar .brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.topbar nav {
  display: flex;
  gap: 4px;
  font-size: 0.84rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 72%;
}

.topbar nav a {
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 999px;
  transition: all 0.18s ease;
}

.topbar nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.topbar nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.topbar nav a.nav-home { font-weight: 600; color: var(--text); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 36px 24px 72px; }

/* ── Hero ── */
.hero { margin-bottom: 36px; }

.hero h1 {
  font-family: var(--display);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.25;
}

.hero .meta {
  color: var(--muted);
  font-size: 0.84rem;
  margin-top: 10px;
}

.hero .tagline {
  margin-top: 14px;
  font-size: 0.96rem;
  color: var(--text-secondary);
  max-width: 720px;
  line-height: 1.75;
}

.hero-index {
  text-align: center;
  padding: 52px 0 36px;
}

.hero-index h1 {
  font-family: var(--display);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--text);
  line-height: 1.2;
}

.hero-index p {
  color: var(--muted);
  max-width: 600px;
  margin: 14px auto 0;
  line-height: 1.7;
  font-size: 0.95rem;
}

/* ── Badges ── */
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.badge {
  font-size: 0.76rem;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-secondary);
  font-weight: 500;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.22s ease, transform 0.22s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card h2 { font-size: 0.98rem; margin-bottom: 12px; color: var(--text); font-weight: 600; }
.card h3 { font-size: 0.9rem; margin-bottom: 8px; color: var(--text-secondary); font-weight: 600; }

.stat { text-align: left; }

.stat .num {
  font-family: var(--display);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
}

.stat .lbl {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 6px;
}

.stat.up .num { color: var(--success); }
.stat.down .num { color: var(--danger); }
.stat.accent .num { color: var(--accent); }

/* ── Section title ── */
.section-title {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 44px 0 20px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title::before {
  content: "";
  width: 4px;
  height: 20px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  flex-shrink: 0;
}

.section-title a {
  font-size: 0.82rem;
  font-weight: 500;
  margin-left: auto;
}

/* ── Flow ── */
.flow { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; margin: 18px 0; }

.flow-step {
  flex: 1;
  min-width: 120px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 18px 14px;
  text-align: center;
  font-size: 0.85rem;
  box-shadow: var(--shadow-sm);
}

.flow-step:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.flow-step:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.flow-step .step-num { font-size: 0.72rem; color: var(--accent); font-weight: 600; margin-bottom: 4px; }
.flow-step .step-title { font-weight: 600; margin-bottom: 4px; color: var(--text); }
.flow-step .step-desc { font-size: 0.78rem; color: var(--muted); line-height: 1.5; }

.flow-arrow {
  display: flex;
  align-items: center;
  color: var(--border);
  font-size: 1.1rem;
  padding: 0 2px;
}

/* ── Arch boxes ── */
.arch-box {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  background: var(--surface);
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.arch-box:hover {
  box-shadow: var(--shadow);
  border-color: var(--border);
}

.arch-box.highlight {
  border-color: #c7d2fe;
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--surface) 100%);
}

.arch-box .arch-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 8px; color: var(--text); }
.arch-box .arch-items { font-size: 0.82rem; color: var(--muted); line-height: 1.75; }

.arch-tree { padding-left: 0; list-style: none; font-size: 0.85rem; color: var(--text-secondary); }
.arch-tree li { padding: 6px 0 6px 20px; border-left: 2px solid var(--border); margin-left: 8px; }
.arch-tree li.root { border-left: none; padding-left: 0; font-weight: 600; margin-left: 0; color: var(--accent); }

/* ── Tables ── */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

table.data th, table.data td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

table.data th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2);
}

table.data tr:hover td { background: #fafbfc; }
table.data td strong { color: var(--accent); font-weight: 600; }

/* ── Bars ── */
.bar-row {
  display: grid;
  grid-template-columns: 100px 1fr 48px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.84rem;
  color: var(--text);
}

.bar-track { height: 8px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* ── Tabs ── */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }

.tab {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--muted);
  transition: all 0.15s;
}

.tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── STAR blocks ── */
.star-block {
  background: var(--warning-soft);
  border: 1px solid #fde68a;
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-top: 24px;
}

.star-block h3 { font-size: 0.92rem; margin-bottom: 12px; color: var(--warning); font-weight: 600; }
.star-block p { font-size: 0.86rem; margin-bottom: 8px; line-height: 1.75; color: var(--text-secondary); }
.star-block .label { font-weight: 700; color: var(--warning); }

/* ── Project cards ── */
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 8px; }

.project-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 26px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
  color: inherit;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.project-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent, var(--accent));
  opacity: 0.85;
}

.project-card:hover {
  border-color: #c7d2fe;
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
  text-decoration: none;
}

.project-card .company {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.project-card h2 {
  font-family: var(--display);
  font-size: 1.12rem;
  margin: 8px 0 10px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.project-card p { font-size: 0.88rem; color: var(--muted); line-height: 1.65; }

.project-card .metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.project-card .metrics span {
  color: var(--card-accent, var(--accent));
  font-weight: 600;
  font-size: 0.74rem;
  padding: 4px 10px;
  background: var(--card-accent-soft, var(--accent-soft));
  border-radius: 999px;
}

.project-card.accent-purple { --card-accent: #7c3aed; --card-accent-soft: #f5f3ff; }
.project-card.accent-green  { --card-accent: #059669; --card-accent-soft: #ecfdf5; }
.project-card.accent-red    { --card-accent: #dc2626; --card-accent-soft: #fef2f2; }
.project-card.accent-cyan   { --card-accent: #2563eb; --card-accent-soft: #eff6ff; }

/* ── Timeline ── */
.timeline { display: flex; gap: 14px; flex-wrap: wrap; margin: 18px 0; }

.timeline-item {
  flex: 1;
  min-width: 150px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  text-align: center;
  transition: all 0.22s ease;
  box-shadow: var(--shadow-sm);
}

.timeline-item:hover {
  border-color: #c7d2fe;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.timeline-item .tl-co { font-size: 0.74rem; color: var(--muted); font-weight: 500; }
.timeline-item .tl-name { font-weight: 700; font-size: 0.92rem; margin: 6px 0; color: var(--text); }
.timeline-item .tl-period { font-size: 0.74rem; color: var(--accent); font-weight: 600; }

/* ── Loop cards ── */
.loop-ring { display: grid; gap: 10px; margin: 14px 0; }

.loop-node {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  transition: background 0.15s;
}

.loop-node:hover { background: var(--accent-soft); }

.loop-node .loop-icon { font-size: 1.25rem; margin-bottom: 6px; }
.loop-node .loop-title { font-weight: 600; font-size: 0.84rem; margin-bottom: 3px; color: var(--text); }
.loop-node .loop-desc { font-size: 0.74rem; color: var(--muted); line-height: 1.5; }

.loop-connector {
  text-align: center;
  font-size: 0.76rem;
  color: var(--accent);
  font-weight: 500;
  padding: 8px 0;
}

.loop-connector::before { content: "↻ "; opacity: 0.7; }

.loop-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.loop-card:hover { box-shadow: var(--shadow-md); }

.loop-card h3 {
  font-size: 0.88rem;
  margin-bottom: 12px;
  color: var(--accent);
  font-weight: 700;
}

/* ── Script toggle ── */
.script-toggle,
.script-btn {
  width: 100%;
  padding: 14px 20px;
  margin-top: 28px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--muted);
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.15s;
  font-family: var(--font);
}

.script-toggle:hover,
.script-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #c7d2fe;
}

.script-panel { display: none; margin-top: 16px; }
.script-panel.open { display: block; }

.star-entry {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.star-entry-header {
  padding: 15px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-2);
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 500;
  transition: background 0.15s;
}

.star-entry-header:hover { background: var(--accent-soft); }

.star-entry-body {
  display: none;
  padding: 18px 20px;
  font-size: 0.84rem;
  line-height: 1.75;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-light);
}

.star-entry.open .star-entry-body { display: block; }

.star-entry .tag {
  font-size: 0.68rem;
  background: var(--warning-soft);
  color: var(--warning);
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid #fde68a;
}

.star-entry p { margin-bottom: 8px; }
.star-entry .lbl { font-weight: 700; color: var(--warning); }

/* ── Level pills ── */
.level-p0 { background: var(--danger-soft); color: #b91c1c; border: 1px solid #fecaca; }
.level-p1 { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.level-p2 { background: var(--warning-soft); color: #b45309; border: 1px solid #fde68a; }
.level-p3 { background: var(--success-soft); color: #047857; border: 1px solid #a7f3d0; }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

/* ── Dim radar ── */
.dim-radar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.dim-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 0.84rem;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}

.dim-item:hover { border-color: var(--border); background: var(--surface); }
.dim-weight { font-size: 0.72rem; color: var(--accent); font-weight: 600; min-width: 40px; }

/* ── Layer boxes (Console) ── */
.layer-box {
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  box-shadow: var(--shadow);
}

.layer-console {
  background: linear-gradient(160deg, #eff6ff 0%, #ffffff 100%);
  border: 1px solid #bfdbfe;
}

.layer-knot {
  background: linear-gradient(160deg, #ecfdf5 0%, #ffffff 100%);
  border: 1px solid #a7f3d0;
}

.layer-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.layer-console .layer-label { color: #2563eb; }
.layer-knot .layer-label { color: var(--success); }

.module-chip {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 0.82rem;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s;
}

.module-chip:hover { border-color: var(--border); }
.module-chip strong { display: block; margin-bottom: 2px; color: var(--text); font-weight: 600; }
.module-chip span { color: var(--muted); font-size: 0.76rem; }

.module-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }

.dual-layer { display: grid; grid-template-columns: 1fr 60px 1fr; gap: 0; align-items: stretch; margin: 22px 0; }

.connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.72rem;
}

.connector .arrow { font-size: 1.3rem; margin: 4px 0; color: var(--accent); }

/* ── Notice ── */
.notice-warn {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  background: var(--warning-soft);
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 14px 18px;
}

.screenshot-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* ── Footer ── */
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 60px;
  padding-top: 28px;
  border-top: 1px solid var(--border-light);
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4, .dim-radar, .projects { grid-template-columns: 1fr; }
  .flow { flex-direction: column; }
  .flow-step { border-radius: var(--radius) !important; }
  .flow-arrow { transform: rotate(90deg); justify-content: center; }
  .dual-layer { grid-template-columns: 1fr; }
  .connector { flex-direction: row; padding: 12px 0; }
}

@media (max-width: 768px) {
  .hero-index h1 { font-size: 1.75rem; }
  .hero h1 { font-size: 1.55rem; }
  .topbar { padding: 12px 16px; }
  .wrap { padding: 24px 16px 56px; }
}

/* ── Portfolio polish · architecture · interaction ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.86rem;
  border: 1px solid transparent;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  text-decoration: none;
  cursor: pointer;
  font-family: var(--font);
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(79,70,229,0.25); }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-danger { background: #dc2626; color: #fff; box-shadow: 0 4px 14px rgba(220,38,38,0.22); }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: #c7d2fe; color: var(--accent); }

.hero-portfolio {
  text-align: center;
  padding: 48px 0 28px;
  position: relative;
}
.hero-portfolio .kicker {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.hero-portfolio h1 {
  font-family: var(--display);
  font-size: clamp(1.85rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.2;
}
.hero-portfolio .lead {
  max-width: 640px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.75;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
}

.toc-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 12px;
  margin: 8px 0 28px;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 64px;
  z-index: 40;
}
.toc-bar a {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  transition: all 0.15s;
}
.toc-bar a:hover { background: var(--accent-soft); color: var(--accent); }

.arch-map {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 24px 22px;
  box-shadow: var(--shadow);
  margin: 12px 0 28px;
}
.arch-map .arch-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.arch-map .arch-head h3 {
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.arch-map .arch-head p {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}
.arch-layers { display: flex; flex-direction: column; gap: 10px; }
.arch-layer {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  align-items: stretch;
}
.arch-layer-label {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 10px 6px;
  border: 1px solid #c7d2fe;
}
.arch-layer-label.red { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
.arch-layer-label.green { color: #047857; background: #ecfdf5; border-color: #a7f3d0; }
.arch-layer-label.blue { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
.arch-layer-label.purple { color: #6d28d9; background: #f5f3ff; border-color: #ddd6fe; }
.arch-nodes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.arch-node {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
.arch-node:hover {
  border-color: #c7d2fe;
  background: #fff;
  transform: translateY(-2px);
}
.arch-node strong {
  display: block;
  font-size: 0.82rem;
  color: var(--text);
  margin-bottom: 3px;
}
.arch-node span {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}
.arch-arrow-down {
  text-align: center;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.7;
  padding: 2px 0;
}

.logic-rail {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  margin: 16px 0 8px;
  counter-reset: step;
}
.logic-step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px 12px;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}
.logic-step:first-child { border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
.logic-step:last-child { border-radius: 0 var(--radius-lg) var(--radius-lg) 0; border-color: #fecaca; background: #fffbfb; }
.logic-step:hover { background: var(--accent-soft); border-color: #c7d2fe; z-index: 1; }
.logic-step .n {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}
.logic-step .t { font-weight: 700; font-size: 0.84rem; margin-bottom: 4px; }
.logic-step .d { font-size: 0.72rem; color: var(--muted); line-height: 1.45; }

.fade-in {
  animation: fadeUp 0.45s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.anchor-offset { scroll-margin-top: 100px; }

@media (max-width: 900px) {
  .arch-layer { grid-template-columns: 1fr; }
  .logic-rail { grid-template-columns: 1fr 1fr; }
  .logic-step { border-radius: 10px !important; }
  .toc-bar { border-radius: 16px; top: 58px; }
}
