:root {
  color-scheme: light;
  --topbar-offset: 4.6rem;
  --bg: #f5f7f4;
  --panel: #ffffff;
  --panel-strong: #eef5ee;
  --ink: #17201b;
  --muted: #637068;
  --line: #dce4dd;
  --green: #1f7a4c;
  --green-dark: #155b38;
  --red: #b73535;
  --amber: #a76b14;
  --blue: #2369a7;
  --shadow: 0 12px 36px rgba(23, 32, 27, 0.08);
  --max-w: 960px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--topbar-offset);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

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

button,
input,
textarea {
  font: inherit;
}

svg {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

/* ── Top Bar ── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1.5rem;
  background: rgba(245, 247, 244, 0.92);
  border-bottom: 1px solid rgba(220, 228, 221, 0.8);
  backdrop-filter: blur(14px);
}

.brand,
.topnav,
.hero-actions,
.button,
.progress-label,
.risk-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 0.5rem;
  min-width: max-content;
  font-weight: 800;
  font-size: 0.95rem;
}

.brand-mark {
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  place-items: center;
  color: #ffffff;
  background: var(--green);
  border-radius: 0.45rem;
}

.brand-mark svg {
  width: 0.9rem;
  height: 0.9rem;
}

.topnav {
  gap: 0.15rem;
  overflow-x: auto;
  white-space: nowrap;
}

.topnav a {
  min-height: 2rem;
  padding: 0.3rem 0.6rem;
  border-radius: 0.4rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.topnav a:hover {
  background: #e8eee9;
  color: var(--ink);
}

.topnav a.active {
  color: var(--green-dark);
  background: #e2efe7;
  font-weight: 900;
}

/* ── Main Container ── */

main {
  width: min(var(--max-w), calc(100% - 2rem));
  margin: 0 auto;
}

/* ── Hero ── */

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2.5rem;
  align-items: center;
  padding: 3.5rem 0 2rem;
}

.hero-copy {
  max-width: 38rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.6rem;
  font-size: 2.8rem;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

h2 {
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  line-height: 1.3;
}

h3 {
  margin-bottom: 0.25rem;
  font-size: 1rem;
  line-height: 1.4;
}

.hero-subtitle {
  max-width: 30rem;
  color: #405149;
  font-size: 1.08rem;
  line-height: 1.7;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.2rem;
}

.button {
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 0.45rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 800;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

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

.button.primary {
  color: #ffffff;
  background: var(--green);
  box-shadow: 0 8px 20px rgba(31, 122, 76, 0.16);
}

.button.primary:hover {
  background: var(--green-dark);
}

.button.secondary,
.button.ghost {
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line);
}

.button.ghost {
  box-shadow: none;
}

.trust-note {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.status-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
  padding: 1.2rem 1.3rem;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.92),
    rgba(238, 245, 238, 0.96)
  );
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
  max-width: 22rem;
}

.status-panel h2 {
  font-size: 1.05rem;
}

.status-panel p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.status-ring {
  display: grid;
  width: 4rem;
  height: 4rem;
  place-items: center;
  color: var(--green-dark);
  background: conic-gradient(var(--green) 0 72%, #d8e5dc 72% 100%);
  border-radius: 999px;
}

.status-ring span {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  background: #ffffff;
  border-radius: 999px;
  font-size: 1.5rem;
  font-weight: 900;
}

/* ── Section Base ── */

.section {
  scroll-margin-top: var(--topbar-offset);
  padding: 2.5rem 0;
  border-top: 1px solid var(--line);
}

.section-heading {
  max-width: 36rem;
  margin-bottom: 1.5rem;
}

.section-heading p:not(.eyebrow) {
  color: var(--muted);
  font-size: 0.92rem;
}

/* ── Stage Cards ── */

.stage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.stage-card {
  display: grid;
  gap: 0.5rem;
  align-content: start;
  padding: 1.1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.stage-card h3 {
  font-size: 1rem;
}

.stage-card p,
.stage-card li {
  color: var(--muted);
  font-size: 0.9rem;
}

.stage-card p {
  margin: 0;
}

.stage-card ul {
  margin: 0;
  display: grid;
  gap: 0.3rem;
  padding-left: 1.1rem;
}

.stage-before {
  border-top: 3px solid var(--green);
}

.stage-during {
  border-top: 3px solid var(--blue);
}

.stage-after {
  border-top: 3px solid var(--amber);
}

.stage-tag {
  width: max-content;
  padding: 0.2rem 0.5rem;
  color: var(--green-dark);
  background: #e7f2eb;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.text-link {
  width: max-content;
  margin-top: auto;
  color: var(--green-dark);
  font-size: 0.88rem;
  font-weight: 800;
}

.text-link:hover {
  text-decoration: underline;
}

/* ── Checklist ── */

.checklist-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.check-card {
  position: relative;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.check-card:hover {
  border-color: #c0d4c6;
}

.check-card input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.check-card label {
  display: grid;
  grid-template-rows: auto auto 1fr;
  cursor: pointer;
}

.check-icon {
  display: grid;
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.6rem;
  place-items: center;
  color: var(--green);
  background: var(--panel-strong);
  border-radius: 0.4rem;
}

.check-card strong {
  font-size: 0.95rem;
}

.check-card p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.check-card input:checked + label {
  color: var(--green-dark);
}

.check-card input:checked + label .check-icon {
  color: #ffffff;
  background: var(--green);
}

.progress-wrap {
  margin-top: 0.75rem;
  padding: 0.8rem 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.progress-label {
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
  font-weight: 800;
}

.text-button {
  padding: 0;
  color: var(--green-dark);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 800;
}

.progress-track {
  height: 0.5rem;
  overflow: hidden;
  background: #e6ece7;
  border-radius: 999px;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--blue));
  border-radius: inherit;
  transition: width 0.25s ease;
}

/* ── Risk Detection ── */

.two-column {
  display: grid;
  grid-template-columns: minmax(12rem, 0.6fr) minmax(0, 1.4fr);
  gap: 1.5rem;
  align-items: start;
}

.sticky-heading {
  position: sticky;
  top: calc(var(--topbar-offset) + 0.5rem);
}

.tool-panel,
.share-tool {
  padding: 1.2rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
}

.field-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
  font-weight: 800;
}

textarea,
input[type="search"] {
  width: 100%;
  padding: 0.7rem;
  color: var(--ink);
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  outline: none;
  font-size: 0.92rem;
}

textarea:focus,
input[type="search"]:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 76, 0.12);
}

.risk-actions {
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.risk-result {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  font-size: 0.9rem;
}

.risk-result.low {
  background: #eef7f1;
  border-color: #cfe4d6;
}

.risk-result.medium {
  background: #fff6e8;
  border-color: #f0d4a6;
}

.risk-result.high {
  background: #fff0f0;
  border-color: #e8b9b9;
}

.risk-level {
  margin-bottom: 0.3rem;
  font-weight: 900;
  font-size: 0.95rem;
}

.risk-result p,
.risk-result ul {
  margin-bottom: 0;
  font-size: 0.88rem;
}

.risk-result ul {
  padding-left: 1.1rem;
}

/* ── Official Links ── */

.official-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.national-links,
.province-list,
.copy-stack {
  display: grid;
  gap: 0.6rem;
}

.link-card,
.copy-card {
  display: grid;
  gap: 0.15rem;
  padding: 0.85rem 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  font-size: 0.9rem;
  transition: border-color 0.15s ease;
}

.link-card:hover {
  border-color: #afc8b7;
}

.link-card.accent {
  background: var(--panel-strong);
  border-color: #c9dccf;
}

.link-card span,
.copy-card h3 {
  font-weight: 800;
  font-size: 0.92rem;
}

.link-card small,
.copy-card p {
  color: var(--muted);
  font-size: 0.82rem;
}

.province-tool {
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.45rem;
}

.province-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0.6rem;
  max-height: 26rem;
  overflow: auto;
  padding-right: 0.2rem;
}

/* ── Copy Cards ── */

.copy-stack {
  gap: 0.5rem;
}

.copy-group {
  margin-bottom: 0.6rem;
}

.copy-group-label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.copy-card {
  grid-template-columns: 1fr auto;
  align-items: start;
}

.copy-card p {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.6;
}

.copy-card button {
  min-width: 4.8rem;
  font-size: 0.82rem;
}

/* ── Share Card ── */

.share-card-preview {
  display: grid;
  align-content: end;
  min-height: 20rem;
  padding: 1.3rem;
  color: #ffffff;
  background: linear-gradient(
    160deg,
    rgba(15, 66, 44, 0.96),
    rgba(32, 105, 72, 0.9)
  ),
  #1f7a4c;
  border-radius: 0.5rem;
}

.share-card-preview p {
  margin-bottom: 0.5rem;
  font-weight: 800;
  font-size: 0.92rem;
}

.share-card-preview h3 {
  max-width: 26rem;
  margin-bottom: 0.6rem;
  font-size: 1.6rem;
  line-height: 1.35;
}

.share-card-preview span {
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.88rem;
}

.share-tool .button {
  width: 100%;
  margin-top: 0.75rem;
}

/* ── Footer ── */

.footer {
  padding: 1.5rem 1.5rem;
  color: #435149;
  background: #e9eee9;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
}

.footer p {
  max-width: var(--max-w);
  margin: 0 auto 0.3rem;
}

.footer-small {
  color: var(--muted);
  font-size: 0.82rem;
}

/* ── Toast ── */

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  max-width: min(18rem, calc(100% - 2rem));
  padding: 0.6rem 0.8rem;
  color: #ffffff;
  background: #17201b;
  border-radius: 0.4rem;
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  opacity: 0;
  transform: translateY(0.4rem);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ── Responsive ── */

@media (max-width: 920px) {
  .hero {
    grid-template-columns: 1fr;
    padding: 2rem 0 1rem;
  }

  .status-panel {
    max-width: none;
  }

  .stage-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .stage-card {
    padding: 0.9rem;
  }

  .two-column,
  .official-layout {
    grid-template-columns: 1fr;
  }

  .sticky-heading {
    position: static;
  }

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

@media (max-width: 640px) {
  :root {
    --topbar-offset: 7.5rem;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 0.5rem 1rem;
  }

  .topnav {
    width: 100%;
    justify-content: flex-start;
  }

  .topnav a {
    padding-inline: 0.4rem;
  }

  h1 {
    font-size: 2.2rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .hero {
    padding-top: 1.2rem;
  }

  .hero-actions .button,
  .risk-actions .button {
    width: 100%;
  }

  .checklist-grid,
  .province-list {
    grid-template-columns: 1fr;
  }

  .copy-card {
    grid-template-columns: 1fr auto;
  }

  .share-card-preview h3 {
    font-size: 1.3rem;
  }
}
