:root {
  --color-dark: #121531;
  --color-paper: #E8E9EA;
  --color-text: #151723;
  --color-brand: #142CEB;
  --color-accent: #ED7D6E;
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", sans-serif;
  --line-height-body: 1.75;
  --line-height-heading: 1.25;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  background: var(--color-paper);
  color: var(--color-text);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
}

.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }

/* Context Overrides */
.bg-dark { background: var(--color-dark); color: var(--color-paper); }
.bg-dark .hl, .bg-dark .badge { color: var(--color-accent); }
.bg-dark a:not(.btn) { color: var(--color-paper); text-decoration-color: var(--color-accent); }
.bg-dark .card { background: var(--color-paper); color: var(--color-text); border-color: var(--color-text); }
.bg-dark .table-wrapper { background: var(--color-paper); border-radius: var(--radius-card); padding: var(--gap); }
.bg-dark table { color: var(--color-text); }
.bg-dark th, .bg-dark td { border-bottom-color: var(--color-text); }

/* Typography */
h1, h2, h3, h4 { font-weight: 600; line-height: var(--line-height-heading); letter-spacing: 0; margin-top: 0; margin-bottom: 0.5rem; }
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: var(--gap); }
h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }
p { max-width: 38em; margin-bottom: 1rem; }
.hl { color: var(--color-brand); }
.badge { display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; margin-bottom: 0.75rem; color: var(--color-brand); }

/* Layout */
section { padding-top: var(--section-y); padding-bottom: var(--section-y); border-bottom: 1px solid var(--color-text); }
section:last-of-type { border-bottom: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--gap); }
.flex-row { display: flex; gap: var(--gap); align-items: center; }
.flex-row.reverse { flex-direction: row-reverse; }
@media (max-width: 768px) {
  .grid-2, .flex-row, .flex-row.reverse { grid-template-columns: 1fr; flex-direction: column; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.75rem; height: 52px; border-radius: var(--radius-btn);
  font-weight: 600; font-size: 1rem; text-decoration: none; cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease; border: 2px solid transparent;
}
.btn-primary { background: var(--color-accent); color: var(--color-dark); }
.btn-primary:hover { transform: translateY(-2px); filter: brightness(0.95); }
.btn-secondary { background: transparent; color: var(--color-text); border-color: var(--color-text); }
.bg-dark .btn-secondary { color: var(--color-paper); border-color: var(--color-paper); }
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }

/* Cards */
.card {
  background: var(--color-paper); border: var(--card-border); border-radius: var(--radius-card);
  box-shadow: var(--card-shadow); padding: var(--gap); position: relative;
}
.card-meta { font-size: 0.85rem; color: var(--color-text); opacity: 0.8; margin-top: 0.75rem; }

/* Table */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin: var(--gap) 0; }
th, td { text-align: left; padding: 0.85rem 1rem; border-bottom: 1px solid var(--color-text); }
th { font-weight: 600; white-space: nowrap; }
td { white-space: nowrap; }

/* FAQ / Details */
details {
  border: var(--card-border); border-radius: var(--radius-card); padding: 1rem var(--gap);
  margin-bottom: var(--gap); background: var(--color-paper); transition: background 0.2s;
}
details[open] { background: var(--color-paper); }
summary {
  cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.25rem; font-weight: 400; }
details[open] summary::after { content: "−"; }
details p { margin-top: 0.75rem; margin-bottom: 0; }

/* Header & Footer */
header { position: sticky; top: 0; z-index: 100; background: var(--color-paper); border-bottom: 1px solid var(--color-text); padding: 0.75rem 0; }
.nav-inner { display: flex; justify-content: space-between; align-items: center; }
nav a { margin-left: 1.5rem; text-decoration: none; color: var(--color-text); font-weight: 500; }
nav a[aria-current="page"] { color: var(--color-brand); font-weight: 700; }
footer { background: var(--color-dark); color: var(--color-paper); padding: var(--section-y) 0; margin-top: var(--section-y); }
.footer-inner { display: flex; flex-direction: column; gap: var(--gap); align-items: center; text-align: center; }
.footer-links a { color: var(--color-paper); margin: 0 0.75rem; text-decoration: underline; }

/* SVG Base */
svg { width: 100%; height: auto; display: block; }
svg .panel-bg { fill: var(--color-paper); stroke: var(--color-text); stroke-width: 1.5; }
svg .panel-accent { fill: var(--color-accent); }
svg .line-draw { stroke: var(--color-text); stroke-width: 1.5; fill: none; pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
svg .dot { fill: var(--color-brand); }
svg .bubble { fill: var(--color-paper); stroke: var(--color-text); stroke-width: 1.5; }

/* Animations */
@keyframes draw-line { 0% { stroke-dashoffset: 1; } 100% { stroke-dashoffset: 0; } }
.anim-draw { animation: draw-line 6s linear infinite alternate; }

@keyframes float-up { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.anim-float { animation: float-up 5s ease-in-out infinite; }

@keyframes pulse-opacity { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
.anim-pulse { animation: pulse-opacity 4s ease-in-out infinite; }

@keyframes flow-dot { 0% { transform: translateX(0); } 100% { transform: translateX(40px); } }
.anim-flow { animation: flow-dot 4s ease-in-out infinite alternate; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
