/* ==========================================================================
   律典 · Design System
   设计语言参考 TDesign / Apple / Google 的克制、清晰与秩序感
   ========================================================================== */

:root {
  --brand: #0052d9;
  --brand-hover: #266fe8;
  --brand-active: #0034b5;
  --brand-weak: #edf4ff;
  --brand-weak-2: #dbe9ff;
  --ink: #111827;
  --ink-2: #364152;
  --ink-3: #667085;
  --ink-4: #98a2b3;
  --bg: #f5f7fa;
  --bg-soft: #fafbfc;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e4e9f0;
  --line-soft: #eef1f5;
  --line-strong: #d3dae5;
  --success: #0e9f6e;
  --success-weak: #e8f8f1;
  --warning: #e37318;
  --warning-weak: #fff4e8;
  --danger: #d54941;
  --danger-weak: #fdeceb;
  --info: #116a9c;
  --info-weak: #eaf6fd;
  --violet: #6b5ce7;
  --violet-weak: #f1efff;
  --gold: #a86400;
  --gold-weak: #fff5e2;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --radius-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.07), 0 2px 6px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, 0.12), 0 8px 20px rgba(16, 24, 40, 0.05);

  --font-ui: "PingFang SC", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", "STSong",
    Georgia, serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;

  --header-h: 64px;
  --container: 1200px;
  --read-size: 18px;
  --read-font: var(--font-serif);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="dark"] {
  --brand: #5b93ff;
  --brand-hover: #7aa8ff;
  --brand-active: #3f7cf0;
  --brand-weak: #14233d;
  --brand-weak-2: #1a2d4d;
  --ink: #e8edf5;
  --ink-2: #c1c9d6;
  --ink-3: #9aa5b4;
  --ink-4: #748094;
  --bg: #0b0f17;
  --bg-soft: #0f1520;
  --surface: #121926;
  --surface-2: #17202f;
  --line: #232d3d;
  --line-soft: #1b2433;
  --line-strong: #334154;
  --success: #4ade9f;
  --success-weak: #102b23;
  --warning: #f0a45c;
  --warning-weak: #332414;
  --danger: #f27d73;
  --danger-weak: #351a1a;
  --info: #6cc4f0;
  --info-weak: #122a38;
  --violet: #a99bff;
  --violet-weak: #201c3a;
  --gold: #e7b667;
  --gold-weak: #33250f;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 76px);
}

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

::selection {
  color: var(--ink);
  background: var(--brand-weak-2);
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

img,
svg {
  display: block;
}

svg.icon {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

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

.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;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
}

.text-muted {
  color: var(--ink-3);
}

.hairline {
  height: 1px;
  background: var(--line);
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--header-h);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.site-header.scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.02);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 30px;
}

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

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(145deg, #1a63e0, #0034b5 65%, #00257f);
  box-shadow: 0 6px 14px rgba(0, 82, 217, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.brand-sub {
  margin-top: 1px;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--ink-4);
  text-transform: uppercase;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1 1 auto;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 13px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  transition: color 0.18s ease, background 0.18s ease;
}

.nav-link:hover {
  color: var(--ink);
  background: var(--surface-2);
}

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

.nav-link.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
  transform: translateX(-50%);
}

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

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  color: var(--ink-2);
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.icon-btn:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.icon-btn:active {
  transform: scale(0.96);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease,
    box-shadow 0.18s ease, transform 0.18s ease;
}

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

.btn-primary {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 2px 4px rgba(0, 82, 217, 0.14);
}

.btn-primary:hover {
  background: var(--brand-hover);
  box-shadow: 0 4px 12px rgba(0, 82, 217, 0.2);
}

.btn-secondary {
  color: var(--ink-2);
  background: var(--surface);
  border-color: var(--line);
}

.btn-secondary:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.btn-ghost {
  color: var(--ink-2);
  background: transparent;
}

.btn-ghost:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.btn-soft {
  color: var(--brand);
  background: var(--brand-weak);
}

.btn-soft:hover {
  background: var(--brand-weak-2);
}

.btn-sm {
  height: 32px;
  padding: 0 11px;
  border-radius: 8px;
  font-size: 13px;
}

.btn-danger {
  color: #fff;
  background: var(--danger);
}

.btn-block {
  width: 100%;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.header-search-btn {
  padding: 0 14px;
}

.header-feedback {
  display: inline-flex;
}

/* ==========================================================================
   Badges / chips
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge-constitution {
  color: var(--gold);
  background: var(--gold-weak);
}

.badge-law {
  color: var(--brand);
  background: var(--brand-weak);
}

.badge-regulation {
  color: var(--success);
  background: var(--success-weak);
}

.badge-judicial {
  color: var(--violet);
  background: var(--violet-weak);
}

.badge-department {
  color: var(--info);
  background: var(--info-weak);
}

.badge-local {
  color: var(--warning);
  background: var(--warning-weak);
}

.badge-case {
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.badge-neutral {
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.status-current {
  color: var(--success);
  background: var(--success-weak);
}

.status-pending {
  color: var(--warning);
  background: var(--warning-weak);
}

.status-history {
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.status-repealed {
  color: var(--danger);
  background: var(--danger-weak);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.chip:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.chip.active {
  color: var(--brand);
  border-color: var(--brand-weak-2);
  background: var(--brand-weak);
}

.chip-count {
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chip.active .chip-count {
  color: var(--brand);
  background: rgba(0, 82, 217, 0.1);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.chip-scroll::-webkit-scrollbar {
  display: none;
}

/* ==========================================================================
   Home
   ========================================================================== */

.hero {
  position: relative;
  padding: 74px 0 54px;
  overflow: hidden;
  isolation: isolate;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -30% -20% auto -20%;
  height: 720px;
  z-index: -1;
  background:
    radial-gradient(560px 320px at 28% 12%, rgba(0, 82, 217, 0.11), transparent 68%),
    radial-gradient(500px 300px at 72% 0%, rgba(107, 92, 231, 0.09), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent 70%);
  pointer-events: none;
}

html[data-theme="dark"] .hero::before {
  background:
    radial-gradient(560px 320px at 28% 12%, rgba(64, 120, 255, 0.16), transparent 68%),
    radial-gradient(500px 300px at 72% 0%, rgba(107, 92, 231, 0.12), transparent 70%),
    linear-gradient(180deg, rgba(18, 25, 38, 0.4), transparent 70%);
}

.hero-inner {
  max-width: 860px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--ink-3);
  font-size: 12px;
  letter-spacing: 0.01em;
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 16%, transparent);
}

.hero h1 {
  margin: 22px 0 14px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.12;
  font-weight: 680;
  letter-spacing: -0.035em;
}

.hero h1 .gradient {
  background: linear-gradient(100deg, var(--brand) 10%, #4d7dff 55%, #6b5ce7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.hero-sub {
  max-width: 640px;
  margin: 0;
  color: var(--ink-3);
  font-size: 16px;
  line-height: 1.8;
}

html[data-theme="dark"] .hero h1 .gradient {
  background: linear-gradient(100deg, #8ab3ff, #b3c8ff 55%, #b9aaff);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-search {
  position: relative;
  z-index: 3;
  max-width: 700px;
  margin-top: 30px;
}

.search-shell {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 58px;
  padding: 0 8px 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.search-shell:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 12%, transparent), var(--shadow-md);
}

.search-shell .icon-search {
  color: var(--ink-4);
  font-size: 20px;
}

.search-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
}

.search-input::placeholder {
  color: var(--ink-4);
}

.search-submit {
  height: 42px;
  padding: 0 18px;
  border-radius: 9px;
  color: #fff;
  background: var(--brand);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.18s ease;
}

.search-submit:hover {
  background: var(--brand-hover);
}

.search-kbd {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 7px;
  margin-right: 4px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--ink-4);
  font-size: 11px;
  font-family: var(--font-mono);
}

.suggest-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  display: none;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.suggest-panel.show {
  display: block;
  animation: fadeDown 0.18s var(--ease);
}

.suggest-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}

.suggest-item:last-child {
  border-bottom: 0;
}

.suggest-item:hover,
.suggest-item.active {
  background: var(--brand-weak);
}

.suggest-main {
  min-width: 0;
  flex: 1 1 auto;
}

.suggest-title {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggest-meta {
  margin-top: 2px;
  color: var(--ink-4);
  font-size: 11px;
}

.suggest-item .icon {
  color: var(--ink-4);
  font-size: 14px;
}

.suggest-empty {
  padding: 18px 16px;
  color: var(--ink-4);
  font-size: 13px;
}

.hot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  color: var(--ink-4);
  font-size: 12px;
}

.hot-link {
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--ink-3);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--line-soft);
  transition: all 0.18s ease;
}

.hot-link:hover {
  color: var(--brand);
  border-color: var(--brand-weak-2);
  background: var(--brand-weak);
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 42px;
  padding-top: 26px;
  border-top: 1px solid var(--line-soft);
}

.stat {
  padding: 0 28px;
  border-left: 1px solid var(--line-soft);
}

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

.stat-value {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-value small {
  margin-left: 2px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
}

.stat-label {
  margin-top: 2px;
  color: var(--ink-4);
  font-size: 11px;
}

.section {
  padding: 52px 0;
}

.section-tight {
  padding: 34px 0;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section-kicker {
  margin-bottom: 7px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.section-title {
  margin: 0;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.section-desc {
  max-width: 540px;
  margin: 8px 0 0;
  color: var(--ink-3);
  font-size: 14px;
}

.section-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  color: var(--ink-3);
  font-size: 13px;
}

.section-link:hover {
  color: var(--brand);
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.level-card {
  position: relative;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease),
    border-color 0.2s ease;
}

.level-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.level-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.level-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--brand-weak);
  color: var(--brand);
  font-size: 17px;
}

.level-card h3 {
  margin: 14px 0 4px;
  font-size: 16px;
  font-weight: 600;
}

.level-card p {
  margin: 0;
  color: var(--ink-4);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.level-card .count {
  font-size: 13px;
  font-weight: 600;
}

.law-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.law-card {
  display: flex;
  flex-direction: column;
  min-height: 168px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease),
    border-color 0.2s ease;
}

.law-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.law-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.law-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.law-card .subtitle {
  margin: 0;
  color: var(--ink-4);
  font-size: 12px;
}

.law-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
  color: var(--ink-4);
  font-size: 11px;
}

.law-card-foot .date {
  font-variant-numeric: tabular-nums;
}

.law-card-foot .arrow {
  color: var(--ink-4);
  transition: transform 0.18s ease, color 0.18s ease;
}

.law-card:hover .arrow {
  color: var(--brand);
  transform: translateX(2px);
}

.region-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.region-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: all 0.18s ease;
}

.region-card:hover {
  border-color: var(--brand-weak-2);
  background: var(--brand-weak);
}

.region-name {
  font-size: 14px;
  font-weight: 550;
}

.region-count {
  color: var(--ink-4);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.home-cta {
  margin-top: 16px;
  color: var(--ink-4);
  font-size: 12px;
}

.notice-bar {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.7;
}

.notice-bar .icon {
  margin-top: 3px;
  color: var(--brand);
  font-size: 15px;
}

/* ==========================================================================
   AI section
   ========================================================================== */

.ai-section {
  position: relative;
  margin: 18px 0 8px;
  padding: 48px 48px 46px;
  overflow: hidden;
  border-radius: var(--radius-xl);
  color: #eef3ff;
  background:
    radial-gradient(700px 360px at 8% 0%, rgba(0, 98, 255, 0.32), transparent 66%),
    radial-gradient(600px 420px at 96% 100%, rgba(122, 82, 255, 0.26), transparent 64%),
    linear-gradient(135deg, #060d19 0%, #0a1a30 52%, #09182c 100%);
  box-shadow: 0 30px 80px rgba(6, 13, 25, 0.24);
  isolation: isolate;
}

.ai-section::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.5;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse at 75% 20%, #000 0%, transparent 68%);
  mask-image: radial-gradient(ellipse at 75% 20%, #000 0%, transparent 68%);
}

.ai-section::after {
  content: "";
  position: absolute;
  width: 320px;
  height: 320px;
  right: -90px;
  top: -140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(90, 140, 255, 0.28), transparent 68%);
  filter: blur(10px);
  pointer-events: none;
}

.ai-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 48px;
  align-items: start;
}

.ai-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  color: #b9c9e6;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.ai-eyebrow .icon {
  color: #85aaff;
  font-size: 14px;
}

.ai-title {
  margin: 20px 0 14px;
  font-size: clamp(30px, 3.6vw, 44px);
  line-height: 1.16;
  font-weight: 650;
  letter-spacing: -0.035em;
}

.ai-title .gradient {
  background: linear-gradient(100deg, #9dc0ff, #cfd9ff 45%, #c4b3ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ai-desc {
  max-width: 460px;
  margin: 0;
  color: #93a6c7;
  font-size: 14px;
  line-height: 1.85;
}

.ai-points {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  color: #aebfd9;
  font-size: 12.5px;
}

.ai-points li {
  display: flex;
  align-items: center;
  gap: 9px;
}

.ai-points .icon {
  color: #6fa1ff;
  font-size: 14px;
}

.ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.ai-btn-light {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border-radius: 9px;
  color: #0a1a30;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ai-btn-light:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
}

.ai-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  color: #cbd8ef;
  background: rgba(255, 255, 255, 0.05);
  font-size: 13px;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.ai-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.26);
}

.ai-panel {
  position: relative;
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.ai-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
}

.ai-tab {
  flex: 1 1 0;
  height: 32px;
  border-radius: 8px;
  color: #8fa4c5;
  font-size: 12px;
  transition: all 0.18s ease;
}

.ai-tab.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.ai-tab:hover {
  color: #fff;
}

.prompt-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.prompt-card {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.045);
  transition: border-color 0.18s ease, background 0.18s ease;
}

.prompt-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.065);
}

.prompt-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.prompt-title {
  margin: 0;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.prompt-desc {
  margin: 4px 0 0;
  color: #8fa4c5;
  font-size: 11.5px;
  line-height: 1.6;
}

.prompt-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  color: #eaf1ff;
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.prompt-copy:hover {
  background: rgba(255, 255, 255, 0.16);
}

.prompt-copy.copied {
  color: #9be7c0;
  border-color: rgba(120, 230, 170, 0.35);
  background: rgba(20, 120, 80, 0.22);
}

.prompt-code {
  position: relative;
  max-height: 76px;
  margin-top: 12px;
  overflow: hidden;
  color: #aabbe0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  -webkit-mask-image: linear-gradient(180deg, #000 62%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 62%, transparent 100%);
}

.prompt-note {
  margin-top: 12px;
  color: #7f92b2;
  font-size: 10.5px;
}

.ai-footer-note {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 16px;
  color: #7f92b2;
  font-size: 11px;
}

.ai-footer-note .icon {
  color: #5e8ee8;
}

/* ==========================================================================
   Law list / browse
   ========================================================================== */

.page-hero {
  padding: 44px 0 30px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(600px 280px at 12% 0%, rgba(0, 82, 217, 0.07), transparent 70%),
    var(--bg-soft);
}

.page-hero h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.page-hero p {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.8;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  color: var(--ink-4);
  font-size: 12px;
}

.breadcrumb a:hover {
  color: var(--brand);
}

.breadcrumb .sep {
  color: var(--line-strong);
}

.segmented {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.segmented button {
  height: 34px;
  padding: 0 15px;
  border-radius: 8px;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.18s ease;
}

.segmented button.active {
  color: var(--ink);
  background: var(--brand-weak);
  box-shadow: inset 0 0 0 1px var(--brand-weak-2);
  color: var(--brand);
}

.browse-toolbar {
  position: sticky;
  top: var(--header-h);
  z-index: 30;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.toolbar-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

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

.toolbar-label {
  flex: 0 0 auto;
  color: var(--ink-4);
  font-size: 12px;
}

.filter-select {
  height: 34px;
  padding: 0 30px 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-2);
  background: var(--surface);
  font-size: 13px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.result-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 0 14px;
  color: var(--ink-3);
  font-size: 13px;
}

.result-summary strong {
  color: var(--ink);
  font-size: 18px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.law-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.law-row {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.16s ease;
}

.law-row:last-child {
  border-bottom: 0;
}

.law-row:hover {
  background: var(--surface-2);
}

.law-row-main {
  min-width: 0;
  flex: 1 1 auto;
}

.law-row-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 7px;
}

.law-row-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.law-row-sub {
  margin: 3px 0 0;
  color: var(--ink-4);
  font-size: 12px;
}

.law-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 8px;
  color: var(--ink-4);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.law-row-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.law-row-meta .icon {
  font-size: 12px;
  color: var(--ink-4);
}

.law-row-side {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
  padding-top: 4px;
}

.law-row-articles {
  color: var(--ink-4);
  font-size: 11px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.law-row-articles strong {
  display: block;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
}

.law-row-arrow {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--ink-4);
  background: var(--surface-2);
  transition: all 0.18s ease;
}

.law-row:hover .law-row-arrow {
  color: #fff;
  background: var(--brand);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 26px;
}

.pager button,
.pager span {
  min-width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--ink-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.pager button:hover {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

.pager button.active {
  color: #fff;
  background: var(--brand);
}

.pager button[disabled] {
  opacity: 0.35;
  pointer-events: none;
}

.empty-state {
  padding: 56px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.empty-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 50%;
  color: var(--ink-4);
  background: var(--surface-2);
  font-size: 22px;
}

.empty-state h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 600;
}

.empty-state p {
  max-width: 420px;
  margin: 0 auto;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.75;
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: var(--line-soft);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s infinite;
}

html[data-theme="dark"] .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
}

.skeleton-row {
  height: 92px;
  margin-bottom: 10px;
  border-radius: 12px;
}

/* ==========================================================================
   Search page
   ========================================================================== */

.search-hero {
  padding: 40px 0 30px;
  background:
    radial-gradient(600px 260px at 50% 0%, rgba(0, 82, 217, 0.07), transparent 70%),
    var(--bg-soft);
  border-bottom: 1px solid var(--line);
}

.search-hero .search-shell {
  max-width: 820px;
  height: 56px;
}

.search-hero h1 {
  margin: 0 0 18px;
  font-size: clamp(24px, 3.4vw, 34px);
  font-weight: 650;
  letter-spacing: -0.03em;
}

.search-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.search-layout {
  padding: 28px 0 64px;
}

.search-result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.search-result-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.search-result-head .meta {
  color: var(--ink-4);
  font-size: 12px;
}

.related-laws {
  margin-bottom: 26px;
}

.related-laws h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 10px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 500;
}

.related-laws .icon {
  color: var(--brand);
  font-size: 13px;
}

.related-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.related-law-card {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: all 0.18s ease;
}

.related-law-card:hover {
  border-color: var(--brand-weak-2);
  background: var(--brand-weak);
}

.related-law-card .title {
  max-width: 300px;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-group {
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.result-group-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px 12px;
}

.result-group-head .law-badge {
  margin-top: 2px;
}

.result-group-title {
  min-width: 0;
  flex: 1 1 auto;
}

.result-group-title h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 600;
}

.result-group-title .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 5px;
  color: var(--ink-4);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.result-group-title .meta .status {
  height: 19px;
  padding: 0 6px;
  font-size: 10px;
}

.result-group-count {
  flex: 0 0 auto;
  color: var(--ink-4);
  font-size: 11px;
}

.hit-row {
  display: block;
  padding: 12px 20px 14px;
  border-top: 1px solid var(--line-soft);
  transition: background 0.16s ease;
}

.hit-row:hover {
  background: var(--surface-2);
}

.hit-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.hit-num {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 4px;
  color: var(--brand);
  background: var(--brand-weak);
  font-size: 11px;
  font-weight: 600;
}

.hit-heading {
  overflow: hidden;
  color: var(--ink-4);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hit-snippet {
  margin: 0;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.8;
  word-break: break-word;
}

.hit-snippet mark {
  padding: 0 1px;
  color: #9a4b00;
  background: #ffe9a8;
  border-radius: 2px;
}

html[data-theme="dark"] .hit-snippet mark {
  color: #ffe7a3;
  background: #5c4310;
}

.result-group-foot {
  padding: 9px 20px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
  color: var(--ink-4);
  font-size: 11px;
}

.result-group-foot a {
  color: var(--brand);
}

.search-tips {
  margin-top: 34px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.search-tips h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
}

.search-tips p {
  margin: 0;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.9;
}

.search-tips code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ==========================================================================
   Law reading page
   ========================================================================== */

body.page-law {
  background: var(--bg);
}

.law-hero {
  position: relative;
  padding: 48px 0 30px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(620px 300px at 12% 0%, rgba(0, 82, 217, 0.07), transparent 70%),
    var(--surface);
}

.law-hero-inner {
  max-width: 980px;
}

.law-head-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 13px;
}

.law-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.law-subtitle {
  margin: 10px 0 0;
  color: var(--ink-3);
  font-size: 15px;
  line-height: 1.7;
}

.law-meta-card {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  max-width: 980px;
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.law-meta-item {
  padding: 13px 16px;
  border-right: 1px solid var(--line-soft);
}

.law-meta-item:last-child {
  border-right: 0;
}

.law-meta-label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-4);
  font-size: 10.5px;
}

.law-meta-label .icon {
  font-size: 11px;
}

.law-meta-value {
  margin-top: 3px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.law-meta-value.muted {
  color: var(--ink-4);
  font-weight: 400;
}

.law-status-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 980px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--warning-weak);
  border-radius: var(--radius-sm);
  color: var(--warning);
  background: var(--warning-weak);
  font-size: 12px;
  line-height: 1.7;
}

.law-status-banner .icon {
  margin-top: 2px;
  font-size: 14px;
}

.law-status-banner a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.law-status-banner.repealed {
  color: var(--danger);
  border-color: var(--danger-weak);
  background: var(--danger-weak);
}

.reading-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.reading-bar-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 54px;
}

.reading-bar-title {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  color: var(--ink-3);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reading-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border-radius: 7px;
  color: var(--ink-3);
  font-size: 12px;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.reading-btn:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.reading-btn .icon {
  font-size: 14px;
}

.reading-btn.active {
  color: var(--brand);
  background: var(--brand-weak);
}

.reading-btn-primary {
  color: #fff;
  background: var(--brand);
}

.reading-btn-primary:hover {
  color: #fff;
  background: var(--brand-hover);
}

.reading-progress {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), #6b5ce7);
  transition: width 0.1s linear;
  pointer-events: none;
}

.law-layout {
  display: grid;
  grid-template-columns: 246px minmax(0, 760px);
  gap: 56px;
  align-items: start;
  padding: 34px 0 72px;
}

.law-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 74px);
  max-height: calc(100vh - var(--header-h) - 100px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-width: thin;
}

.law-sidebar::-webkit-scrollbar {
  width: 4px;
}

.law-sidebar::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background: var(--line-strong);
}

.toc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.toc-head h2 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toc-head .icon {
  color: var(--brand);
  font-size: 13px;
}

.toc-jump {
  color: var(--ink-4);
  font-size: 11px;
}

.toc-jump:hover {
  color: var(--brand);
}

.toc-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc-link {
  display: block;
  padding: 7px 9px;
  border-radius: 6px;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.55;
  transition: all 0.15s ease;
}

.toc-link:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.toc-link.active {
  color: var(--brand);
  background: var(--brand-weak);
  font-weight: 550;
}

.toc-link.lv1 {
  margin-top: 5px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
}

.toc-link.lv3 {
  padding-left: 19px;
  color: var(--ink-4);
  font-size: 11.5px;
}

.toc-index {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.toc-index-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
  color: var(--ink-4);
  font-size: 11px;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 3px;
}

.article-chip {
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: var(--ink-3);
  background: var(--surface-2);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  transition: all 0.15s ease;
}

.article-chip:hover {
  color: #fff;
  background: var(--brand);
}

.article-chip.current {
  color: var(--brand);
  background: var(--brand-weak);
}

.law-reading {
  min-width: 0;
}

.law-content {
  position: relative;
  padding: 38px 46px 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

html[data-theme="dark"] .law-content {
  box-shadow: none;
}

.law-body {
  color: var(--ink-2);
  font-family: var(--read-font);
  font-size: var(--read-size);
  line-height: 1.95;
  transition: font-size 0.15s ease;
}

.law-body p {
  margin: 0 0 1.05em;
  text-align: justify;
  text-justify: inter-ideograph;
  word-break: break-word;
}

.law-body p:last-child {
  margin-bottom: 0;
}

.intro-block {
  padding-bottom: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.chapter-title {
  margin: 36px 0 12px;
  padding-top: 8px;
  font-family: var(--font-serif);
  font-size: 1.32em;
  line-height: 1.45;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.chapter-title.lv1 {
  margin-top: 40px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ink);
  font-size: 1.55em;
}

.chapter-title.lv3 {
  margin-top: 28px;
  font-size: 1.16em;
  font-weight: 600;
  color: var(--ink-2);
}

.chapter-title:first-child {
  margin-top: 0;
}

.article {
  position: relative;
  padding: 15px 0 16px;
  scroll-margin-top: calc(var(--header-h) + 118px);
  transition: background 0.25s ease;
}

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

.article:hover {
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--brand) 3%, transparent));
}

.article.highlighted {
  background: #fff7d9;
}

html[data-theme="dark"] .article.highlighted {
  background: #3a2f10;
}

.article-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.article-num {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
  font-family: var(--font-ui);
  font-size: 0.82em;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.article-num::after {
  content: "";
  width: 18px;
  height: 1px;
  background: color-mix(in srgb, var(--brand) 35%, transparent);
}

.article-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.article:hover .article-actions,
.article-actions:focus-within {
  opacity: 1;
}

.article-action {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--ink-4);
  background: transparent;
  transition: all 0.15s ease;
}

.article-action:hover {
  color: var(--brand);
  background: var(--brand-weak);
}

.article-action .icon {
  font-size: 14px;
}

.article-body {
  padding-left: 0;
}

.article-body p {
  margin: 0 0 0.82em;
}

.article-body p:last-child {
  margin-bottom: 0;
}

.table-wrap {
  margin: 14px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table.law-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.78em;
  line-height: 1.7;
}

table.law-table th,
table.law-table td {
  padding: 8px 12px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

table.law-table th {
  color: var(--ink-3);
  background: var(--surface-2);
  font-weight: 600;
  white-space: nowrap;
}

table.law-table tr:last-child td {
  border-bottom: 0;
}

table.law-table td:last-child,
table.law-table th:last-child {
  border-right: 0;
}

.law-end {
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--ink-4);
  font-size: 11px;
  text-align: center;
}

.law-detail-foot {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  margin-top: 18px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.law-detail-foot strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.law-detail-foot p {
  margin: 3px 0 0;
  color: var(--ink-4);
  font-size: 11px;
}

.law-extra {
  margin-top: 26px;
}

.extra-card {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.extra-card h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
}

.extra-card h3 .icon {
  color: var(--brand);
  font-size: 14px;
}

.version-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border-radius: 7px;
  background: var(--surface-2);
  font-size: 12px;
}

.version-row.current {
  color: var(--brand);
  background: var(--brand-weak);
}

.version-row:hover {
  background: var(--brand-weak);
}

.version-row .version-date {
  font-variant-numeric: tabular-nums;
}

.history-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 4px;
}

.history-item {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 0 0 13px 18px;
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.65;
}

.history-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.history-item::after {
  content: "";
  position: absolute;
  left: 2.5px;
  top: 14px;
  bottom: -2px;
  width: 1px;
  background: var(--line);
}

.history-item:last-child::after {
  display: none;
}

.history-date {
  flex: 0 0 82px;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}

.citation-box {
  padding: 12px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--font-serif);
  font-size: 13px;
  line-height: 1.8;
}

.citation-box .cite-line {
  margin: 0;
}

.citation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.related-item {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: all 0.18s ease;
}

.related-item:hover {
  border-color: var(--brand-weak-2);
  background: var(--brand-weak);
}

.related-item .title {
  display: block;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.related-item .meta {
  margin-top: 3px;
  color: var(--ink-4);
  font-size: 10px;
}

/* In-law finder */

.inlaw-finder {
  position: fixed;
  top: calc(var(--header-h) + 62px);
  right: max(24px, calc((100vw - var(--container)) / 2 + 24px));
  z-index: 55;
  display: none;
  width: 340px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.inlaw-finder.show {
  display: block;
  animation: fadeDown 0.18s var(--ease);
}

.inlaw-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.inlaw-search .icon {
  color: var(--ink-4);
  font-size: 16px;
}

.inlaw-search input {
  flex: 1 1 auto;
  min-width: 0;
  height: 30px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
}

.inlaw-results {
  max-height: 320px;
  overflow-y: auto;
}

.inlaw-hit {
  display: block;
  width: 100%;
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}

.inlaw-hit:hover {
  background: var(--surface-2);
}

.inlaw-hit .num {
  color: var(--brand);
  font-size: 11px;
  font-weight: 600;
}

.inlaw-hit .snippet {
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.6;
}

.inlaw-empty {
  padding: 18px 12px;
  color: var(--ink-4);
  font-size: 12px;
  text-align: center;
}

/* ==========================================================================
   AI page / about
   ========================================================================== */

.ai-page-hero {
  position: relative;
  padding: 64px 0 50px;
  overflow: hidden;
  background:
    radial-gradient(700px 340px at 20% 0%, rgba(0, 82, 217, 0.1), transparent 70%),
    radial-gradient(600px 320px at 82% 0%, rgba(107, 92, 231, 0.09), transparent 72%),
    var(--bg-soft);
  border-bottom: 1px solid var(--line);
}

.ai-page-hero h1 {
  max-width: 780px;
  margin: 16px 0 14px;
  font-size: clamp(32px, 4.6vw, 52px);
  line-height: 1.15;
  font-weight: 660;
  letter-spacing: -0.035em;
}

.ai-page-hero p {
  max-width: 680px;
  margin: 0;
  color: var(--ink-3);
  font-size: 15px;
  line-height: 1.85;
}

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

.step-card {
  position: relative;
  padding: 22px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.step-num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--brand);
  background: var(--brand-weak);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.step-card h3 {
  margin: 12px 0 6px;
  font-size: 15px;
  font-weight: 600;
}

.step-card p {
  margin: 0;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.75;
}

.prompt-library {
  padding: 46px 0 20px;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.prompt-card-light {
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.prompt-card-light:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.prompt-card-light-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.prompt-cat {
  display: inline-flex;
  height: 20px;
  align-items: center;
  padding: 0 7px;
  border-radius: 4px;
  color: var(--ink-3);
  background: var(--surface-2);
  font-size: 10px;
}

.prompt-card-light h3 {
  margin: 7px 0 4px;
  font-size: 16px;
  font-weight: 600;
}

.prompt-card-light p {
  margin: 0;
  color: var(--ink-4);
  font-size: 11.5px;
  line-height: 1.65;
}

.prompt-preview-light {
  flex: 1 1 auto;
  max-height: 150px;
  margin: 14px 0;
  padding: 13px 14px;
  overflow: hidden;
  border-radius: 8px;
  color: var(--ink-2);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  -webkit-mask-image: linear-gradient(180deg, #000 76%, transparent);
  mask-image: linear-gradient(180deg, #000 76%, transparent);
}

.prompt-card-light-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.prompt-card-light .prompt-copy {
  color: var(--brand);
  background: var(--brand-weak);
  border-color: var(--brand-weak-2);
}

.prompt-card-light .prompt-copy:hover {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.prompt-card-light .prompt-copy.copied {
  color: var(--success);
  background: var(--success-weak);
  border-color: var(--success-weak);
}

.prompt-card-light-foot .hint {
  color: var(--ink-4);
  font-size: 10px;
}

.api-section {
  padding: 42px 0 70px;
}

.api-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 28px;
  align-items: start;
}

.api-card {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.api-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
}

.api-card h3 .icon {
  color: var(--brand);
  font-size: 17px;
}

.api-card > p {
  margin: 0 0 16px;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.7;
}

.endpoint {
  margin-bottom: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.endpoint-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.method {
  display: inline-flex;
  height: 18px;
  align-items: center;
  padding: 0 5px;
  border-radius: 3px;
  color: var(--success);
  background: var(--success-weak);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
}

.endpoint-path {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.endpoint-desc {
  color: var(--ink-4);
  font-size: 10.5px;
  line-height: 1.6;
}

.code-block {
  position: relative;
  margin-top: 12px;
  padding: 14px 16px;
  overflow-x: auto;
  border-radius: 8px;
  color: #c6d3e8;
  background: #0b1524;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.75;
  white-space: pre;
}

.code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 5px;
  color: #b9c9e6;
  background: rgba(255, 255, 255, 0.06);
  font-size: 10px;
}

.code-copy:hover {
  background: rgba(255, 255, 255, 0.12);
}

.api-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.api-list li {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.7;
}

.api-list li:last-child {
  border-bottom: 0;
}

.api-list .icon {
  margin-top: 3px;
  color: var(--success);
  font-size: 13px;
}

.prose-page {
  padding: 42px 0 80px;
}

.prose-card {
  padding: 32px 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.prose-card h2 {
  margin: 30px 0 10px;
  font-size: 19px;
  font-weight: 650;
}

.prose-card h2:first-child {
  margin-top: 0;
}

.prose-card p,
.prose-card li {
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.9;
}

.prose-card ul {
  padding-left: 20px;
  margin: 8px 0 0;
}

.prose-card a {
  color: var(--brand);
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 8px;
}

.about-stat {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.about-stat strong {
  display: block;
  font-size: 24px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.about-stat span {
  color: var(--ink-4);
  font-size: 11px;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  margin-top: 30px;
  padding: 42px 0 34px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 0.7fr));
  gap: 36px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.footer-desc {
  max-width: 380px;
  margin: 0;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.8;
}

.footer-col h4 {
  margin: 0 0 10px;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.footer-col a,
.footer-col button {
  display: block;
  padding: 3px 0;
  color: var(--ink-4);
  font-size: 12px;
  text-align: left;
}

.footer-col a:hover,
.footer-col button:hover {
  color: var(--brand);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-4);
  font-size: 11px;
}

.footer-disclaimer {
  max-width: 820px;
  margin-top: 12px;
  color: var(--ink-4);
  font-size: 10.5px;
  line-height: 1.8;
}

/* ==========================================================================
   Modal / sheet / toast
   ========================================================================== */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 18, 30, 0.5);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.overlay.show {
  display: flex;
  animation: fadeIn 0.18s ease;
}

.modal {
  width: 100%;
  max-width: 540px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.24s var(--ease);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 14px;
}

.modal-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.modal-head p {
  margin: 4px 0 0;
  color: var(--ink-4);
  font-size: 11.5px;
  line-height: 1.65;
}

.modal-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--ink-4);
}

.modal-close:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.modal-body {
  padding: 4px 24px 20px;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px 22px;
}

.field {
  margin-bottom: 16px;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
}

.field-label .required {
  color: var(--danger);
}

.field-hint {
  color: var(--ink-4);
  font-size: 10.5px;
  font-weight: 400;
}

.field-input,
.field-select,
.field-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field-input,
.field-select {
  height: 42px;
  padding: 0 12px;
}

.field-textarea {
  min-height: 112px;
  padding: 10px 12px;
  line-height: 1.75;
  resize: vertical;
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  outline: 0;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent);
}

.field-input::placeholder,
.field-textarea::placeholder {
  color: var(--ink-4);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.type-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-3);
  background: var(--surface);
  font-size: 12px;
  text-align: left;
  transition: all 0.18s ease;
}

.type-option:hover {
  border-color: var(--line-strong);
}

.type-option.active {
  color: var(--brand);
  border-color: var(--brand-weak-2);
  background: var(--brand-weak);
}

.type-option .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
}

.type-option.active .dot {
  background: var(--brand);
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.form-error {
  display: none;
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 7px;
  color: var(--danger);
  background: var(--danger-weak);
  font-size: 11.5px;
}

.form-error.show {
  display: block;
}

.feedback-success {
  padding: 20px 4px 8px;
  text-align: center;
}

.success-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 50%;
  color: var(--success);
  background: var(--success-weak);
  font-size: 26px;
}

.feedback-success h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 650;
}

.feedback-success p {
  margin: 0;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.7;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(30px + env(safe-area-inset-bottom));
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(90vw, 520px);
  padding: 11px 16px;
  border-radius: 10px;
  color: #fff;
  background: rgba(17, 24, 39, 0.94);
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  line-height: 1.5;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s var(--ease);
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.toast .icon {
  font-size: 15px;
  color: #8fe1b7;
}

.toast.error .icon {
  color: #ffb0a8;
}

.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  background: rgba(10, 18, 30, 0.45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.sheet-overlay.show {
  display: block;
  animation: fadeIn 0.18s ease;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 85;
  max-height: 86vh;
  display: none;
  flex-direction: column;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  box-shadow: 0 -10px 40px rgba(10, 18, 30, 0.18);
}

.sheet.show {
  display: flex;
  animation: sheetIn 0.26s var(--ease);
}

.sheet-handle {
  width: 38px;
  height: 4px;
  margin: 2px auto 12px;
  border-radius: 4px;
  background: var(--line-strong);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sheet-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  margin-bottom: 12px;
  border-radius: 9px;
  background: var(--surface-2);
}

.sheet-tab {
  flex: 1 1 0;
  height: 32px;
  border-radius: 7px;
  color: var(--ink-3);
  font-size: 12px;
}

.sheet-tab.active {
  color: var(--brand);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.settings-group {
  margin-bottom: 18px;
}

.settings-label {
  margin-bottom: 7px;
  color: var(--ink-4);
  font-size: 11px;
}

.settings-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.settings-option {
  min-width: 52px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-3);
  background: var(--surface);
  font-size: 12px;
}

.settings-option.active {
  color: var(--brand);
  border-color: var(--brand-weak-2);
  background: var(--brand-weak);
}

/* ==========================================================================
   Mobile nav & responsive
   ========================================================================== */

.mobile-nav {
  display: none;
}

@media (max-width: 1080px) {
  .level-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

  .law-layout {
    grid-template-columns: 216px minmax(0, 1fr);
    gap: 34px;
  }
}

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

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

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

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 26px;
  }

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

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

  .law-layout {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-top: 24px;
  }

  .law-sidebar {
    display: none;
  }

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

  .law-meta-item:nth-child(2) {
    border-right: 0;
  }

  .law-meta-item:nth-child(3),
  .law-meta-item:nth-child(4) {
    border-top: 1px solid var(--line-soft);
  }
}

@media (max-width: 820px) {
  :root {
    --header-h: 56px;
    --read-size: 17px;
  }

  body {
    padding-bottom: calc(66px + env(safe-area-inset-bottom));
  }

  body.page-law {
    padding-bottom: 18px;
  }

  .container,
  .container-narrow {
    padding: 0 16px;
  }

  .site-header {
    height: var(--header-h);
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    font-size: 17px;
    border-radius: 8px;
  }

  .brand-name {
    font-size: 17px;
  }

  .brand-sub {
    display: none;
  }

  .header-inner {
    gap: 12px;
  }

  .header-actions {
    gap: 2px;
  }

  .header-actions .header-search-btn {
    display: none;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    display: flex;
    align-items: stretch;
    height: calc(62px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
  }

  .mobile-nav-link {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--ink-4);
    font-size: 10px;
  }

  .mobile-nav-link .icon {
    font-size: 20px;
  }

  .mobile-nav-link.active {
    color: var(--brand);
  }

  .mobile-nav-link.active::before {
    content: "";
    position: absolute;
    top: 0;
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: var(--brand);
  }

  .mobile-nav-link {
    position: relative;
  }

  body.page-law .mobile-nav {
    display: none;
  }

  .hero {
    padding: 46px 0 36px;
  }

  .hero h1 {
    margin-top: 18px;
  }

  .hero-sub {
    font-size: 14.5px;
  }

  .hero-search {
    margin-top: 24px;
  }

  .search-shell {
    height: 54px;
    padding-left: 14px;
  }

  .search-input {
    font-size: 15px;
  }

  .search-submit {
    height: 40px;
    padding: 0 14px;
  }

  .search-kbd {
    display: none;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 0;
    margin-top: 30px;
    padding-top: 22px;
  }

  .stat {
    padding: 0 18px;
  }

  .stat:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }

  .stat-value {
    font-size: 21px;
  }

  .section {
    padding: 38px 0;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .section-title {
    font-size: 23px;
  }

  .level-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .level-card {
    padding: 14px;
  }

  .level-card h3 {
    font-size: 14px;
  }

  .law-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .law-card {
    min-height: auto;
    padding: 16px;
  }

  .region-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .region-card {
    height: 48px;
    padding: 0 13px;
  }

  .ai-section {
    margin: 8px 0;
    padding: 30px 20px 26px;
    border-radius: 20px;
  }

  .ai-title {
    font-size: 29px;
  }

  .ai-desc {
    font-size: 13px;
  }

  .ai-panel {
    padding: 12px;
  }

  .ai-actions {
    margin-top: 22px;
  }

  .ai-btn-light,
  .ai-btn-ghost {
    height: 38px;
    padding: 0 13px;
    font-size: 12px;
  }

  .prompt-code {
    max-height: 66px;
    font-size: 10px;
  }

  .page-hero {
    padding: 30px 0 24px;
  }

  .page-hero h1 {
    font-size: 28px;
  }

  .browse-toolbar {
    top: var(--header-h);
    padding: 9px 0;
  }

  .toolbar-row {
    gap: 8px;
  }

  .filter-select {
    height: 32px;
    font-size: 12px;
  }

  .segmented {
    width: 100%;
  }

  .segmented button {
    flex: 1 1 0;
    padding: 0 8px;
    font-size: 12px;
  }

  .result-summary {
    display: block;
    margin: 18px 0 12px;
  }

  .result-summary > span {
    display: block;
  }

  .result-summary > span + span {
    margin-top: 4px;
  }

  .law-row {
    padding: 15px 15px;
    gap: 10px;
  }

  .law-row-title {
    font-size: 15.5px;
  }

  .law-row-side {
    gap: 6px;
    padding-top: 2px;
  }

  .law-row-articles {
    display: none;
  }

  .law-row-arrow {
    width: 28px;
    height: 28px;
  }

  .law-row-meta {
    gap: 3px 10px;
  }

  .pager {
    flex-wrap: wrap;
  }

  .search-hero {
    padding: 30px 0 24px;
  }

  .search-hero h1 {
    font-size: 24px;
  }

  .search-hero .search-shell {
    height: 52px;
  }

  .search-filters {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .search-filters::-webkit-scrollbar {
    display: none;
  }

  .result-group-head {
    padding: 14px 15px 10px;
  }

  .result-group-title h3 {
    font-size: 15px;
  }

  .result-group-count {
    display: none;
  }

  .hit-row {
    padding: 11px 15px 13px;
  }

  .law-hero {
    padding: 30px 0 22px;
  }

  .law-title {
    font-size: 27px;
  }

  .law-subtitle {
    font-size: 13px;
  }

  .law-meta-card {
    margin-top: 18px;
  }

  .law-meta-item {
    padding: 11px 13px;
  }

  .law-meta-value {
    font-size: 12px;
  }

  .reading-bar-inner {
    height: 50px;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .reading-bar-inner::-webkit-scrollbar {
    display: none;
  }

  .reading-bar-title {
    display: none;
  }

  .reading-btn {
    height: 34px;
    padding: 0 9px;
    font-size: 11.5px;
  }

  .reading-btn .label {
    display: none;
  }

  .reading-btn-primary .label {
    display: inline;
  }

  .law-content {
    padding: 24px 19px 28px;
    border-radius: 12px;
  }

  .law-body {
    line-height: 1.92;
  }

  .chapter-title {
    margin-top: 28px;
    font-size: 1.26em;
  }

  .chapter-title.lv1 {
    margin-top: 30px;
    font-size: 1.45em;
  }

  .article {
    padding: 13px 0 14px;
  }

  .article-num {
    font-size: 0.78em;
  }

  .article-actions {
    opacity: 1;
  }

  .article-action {
    width: 30px;
    height: 30px;
  }

  .article:hover {
    background: transparent;
  }

  .article.highlighted {
    margin: 0 -10px;
    padding-left: 10px;
    padding-right: 10px;
    border-radius: 6px;
  }

  .inlaw-finder {
    position: fixed;
    left: 16px;
    right: 16px;
    top: auto;
    bottom: calc(14px + env(safe-area-inset-bottom));
    width: auto;
  }

  .law-detail-foot {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .ai-page-hero {
    padding: 40px 0 34px;
  }

  .ai-page-hero h1 {
    font-size: 31px;
  }

  .steps {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 24px;
  }

  .step-card {
    padding: 16px;
  }

  .prompt-library {
    padding-top: 34px;
  }

  .prompt-card-light {
    padding: 16px;
  }

  .api-section {
    padding: 30px 0 54px;
  }

  .api-card {
    padding: 18px;
  }

  .prose-page {
    padding: 28px 0 60px;
  }

  .prose-card {
    padding: 22px 19px;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .site-footer {
    padding: 30px 0 24px;
  }

  .footer-desc {
    max-width: none;
  }

  .overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    max-width: none;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

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

  .modal-body {
    padding: 4px 18px 16px;
  }

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

  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .type-grid {
    grid-template-columns: 1fr;
  }

  .toast {
    bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .hero-stats .stat {
    border-left: 1px solid var(--line-soft);
  }

  .hero-stats .stat:nth-child(odd) {
    border-left: 0;
  }
}

@media (max-width: 420px) {
  .hero h1 {
    font-size: 31px;
  }

  .law-title {
    font-size: 24px;
  }

  .stat-value {
    font-size: 19px;
  }

  .law-meta-card {
    grid-template-columns: 1fr 1fr;
  }

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

  .ai-tabs {
    overflow-x: auto;
  }

  .ai-tab {
    min-width: 58px;
    flex: 0 0 auto;
    padding: 0 9px;
  }
}

/* ==========================================================================
   Reading themes
   ========================================================================== */

html[data-reading="sepia"] .law-content,
html[data-reading="sepia"] .law-hero {
  background: #fbf6e9;
  border-color: #eadfc6;
  color: #342e24;
}

html[data-reading="sepia"] .law-body,
html[data-reading="sepia"] .article-body {
  color: #342e24;
}

html[data-reading="sepia"] .article-num {
  color: #8a5a00;
}

html[data-reading="sepia"] .article + .article {
  border-top-color: #ece2cd;
}

html[data-reading="sepia"] .chapter-title {
  color: #241f17;
}

html[data-reading="sepia"] .law-title {
  color: #241f17;
}

html[data-reading="sans"] .law-body {
  --read-font: var(--font-ui);
}

/* ==========================================================================
   Animation / print
   ========================================================================== */

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

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

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes sheetIn {
  from { transform: translateY(40px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.reveal {
  animation: fadeUp 0.55s var(--ease) both;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body {
    background: #fff;
    padding: 0;
  }

  .site-header,
  .mobile-nav,
  .reading-bar,
  .reading-progress,
  .law-sidebar,
  .law-hero .breadcrumb,
  .law-detail-foot,
  .law-extra,
  .site-footer,
  .toast,
  .overlay,
  .sheet,
  .inlaw-finder,
  .article-actions {
    display: none !important;
  }

  .law-hero {
    padding: 0 0 16px;
    border: 0;
    background: #fff;
  }

  .law-meta-card {
    border: 1px solid #ddd;
    background: #fff;
  }

  .law-layout {
    display: block;
    padding: 0;
  }

  .law-content {
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .law-body {
    color: #000;
    font-size: 12pt;
    line-height: 1.8;
  }

  .article {
    break-inside: avoid;
  }

  .chapter-title {
    break-after: avoid;
  }

  .article + .article {
    border-top-color: #ddd;
  }

  .law-title {
    font-size: 20pt;
  }
}
