:root {
  color-scheme: light;
  --canvas: #f3f6f5;
  --surface: #ffffff;
  --ink: #17211f;
  --muted: #65716d;
  --line: #d5dfdc;
  --brand: #176c58;
  --brand-dark: #0d4d3d;
  --accent: #d76843;
  --warning: #f4c95d;
  --soft: #e8f2ee;
  --danger: #b33f32;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: 0;
}
button, input { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--brand-dark); text-underline-offset: 3px; }
[hidden] { display: none !important; }

.topbar { border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.96); }
.topbar-inner {
  width: min(1120px, calc(100% - 40px));
  min-height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.wordmark { color: var(--ink); font-weight: 780; text-decoration: none; }
.network-status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.network-status span { width: 8px; height: 8px; border-radius: 50%; background: #2f9b70; }

.tool-shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 40px; }
.tool-heading { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 24px; border-bottom: 2px solid var(--ink); padding-bottom: 24px; }
.tool-heading .eyebrow { grid-column: 1 / -1; margin-bottom: -14px; }
.tool-heading h1 { margin: 0; font-size: 42px; line-height: 1.16; }
.tool-heading > p:last-child { margin: 0 0 4px; color: var(--muted); }
.eyebrow { margin: 0; color: var(--brand); font-size: 12px; font-weight: 800; text-transform: uppercase; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr); gap: 20px; padding-top: 24px; }
.form-panel, .result-panel { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 28px; }
.panel-heading { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 28px; }
.panel-heading h2 { margin: 0; font-size: 20px; line-height: 1.3; }
.panel-heading p:not(.step) { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.step { min-width: 32px; margin: 1px 0 0; color: var(--accent); font-size: 13px; font-weight: 800; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field > span, .mode-fieldset legend { color: #34413d; font-size: 13px; font-weight: 700; }
.field b, .mode-fieldset b { color: var(--accent); }
.field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #bfcac7;
  border-radius: 6px;
  background: #fbfcfc;
  color: var(--ink);
  padding: 9px 12px;
  outline: none;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23, 108, 88, 0.12); }
.field input::placeholder { color: #98a29f; }
.mode-fieldset { margin: 24px 0 0; padding: 0; border: 0; }
.mode-fieldset legend { margin-bottom: 8px; }
.fieldset-help { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.local-storage-choice {
  min-height: 62px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #bfcac7;
  border-radius: 6px;
  cursor: pointer;
}
.local-storage-choice input,
.privacy-disclosure-item > label input { width: 17px; height: 17px; margin: 0; accent-color: var(--brand); }
.local-storage-choice strong,
.local-storage-choice small,
.privacy-disclosure-item strong,
.privacy-disclosure-item small { display: block; }
.local-storage-choice strong,
.privacy-disclosure-item strong { font-size: 13px; }
.local-storage-choice small,
.privacy-disclosure-item small { margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.privacy-disclosure-list { overflow: hidden; border: 1px solid #bfcac7; border-radius: 6px; }
.privacy-disclosure-item + .privacy-disclosure-item { border-top: 1px solid var(--line); }
.privacy-disclosure-item > label {
  min-height: 58px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
}
.privacy-purpose-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 12px 12px 40px; }
.privacy-purpose-list > span { color: var(--muted); font-size: 11px; }
.privacy-purpose-list label { position: relative; }
.privacy-purpose-list input { position: absolute; opacity: 0; pointer-events: none; }
.privacy-purpose-list b {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid #bfcac7;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
}
.privacy-purpose-list input:checked + b { color: var(--brand-dark); background: var(--soft); border-color: var(--brand); }
.privacy-purpose-list input:focus-visible + b { box-shadow: 0 0 0 3px rgba(23, 108, 88, 0.16); }
.segmented-control { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid #bfcac7; border-radius: 7px; overflow: hidden; }
.segmented-control-four { grid-template-columns: repeat(4, 1fr); }
.segmented-control label { min-width: 0; }
.segmented-control label + label { border-left: 1px solid #bfcac7; }
.segmented-control input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-control span { min-height: 42px; display: flex; align-items: center; justify-content: center; padding: 8px; color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; }
.segmented-control input:checked + span { background: var(--brand); color: #fff; }
.segmented-control input:focus-visible + span { box-shadow: inset 0 0 0 3px var(--warning); }

.form-actions { display: flex; gap: 10px; margin-top: 26px; }
.button, .copy-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 16px;
  font-weight: 760;
  cursor: pointer;
  text-decoration: none;
}
.button-primary { background: var(--ink); color: #fff; }
.button-primary:hover { background: var(--brand-dark); }
.button-secondary { border-color: #bfcac7; background: #fff; color: var(--ink); }
.button-secondary:hover, .copy-button:hover { border-color: var(--brand); color: var(--brand-dark); }
.full-width { width: 100%; margin-top: 22px; }
.form-status { min-height: 24px; margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.form-status[data-state="success"] { color: var(--brand-dark); }
.form-status[data-state="error"] { color: var(--danger); }

.empty-state { min-height: 282px; display: grid; place-content: center; justify-items: center; color: var(--muted); }
.document-mark { width: 72px; height: 88px; display: grid; place-items: center; border: 2px solid var(--line); border-top: 10px solid var(--warning); color: var(--brand); font-family: Georgia, serif; font-size: 34px; font-weight: 700; }
.empty-state p { margin: 16px 0 0; font-size: 14px; }
.result-list { border-top: 1px solid var(--line); }
.result-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--line); }
.result-row strong { display: block; margin-bottom: 5px; font-size: 14px; }
.result-row a { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.copy-button { min-height: 36px; border-color: #bfcac7; background: #fff; color: var(--ink); padding: 6px 12px; font-size: 13px; }
.privacy-note { max-width: 860px; margin: 18px 0 0; color: var(--muted); font-size: 12px; }

.document-nav { display: flex; gap: 20px; font-size: 13px; }
.document-nav a { text-decoration: none; }
.document-nav [aria-current="page"] { color: var(--muted); }
.document-hero, .document-body, .document-error { width: min(860px, calc(100% - 40px)); margin: 0 auto; }
.document-hero { padding: 72px 0 46px; }
.document-hero h1, .document-error h1 { margin: 10px 0 0; font-size: 46px; line-height: 1.2; }
.document-lead { max-width: 700px; margin: 18px 0 0; color: var(--muted); font-size: 18px; }
.document-meta { margin: 22px 0 0; color: var(--muted); font-size: 13px; }
.mode-note { margin-top: 30px; padding: 18px 20px; border-left: 4px solid var(--accent); background: var(--surface); }
.mode-note strong { display: block; margin-bottom: 4px; }
.document-body { padding-bottom: 80px; }
.document-body section { border-top: 1px solid var(--line); padding-top: 4px; }
.document-body h2 { margin: 42px 0 10px; font-size: 25px; line-height: 1.3; }
.document-body h3 { margin: 28px 0 8px; font-size: 18px; line-height: 1.35; }
.document-body p, .document-body li { color: #35423e; }
.document-body ul { padding-left: 22px; }
.language-divider { margin-top: 64px; padding-top: 34px; border-top: 2px solid var(--ink); }
.language-divider.is-primary-language { margin-top: 0; padding-top: 72px; border-top: 0; }
.language-divider.is-primary-language h2 { margin: 10px 0 0; font-size: 46px; line-height: 1.2; }
.english-lead { max-width: 700px; margin: 18px 0 0; color: var(--muted); font-size: 18px; }
.english-meta { margin: 22px 0 0; color: var(--muted); font-size: 13px; }
.contact-link { font-weight: 750; }
.document-error { min-height: calc(100vh - 65px); padding: 80px 0; }
.document-error > p:not(.eyebrow) { color: var(--muted); }
.document-error .button { display: inline-flex; margin-top: 18px; }

@media (max-width: 820px) {
  .workspace { grid-template-columns: 1fr; }
  .result-panel { min-height: 360px; }
}

@media (max-width: 600px) {
  .topbar-inner, .tool-shell { width: min(100% - 28px, 1120px); }
  .topbar-inner { min-height: 58px; }
  .tool-shell { padding-top: 38px; }
  .tool-heading { grid-template-columns: 1fr; gap: 7px; }
  .tool-heading .eyebrow { margin-bottom: 4px; }
  .tool-heading h1 { font-size: 34px; }
  .form-panel, .result-panel { padding: 22px 18px; }
  .field-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .segmented-control span { min-height: 48px; padding: 6px; font-size: 12px; }
  .segmented-control-four { grid-template-columns: repeat(2, 1fr); }
  .segmented-control-four label:nth-child(3) { border-left: 0; border-top: 1px solid #bfcac7; }
  .segmented-control-four label:nth-child(4) { border-top: 1px solid #bfcac7; }
  .document-hero, .document-body, .document-error { width: min(100% - 32px, 860px); }
  .document-hero { padding-top: 48px; }
  .document-hero h1, .document-error h1 { font-size: 35px; }
  .language-divider.is-primary-language { padding-top: 48px; }
  .language-divider.is-primary-language h2 { font-size: 35px; }
  .document-lead { font-size: 16px; }
  .english-lead { font-size: 16px; }
}
