/* ===== CSS Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #1a1a1f;
  --bg-card: #23232b;
  --bg-elevated: #2c2c36;
  --text: #e8e6e3;
  --text-muted: #9a9894;
  --text-dim: #6b6966;
  --accent: #d4952a;
  --accent-light: #e8b04a;
  --accent-dark: #a87420;
  --good: #4caf50;
  --bad: #e57373;
  --border: #3a3a45;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  --max-width: 960px;
  --transition: 0.2s ease;
}

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

a { color: var(--accent-light); text-decoration: none; transition: color var(--transition); }
a:hover, a:focus { color: var(--accent); text-decoration: underline; }

img, svg { max-width: 100%; height: auto; }

.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 1.25rem; }

.skip-link {
  position: absolute; top: -100%; left: 1rem; z-index: 100;
  background: var(--accent); color: #000; padding: 0.5rem 1rem;
  border-radius: 0 0 var(--radius) var(--radius); font-weight: 600;
}
.skip-link:focus { top: 0; }

.hidden { display: none !important; }

/* ===== Header ===== */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 0.75rem; padding-bottom: 0.75rem;
}
.logo {
  display: flex; align-items: center; gap: 0.5rem;
  color: var(--text); font-weight: 700; font-size: 1.15rem;
}
.logo:hover, .logo:focus { text-decoration: none; color: var(--accent); }
.logo-accent { color: var(--accent); }

.main-nav { display: flex; gap: 1.5rem; }
.main-nav a {
  color: var(--text-muted); font-size: 0.9rem; font-weight: 500;
  padding: 0.25rem 0;
}
.main-nav a:hover, .main-nav a:focus { color: var(--text); text-decoration: none; }

.nav-toggle {
  display: none; flex-direction: column; gap: 4px;
  background: none; border: none; cursor: pointer; padding: 0.25rem;
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 1px; }

.mobile-nav {
  display: none; flex-direction: column; gap: 0.5rem;
  padding: 0.75rem 1.25rem; background: var(--bg-elevated);
  border-top: 1px solid var(--border);
}
.mobile-nav a { color: var(--text-muted); font-size: 0.95rem; padding: 0.25rem 0; }
.mobile-nav a:hover { color: var(--text); }
.mobile-nav[hidden] { display: none; }
.mobile-nav.open { display: flex; }

/* ===== Hero ===== */
.hero {
  padding: 4rem 0 3rem;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg) 100%);
}
.hero h1 {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 800; line-height: 1.15;
  margin-bottom: 1rem;
}
.hero-sub {
  font-size: 1.1rem; color: var(--text-muted);
  max-width: 560px; margin: 0 auto 1.5rem;
}
.hero-note { font-size: 0.85rem; color: var(--text-dim); margin-top: 0.75rem; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.6rem 1.25rem; border-radius: var(--radius);
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  border: 2px solid transparent; transition: all var(--transition);
  text-decoration: none; line-height: 1.3;
}
.btn:hover, .btn:focus { text-decoration: none; }
.btn-primary { background: var(--accent); color: #000; border-color: var(--accent); }
.btn-primary:hover, .btn-primary:focus { background: var(--accent-light); border-color: var(--accent-light); }
.btn-secondary { background: var(--bg-elevated); color: var(--text); border-color: var(--border); }
.btn-secondary:hover, .btn-secondary:focus { background: var(--border); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover, .btn-ghost:focus { color: var(--text); border-color: var(--text-muted); }
.btn-lg { padding: 0.8rem 1.75rem; font-size: 1.05rem; }

/* ===== Sections ===== */
section { padding: 3rem 0; }
section:nth-child(even) { background: var(--bg-card); }

.section-intro {
  color: var(--text-muted); max-width: 640px;
  margin-bottom: 1.5rem; font-size: 1rem;
}

h2 {
  font-size: 1.6rem; font-weight: 700; margin-bottom: 0.5rem;
}
h3 { font-size: 1.15rem; font-weight: 600; margin-bottom: 0.5rem; }

/* ===== Presets ===== */
.presets {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin-bottom: 2rem;
}
.preset-btn {
  padding: 0.5rem 1rem; border-radius: 20px;
  background: var(--bg-elevated); color: var(--text);
  border: 1px solid var(--border); cursor: pointer;
  font-size: 0.85rem; font-weight: 500;
  transition: all var(--transition);
}
.preset-btn:hover, .preset-btn:focus {
  background: var(--accent); color: #000; border-color: var(--accent);
}
.preset-btn.active {
  background: var(--accent); color: #000; border-color: var(--accent);
}

/* ===== Form ===== */
.matcher-form fieldset {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.25rem; margin-bottom: 1.5rem;
}
.matcher-form legend {
  font-weight: 600; font-size: 1rem; padding: 0 0.5rem;
}

.checkbox-grid, .radio-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem; margin-top: 0.75rem;
}

.checkbox-card, .radio-card {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 0.75rem; border-radius: var(--radius);
  background: var(--bg-elevated); border: 1px solid var(--border);
  cursor: pointer; transition: all var(--transition);
  font-size: 0.9rem;
}
.checkbox-card:hover, .radio-card:hover { border-color: var(--accent); }
.checkbox-card input, .radio-card input {
  accent-color: var(--accent); width: 16px; height: 16px;
}
.checkbox-card:has(input:checked), .radio-card:has(input:checked) {
  border-color: var(--accent); background: rgba(212,149,42,0.1);
}

.form-actions {
  display: flex; gap: 0.75rem; flex-wrap: wrap;
}

/* ===== Results ===== */
.results-summary {
  font-size: 1.05rem; color: var(--text-muted);
  margin-bottom: 1.5rem; max-width: 600px;
}

.result-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem; margin-bottom: 2rem;
}
.result-card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
}
.result-card h3 {
  color: var(--accent); font-size: 0.85rem; text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: 0.5rem;
}
.result-body p { margin-bottom: 0.5rem; font-size: 0.95rem; }
.result-body strong { color: var(--text); }
.result-body .reason { color: var(--text-muted); font-size: 0.85rem; }

.result-models {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1.5rem;
}
.result-models .hint { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 0.75rem; }
.model-list { list-style: none; }
.model-list li {
  padding: 0.5rem 0; border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.model-list li:last-child { border-bottom: none; }
.model-list .model-name { font-weight: 600; }
.model-list .model-note { color: var(--text-muted); font-size: 0.85rem; }

.result-actions {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
}

.toast {
  margin-top: 0.75rem; padding: 0.6rem 1rem;
  background: var(--bg-elevated); border: 1px solid var(--good);
  border-radius: var(--radius); font-size: 0.9rem;
}

/* ===== Reference ===== */
.ref-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}
.ref-card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
}
.ref-card summary {
  cursor: pointer; font-size: 0.95rem; padding: 0.25rem 0;
}
.ref-card summary:hover { color: var(--accent); }
.ref-card p { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.5rem; }

.tag {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px;
  font-size: 0.75rem; font-weight: 600; margin-right: 0.25rem;
}
.tag-good { background: rgba(76,175,80,0.15); color: var(--good); }
.tag-bad { background: rgba(229,115,115,0.15); color: var(--bad); }

/* ===== Comparison Table ===== */
.comparison-table-wrap {
  overflow-x: auto; margin-bottom: 2rem;
}
.comparison-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.9rem;
}
.comparison-table th {
  text-align: left; padding: 0.6rem 0.75rem;
  background: var(--bg-elevated); color: var(--accent);
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 2px solid var(--border);
}
.comparison-table td {
  padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.comparison-table tr:hover td { background: rgba(255,255,255,0.02); }

.legal-note {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
}
.legal-note h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.legal-note p { font-size: 0.9rem; color: var(--text-muted); }

/* ===== Saved ===== */
.saved-list { margin-bottom: 1rem; }
.saved-item {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; margin-bottom: 0.5rem;
}
.saved-item .saved-date { font-size: 0.8rem; color: var(--text-dim); }
.saved-item .saved-match { font-size: 0.9rem; margin-top: 0.25rem; }
.saved-item .saved-match span { color: var(--accent); font-weight: 600; }
.saved-item .saved-actions { margin-top: 0.5rem; display: flex; gap: 0.5rem; }
.saved-item .saved-actions button {
  font-size: 0.8rem; padding: 0.3rem 0.6rem;
  background: var(--bg-card); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 4px; cursor: pointer;
}
.saved-item .saved-actions button:hover { color: var(--text); border-color: var(--text-muted); }

.empty-state { color: var(--text-dim); font-size: 0.9rem; font-style: italic; }

/* ===== Why Section ===== */
.why-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem; margin-bottom: 2rem;
}
.why-card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
}
.why-card h3 { color: var(--accent); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.why-card p { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.5rem; }

.common-mistakes {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
}
.common-mistakes h3 { margin-bottom: 0.75rem; }
.common-mistakes ul { padding-left: 1.25rem; }
.common-mistakes li { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.common-mistakes li strong { color: var(--text); }

/* ===== Footer ===== */
.site-footer {
  margin-top: auto; background: var(--bg-card);
  border-top: 1px solid var(--border); padding: 2rem 0;
}
.footer-inner { display: flex; flex-direction: column; gap: 1rem; }
.footer-brand p { font-size: 0.85rem; color: var(--text-muted); max-width: 400px; }
.footer-nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.footer-nav a { color: var(--text-muted); font-size: 0.85rem; }
.footer-nav a:hover { color: var(--text); }
.footer-legal { font-size: 0.8rem; color: var(--text-dim); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .main-nav { display: none; }
  .nav-toggle { display: flex; }
  .hero { padding: 2.5rem 0 2rem; }
  .checkbox-grid, .radio-grid { grid-template-columns: 1fr; }
  .result-cards { grid-template-columns: 1fr; }
  .presets { gap: 0.4rem; }
  .preset-btn { font-size: 0.8rem; padding: 0.4rem 0.75rem; }
}

@media (max-width: 480px) {
  .container { padding: 0 1rem; }
  section { padding: 2rem 0; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }
  .result-actions { flex-direction: column; }
  .result-actions .btn { width: 100%; }
}

/* ===== Print ===== */
@media print {
  .site-header, .site-footer, .presets, .form-actions, .result-actions, .nav-toggle, .mobile-nav { display: none !important; }
  body { background: #fff; color: #000; }
  .result-card, .result-models { border: 1px solid #ccc; break-inside: avoid; }
  section { padding: 1rem 0; }
}

/* ===== Focus Styles ===== */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ===== Scroll Margin ===== */
section { scroll-margin-top: 4rem; }



/* 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;
}
