:root {
  color-scheme: light;
  --bg: #f7f8f5;
  --surface: #ffffff;
  --ink: #18201d;
  --muted: #5f6863;
  --line: #dfe5df;
  --green: #236b4f;
  --green-dark: #174734;
  --blue: #2f5f95;
  --amber: #9a6515;
  --red: #a23b37;
  --shadow: 0 18px 50px rgba(27, 39, 32, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(18px, 5vw, 64px);
  background: rgba(247, 248, 245, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 0.85rem;
  letter-spacing: 0;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

.nav-links a,
.inline-actions a {
  text-decoration: none;
}

.nav-links a:hover,
.inline-actions a:hover,
.source-list a:hover {
  color: var(--green);
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.language-switch button {
  min-width: 34px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 760;
  text-align: center;
}

.language-switch button.active {
  background: var(--surface);
  color: var(--ink);
}

main {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: clamp(28px, 6vw, 72px);
  align-items: center;
  min-height: calc(100vh - 76px);
  padding: 64px 0 44px;
}

.hero-copy {
  max-width: 680px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 18px;
  font-size: clamp(2.35rem, 6vw, 5.1rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(1.75rem, 3.5vw, 2.55rem);
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.lead {
  max-width: 620px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.hero-actions,
.button-row,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.button,
.icon-button {
  appearance: none;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover,
.icon-button:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
  transform: translateY(-1px);
}

.button.secondary {
  background: #fff;
  color: var(--green-dark);
}

.button.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.state-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.state-tile {
  min-height: 122px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf8;
  color: var(--blue);
  font-size: 2.1rem;
  font-weight: 900;
  letter-spacing: 0;
}

.state-tile span {
  display: block;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.state-tile.active {
  background: #eef7f2;
  border-color: #b9d9c8;
  color: var(--green);
}

.state-tile.warning {
  color: var(--amber);
}

.notice,
.address-source-section,
.generator-shell,
.saved-section,
.state-section,
.tips-section,
.sources-section {
  margin: 0 0 28px;
  padding: clamp(22px, 4vw, 36px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.notice {
  border-left: 6px solid var(--red);
}

.notice p:last-child,
.section-header p:last-child,
.tip-item p:last-child {
  margin-bottom: 0;
}

.section-header {
  max-width: 760px;
  margin-bottom: 24px;
}

.section-header p {
  color: var(--muted);
}

.data-stats {
  display: block;
  max-width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid #cfe2d7;
  border-radius: 8px;
  background: #f5fbf7;
  color: var(--green-dark);
  font-weight: 700;
}

.generator-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 20px;
  align-items: start;
}

.generator-form {
  display: grid;
  gap: 14px;
}

.test-panel,
.form-title {
  border: 1px solid #cfe2d7;
  border-radius: 8px;
  background: #f5fbf7;
}

.test-panel {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
  padding: 18px;
}

.test-panel p:last-child,
.form-title h3 {
  margin-bottom: 0;
}

.form-title {
  padding: 14px;
}

.form-row {
  display: grid;
  gap: 7px;
}

label {
  color: var(--ink);
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 10px 12px;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(47, 95, 149, 0.22);
  outline-offset: 2px;
}

.result-panel {
  border: 1px solid #c9d7cd;
  border-radius: 8px;
  background: #f8fbf9;
  overflow: hidden;
}

.result-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 18px 18px 10px;
}

.result-topline h3 {
  margin-bottom: 0;
}

.icon-button {
  min-height: 38px;
  padding: 8px 12px;
}

.icon-button.secondary {
  background: #fff;
  color: var(--green-dark);
}

.result-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

pre {
  min-height: 284px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  border-top: 1px solid #dbe8df;
  background: #102018;
  color: #ecfff5;
  font: 0.94rem/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
}

.mini-note {
  margin: 0;
  padding: 12px 18px 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.state-grid,
.tips-grid,
.source-card-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.tips-grid,
.source-card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.state-card,
.tip-item,
.source-card,
.format-note {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.state-card strong {
  display: block;
  font-size: 1.45rem;
  color: var(--green);
}

.state-card p,
.tip-item p,
.source-card p,
.format-note p,
.source-list {
  color: var(--muted);
}

.state-card button {
  width: 100%;
  margin-top: 10px;
}

.inline-actions a {
  color: var(--blue);
  font-weight: 800;
}

.source-card a,
.format-note a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.source-card a:hover,
.format-note a:hover {
  color: var(--green);
}

.format-note {
  margin-top: 12px;
  background: #f7faf9;
}

.saved-actions {
  margin-bottom: 14px;
}

.saved-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.saved-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #fff;
}

.saved-table th,
.saved-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.saved-table th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.saved-table tr:last-child td {
  border-bottom: 0;
}

.saved-table button {
  min-height: 34px;
  padding: 6px 10px;
}

.source-list {
  margin: 0;
  padding-left: 20px;
}

.source-list li + li {
  margin-top: 8px;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  width: min(1180px, calc(100% - 36px));
  margin: 36px auto 0;
  padding: 22px 0 36px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .site-header,
  .hero,
  .generator-layout,
  .test-panel,
  .state-grid,
  .tips-grid,
  .source-card-grid {
    grid-template-columns: 1fr;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero {
    min-height: auto;
    padding-top: 38px;
  }

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

@media (max-width: 560px) {
  main,
  .footer {
    width: min(100% - 24px, 1180px);
  }

  .state-board,
  .state-grid {
    grid-template-columns: 1fr;
  }

  .button,
  .button-row .button {
    width: 100%;
  }
}
