/* =========================================================
   AI Native Systems Lab — Precision Systems Lab
   Paper white + deep-sea blueprint + verification teal
   ========================================================= */

:root {
  --paper: #f8fafc;
  --paper-2: #f1f5f9;
  --card: #ffffff;
  --ink: #0b192c;
  --ink-2: #10233f;
  --ink-3: #173252;
  --blue: #1f6feb;
  --blue-ink: #174ea6;
  --blue-soft: #e8f0fe;
  --teal: #0f766e;
  --teal-bright: #2dd4bf;
  --teal-soft: #e6f4f1;
  --amber: #b45309;
  --amber-soft: #fdf3e3;
  --muted: #475569;
  --muted-2: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  --mono: ui-monospace, Consolas, "SFMono-Regular", "Cascadia Mono", Menlo, monospace;
  --shadow-sm: 0 1px 2px rgba(11, 25, 44, 0.05);
  --shadow-md: 0 24px 60px -32px rgba(11, 25, 44, 0.28), 0 3px 10px rgba(11, 25, 44, 0.05);
  --radius: 14px;
  --wrap: 1280px;
  --gutter: clamp(20px, 4vw, 48px);
  --header-h: 64px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

h1,
h2,
h3,
h4,
p,
figure {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

img,
svg {
  max-width: 100%;
}

img {
  display: block;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 4px;
  overflow-wrap: anywhere;
}

::selection {
  color: var(--ink);
  background: #cfe0ff;
}

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

[hidden] {
  display: none !important;
}

.wrap {
  width: min(calc(100% - (2 * var(--gutter))), var(--wrap));
  margin-inline: auto;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 8px 22px -12px rgba(31, 111, 235, 0.65);
}

.btn-primary:hover {
  background: #1a63d2;
  border-color: #1a63d2;
}

.btn-dark {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.btn-dark:hover {
  background: var(--ink-2);
  border-color: var(--ink-2);
}

.btn-ghost {
  color: var(--ink);
  background: transparent;
  border-color: var(--line-strong);
}

.btn-ghost:hover {
  background: #fff;
  border-color: #94a3b8;
}

.btn-outline-light {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.24);
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.45);
}

.btn-quiet {
  color: #cbd5e1;
  background: transparent;
  border-color: transparent;
  padding-inline: 8px;
}

.btn-quiet:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12.5px;
}

.btn-lg {
  min-height: 48px;
  padding: 0 20px;
  font-size: 14.5px;
  border-radius: 9px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  background: rgba(248, 250, 252, 0.88);
  border-bottom: 1px solid rgba(203, 213, 225, 0.75);
  -webkit-backdrop-filter: blur(16px) saturate(1.35);
  backdrop-filter: blur(16px) saturate(1.35);
  transition: box-shadow 0.25s ease, background-color 0.25s ease;
}

.site-header.is-scrolled {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 30px -26px rgba(11, 25, 44, 0.4);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
}

.brand-mark {
  display: inline-flex;
  color: var(--ink);
}

.brand-mark svg {
  width: 27px;
  height: 27px;
}

.brand-text {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  white-space: nowrap;
}

.brand-text em {
  font-style: normal;
  color: var(--blue-ink);
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 12px;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 2px;
  height: 1.5px;
  border-radius: 2px;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.nav-link:hover {
  color: var(--ink);
  background: rgba(226, 232, 240, 0.55);
}

.nav-link.is-active {
  color: var(--ink);
}

.nav-link.is-active::after {
  transform: scaleX(1);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}

.menu-toggle span {
  display: block;
  width: 16px;
  height: 1.5px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(5.5px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-5.5px) rotate(-45deg);
}

.mobile-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: calc(100vh - var(--header-h));
  max-height: calc(100dvh - var(--header-h));
  overflow-y: auto;
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 14px var(--gutter) 20px;
  box-shadow: 0 24px 40px -30px rgba(11, 25, 44, 0.35);
  animation: menuIn 0.22s ease-out;
}

.mobile-menu.is-open {
  display: block;
}

.mobile-nav {
  display: grid;
  gap: 2px;
}

.mobile-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 4px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 500;
}

.mobile-nav a .mono {
  color: var(--muted-2);
  font-size: 10px;
}

.mobile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background: var(--ink);
  padding: clamp(58px, 8vw, 94px) 0 clamp(36px, 5vw, 56px);
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.075) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse at 68% 30%, black 0%, transparent 76%);
  mask-image: radial-gradient(ellipse at 68% 30%, black 0%, transparent 76%);
  pointer-events: none;
}

.hero-glow {
  position: absolute;
  top: -26%;
  right: -8%;
  width: 780px;
  height: 780px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(31, 111, 235, 0.22) 0%, rgba(15, 118, 110, 0.12) 36%, transparent 68%);
  filter: blur(4px);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

.hero-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  color: #94a3b8;
  font-size: 10.5px;
  letter-spacing: 0.12em;
}

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #99f6e4;
  letter-spacing: 0.08em;
}

.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal-bright);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.12);
  flex: 0 0 auto;
}

.hero-status .dot {
  animation: pulse 2.6s ease-out infinite;
}

.hero h1 {
  max-width: 980px;
  margin-top: clamp(30px, 5vw, 50px);
  font-size: clamp(42px, 6.4vw, 80px);
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: -0.035em;
  color: #fff;
}

.hero-em {
  display: inline-block;
  white-space: nowrap;
  background: linear-gradient(180deg, transparent 63%, rgba(15, 118, 110, 0.62) 63%, rgba(15, 118, 110, 0.62) 93%, transparent 93%);
}

.hero-sub {
  max-width: 760px;
  margin-top: 22px;
  color: #cbd5e1;
  font-size: clamp(16px, 1.7vw, 19px);
  line-height: 1.65;
}

.hero-desc {
  max-width: 660px;
  margin-top: 10px;
  color: #94a3b8;
  font-size: 13.5px;
  line-height: 1.75;
}

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

.metric-rail {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: clamp(42px, 6vw, 64px);
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 18px 18px 17px;
  border-left: 1px solid rgba(148, 163, 184, 0.18);
}

.metric:first-child {
  border-left: 0;
  padding-left: 0;
}

.metric-num {
  display: block;
  font-family: var(--mono);
  font-size: clamp(24px, 2.6vw, 33px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.metric-num sup {
  position: relative;
  top: -0.55em;
  margin-left: 1px;
  font-size: 0.48em;
  font-weight: 500;
  color: #7dd3fc;
  letter-spacing: 0;
}

.metric-num .unit {
  margin-left: 2px;
  font-size: 0.55em;
  font-weight: 500;
  color: #cbd5e1;
  letter-spacing: 0;
}

.metric-label {
  color: #e2e8f0;
  font-size: 11.5px;
  line-height: 1.45;
}

.metric-note {
  color: #94a3b8;
  font-size: 9.5px;
  letter-spacing: 0.02em;
}

.hero-foot {
  margin-top: 18px;
  color: #94a3b8;
  font-size: 10px;
  letter-spacing: 0.02em;
}

.hero-foot a {
  color: #cbd5e1;
  border-bottom: 1px solid rgba(203, 213, 225, 0.35);
}

.hero-foot a:hover {
  color: #fff;
}

/* ---------- Sections ---------- */

.section {
  position: relative;
  padding: clamp(70px, 8vw, 108px) 0;
}

.section + .section {
  border-top: 1px solid var(--line);
}

.section-head {
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr);
  gap: clamp(22px, 4vw, 60px);
  align-items: start;
  margin-bottom: 34px;
}

.section-eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-top: 7px;
  min-width: 0;
}

.sec-num {
  flex: 0 0 auto;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--blue-ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.5;
}

.sec-label {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.sec-rule {
  flex: 1;
  height: 1px;
  min-width: 12px;
  background: var(--line);
}

.section-title h2 {
  max-width: 880px;
  font-size: clamp(28px, 3.4vw, 42px);
  font-weight: 650;
  line-height: 1.22;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.section-lede {
  max-width: 760px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.78;
}

/* ---------- Filters ---------- */

.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.filter-pill:hover {
  color: var(--ink);
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.filter-pill.is-active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.filter-pill span {
  font-family: var(--mono);
  font-size: 10px;
  opacity: 0.6;
}

.filter-count {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: 0.03em;
}

/* ---------- System cards ---------- */

.system-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row dense;
  gap: 24px;
  margin-top: 26px;
  align-items: stretch;
}

.system-grid.is-single {
  grid-template-columns: minmax(0, 780px);
}

.system-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: clamp(20px, 2.4vw, 30px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: transform 0.32s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.32s ease, border-color 0.32s ease;
}

.system-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  height: 2px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--blue), var(--teal-bright));
  opacity: 0.35;
  transition: opacity 0.3s ease;
}

.system-card[data-accent="teal"]::before {
  background: linear-gradient(90deg, var(--teal), #5eead4);
}

.system-card[data-accent="amber"]::before {
  background: linear-gradient(90deg, var(--amber), #fbbf24);
}

/* 旗舰独立大卡片：横跨两列，dense 流自动回填普通卡片 */
.system-card-wide {
  grid-column: 1 / -1;
  border-color: #c9d8ea;
}

.system-card-wide h3 {
  font-size: clamp(22px, 2.2vw, 30px);
}

.card-flag {
  flex: 0 0 auto;
  padding: 2px 6px;
  border: 1px solid rgba(15, 118, 110, 0.4);
  border-radius: 3px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.system-card:hover {
  transform: translateY(-4px);
  border-color: #d3deea;
  box-shadow: var(--shadow-md);
}

.system-card:hover::before {
  opacity: 1;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.card-index {
  padding: 2px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.card-cat {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--teal);
  white-space: nowrap;
}

.card-state .dot {
  width: 5px;
  height: 5px;
  box-shadow: none;
}

.system-card h3 {
  margin-top: 16px;
  font-size: clamp(20px, 1.85vw, 25px);
  font-weight: 650;
  line-height: 1.26;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.system-card h3 span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68em;
  font-weight: 500;
  letter-spacing: 0;
}

.card-sub {
  margin-top: 8px;
  color: var(--muted-2);
  font-size: 13px;
  line-height: 1.6;
}

.card-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.card-stats > div {
  min-width: 0;
  padding-left: 13px;
  border-left: 1px solid var(--line);
}

.card-stats > div:first-child {
  padding-left: 0;
  border-left: 0;
}

.card-stats b {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-stats span {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.verdict {
  display: grid;
  gap: 9px;
  margin-top: 16px;
  padding-left: 12px;
  border-left: 2px solid #dbe7f5;
}

.verdict-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
}

.v-label {
  padding-top: 2px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.verdict-row:last-child .v-label {
  color: var(--teal);
}

.verdict p {
  color: #334155;
  font-size: 13.2px;
  line-height: 1.72;
}

.verdict code {
  font-size: 0.86em;
  padding: 0 3px;
}

.gate-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 14px;
}

.gate-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: #334155;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.5;
  white-space: nowrap;
}

.gate-chip::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: var(--teal);
  transform: rotate(45deg);
  flex: 0 0 auto;
}

.compare {
  margin-top: 18px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
}

.compare-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: 0.06em;
}

.compare-badge {
  flex: 0 0 auto;
  padding: 2px 7px;
  border: 1px solid #c9e6e1;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0;
  white-space: nowrap;
}

.compare-row + .compare-row {
  margin-top: 10px;
}

.compare-labels {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.compare-vals {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.compare-vals .before {
  color: #94a3b8;
}

.compare-vals b {
  font-weight: 600;
}

.compare-track {
  position: relative;
  height: 7px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3ebf5;
}

.bar-after {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--pct, 0%);
  min-width: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), var(--teal-bright));
}

.compare-row.is-zero .bar-after {
  width: 0;
  min-width: 3px;
  border-radius: 0;
  background: transparent;
  border-left: 2px solid var(--teal);
}

.compare-note {
  margin-top: 8px;
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.55;
}

/* compare entry animation only after JS opts in */
.js .compare-init .bar-after {
  width: 0;
}

.js .compare-init.is-inview .bar-after {
  width: var(--pct, 0%);
  transition: width 1.05s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.js .compare-init.is-zero .bar-after {
  width: 0;
}

.js .compare-init.is-zero.is-inview .bar-after {
  width: 3px;
}

.pipeline-list {
  display: grid;
  gap: 5px;
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  list-style: none;
}

.pipeline-list li {
  position: relative;
  padding-left: 12px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
}

.pipeline-list li::before {
  content: "✓";
  position: absolute;
  top: 0;
  left: 0;
  color: var(--teal);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
}

/* ---------- Media / screenshots ---------- */

.media {
  position: relative;
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #dbe4ee;
  border-radius: 10px;
  background: var(--ink);
  cursor: zoom-in;
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
}

.media img {
  width: 100%;
  height: auto;
  object-fit: contain;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.media:hover img {
  transform: scale(1.018);
}

.media .arch-svg {
  display: block;
  width: 100%;
  height: auto;
}

.media-tag {
  position: absolute;
  top: 9px;
  left: 9px;
  padding: 3px 7px;
  border: 1px solid rgba(11, 25, 44, 0.08);
  border-radius: 4px;
  background: rgba(248, 250, 252, 0.94);
  color: var(--ink);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.media-hint {
  position: absolute;
  right: 9px;
  bottom: 9px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  background: rgba(11, 25, 44, 0.78);
  color: #e2e8f0;
  font-size: 9.5px;
  letter-spacing: 0.02em;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.media:hover .media-hint {
  background: rgba(11, 25, 44, 0.94);
  color: #fff;
}

.media-caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.5;
}

.media-caption .mono {
  font-size: 9px;
  white-space: nowrap;
}

.card-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.boundary-badge {
  display: inline-block;
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid #f1d8b5;
  border-radius: 4px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 10px;
  line-height: 1.5;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue-ink);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.text-btn span {
  transition: transform 0.2s ease;
}

.text-btn:hover span {
  transform: translateX(3px);
}

/* ---------- SDD lab ---------- */

.lab {
  overflow: hidden;
  background: var(--ink);
  color: #fff;
  border-top: 0 !important;
}

.lab::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.065) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.065) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: linear-gradient(to bottom, black 0%, rgba(0, 0, 0, 0.35) 62%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 0%, rgba(0, 0, 0, 0.35) 62%, transparent 100%);
  pointer-events: none;
}

.lab > .wrap {
  position: relative;
  z-index: 1;
}

.section-head-dark .sec-num {
  color: #7dd3fc;
  border-color: rgba(148, 163, 184, 0.35);
}

.section-head-dark .sec-label {
  color: #94a3b8;
}

.section-head-dark .sec-rule {
  background: rgba(148, 163, 184, 0.25);
}

.section-head-dark h2 {
  color: #fff;
}

.section-head-dark .section-lede {
  color: #94a3b8;
}

.diagram-panel {
  margin-top: 30px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  background: linear-gradient(180deg, #0d2038 0%, #0a1729 100%);
  box-shadow: 0 30px 80px -50px rgba(0, 0, 0, 0.8);
}

.diagram-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 13px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  color: #94a3b8;
  font-size: 9.5px;
  letter-spacing: 0.09em;
}

.diagram-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #5eead4;
}

.diagram-status .dot {
  width: 5px;
  height: 5px;
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.1);
}

.diagram-scroll {
  overflow-x: auto;
  padding: 16px 18px 18px;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

.diagram-scroll::-webkit-scrollbar {
  height: 7px;
}

.diagram-scroll::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 10px;
}

.lab-diagram {
  display: block;
  width: 100%;
  min-width: 860px;
  height: auto;
}

.diagram-hint {
  display: none;
  margin: 0;
  padding: 0 18px 13px;
  color: #94a3b8;
  font-size: 9px;
  text-align: right;
}

.diagram text {
  font-family: var(--sans);
}

.diagram .m {
  font-family: var(--mono);
}

/* ---------- Gate tabs ---------- */

.gate-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 20px;
}

.gate-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 96px;
  padding: 13px 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  color: #cbd5e1;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.22s ease, border-color 0.22s ease, color 0.22s ease, transform 0.22s ease;
}

.gate-tab:hover {
  border-color: rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.gate-tab[aria-selected="true"] {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--paper);
}

.tab-num {
  color: #7dd3fc;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.gate-tab[aria-selected="true"] .tab-num {
  color: var(--blue-ink);
}

.gate-tab strong {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.tab-en {
  margin-top: auto;
  padding-top: 8px;
  color: #94a3b8;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
}

.gate-tab[aria-selected="true"] .tab-en {
  color: var(--muted-2);
}

.gate-panel {
  padding: clamp(20px, 3vw, 30px);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  animation: panelIn 0.32s ease-out;
}

.gate-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.gate-code {
  color: var(--blue-ink);
  font-size: 9.5px;
  letter-spacing: 0.09em;
}

.gate-panel h3 {
  margin-top: 5px;
  color: var(--ink);
  font-size: clamp(20px, 2.2vw, 27px);
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.gate-panel h3 span {
  display: inline-block;
  margin-left: 8px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  vertical-align: middle;
}

.gate-panel-head p {
  max-width: 700px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.gate-state {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid #c9e6e1;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 8.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.gate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 34px;
  margin-top: 20px;
}

.gate-col h4 {
  margin-bottom: 7px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
}

.gate-col ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gate-col li {
  position: relative;
  padding-left: 13px;
  color: #334155;
  font-size: 13px;
  line-height: 1.62;
}

.gate-col li::before {
  content: "";
  position: absolute;
  top: 0.62em;
  left: 0;
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: var(--blue);
  transform: rotate(45deg);
}

.gate-block li::before {
  background: var(--amber);
}

.gate-col p {
  color: #334155;
  font-size: 13px;
  line-height: 1.7;
}

.gate-foot {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.gate-foot .mono {
  flex: 0 0 auto;
  color: var(--teal);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.gate-foot p {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

/* ---------- Rules ---------- */

.rules-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 26px;
  margin-top: 52px;
  padding-top: 26px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.rules-head .sec-label {
  color: #7dd3fc;
}

.rules-head h2 {
  margin-top: 6px;
  color: #fff;
  font-size: clamp(24px, 2.8vw, 34px);
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.rules-head > p {
  max-width: 390px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.7;
  text-align: right;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.rule-card {
  display: flex;
  flex-direction: column;
  min-height: 190px;
  padding: 17px;
  border: 1px solid rgba(148, 163, 184, 0.19);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.033);
  transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.rule-card:hover {
  border-color: rgba(148, 163, 184, 0.38);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-2px);
}

.rule-num {
  color: #7dd3fc;
  font-size: 9px;
  letter-spacing: 0.06em;
}

.rule-card h3 {
  margin-top: 7px;
  color: #fff;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.4;
}

.rule-card p {
  margin-top: 6px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.72;
}

.rule-card code {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
}

.rule-evidence {
  margin-top: auto !important;
  padding-top: 11px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  color: #5eead4 !important;
  font-family: var(--mono);
  font-size: 9px !important;
  line-height: 1.5 !important;
}

.rule-card-wide {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 50px minmax(0, 1.5fr) minmax(0, 0.9fr);
  align-items: center;
  gap: 22px;
  min-height: 118px;
}

.rule-card-wide .rule-evidence {
  margin-top: 0 !important;
  padding-top: 0;
  border-top: 0;
  text-align: right;
  font-size: 9.5 !important;
}

.rule-card-wide p {
  max-width: 760px;
}

/* ---------- More projects ---------- */

.more {
  background: #fff;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  grid-column: span 3;
  min-width: 0;
  min-height: 226px;
  padding: 21px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
  transition: border-color 0.25s ease, background-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.project-card:nth-child(n + 3) {
  grid-column: span 2;
}

.project-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s ease;
}

.project-card:hover {
  transform: translateY(-3px);
  border-color: #d3deea;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.project-card:hover::before {
  transform: scaleX(1);
}

.project-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: 0.08em;
}

.project-tag {
  overflow: hidden;
  color: var(--blue-ink);
  font-size: 9px;
  letter-spacing: 0.02em;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-card h3 {
  margin-top: 10px;
  color: var(--ink);
  font-size: 16.5px;
  font-weight: 650;
  line-height: 1.38;
  letter-spacing: -0.01em;
}

.project-desc {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.project-metrics {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.project-metrics > div {
  min-width: 0;
}

.project-metrics b {
  display: block;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.project-metrics span {
  display: block;
  color: var(--muted-2);
  font-size: 9.5px;
  line-height: 1.4;
}

.project-note {
  margin-top: 8px;
  color: var(--amber);
  font-size: 9px;
  letter-spacing: 0.02em;
}

/* ---------- Evidence ---------- */

.evidence {
  background: var(--paper);
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 30px;
}

.evidence-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--blue);
  border-radius: 10px;
  background: #fff;
}

.evidence-card-measured {
  border-top-color: var(--blue);
}

.evidence-card-reported {
  border-top-color: var(--teal);
}

.evidence-card-boundary {
  border-top-color: var(--amber);
}

.evidence-card-head .mono {
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.evidence-card h3 {
  margin-top: 7px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 650;
  line-height: 1.3;
}

.evidence-card ul {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.evidence-card li {
  position: relative;
  padding-left: 13px;
  color: #334155;
  font-size: 12.2px;
  line-height: 1.7;
}

.evidence-card li::before {
  content: "";
  position: absolute;
  top: 0.63em;
  left: 0;
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: var(--blue);
  transform: rotate(45deg);
}

.evidence-card-reported li::before {
  background: var(--teal);
}

.evidence-card-boundary li::before {
  background: var(--amber);
}

.evidence-card li b {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.94em;
  font-weight: 600;
}

.evidence-card code {
  font-size: 0.85em;
}

.evidence-stamp {
  margin-top: auto;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.method-note {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 16px;
  padding: 17px 20px;
  border-radius: 10px;
  background: var(--ink);
  color: #cbd5e1;
}

.method-stamp {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid rgba(94, 234, 212, 0.35);
  border-radius: 4px;
  color: #5eead4;
  font-size: 9px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.method-note p {
  flex: 1;
  font-size: 11.5px;
  line-height: 1.65;
}

.method-link {
  flex: 0 0 auto;
  color: #7dd3fc;
  font-size: 9.5px;
  white-space: nowrap;
  border-bottom: 1px solid rgba(125, 211, 252, 0.35);
}

.method-link:hover {
  color: #fff;
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 52px 0 22px;
  background: #081422;
  color: #cbd5e1;
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 44px;
  align-items: start;
}

.footer-id {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.footer-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  object-fit: cover;
  opacity: 0.9;
  filter: saturate(0.85);
}

.footer-name {
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.footer-cred {
  margin-top: 4px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.6;
}

.footer-cred-dim {
  color: #94a3b8;
  font-size: 11px;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 10px;
}

.footer-links a {
  color: #cbd5e1;
  border-bottom: 1px solid rgba(203, 213, 225, 0.28);
}

.footer-links a:hover {
  color: #fff;
  border-bottom-color: #fff;
}

.footer-links span {
  color: #64748b;
}

.footer-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 38px;
  padding-top: 16px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  color: #94a3b8;
  font-size: 9px;
  letter-spacing: 0.03em;
}

.footer-sep {
  color: #475569;
}

.footer-bottom-links {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.footer-bottom a {
  color: #cbd5e1;
}

.footer-bottom a:hover {
  color: #fff;
}

/* ---------- Detail modal ---------- */

dialog {
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(3, 10, 20, 0.7);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  animation: backdropIn 0.22s ease-out;
}

.modal {
  position: fixed;
  inset: 0;
  width: min(980px, calc(100vw - 32px));
  max-width: 980px;
  max-height: min(90vh, 900px);
  max-height: min(90dvh, 900px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  overflow: visible;
}

.modal[open] {
  animation: modalIn 0.26s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.modal-shell {
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 900px);
  max-height: min(90dvh, 900px);
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 40px 110px -30px rgba(0, 0, 0, 0.6);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex: 0 0 auto;
  padding: 22px 26px 20px;
  background: var(--ink);
  color: #fff;
}

.modal-head-copy {
  min-width: 0;
}

.modal-head .mono {
  color: #7dd3fc;
  font-size: 9px;
  letter-spacing: 0.09em;
}

.modal-head h2 {
  margin-top: 5px;
  color: #fff;
  font-size: clamp(20px, 2.4vw, 27px);
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.modal-sub {
  max-width: 740px;
  margin-top: 5px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.6;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover {
  background: var(--paper);
  border-color: var(--line-strong);
}

.modal-close {
  margin-left: auto;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
}

.modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px 26px 26px;
  overscroll-behavior: contain;
}

.modal-body::-webkit-scrollbar {
  width: 9px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border: 2px solid #fff;
  border-radius: 10px;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding: 12px 26px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.modal-foot .mono {
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.5;
}

.modal-foot .btn {
  margin-left: auto;
}

.detail-main,
.detail-aside {
  min-width: 0;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--line);
  gap: 1px;
}

.detail-stats > div {
  min-width: 0;
  padding: 11px 13px;
  background: var(--paper);
}

.detail-stats b {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-stats span {
  display: block;
  margin-top: 1px;
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.4;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 26px;
  margin-top: 22px;
}

.detail-section + .detail-section {
  margin-top: 22px;
}

.detail-section h3 {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 11px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.detail-section h3 .num {
  color: var(--blue-ink);
}

.decision-item {
  padding-left: 12px;
  border-left: 2px solid #dbe7f5;
}

.decision-item + .decision-item {
  margin-top: 12px;
}

.decision-item h4 {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}

.decision-item p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.decision-item code {
  font-size: 0.85em;
}

.flow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.flow-step {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: #334155;
  font-size: 11px;
  line-height: 1.4;
}

.flow-arrow {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10px;
}

.evidence-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--line);
  gap: 1px;
}

.evidence-row {
  display: grid;
  grid-template-columns: minmax(86px, 0.95fr) minmax(0, 1.6fr);
  gap: 10px;
  align-items: baseline;
  padding: 8px 11px;
  background: #fff;
}

.evidence-row b {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.evidence-row span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.boundary-box {
  padding: 14px;
  border: 1px solid #f1d8b5;
  border-radius: 8px;
  background: var(--amber-soft);
}

.boundary-box h3 {
  margin-bottom: 8px;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
}

.boundary-box ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.boundary-box li {
  position: relative;
  padding-left: 12px;
  color: #7c4a12;
  font-size: 11px;
  line-height: 1.65;
}

.boundary-box li::before {
  content: "!";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
}

.artifact-box {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.artifact-box h3 {
  margin-bottom: 9px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
}

.artifact-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.artifact-chip {
  padding: 3px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #fff;
  color: #334155;
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.source-note {
  margin-top: 14px;
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.6;
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  width: min(1180px, calc(100vw - 28px));
  max-width: 1180px;
  max-height: 92vh;
  max-height: 92dvh;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  overflow: visible;
}

.lightbox[open] {
  animation: modalIn 0.24s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.lightbox-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  max-height: 92dvh;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  background: #08111f;
  box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.8);
}

.lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(8, 17, 31, 0.72);
  color: #fff;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.4);
}

.lightbox-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 18px;
  overflow: auto;
  background: #08111f;
}

.lightbox-stage img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(92vh - 110px);
  max-height: calc(92dvh - 110px);
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-stage svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(92vh - 110px);
  max-height: calc(92dvh - 110px);
}

.lightbox-caption {
  flex: 0 0 auto;
  margin: 0;
  padding: 10px 48px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  font-size: 11px;
  line-height: 1.65;
}

/* ---------- Motion ---------- */

.reveal-init {
  opacity: 0;
  transform: translateY(16px);
}

.reveal-init.is-visible {
  opacity: 1;
  transform: none;
  animation: revealIn 0.65s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
  animation-delay: var(--reveal-delay, 0ms);
}

@keyframes revealIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card-enter {
  animation: cardIn 0.35s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
  animation-delay: calc(var(--enter-i, 1) * 40ms);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.28);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(45, 212, 191, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(45, 212, 191, 0);
  }
}

@keyframes menuIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes backdropIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ---------- Responsive ---------- */

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

  .menu-toggle {
    display: inline-flex;
  }

  .header-actions {
    margin-left: auto;
  }

  .system-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .section-head {
    grid-template-columns: minmax(0, 1fr);
    gap: 13px;
  }

  .section-eyebrow {
    padding-top: 0;
  }

  .sec-rule {
    max-width: 120px;
  }

  .system-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .system-card {
    max-width: 860px;
  }

  .evidence-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
}

@media (max-width: 900px) {
  .header-gitea {
    display: none;
  }

  .rules-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rule-card-wide {
    grid-column: 1 / -1;
  }

  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-card,
  .project-card:nth-child(n + 3) {
    grid-column: span 1;
  }

  .project-card:last-child {
    grid-column: 1 / -1;
  }

  .gate-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gate-tab {
    min-height: 84px;
  }

  .detail-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-main,
  .detail-aside {
    min-width: 0;
  }
}

@media (max-width: 760px) {
  :root {
    --header-h: 58px;
  }

  .hero {
    padding-top: 40px;
  }

  .hero h1 {
    font-size: clamp(37px, 10.6vw, 54px);
  }

  .metric-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    padding: 14px 12px;
  }

  .metric:nth-child(1),
  .metric:nth-child(2) {
    border-top: 0;
  }

  .metric:nth-child(3) {
    border-left: 0;
    padding-left: 0;
  }

  .metric:nth-child(5) {
    grid-column: 1 / -1;
    border-left: 0;
    padding-left: 0;
  }

  .metric:first-child {
    padding-left: 0;
  }

  .metric-note {
    display: none;
  }

  .hero-actions {
    align-items: stretch;
  }

  .hero-actions .btn {
    flex: 1 1 auto;
  }

  .card-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 9px;
  }

  .card-stats > div {
    padding-left: 11px;
  }

  .card-stats > div:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }

  .card-stats > div:nth-child(n + 3) {
    padding-top: 8px;
    border-top: 1px solid var(--line);
  }

  .gate-panel-head {
    flex-direction: column;
    gap: 10px;
  }

  .gate-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .rules-head {
    display: block;
  }

  .rules-head > p {
    margin-top: 9px;
    text-align: left;
  }

  .rule-card-wide {
    display: flex;
    align-items: flex-start;
    gap: 0;
    min-height: 0;
    padding: 17px;
  }

  .rule-card-wide .rule-evidence {
    margin-top: auto !important;
    padding-top: 11px;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
    text-align: left;
  }

  .method-note {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .method-note p {
    flex-basis: calc(100% - 100px);
  }

  .method-link {
    margin-left: auto;
  }

  .footer-bottom-links {
    width: 100%;
    margin-left: 0;
    padding-top: 8px;
  }

  .diagram-hint {
    display: block;
  }

  .detail-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-aside {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .brand-text {
    font-size: 9.5px;
    letter-spacing: 0.08em;
  }

  .brand-mark svg {
    width: 24px;
    height: 24px;
  }

  .header-inner {
    gap: 10px;
  }

  .header-actions {
    gap: 6px;
  }

  .hero-meta {
    font-size: 9px;
    letter-spacing: 0.08em;
  }

  .hero-desc {
    font-size: 12.5px;
  }

  .filter-count {
    width: 100%;
    margin-left: 0;
    text-align: right;
  }

  .project-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .modal {
    width: 100vw;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border-radius: 0;
  }

  .modal-shell {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .modal-head {
    padding: 17px 18px 15px;
  }

  .modal-body {
    padding: 18px;
  }

  .modal-foot {
    padding: 10px 18px;
  }

  .modal-foot .mono {
    display: none;
  }

  .detail-stats b {
    font-size: 14px;
  }

  .evidence-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 1px;
  }

  .lightbox {
    width: 100vw;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }

  .lightbox-shell {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .lightbox-stage {
    flex: 1;
    padding: 10px;
  }

  .lightbox-stage img,
  .lightbox-stage svg {
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
  }

  .lightbox-caption {
    padding: 9px 46px 12px 14px;
    font-size: 10px;
  }
}

@media (max-width: 420px) {
  :root {
    --gutter: 18px;
  }

  .btn-sm {
    font-size: 11.5px;
  }

  .gate-tabs {
    grid-template-columns: minmax(0, 1fr);
  }

  .gate-tab {
    min-height: 66px;
  }

  .system-card {
    padding: 17px;
    border-radius: 12px;
  }

  .system-card h3 {
    font-size: 20px;
  }

  .verdict-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 1px;
  }

  .v-label {
    padding-top: 0;
  }

  .compare-labels {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .media-caption {
    flex-direction: column;
    gap: 2px;
  }

  .card-foot {
    align-items: flex-start;
  }

  .text-btn {
    margin-left: 0;
  }

  .rules-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .project-metrics {
    gap: 14px;
  }

  .footer-links {
    gap: 5px;
  }
}

/* Keep card hover lift working after the reveal animation settles. */
.system-card.reveal-init.is-visible:hover {
  transform: translateY(-4px);
}

.project-card.reveal-init.is-visible:hover {
  transform: translateY(-3px);
}

.rule-card.reveal-init.is-visible:hover {
  transform: translateY(-2px);
}

/* Lock the page behind native dialogs. */
html.is-locked,
html.is-locked body {
  overflow: hidden;
}

@media (min-width: 1121px) {
  .mobile-menu,
  .mobile-menu.is-open {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .reveal-init {
    opacity: 1;
    transform: none;
  }
}

/* =========================================================
   THREE.JS LAB · Hero 星图 / 3D 舞台 / 遥测 HUD / 移动 Dock
   ========================================================= */

html {
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
}

/* ---------- Hero 3D 宪政拓扑星图 ---------- */

.hero-three {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.hero-three canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* 深蓝对比度暗罩：保证 Hero 文字 100% 锐利可读 */
.hero-three-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(97deg, rgba(11, 25, 44, 0.93) 0%, rgba(11, 25, 44, 0.78) 30%, rgba(11, 25, 44, 0.42) 58%, rgba(11, 25, 44, 0.6) 100%),
    radial-gradient(ellipse at 50% 118%, rgba(11, 25, 44, 0.85) 0%, transparent 58%);
}

body.three-off .hero-three {
  display: none;
}

/* ---------- 3D 实验室_section ---------- */

.three-lab {
  color: #e2e8f0;
  background:
    radial-gradient(ellipse 90% 60% at 78% -10%, rgba(31, 111, 235, 0.16) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 8% 110%, rgba(15, 118, 110, 0.14) 0%, transparent 62%),
    linear-gradient(180deg, #0b192c 0%, #0d1e36 52%, #0b192c 100%);
  border-top: 1px solid rgba(125, 211, 252, 0.14);
}

.three-lab .section-lede {
  color: #94a3b8;
}

.three-lab .sec-rule {
  background: linear-gradient(90deg, rgba(125, 211, 252, 0.5), transparent);
}

.lab-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.lab-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 10px;
  background: rgba(16, 35, 63, 0.62);
  color: #cbd5e1;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.lab-view-btn:hover {
  border-color: rgba(125, 211, 252, 0.6);
  color: #f8fafc;
  transform: translateY(-1px);
}

.lab-view-btn.is-active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #1f6feb 0%, #0f766e 100%);
  box-shadow: 0 10px 26px -12px rgba(31, 111, 235, 0.75);
}

.lab-view-num {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  opacity: 0.75;
}

.lab-status {
  margin-left: auto;
  color: #7dd3fc;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.lab-stage-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: stretch;
}

.lab-stage {
  position: relative;
  height: 460px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, 0.18);
  background:
    radial-gradient(ellipse 80% 70% at 60% 30%, rgba(23, 50, 82, 0.85) 0%, rgba(11, 25, 44, 0.95) 70%),
    #0b192c;
  box-shadow: inset 0 0 60px rgba(8, 20, 34, 0.6), 0 24px 60px -32px rgba(0, 0, 0, 0.6);
}

.lab-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
  cursor: grab;
}

.lab-stage canvas.is-dragging {
  cursor: grabbing;
}

.lab-stage-tag {
  position: absolute;
  top: 12px;
  left: 14px;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid rgba(125, 211, 252, 0.25);
  background: rgba(11, 25, 44, 0.66);
  color: #7dd3fc;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  pointer-events: none;
}

.lab-stage-hint {
  position: absolute;
  right: 14px;
  bottom: 12px;
  color: rgba(148, 163, 184, 0.85);
  font-size: 10px;
  letter-spacing: 0.05em;
  pointer-events: none;
}

/* WebGL 不可用时的静态降级 */
.lab-fallback {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 26px 26px 22px;
  color: #cbd5e1;
}

.lab-fallback > p {
  color: #fbbf24;
  font-size: 10.5px;
  letter-spacing: 0.12em;
}

.lab-fallback h3 {
  margin: 10px 0 14px;
  color: #f8fafc;
  font-size: 17px;
  line-height: 1.5;
}

.lab-fallback ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  font-size: 13px;
  line-height: 1.7;
}

.lab-fallback b {
  color: #7dd3fc;
}

/* ---------- 遥测 HUD ---------- */

.lab-hud {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 460px;
  overflow-y: auto;
  padding: 20px 18px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, rgba(16, 35, 63, 0.92) 0%, rgba(11, 25, 44, 0.94) 100%);
  scrollbar-width: thin;
  scrollbar-color: #1f6feb #0b192c;
}

.lab-hud::-webkit-scrollbar {
  width: 8px;
}

.lab-hud::-webkit-scrollbar-track {
  background: #0b192c;
  border-radius: 8px;
}

.lab-hud::-webkit-scrollbar-thumb {
  background: #1f6feb;
  border-radius: 8px;
}

.lab-hud::-webkit-scrollbar-thumb:hover {
  background: #38bdf8;
}

.hud-kicker {
  color: #2dd4bf;
  font-size: 10px;
  letter-spacing: 0.16em;
}

.hud-title {
  color: #f8fafc;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.hud-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hud-tag {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(45, 212, 191, 0.4);
  background: rgba(15, 118, 110, 0.18);
  color: #99f6e4;
  font-size: 10.5px;
  letter-spacing: 0.03em;
}

.hud-metrics {
  display: grid;
  gap: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.hud-metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  font-size: 12px;
}

.hud-metric span {
  color: #94a3b8;
  flex: 0 0 auto;
}

.hud-metric b {
  color: #7dd3fc;
  font-size: 12.5px;
  font-weight: 600;
  text-align: right;
}

.hud-desc {
  color: #cbd5e1;
  font-size: 12.5px;
  line-height: 1.75;
}

.hud-hint {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed rgba(148, 163, 184, 0.22);
  color: #64748b;
  font-size: 10px;
  letter-spacing: 0.04em;
}

/* ---------- 视角控制 ---------- */

.lab-controls {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.lab-ctrl-btn {
  min-height: 44px;
  padding: 0 20px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(16, 35, 63, 0.62);
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.lab-ctrl-btn:hover {
  border-color: rgba(125, 211, 252, 0.6);
  color: #f8fafc;
  background: rgba(23, 50, 82, 0.8);
}

.lab-ctrl-btn:active {
  background: rgba(31, 111, 235, 0.35);
}

.lab-ctrl-reset {
  border-color: rgba(45, 212, 191, 0.45);
  color: #99f6e4;
}

.lab-note {
  margin-top: 16px;
  color: #64748b;
  font-size: 10.5px;
  letter-spacing: 0.03em;
  line-height: 1.8;
}

/* ---------- 移动端底部玻璃拟态快捷导航 ---------- */

.mobile-dock {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 6px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(11, 25, 44, 0.74);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  backdrop-filter: blur(16px) saturate(1.5);
  box-shadow: 0 18px 44px -18px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(248, 250, 252, 0.08);
}

.mobile-dock a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  border-radius: 12px;
  color: #cbd5e1;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.mobile-dock a svg {
  width: 19px;
  height: 19px;
}

.mobile-dock a:hover,
.mobile-dock a:active {
  background: rgba(31, 111, 235, 0.28);
  color: #7dd3fc;
}

/* ---------- PC / 手机双规格 ---------- */

@media (max-width: 1023px) {
  .lab-stage-shell {
    grid-template-columns: minmax(0, 1fr) 280px;
  }
}

@media (max-width: 768px) {
  body {
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-dock {
    display: grid;
  }

  .lab-stage-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .lab-stage {
    height: 340px;
  }

  .lab-hud {
    max-height: none;
  }

  .lab-toolbar {
    gap: 8px;
  }

  .lab-view-btn {
    flex: 1 1 auto;
    justify-content: center;
    padding: 0 12px;
    font-size: 12.5px;
  }

  .lab-status {
    width: 100%;
    margin-left: 0;
    text-align: right;
  }

  .lab-controls {
    gap: 8px;
  }

  .lab-ctrl-btn {
    flex: 1 1 0;
    padding: 0 8px;
    min-height: 46px;
  }

  .lab-stage-hint {
    display: none;
  }

  .hud-title {
    font-size: 16px;
  }
}

@media (max-width: 420px) {
  .lab-view-btn {
    flex-basis: 100%;
  }

  .lab-stage {
    height: 320px;
  }
}