:root {
  color-scheme: light;
  --bg: #f7f6f2;
  --surface: #fff;
  --surface-soft: #f1f0eb;
  --surface-tint: #eaf1ed;
  --ink: #20221f;
  --muted: #6b6e68;
  --subtle: #92958f;
  --line: #dedfd9;
  --line-strong: #c9ccc5;
  --green: #234d40;
  --green-hover: #193d32;
  --green-soft: #e5efea;
  --logo-accent: #007cba;
  --action-bg: #234d40;
  --action-hover: #193d32;
  --hover: #e9e9e4;
  --floating-surface: rgba(255,255,255,.9);
  --backdrop: rgba(20,22,20,.3);
  --on-solid: #fff;
  --amber-soft: #f7eedc;
  --red: #9a3838;
  --red-soft: #fbefed;
  --shadow-sm: 0 1px 2px rgba(26, 31, 27, .05), 0 8px 24px rgba(26, 31, 27, .05);
  --shadow-md: 0 18px 48px rgba(26, 31, 27, .11);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --control: 44px;
  --sidebar: 260px;
  --sidebar-collapsed: 72px;
  --content: 820px;
  --page-content: 720px;
  --page-gutter: clamp(16px, 4vw, 32px);
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-logo: "Avenir Next", Avenir, var(--font-sans);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171a18;
  --surface: #202421;
  --surface-soft: #2a2f2b;
  --surface-tint: #25332d;
  --ink: #f0f1ed;
  --muted: #b5bab4;
  --subtle: #919890;
  --line: #363c37;
  --line-strong: #4a524b;
  --green: #6fa58f;
  --green-hover: #82b8a1;
  --green-soft: #263b32;
  --action-bg: #376f5c;
  --action-hover: #43836c;
  --hover: #303531;
  --floating-surface: rgba(32,36,33,.92);
  --backdrop: rgba(0,0,0,.5);
  --on-solid: #fff;
  --amber-soft: #413621;
  --red: #ed9292;
  --red-soft: #462a29;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.22), 0 8px 24px rgba(0,0,0,.18);
  --shadow-md: 0 18px 48px rgba(0,0,0,.38);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { color: var(--ink); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
img, svg, video { max-width: 100%; }
button, input, textarea { font: inherit; }
button, a { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(35, 77, 64, .25);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body { min-height: 100vh; min-height: 100svh; margin: 0; background: var(--bg); font-size: 16px; line-height: 1.5; overflow-x: clip; }
main { width: min(var(--page-content), calc(100% - (2 * var(--page-gutter)))); margin: 0 auto; padding: clamp(64px, 10vh, 92px) 0 max(48px, env(safe-area-inset-bottom)); }
.breadcrumbs { min-width: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; padding-right: min(300px, 34vw); color: var(--muted); font-size: 14px; }
a.wordmark { flex: none; color: var(--ink); font-family: var(--font-logo); font-size: 23px; letter-spacing: -.055em; text-decoration: none; }
a.wordmark .ai { color: var(--logo-accent); font-weight: 700; }
.breadcrumb-separator { color: var(--subtle); }
.page-heading { margin: clamp(42px, 8vw, 64px) 0 24px; }
.page-heading h1 { margin: 0 0 8px; font-family: var(--font-serif); font-size: clamp(36px, 7vw, 54px); font-weight: 500; line-height: 1.05; letter-spacing: -.04em; overflow-wrap: anywhere; }
.eyebrow { margin: 0 0 7px; color: var(--green); font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.muted { color: var(--muted); }
.card { min-height: 92px; padding: clamp(18px, 4vw, 24px); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); overflow-wrap: anywhere; }
.card p { margin: 0 0 10px; }
.card p:last-child { margin-bottom: 0; }
.err { color: var(--red); }
a { color: var(--green); }

@media (max-width: 640px) {
  main { width: min(100% - 24px, var(--page-content)); padding-top: max(68px, calc(env(safe-area-inset-top) + 56px)); }
  .breadcrumbs { padding-right: 48px; }
  .page-heading { margin-top: 40px; }
}

@media (max-height: 620px) and (orientation: landscape) {
  main { padding-top: 56px; }
  .page-heading { margin-top: 28px; }
}

.card { min-height: 120px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { padding: 0; font-family: var(--font-serif); font-size: 24px; font-weight: 500; letter-spacing: -.025em; }
fieldset > .muted { margin-top: 5px; }
.mode-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 20px; }
.mode-options label { min-width: 0; display: flex; align-items: flex-start; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); cursor: pointer; }
.mode-options label:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.mode-options input { flex: none; margin: 3px 0 0; accent-color: var(--green); }
.mode-options span { min-width: 0; display: grid; gap: 2px; }
.mode-options strong { font-size: 14px; }
.mode-options small { color: var(--muted); font-size: 12px; line-height: 1.35; }

@media (max-width: 560px) {
  .mode-options { grid-template-columns: 1fr; }
}
