:root {
  color-scheme: light dark;
  --canvas: #f4f5f1;
  --surface: #ffffff;
  --surface-muted: #e9ece4;
  --ink: #14211e;
  --muted: #56635d;
  --line: #ccd4ce;
  --accent: #0a7658;
  --accent-strong: #075a43;
  --accent-pale: #d9eee6;
  --focus: #135eaf;
  --radius: 14px;
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--canvas); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-size: 16px;
  line-height: 1.5;
}

button, input, textarea { font: inherit; }

.skip-link { position: absolute; top: -4rem; left: 1rem; z-index: 10; padding: .65rem 1rem; color: #fff; background: var(--accent-strong); border-radius: 8px; }
.skip-link:focus { top: 1rem; }

.site-header, footer, .workspace { max-width: 1360px; margin-inline: auto; padding-inline: clamp(1.25rem, 4vw, 4rem); }

.site-header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--ink); font-size: .88rem; font-weight: 760; letter-spacing: .08em; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; color: #fff; background: var(--accent); border-radius: 8px; font-size: .9rem; letter-spacing: 0; }
.header-status, .api-state { display: inline-flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .82rem; }
.header-status span, .api-state span:first-child { width: .55rem; height: .55rem; border-radius: 50%; background: #c07b15; }

.workspace { padding-block: clamp(3rem, 7vw, 6.5rem) 4rem; }
.intro { max-width: 760px; margin-bottom: clamp(2.5rem, 5vw, 4.5rem); }
.overline { margin: 0 0 .8rem; color: var(--accent-strong); font-size: .75rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 14ch; margin-bottom: 1.25rem; font-size: clamp(2.4rem, 6vw, 5.5rem); line-height: .98; letter-spacing: -.045em; }
h2 { margin-bottom: .55rem; font-size: clamp(1.25rem, 2vw, 1.6rem); letter-spacing: -.025em; }
.intro-copy { max-width: 58ch; margin-bottom: 0; color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.15rem); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 370px); gap: clamp(2rem, 5vw, 6rem); align-items: start; }
.check-form { padding: clamp(1.25rem, 3vw, 2.5rem); background: var(--surface); border-radius: var(--radius); box-shadow: 0 18px 44px rgb(20 33 30 / .08); }
.form-heading { margin-bottom: 2.25rem; }
.form-heading p, .panel-note p, .field-hint, .form-actions p { color: var(--muted); }
.form-heading p { margin-bottom: 0; max-width: 54ch; }
.field-label, legend { display: block; margin-bottom: .55rem; font-weight: 690; font-size: .92rem; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
input[type="text"], input[type="search"], textarea { width: 100%; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; outline: none; }
input[type="text"], input[type="search"] { min-height: 46px; padding: .65rem .8rem; }
textarea { min-height: 260px; padding: .85rem; resize: vertical; line-height: 1.55; }
input:focus, textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 17%, transparent); }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-top: 1.6rem; }
.field-row .field-label { margin-bottom: .55rem; }
.count { color: var(--accent-strong); font-size: .83rem; font-variant-numeric: tabular-nums; }
.field-hint { margin: .5rem 0 0; font-size: .82rem; }

.settings-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 2.25rem; margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.region-results { display: grid; max-height: 185px; margin-top: .5rem; overflow: auto; background: var(--surface-muted); border-radius: 9px; }
.region-option { display: flex; align-items: flex-start; gap: .55rem; padding: .7rem .8rem; cursor: pointer; font-size: .86rem; }
.region-option + .region-option { border-top: 1px solid var(--line); }
.region-option small { display: block; color: var(--muted); }
.choice { display: flex; gap: .55rem; align-items: center; margin-bottom: .6rem; cursor: pointer; font-size: .9rem; }
.choice input, .region-option input { accent-color: var(--accent); }

.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
button { min-height: 46px; padding: .7rem 1rem; color: #fff; background: var(--accent); border: 0; border-radius: 9px; font-weight: 700; cursor: pointer; transition: transform .18s ease, background .18s ease; }
button:hover:not(:disabled) { background: var(--accent-strong); }
button:active:not(:disabled) { transform: translateY(1px); }
button:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent); outline-offset: 2px; }
button:disabled { color: #6e7d75; background: #d8dfda; cursor: not-allowed; }
.form-actions p { max-width: 32ch; margin: 0; font-size: .82rem; text-align: right; }

.side-panel { padding-top: .45rem; }
.panel-note { padding-bottom: 2rem; border-bottom: 1px solid var(--line); }
.panel-note p:last-child { margin-bottom: 0; }
.flow-list { display: grid; gap: 1.5rem; margin: 0; padding: 2rem 0; list-style: none; counter-reset: steps; }
.flow-list li { position: relative; padding-left: 2.7rem; counter-increment: steps; }
.flow-list li::before { content: counter(steps); position: absolute; left: 0; top: -.1rem; display: grid; place-items: center; width: 1.75rem; height: 1.75rem; color: var(--accent-strong); background: var(--accent-pale); border-radius: 50%; font-size: .78rem; font-weight: 750; }
.flow-list strong, .flow-list span { display: block; }
.flow-list span { color: var(--muted); font-size: .88rem; }
.api-state { padding: .85rem .9rem; color: #775314; background: #fbf1d8; border-radius: 9px; }

footer { display: flex; justify-content: space-between; gap: 1rem; padding-block: 1.5rem; color: var(--muted); border-top: 1px solid var(--line); font-size: .78rem; }

@media (max-width: 820px) {
  .site-header { min-height: 64px; }
  .header-status { display: none; }
  .workspace { padding-top: 3.3rem; }
  .layout, .settings-grid { grid-template-columns: 1fr; }
  .side-panel { padding: 0 1rem; }
}

@media (max-width: 520px) {
  h1 { max-width: 11ch; }
  .check-form { padding: 1.15rem; }
  .form-actions { display: grid; }
  .form-actions button { width: 100%; }
  .form-actions p { max-width: none; text-align: left; }
  footer { display: grid; }
}

@media (prefers-color-scheme: dark) {
  :root { --canvas: #111917; --surface: #17231f; --surface-muted: #20302a; --ink: #e7f0eb; --muted: #acbbb3; --line: #34463e; --accent: #46ae89; --accent-strong: #7dd1ae; --accent-pale: #173f32; --focus: #7dbaf5; }
  .check-form { box-shadow: 0 18px 44px rgb(0 0 0 / .2); }
  .brand-mark, button { color: #07130e; }
  .api-state { color: #f5d391; background: #3c321d; }
  button:disabled { color: #9aa9a1; background: #31423a; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
