:root {
  color-scheme: dark;
  --bg: #07131f;
  --surface: #0d1b2a;
  --surface-2: #13283b;
  --text: #f8fafc;
  --muted: #b8c7d5;
  --border: #294157;
  --accent: #2dd4bf;
  --accent-2: #38bdf8;
  --danger: #f87171;
  --success: #34d399;
  --shadow: 0 18px 45px rgba(0, 0, 0, .25);
  --footer-bg: var(--surface);
  --footer-text: var(--muted);
  --footer-heading: var(--text);
  --footer-link: var(--accent-2);
  --footer-border: var(--border);
  --theme-toggle-bg: var(--surface);
  --theme-toggle-text: var(--text);
  --theme-toggle-border: var(--border);
  --theme-toggle-shadow: none;
  --button-bg: var(--surface);
  --button-text: var(--text);
  --button-border: var(--border);
  --button-hover-bg: var(--surface-2);
  --button-hover-border: var(--accent-2);
  --button-shadow: none;
  --primary-button-bg: var(--accent);
  --primary-button-text: #06201d;
  --primary-button-border: color-mix(in srgb, var(--accent) 70%, #000);
  --primary-button-hover-bg: color-mix(in srgb, var(--accent) 88%, #ffffff);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f7faf9;
  --surface: #ffffff;
  --surface-2: #edf7f6;
  --text: #152331;
  --muted: #526575;
  --border: #cfe0df;
  --accent: #0f766e;
  --accent-2: #0369a1;
  --danger: #b91c1c;
  --success: #047857;
  --shadow: 0 16px 38px rgba(15, 35, 52, .1);
  --footer-bg: var(--surface);
  --footer-text: var(--muted);
  --footer-heading: var(--text);
  --footer-link: var(--accent-2);
  --footer-border: var(--border);
  --theme-toggle-bg: #152331;
  --theme-toggle-text: #ffffff;
  --theme-toggle-border: #152331;
  --theme-toggle-shadow: 0 8px 20px rgba(21, 35, 49, .22);
  --button-bg: #f4fbfb;
  --button-text: #123247;
  --button-border: #9bc7d2;
  --button-hover-bg: #e7f7f7;
  --button-hover-border: #0f8f87;
  --button-shadow: 0 8px 18px rgba(15, 118, 110, .08);
  --primary-button-bg: #0f8f87;
  --primary-button-text: #ffffff;
  --primary-button-border: #087168;
  --primary-button-hover-bg: #0b7d76;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent-2) 75%, #ffffff);
  outline-offset: 3px;
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  padding: .75rem 1rem;
  background: var(--accent);
  color: #06201d;
  border-radius: .5rem;
  font-weight: 700;
}
.skip-link:focus { top: 1rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
}
.header-inner, .container {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}
.header-inner {
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  color: var(--text);
  font-weight: 800;
  min-width: max-content;
}
.brand img { width: 176px; color: var(--text); }
.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}
.site-nav a {
  color: var(--muted);
  padding: .45rem .7rem;
  border-radius: .5rem;
  font-weight: 650;
}
.site-nav a:hover, .site-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}
.theme-toggle {
  border: 1px solid var(--theme-toggle-border);
  background: var(--theme-toggle-bg);
  color: var(--theme-toggle-text);
  border-radius: .5rem;
  padding: 8px;
  font-weight: 800;
  font-size: 1.15rem;
  cursor: pointer;
  min-width: 42px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--theme-toggle-shadow);
}

main { min-height: 70vh; }
.hero {
  padding: clamp(3rem, 8vw, 6.5rem) 0 2rem;
}
.eyebrow, .badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 999px;
  padding: .35rem .7rem;
  font-size: .9rem;
  font-weight: 750;
}
.hero h1, .page-title {
  max-width: 930px;
  margin: 1rem 0;
  font-size: clamp(2.35rem, 5vw, 4.8rem);
  line-height: 1.03;
  letter-spacing: 0;
}
.hero p, .lead {
  max-width: 760px;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
}
.hero-actions, .button-row {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1.5rem;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 44px;
  border-radius: .55rem;
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  color: var(--button-text);
  padding: .7rem 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--button-shadow);
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.button.primary {
  background: var(--primary-button-bg);
  color: var(--primary-button-text);
  border-color: var(--primary-button-border);
}
.button.support-button {
  background: #ffd84d;
  color: #111827;
  border-color: #f2c230;
  box-shadow: 0 10px 24px rgba(255, 216, 77, .16);
}
.button.support-button:hover {
  background: #ffe36d;
  color: #111827;
}
.button:hover {
  background: var(--button-hover-bg);
  border-color: var(--button-hover-border);
  color: var(--button-text);
  text-decoration: none;
  transform: translateY(-1px);
}
.button.primary:hover {
  background: var(--primary-button-hover-bg);
  color: var(--primary-button-text);
  border-color: var(--primary-button-border);
}
.button.danger { color: var(--danger); }

.prose a,
.notice a,
details a,
.footer-bottom a,
.panel a,
.section > p a {
  text-decoration: underline;
  text-decoration-thickness: .08em;
  text-underline-offset: .18em;
  font-weight: 750;
}

.section {
  padding: 2.5rem 0;
  scroll-margin-top: 96px;
}
.section h2 { margin: 0 0 1rem; font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.15; }
.section-intro { max-width: 760px; color: var(--muted); margin-top: -.35rem; }
.section > h2:not(:first-child),
.section > .notice + h2,
.section > .grid + h2,
.section > p + h2 {
  margin-top: 2rem;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}
.card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: .5rem;
  padding: 1.1rem;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 .45rem; line-height: 1.2; }
.card p { color: var(--muted); margin: 0; }
.tool-card {
  display: flex;
  flex-direction: column;
  min-height: 190px;
}
.tool-card .button { margin-top: auto; align-self: flex-start; }
.article-card {
  min-height: 220px;
}
.article-card .tag-list {
  margin: .8rem 0;
}
.notice {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-left: 4px solid var(--accent);
  border-radius: .5rem;
  padding: 1rem;
}
.notice.warning { border-left-color: var(--danger); }

.trust-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1.25rem;
}

.tool-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}
.panel {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: .5rem;
  padding: 1rem;
}
label { display: block; font-weight: 800; margin-bottom: .45rem; }
textarea, input, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: .5rem;
  background: var(--bg);
  color: var(--text);
  padding: .85rem;
  font: inherit;
}
textarea {
  min-height: 320px;
  resize: vertical;
  line-height: 1.55;
}
input, select { min-height: 44px; }
.count-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: .92rem;
  margin-top: .5rem;
}
.options {
  display: flex;
  flex-wrap: wrap;
  gap: .85rem;
  margin-top: .85rem;
}
.option {
  display: inline-flex;
  gap: .45rem;
  align-items: center;
  color: var(--muted);
  font-weight: 700;
}
.option input { width: auto; min-height: auto; }

details {
  border: 1px solid var(--border);
  border-radius: .5rem;
  background: var(--surface);
  padding: .85rem 1rem;
}
details + details { margin-top: .7rem; }
summary { cursor: pointer; font-weight: 800; }
details p { color: var(--muted); margin-bottom: 0; }

.results-list {
  display: grid;
  gap: .75rem;
  margin-top: 1rem;
}
.result-item {
  border: 1px solid var(--border);
  border-radius: .5rem;
  padding: .9rem;
  background: var(--surface);
}
.result-item strong { display: block; font-size: 1.05rem; }
.review-output {
  min-height: 320px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--border);
  border-radius: .5rem;
  background: var(--bg);
  color: var(--text);
  padding: .85rem;
}
.review-output mark {
  background: color-mix(in srgb, var(--danger) 24%, transparent);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--danger) 65%, transparent);
  border-radius: .25rem;
  padding: .05rem .2rem;
}
.print-sheet {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: .5rem;
  padding: 1rem;
  min-height: 320px;
  white-space: pre-wrap;
}
.prose {
  max-width: 860px;
}
.prose h2 {
  margin-top: 2rem;
}
.prose p, .prose li {
  color: var(--muted);
}
.prose ul {
  padding-left: 1.25rem;
}
.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.tag {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .2rem .55rem;
  color: var(--muted);
  font-size: .85rem;
}

.support-band,
.support-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1rem;
  align-items: center;
}
.support-panel {
  align-items: stretch;
}
.support-copy,
.support-qr {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: .5rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  box-shadow: var(--shadow);
}
.support-copy h2,
.support-qr h2 {
  margin-top: 0;
}
.support-copy p,
.support-qr p {
  color: var(--muted);
}
.support-qr {
  text-align: center;
}
.support-qr img {
  width: min(180px, 100%);
  background: #fff;
  border-radius: .65rem;
  padding: .35rem;
  aspect-ratio: 1 / 1;
}
.qr-card { text-align: center; }
.qr-card img {
  width: 160px;
  background: #fff;
  border-radius: .5rem;
  aspect-ratio: 1 / 1;
}

.site-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  background: var(--footer-bg);
  color: var(--footer-text);
}
.footer-inner {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 2.8rem 0 1.5rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.45fr .8fr .8fr 1.2fr;
  gap: clamp(1.5rem, 4vw, 4rem);
}
.footer-grid h2 {
  color: var(--footer-heading);
  margin: 0 0 .75rem;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1.05;
}
.footer-grid h3 { color: var(--footer-heading); margin: 0 0 .55rem; }
.footer-grid p { max-width: 260px; margin: 0; color: var(--footer-text); }
.footer-grid a {
  display: block;
  margin: .55rem 0;
  color: var(--footer-link);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: .08em;
  text-underline-offset: .2em;
}
.footer-bottom {
  border-top: 1px solid var(--footer-border);
  margin-top: 2.2rem;
  padding-top: 1.1rem;
  font-size: .95rem;
  color: var(--footer-text);
}

@media (max-width: 800px) {
  .header-inner { align-items: flex-start; flex-direction: column; padding: .85rem 0; }
  .site-nav { margin-left: 0; width: 100%; }
  .theme-toggle { width: 100%; justify-content: center; }
  .tool-shell, .support-band, .support-panel, .footer-grid { grid-template-columns: 1fr; }
  textarea { min-height: 240px; }
}

@media print {
  .site-header,
  .site-footer,
  .skip-link,
  .button-row,
  .options,
  .no-print {
    display: none !important;
  }
  body {
    background: #fff;
    color: #111827;
  }
  .container {
    width: 100%;
  }
  .panel,
  .card,
  .notice,
  .print-sheet {
    box-shadow: none;
    border-color: #d1d5db;
    background: #fff;
    color: #111827;
  }
  textarea,
  input,
  select {
    border-color: #d1d5db;
    background: #fff;
    color: #111827;
  }
}
