/* WardType Web Design System — Pure Linear Precision Engineering Aesthetic
 * Single unified design language:
 * - True obsidian dark (#08090A) & crisp neutral light (#FFFFFF)
 * - Ruthless monochrome high-contrast primary actions (#F7F8F8 on dark / #0E1013 on light)
 * - Single surgical accent (#5E6AD2 / #7C86F2) reserved for focus, code syntax & active signals
 * - Open 1px hairline grids instead of nested box-in-box cards
 * - Left-aligned editorial spine across every page
 */

:root {
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Cascadia Mono', monospace;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 9999px;

  /* Dark Mode — True Linear Obsidian */
  --bg: #08090A;
  --bg-subtle: #0D0E10;
  --surface: #0F1012;
  --surface-elevated: #15161A;
  --surface-hover: #1B1D22;
  --segment-active-bg: #15161A;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --specular: inset 0 1px 0 rgba(255, 255, 255, 0.05);

  --text: #F7F8F8;
  --text-muted: #9BA1AE;
  --text-subtle: #8A909E;

  /* High-contrast monochrome primary CTA (Linear signature) */
  --primary: #F7F8F8;
  --primary-hover: #E2E4E9;
  --on-primary: #08090A;

  /* Single surgical accent (focus ring, URI syntax, subtle active indicators) */
  --accent: #7C86F2;
  --accent-soft: rgba(124, 134, 242, 0.13);
  --link: #A5AEFF;

  --ok: #34D399;
  --ok-soft: rgba(52, 211, 153, 0.11);
  --warn: #FBBF24;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --danger: #F87171;
  --danger-soft: rgba(248, 113, 113, 0.12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-stage: 0 36px 90px -28px rgba(0, 0, 0, 0.9);
  --shadow-lg: 0 24px 64px -16px rgba(0, 0, 0, 0.78);
  --header-bg: rgba(8, 9, 10, 0.8);
  --wire-stroke: rgba(255, 255, 255, 0.16);
  --wire-stroke-strong: rgba(255, 255, 255, 0.34);
  --wire-fill: rgba(255, 255, 255, 0.025);
  color-scheme: dark;
}

html[data-theme='light'] {
  /* Light Mode — Crisp Linear Architectural Light */
  --bg: #FFFFFF;
  --bg-subtle: #FAFAFB;
  --surface: #F7F8F9;
  --surface-elevated: #EFF0F3;
  --surface-hover: #E6E8EC;
  --segment-active-bg: #FFFFFF;
  --border: rgba(14, 16, 19, 0.08);
  --border-strong: rgba(14, 16, 19, 0.17);
  --specular: inset 0 1px 0 rgba(255, 255, 255, 0.8);

  --text: #0E1013;
  --text-muted: #525763;
  --text-subtle: #666C7A;

  /* High-contrast monochrome primary CTA */
  --primary: #0E1013;
  --primary-hover: #262930;
  --on-primary: #FFFFFF;

  /* Single surgical accent */
  --accent: #4F5BD5;
  --accent-soft: rgba(79, 91, 213, 0.1);
  --link: #434EC2;

  --ok: #047857;
  --ok-soft: rgba(4, 120, 87, 0.1);
  --warn: #B45309;
  --warn-soft: rgba(180, 83, 9, 0.1);
  --danger: #DC2626;
  --danger-soft: rgba(220, 38, 38, 0.1);

  --shadow-sm: 0 1px 2px rgba(14, 16, 19, 0.06);
  --shadow-stage: 0 32px 76px -28px rgba(14, 16, 19, 0.18);
  --shadow-lg: 0 20px 48px -16px rgba(14, 16, 19, 0.14);
  --header-bg: rgba(255, 255, 255, 0.84);
  --wire-stroke: rgba(14, 16, 19, 0.14);
  --wire-stroke-strong: rgba(14, 16, 19, 0.34);
  --wire-fill: rgba(14, 16, 19, 0.025);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  background-color: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

@media (pointer: fine) {
  html {
    overscroll-behavior: none;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

main {
  flex: 1 0 auto;
}

::selection {
  background-color: var(--accent-soft);
  color: var(--text);
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 2px solid var(--bg);
}

a {
  color: var(--text);
  text-decoration: none;
}

@media (hover: hover) and (pointer: fine) {
  a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.12;
  text-wrap: balance;
  scroll-margin-top: 80px;
}

p {
  margin: 0;
  text-wrap: pretty;
}

code, pre, kbd, .mono {
  font-family: var(--font-mono);
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 2px 7px;
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text);
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 1000;
  padding: 10px 16px;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.skip-link:focus {
  left: 16px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Layered Width System */
.container {
  width: 100%;
  max-width: 1320px;
  margin-inline: auto;
  padding-inline: clamp(16px, 3vw, 40px);
}

.container-operate {
  max-width: 1140px;
}

.reading-measure {
  max-width: 74ch;
}

/* Header — Linear Ultra-Clean Single-Row Chrome */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  min-height: 56px;
}

.brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.96rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: color 150ms ease, background-color 150ms ease;
  text-decoration: none;
}

.nav-links a[aria-current='page'] {
  color: var(--text);
  background-color: var(--surface-elevated);
}

@media (hover: hover) and (pointer: fine) {
  .nav-links a:hover {
    color: var(--text);
  }
}

.header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-divider {
  width: 1px;
  height: 16px;
  background-color: var(--border-strong);
  margin-inline: 2px;
}

@media (max-width: 820px) {
  .header-inner {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    padding-top: 10px;
    padding-bottom: 10px;
    min-height: 52px;
  }
  .header-divider {
    display: none;
  }
  .nav-links {
    order: 3;
    flex-basis: 100%;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    overflow-x: auto;
    font-size: 0.85rem;
  }
}

/* Buttons — Linear Monochrome Precision */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 550;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 160ms var(--ease-out), background-color 150ms var(--ease-out), border-color 150ms var(--ease-out), color 150ms var(--ease-out);
}

.btn:hover {
  text-decoration: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--on-primary);
}

.btn-secondary {
  background-color: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-ghost {
  background-color: transparent;
  border-color: transparent;
  color: var(--text-muted);
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.84rem;
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
  }
  .btn-secondary:hover:not(:disabled) {
    background-color: var(--surface-elevated);
    border-color: var(--border-strong);
  }
  .btn-ghost:hover:not(:disabled) {
    color: var(--text);
    background-color: var(--surface-elevated);
  }
}

.btn-icon {
  width: 32px;
  min-height: 32px;
  padding: 0;
  border-color: var(--border);
}

.btn-lg {
  min-height: 40px;
  padding: 0 18px;
  font-size: 0.9rem;
  border-radius: 8px;
}

.btn-pill {
  border-radius: var(--radius-pill);
}

/* Flat Architectural Surfaces (No Heavy Nested Shadows) */
.panel {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.panel-elevated {
  background-color: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 550;
  line-height: 1.25;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-ok {
  background-color: var(--ok-soft);
  color: var(--ok);
}

.badge-primary {
  background-color: var(--accent-soft);
  color: var(--link);
}

.badge-warn {
  background-color: var(--warn-soft);
  color: var(--warn);
}

.badge-danger {
  background-color: var(--danger-soft);
  color: var(--danger);
}

.badge-neutral {
  background-color: var(--surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* Forms */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 0.85rem;
  font-weight: 550;
  color: var(--text);
}

.field-hint {
  font-size: 0.81rem;
  color: var(--text-muted);
}

.field-error {
  font-size: 0.81rem;
  color: var(--danger);
  min-height: 1.2em;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background-color: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.91rem;
  caret-color: var(--accent);
  transition: border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

.input.mono,
.textarea.mono {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input[aria-invalid='true'] {
  border-color: var(--danger);
}

.select option {
  background-color: var(--surface);
  color: var(--text);
}

/* Segmented Controls — Minimal Monochrome Track */
.segmented {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 3px;
  padding: 4px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 100%;
  overflow-x: auto;
}

.segmented button {
  min-height: 28px;
  padding: 0 11px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 140ms ease, color 140ms ease, transform 110ms var(--ease-out);
}

.field > .segmented {
  align-self: flex-start;
}

.segmented-wrap {
  flex-wrap: wrap;
  overflow-x: visible;
}

.segmented button:active {
  transform: scale(0.98);
}

.segmented button[aria-selected='true'],
.segmented button.active {
  background-color: var(--segment-active-bg);
  color: var(--text);
}

html[data-theme='light'] .segmented button[aria-selected='true'],
html[data-theme='light'] .segmented button.active {
  box-shadow: var(--shadow-sm);
}

/* Sections */
.section {
  padding-top: 96px;
  padding-bottom: 96px;
}

@media (max-width: 768px) {
  .section {
    padding-top: 64px;
    padding-bottom: 64px;
  }
}

/* Hero — Pure Linear Left-Aligned Spine */
.linear-hero {
  padding-top: 88px;
  padding-bottom: 84px;
}

@media (max-width: 640px) {
  .linear-hero {
    padding-top: 52px;
    padding-bottom: 56px;
  }
}

.hero-title {
  font-size: clamp(2.35rem, 4.5vw, 3.85rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.09;
  max-width: 24ch;
}

.hero-sub-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-top: 22px;
}

.hero-lead {
  font-size: clamp(1rem, 1.3vw, 1.12rem);
  line-height: 1.62;
  color: var(--text-muted);
  max-width: 56ch;
}

.hero-inline-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 150ms ease;
}

.hero-inline-link strong {
  color: var(--text);
  font-weight: 600;
}

@media (hover: hover) and (pointer: fine) {
  .hero-inline-link:hover {
    color: var(--text);
    text-decoration: none;
  }
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
}

/* Linear Immersive App Surface — Single Clean Border, Zero Outer Shell Box-in-Box */
.app-showcase {
  margin-top: 52px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background-color: var(--surface);
  box-shadow: var(--specular), var(--shadow-stage);
  overflow: hidden;
}

.app-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

.app-topbar-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.app-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--ok);
}

.app-workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 368px;
}

@media (max-width: 860px) {
  .app-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
}

.app-sidebar {
  padding: 14px;
  background-color: var(--bg-subtle);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 860px) {
  .app-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

.app-sidebar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  font-size: 0.76rem;
  color: var(--text-subtle);
}

.app-vault-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 4px;
}

.app-vault-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid var(--border);
  font-size: 0.74rem;
  color: var(--text-muted);
}

.app-entry-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.app-entry {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 140ms var(--ease-out), background-color 140ms ease, border-color 140ms ease;
}

.app-entry:active {
  transform: scale(0.99);
}

.app-entry strong {
  font-size: 0.84rem;
  font-weight: 550;
  color: var(--text);
}

.app-entry small {
  font-size: 0.74rem;
  font-family: var(--font-mono);
  color: var(--text-subtle);
}

.app-entry.is-selected {
  background-color: var(--surface-elevated);
  border-color: var(--border);
}

@media (hover: hover) and (pointer: fine) {
  .app-entry:hover:not(.is-selected) {
    background-color: var(--surface);
  }
}

.app-main {
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

@media (max-width: 640px) {
  .app-main {
    padding: 16px;
  }
}

.app-main-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.sim-target-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.sim-target-sub {
  margin-top: 3px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.sim-rule-code {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.81rem;
  line-height: 1.6;
  color: var(--link);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sim-seq-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sim-step {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 5px;
  background-color: var(--bg);
  border: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 0.77rem;
  color: var(--text);
  transition: border-color 180ms var(--ease-out), background-color 180ms var(--ease-out), color 180ms var(--ease-out);
}

.sim-step.is-active {
  border-color: var(--ok);
  background-color: var(--ok-soft);
  color: var(--ok);
}

.app-guard-line {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.81rem;
  color: var(--text-muted);
}

.app-guard-line svg {
  flex-shrink: 0;
  color: var(--ok);
}

/* Linear Section 2 — Two-Tone Statement + Open 3-Column Hairline Grid (No Cards!) */
.editorial-statement {
  font-size: clamp(1.6rem, 2.85vw, 2.45rem);
  font-weight: 550;
  letter-spacing: -0.032em;
  line-height: 1.24;
  max-width: 36ch;
  text-wrap: pretty;
}

.editorial-statement strong {
  font-weight: 600;
  color: var(--text);
}

.editorial-statement .muted-copy {
  color: var(--text-muted);
}

.pillar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 52px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

@media (max-width: 900px) {
  .pillar-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.pillar-cell {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 32px 32px 36px;
  border-right: 1px solid var(--border);
  min-width: 0;
}

.pillar-cell:first-child {
  padding-left: 0;
}

.pillar-cell:last-child {
  padding-right: 0;
  border-right: none;
}

@media (max-width: 900px) {
  .pillar-cell,
  .pillar-cell:first-child,
  .pillar-cell:last-child {
    padding: 28px 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .pillar-cell:last-child {
    border-bottom: none;
  }
}

.pillar-figure {
  width: 100%;
  height: 148px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.pillar-figure svg {
  width: 100%;
  max-width: 240px;
  height: 136px;
  overflow: visible;
}

.pillar-cell h3 {
  font-size: 1.06rem;
  font-weight: 600;
  color: var(--text);
}

.pillar-cell p {
  margin-top: 8px;
  font-size: 0.9rem;
  line-height: 1.62;
  color: var(--text-muted);
}

.pillar-spec {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 0.77rem;
  color: var(--text-subtle);
}

/* Open Hairline 2x2 Directory Matrix (Zero Floating Boxes) */
.dir-matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 28px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

@media (max-width: 720px) {
  .dir-matrix {
    grid-template-columns: minmax(0, 1fr);
  }
}

.dir-cell {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 28px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background-color 150ms ease, transform 140ms var(--ease-out);
}

.dir-cell:active {
  transform: scale(0.995);
}

.dir-cell:nth-child(odd) {
  padding-left: 0;
  border-right: 1px solid var(--border);
}

.dir-cell:nth-child(even) {
  padding-right: 0;
}

.dir-cell:nth-last-child(-n + 2) {
  border-bottom: none;
}

@media (max-width: 720px) {
  .dir-cell,
  .dir-cell:nth-child(odd),
  .dir-cell:nth-child(even) {
    padding: 22px 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .dir-cell:last-child {
    border-bottom: none;
  }
}

@media (hover: hover) and (pointer: fine) {
  .dir-cell:hover {
    background-color: var(--bg-subtle);
    text-decoration: none;
  }
  .dir-cell:hover .dir-arrow {
    color: var(--text);
    transform: translateX(4px);
  }
}

.dir-cell h3 {
  font-size: 1.04rem;
  font-weight: 600;
}

.dir-cell p {
  margin-top: 6px;
  font-size: 0.89rem;
  color: var(--text-muted);
  max-width: 48ch;
}

.dir-arrow {
  flex-shrink: 0;
  color: var(--text-subtle);
  margin-top: 2px;
  transition: transform 160ms var(--ease-out), color 150ms ease;
}

/* Subpage Layouts — Unified Left-Aligned Hairline Grammar */
.page-shell {
  padding-top: 56px;
  padding-bottom: 88px;
}

.page-heading {
  font-size: clamp(1.95rem, 3.6vw, 2.85rem);
  font-weight: 600;
  letter-spacing: -0.036em;
  line-height: 1.1;
}

.section-heading {
  font-size: clamp(1.45rem, 2.4vw, 1.95rem);
  font-weight: 600;
}

.section-sub {
  margin-top: 12px;
  color: var(--text-muted);
  max-width: 60ch;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: 40px;
  align-items: start;
}

.split-grid > *,
.pricing-layout > *,
.two-col-operate > *,
.two-col-even > * {
  min-width: 0;
}

@media (max-width: 900px) {
  .split-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
}

/* Features — Clean Hairline Rows (No Pastel Icon Tiles) */
.feature-rows {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.feature-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 14px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.feature-row-icon {
  color: var(--text-muted);
  margin-top: 2px;
}

.feature-row h2 {
  font-size: 1rem;
  font-weight: 600;
}

.feature-row p {
  margin-top: 5px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Protocol Explorer */
.code-block {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.83rem;
  line-height: 1.65;
  overflow-x: auto;
  color: var(--link);
}

.token-chips code {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 5px;
  background-color: var(--bg);
  border: 1px solid var(--border-strong);
  font-size: 0.78rem;
  color: var(--text);
}

/* Download — Hairline 2-Column Platform Matrix */
.platform-matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 32px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

@media (max-width: 720px) {
  .platform-matrix {
    grid-template-columns: minmax(0, 1fr);
  }
}

.platform-cell {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 28px;
}

.platform-cell:first-child {
  padding-left: 0;
  border-right: 1px solid var(--border);
}

.platform-cell:last-child {
  padding-right: 0;
}

@media (max-width: 720px) {
  .platform-cell,
  .platform-cell:first-child,
  .platform-cell:last-child {
    padding: 22px 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .platform-cell:last-child {
    border-bottom: none;
  }
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.89rem;
  text-align: left;
  min-width: 540px;
}

.data-table th,
.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table th {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background-color: var(--bg-subtle);
  white-space: nowrap;
}

.data-table tr:last-child td {
  border-bottom: none;
}

@media (min-width: 681px) {
  #comparison-table th:first-child,
  #comparison-table td:first-child {
    white-space: nowrap;
    font-weight: 550;
  }
  #requirements-table td.mono {
    white-space: nowrap;
  }
  #shortcuts-table td:first-child,
  #shortcuts-table td:nth-child(2) {
    white-space: nowrap;
  }
}

/* Pricing + Comparison Layout */
.pricing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.38fr) minmax(300px, 0.82fr);
  gap: 28px;
  align-items: start;
  margin-top: 32px;
}

@media (max-width: 920px) {
  .pricing-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.pro-card {
  padding: 26px;
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--specular);
}

.price-figure {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 14px;
}

.price-amount {
  font-size: 2.5rem;
  font-weight: 650;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.price-note {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.check-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.89rem;
}

.check-list li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.check-list svg {
  flex-shrink: 0;
  margin-top: 3px;
  color: var(--ok);
}

.checkout-construction-inline {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
}

.construction-box {
  padding: 2px 0;
}

/* FAQ — Flat Hairline Accordion (Linear Style, No Stacked Boxes) */
.faq-list {
  display: flex;
  flex-direction: column;
  margin-top: 20px;
  border-top: 1px solid var(--border);
}

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: color 140ms ease, transform 140ms var(--ease-out);
}

.faq-trigger:active {
  transform: scale(0.995);
}

.faq-trigger svg {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 200ms var(--ease-out);
}

.faq-trigger[aria-expanded='true'] svg {
  transform: rotate(180deg);
}

.faq-panel {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 140ms var(--ease-out), opacity 120ms ease;
}

.faq-panel.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
  transition: grid-template-rows 200ms var(--ease-out), opacity 180ms ease;
}

.faq-panel-inner {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.91rem;
  line-height: 1.65;
}

.faq-panel.is-open .faq-panel-inner {
  padding-bottom: 18px;
}

/* Toast (Sonner-aligned stacked region hover & asymmetric enter/exit) */
.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

.toast {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  border-radius: var(--radius-sm);
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 500;
  pointer-events: auto;
  transform: translateY(100%) scale(0.97);
  opacity: 0;
  transition: transform 150ms var(--ease-out), opacity 150ms ease;
}

.toast::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 8px;
}

.toast.is-visible {
  transform: translateY(0) scale(1);
  opacity: 1;
  transition: transform 220ms var(--ease-out), opacity 200ms ease;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding-top: 28px;
  padding-bottom: 28px;
  color: var(--text-subtle);
  font-size: 0.83rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-links a {
  color: var(--text-muted);
}

@media (hover: hover) and (pointer: fine) {
  .footer-links a:hover {
    color: var(--text);
  }
}

/* Operate Pages (/activate, /admin) */
.two-col-operate {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 28px;
  align-items: start;
  margin-top: 28px;
}

.two-col-even {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
}

@media (max-width: 880px) {
  .two-col-operate,
  .two-col-even {
    grid-template-columns: minmax(0, 1fr);
  }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.stat-card {
  padding: 16px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.stat-value {
  margin-top: 6px;
  font-size: 1.6rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.stack-md { display: flex; flex-direction: column; gap: 16px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.space-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.min-w-0 { min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.license-output {
  padding: 14px;
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  border: 1px solid var(--ok);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  word-break: break-all;
  line-height: 1.55;
}

.panel,
.panel-elevated,
.app-showcase,
.pro-card,
.table-wrap {
  max-width: 100%;
}

/* Documentation Manual (Linear Read-Mode Layout) */
.docs-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

@media (max-width: 960px) {
  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
}

.docs-sidebar {
  position: sticky;
  top: 84px;
}

@media (max-width: 960px) {
  .docs-sidebar {
    position: static;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
  }
}

.docs-toc-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-subtle);
  margin-bottom: 10px;
}

.docs-toc {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
}

.docs-toc a {
  display: block;
  padding: 6px 0 6px 14px;
  margin-left: -1px;
  border-left: 1.5px solid transparent;
  font-size: 0.86rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 140ms ease, border-color 140ms ease;
}

.docs-toc a.is-active {
  color: var(--text);
  font-weight: 550;
  border-left-color: var(--text);
}

@media (hover: hover) and (pointer: fine) {
  .docs-toc a:hover {
    color: var(--text);
    text-decoration: none;
  }
}

.docs-sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
}

.docs-sidebar-links a {
  color: var(--text-muted);
  transition: color 140ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .docs-sidebar-links a:hover {
    color: var(--text);
  }
}

.docs-article {
  min-width: 0;
  max-width: 76ch;
}

.docs-header {
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.docs-section {
  padding-top: 36px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 76px;
}

.docs-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.docs-section h2 {
  font-size: clamp(1.32rem, 2vw, 1.65rem);
  font-weight: 600;
}

.docs-section h3 {
  margin-top: 24px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.docs-section > p {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.68;
}

.docs-list {
  margin: 14px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.93rem;
  line-height: 1.65;
}

.docs-code-wrap {
  margin-top: 14px;
}

.docs-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 0.78rem;
  color: var(--text-subtle);
}

.docs-code-wrap .code-block {
  margin: 0;
}

/* Mobile Responsive Overrides */
@media (max-width: 680px) {
  .data-table.responsive-table {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .data-table.responsive-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
  .data-table.responsive-table tbody,
  .data-table.responsive-table tr,
  .data-table.responsive-table td {
    display: block;
    width: 100%;
  }
  .data-table.responsive-table tr {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
  }
  .data-table.responsive-table tr:last-child {
    border-bottom: none;
  }
  .data-table.responsive-table td {
    padding: 4px 0;
    border-bottom: none;
    overflow-wrap: anywhere;
  }
  .data-table.responsive-table td:first-child {
    font-weight: 600;
    color: var(--text);
    padding-bottom: 6px;
  }
  .data-table.responsive-table td[data-label]::before {
    content: attr(data-label) ': ';
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 550;
    color: var(--text-subtle);
    margin-right: 4px;
  }
  html[lang='zh-CN'] .data-table.responsive-table td[data-label]::before {
    content: attr(data-label) '：';
  }
}

@media (pointer: coarse) {
  .btn,
  .btn-ghost {
    min-height: 40px;
  }
  .btn-icon {
    width: 40px;
    min-height: 40px;
  }
  .segmented button {
    min-height: 36px;
  }
  .nav-links a {
    padding: 8px 12px;
  }
}

@media (max-width: 640px) {
  .app-showcase {
    margin-top: 32px;
  }
  .segmented-wrap {
    width: 100%;
  }
  .segmented-wrap button {
    flex: 1 1 auto;
    text-align: center;
  }
  .sim-rule-code,
  .code-block {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .hero-cta .btn {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .header-inner {
    gap: 8px;
  }
  .header-actions {
    gap: 6px;
  }
  .header-actions .btn-primary {
    padding: 0 11px;
    font-size: 0.81rem;
    min-height: 32px;
  }
  .segmented button {
    padding: 0 9px;
    font-size: 0.78rem;
  }
}

@view-transition {
  navigation: auto;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
  html {
    scroll-behavior: auto;
  }
  .btn:active:not(:disabled),
  .segmented button:active,
  .app-entry:active,
  .dir-cell:active,
  .dir-cell:hover .dir-arrow,
  .faq-trigger:active,
  .faq-trigger[aria-expanded='true'] svg,
  .toast,
  .toast.is-visible {
    transform: none !important;
  }
  .btn,
  .segmented button,
  .app-entry,
  .dir-cell,
  .dir-arrow,
  .faq-trigger,
  .faq-trigger svg,
  .faq-panel,
  .faq-panel.is-open,
  .toast,
  .toast.is-visible {
    transition-property: opacity, background-color, border-color, color;
    transition-duration: 140ms;
  }
}
