:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-alt: #f0ede4;
  --border: #d9d4c7;
  --text: #2a2720;
  --text-muted: #5c564a;
  --accent: #b5651d;
  --accent-dark: #8a4a10;
  --accent-light: #f3e4cf;
  --safe: #2e7d4f;
  --caution: #b8860b;
  --avoid: #b22222;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(42, 39, 32, 0.06), 0 4px 14px rgba(42, 39, 32, 0.05);
  --max-width: 1100px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; }
.brand-icon { color: var(--accent); }
.site-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-nav a { color: var(--text-muted); text-decoration: none; font-size: 14px; }
.site-nav a:hover { color: var(--accent-dark); }

/* Hero */
.hero {
  padding: 56px 0 32px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}
.hero h1 { font-size: 36px; margin: 0 0 12px; letter-spacing: -0.02em; }
.lede { font-size: 17px; color: var(--text-muted); max-width: 640px; margin: 0 0 24px; }
.search-row { display: flex; gap: 10px; max-width: 520px; }
.search-row input {
  flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 15px; background: var(--surface); color: var(--text);
}
.search-row input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--radius); border: 1px solid transparent;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--accent-dark); }
.btn:active { transform: translateY(1px); }
.btn-outline { background: transparent; color: var(--accent-dark); border-color: var(--border); }
.btn-outline:hover { background: var(--accent-light); border-color: var(--accent); color: var(--accent-dark); }
.btn-icon {
  background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted);
  padding: 4px 8px; line-height: 1;
}
.btn-icon:hover { color: var(--text); }

/* Sections */
.section { padding: 48px 0; }
.section-alt { background: var(--surface-alt); }
.section h2 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.01em; }
.section-sub { color: var(--text-muted); margin: 0 0 24px; max-width: 620px; }

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
}
.card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }
.card svg { width: 100%; height: 72px; }
.card h3 { margin: 0; font-size: 16px; }
.card p { margin: 0; font-size: 13px; color: var(--text-muted); }
.card .card-actions { display: flex; gap: 8px; margin-top: auto; }
.card .card-actions .btn { padding: 6px 12px; font-size: 13px; }

/* Detail panel */
.detail-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; min-height: 240px;
}
.detail-panel h3 { margin: 0 0 4px; font-size: 22px; }
.detail-panel .tag { display: inline-block; background: var(--accent-light); color: var(--accent-dark); padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; margin-right: 6px; }
.detail-panel .uses-list { margin: 14px 0; padding-left: 20px; }
.detail-panel .uses-list li { margin-bottom: 6px; }
.detail-panel .bonus { background: var(--surface-alt); border-left: 3px solid var(--accent); padding: 12px 14px; border-radius: 6px; margin-top: 14px; }
.detail-panel .bonus h4 { margin: 0 0 6px; font-size: 14px; color: var(--accent-dark); }
.detail-panel .floor-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.detail-panel .floor-chip { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.floor-safe { background: #e6f4ec; color: var(--safe); }
.floor-caution { background: #fdf3d6; color: var(--caution); }
.floor-avoid { background: #fbe4e4; color: var(--avoid); }

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; color: var(--text-muted); padding: 32px 16px; }
.empty-state.small { padding: 16px; font-size: 14px; }

/* Table */
.table-wrap { overflow-x: auto; }
.compat-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); font-size: 14px; }
.compat-table th, .compat-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.compat-table th { background: var(--surface-alt); font-weight: 600; font-size: 13px; color: var(--text-muted); }
.compat-table tr:last-child td { border-bottom: none; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.dot-safe { background: var(--safe); }
.dot-caution { background: var(--caution); }
.dot-avoid { background: var(--avoid); }
.legend { font-size: 13px; color: var(--text-muted); margin-top: 12px; }
.legend .dot { margin-left: 10px; }

/* Mistakes */
.mistake-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.mistake-list li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; border-left: 4px solid var(--avoid); }
.mistake-list li strong { display: block; margin-bottom: 4px; }
.mistake-list li p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* Cheat sheet */
.kit-controls { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.kit-output {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; min-height: 120px;
}
.kit-item { padding: 12px 0; border-bottom: 1px dashed var(--border); }
.kit-item:last-child { border-bottom: none; }
.kit-item h4 { margin: 0 0 4px; font-size: 15px; }
.kit-item p { margin: 0; font-size: 13px; color: var(--text-muted); }

/* Steps */
.steps { padding-left: 20px; margin: 0 0 24px; display: grid; gap: 10px; }
.steps li { color: var(--text); }
.steps li strong { color: var(--text); }

/* Modal */
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(42, 39, 32, 0.45); }
.modal-card {
  position: relative; background: var(--surface); border-radius: var(--radius);
  max-width: 520px; width: 100%; padding: 24px; box-shadow: var(--shadow);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-header h2 { margin: 0; font-size: 20px; }
.quiz-option {
  display: block; width: 100%; text-align: left; padding: 12px 14px; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-alt);
  cursor: pointer; font-size: 14px; color: var(--text);
}
.quiz-option:hover { border-color: var(--accent); background: var(--accent-light); }
.quiz-result { margin-top: 16px; padding: 14px; background: var(--accent-light); border-radius: var(--radius); }
.quiz-result h3 { margin: 0 0 6px; font-size: 16px; }
.quiz-result p { margin: 0; font-size: 14px; color: var(--text-muted); }

/* Footer */
.site-footer {
  padding: 32px 0; border-top: 1px solid var(--border); color: var(--text-muted);
  font-size: 13px; margin-top: 32px;
}
.footer-links { margin-top: 8px; }
.footer-links a { color: var(--accent-dark); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* Print */
@media print {
  .site-header, .site-footer, .card-actions, .kit-controls, .search-row, .btn, .modal, .hero { display: none !important; }
  .section { padding: 16px 0; }
  .detail-panel { border: none; padding: 0; }
  .kit-item { page-break-inside: avoid; }
}

/* Responsive */
@media (max-width: 640px) {
  .hero h1 { font-size: 28px; }
  .site-header .container { flex-wrap: wrap; height: auto; padding: 12px 20px; gap: 8px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .compat-table { font-size: 13px; }
  .compat-table th, .compat-table td { padding: 8px; }
}


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