*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-alt: #f5f0e8;
  --text: #2c2416;
  --text-secondary: #5c5240;
  --text-muted: #8a7e6b;
  --accent: #b85c38;
  --accent-hover: #9a4a2a;
  --accent-light: #f0d9cc;
  --border: #d9cebc;
  --border-light: #e8dfd0;
  --shadow: 0 2px 8px rgba(44, 36, 22, 0.08);
  --radius: 8px;
  --radius-sm: 4px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  --max-width: 1100px;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.main-nav { display: flex; gap: 1.25rem; }
.main-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.15s;
}
.main-nav a:hover, .main-nav a:focus { color: var(--accent); }

main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  width: 100%;
}

.intro { margin-bottom: 2rem; }
.intro-content { max-width: 700px; }
h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.intro-lead {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 650;
  margin-bottom: 1rem;
  color: var(--text);
}

.workspace {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.preset-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}
.preset-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-right: 0.25rem;
}
.preset-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.preset-btn:hover, .preset-btn:focus { background: var(--accent-light); border-color: var(--accent); }
.preset-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.control-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.control-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}
.label-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-sm);
}
.control-card input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 6px;
}
.control-card select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  background: var(--surface);
  color: var(--text);
}
.control-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.actions-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.action-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.25rem;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.action-btn:hover, .action-btn:focus { background: var(--accent-hover); }
.action-btn.secondary {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
}
.action-btn.secondary:hover, .action-btn.secondary:focus { background: var(--border-light); }

.results { margin-bottom: 2rem; }
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.results-count { color: var(--text-muted); font-size: 0.9rem; }

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 600px;
}
.results-table th {
  background: var(--surface-alt);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 650;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  cursor: default;
}
.results-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.results-table th.sortable:hover { background: var(--accent-light); }
.sort-arrow { font-size: 0.7rem; color: var(--text-muted); }
.results-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.results-table tbody tr:hover { background: #fdfaf5; }
.match-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-sm);
  font-weight: 650;
  font-size: 0.8rem;
  font-family: var(--font-mono);
}
.match-high { background: #d4edda; color: #2d5a27; }
.match-mid { background: #fff3cd; color: #6d5200; }
.match-low { background: #f8d7da; color: #6b1c1c; }

.no-results {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-style: italic;
}

.reference { margin-bottom: 2rem; }
.reference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}
.ref-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.ref-card h3 {
  font-size: 1rem;
  font-weight: 650;
  margin-bottom: 0.5rem;
  color: var(--accent);
}
.ref-card p { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.5; }

.scenarios { margin-bottom: 2rem; }
.scenario-list { display: flex; flex-direction: column; gap: 1rem; }
.scenario-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.scenario-item h3 { font-size: 1rem; font-weight: 650; margin-bottom: 0.35rem; }
.scenario-item p { font-size: 0.9rem; color: var(--text-secondary); }

.troubleshooting { margin-bottom: 2rem; }
.trouble-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.trouble-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.trouble-list li strong { color: var(--text); }

.about-blurb {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
}
.about-blurb h2 { margin-bottom: 0.75rem; }
.about-blurb p { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 0.75rem; }
.about-blurb p:last-child { margin-bottom: 0; }

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.25rem;
  margin-top: auto;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.footer-links { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.footer-links a, .footer-ecosystem a { color: var(--accent); text-decoration: none; }
.footer-links a:hover, .footer-ecosystem a:hover { text-decoration: underline; }
.footer-disclaimer { font-size: 0.8rem; color: var(--text-muted); }

@media (max-width: 600px) {
  h1 { font-size: 1.5rem; }
  .intro-lead { font-size: 1rem; }
  .controls-grid { grid-template-columns: 1fr; }
  .reference-grid { grid-template-columns: 1fr; }
  .header-inner { flex-direction: column; align-items: flex-start; }
  .workspace { padding: 1rem; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
