/* Bug Bite Reaction Decoder – custom theme */
:root {
  --bg: #f4faf7;
  --surface: #ffffff;
  --text: #1b3a2d;
  --text-secondary: #3d6b5a;
  --primary: #2d6a4f;
  --primary-light: #52b788;
  --primary-pale: #d8f3dc;
  --accent: #e76f51;
  --accent-pale: #fce4d6;
  --border: #b7e4c7;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(27, 58, 45, 0.08);
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1f17;
    --surface: #142e22;
    --text: #d8f3dc;
    --text-secondary: #95d5b2;
    --primary: #52b788;
    --primary-light: #74c69d;
    --primary-pale: #1b4332;
    --accent: #e76f51;
    --accent-pale: #3d1f17;
    --border: #2d6a4f;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container { width: 100%; max-width: 860px; margin: 0 auto; padding: 0 1.25rem; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.hidden { display: none !important; }

/* Header */
.site-header { background: var(--surface); border-bottom: 2px solid var(--border); padding: 0.75rem 0; position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.logo { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; color: var(--primary); font-weight: 700; font-size: 1.1rem; }
.logo-text { letter-spacing: -0.02em; }
.nav-list { display: flex; list-style: none; gap: 1rem; font-size: 0.9rem; }
.nav-list a { color: var(--text-secondary); text-decoration: none; padding: 0.25rem 0; border-bottom: 2px solid transparent; }
.nav-list a:hover, .nav-list a[aria-current="page"] { color: var(--primary); border-bottom-color: var(--primary-light); }

/* Hero */
.hero { padding: 2.5rem 0 1.5rem; text-align: center; }
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; color: var(--primary); line-height: 1.2; margin-bottom: 0.75rem; }
.hero-sub { font-size: 1.05rem; color: var(--text-secondary); max-width: 600px; margin: 0 auto; }

/* Workspace */
.decoder-workspace { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin: 1rem 0 2rem; box-shadow: var(--shadow); }
.workspace-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.panel h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--primary); }

/* Choice buttons */
.choice-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.choice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.6rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: var(--font);
  transition: border-color 0.15s, background 0.15s;
  flex: 1 0 120px;
}
.choice-btn:hover { border-color: var(--primary-light); }
.choice-btn[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-pale); font-weight: 600; }
.choice-icon { font-size: 1.1rem; }
.choice-label { text-align: center; line-height: 1.2; }

/* Selects */
select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
}
select:focus { outline: 2px solid var(--primary-light); outline-offset: 1px; }

/* Checkboxes */
.checkbox-group { display: flex; flex-direction: column; gap: 0.4rem; border: none; }
.checkbox-group label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; cursor: pointer; }
input[type="checkbox"] { accent-color: var(--primary); width: 1.1em; height: 1.1em; }

/* Results */
.results-area { margin: 1.25rem 0; }
.result-card { padding: 1.25rem; border-radius: var(--radius); }
.result-empty { background: var(--primary-pale); color: var(--text-secondary); text-align: center; }
.result-output { background: var(--primary-pale); border: 2px solid var(--primary-light); }
.result-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.result-header h3 { font-size: 1.1rem; color: var(--primary); }
.severity-badge { padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.severity-mild { background: #d8f3dc; color: #1b4332; }
.severity-moderate { background: #fff3cd; color: #856404; }
.severity-severe { background: #f8d7da; color: #721c24; }
.result-actions { margin: 0.75rem 0; font-size: 0.95rem; }
.result-details h4 { font-size: 0.9rem; color: var(--primary); margin-bottom: 0.25rem; }
.result-details ul { padding-left: 1.25rem; font-size: 0.9rem; }
.result-details li { margin-bottom: 0.15rem; }

/* Action row */
.action-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.btn {
  padding: 0.55rem 1rem;
  border: 2px solid var(--primary);
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover:not(:disabled) { background: var(--primary-light); border-color: var(--primary-light); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover:not(:disabled) { background: var(--primary-pale); }

/* Sections */
section { margin-bottom: 2.5rem; }
section h2 { font-size: 1.3rem; font-weight: 700; color: var(--primary); margin-bottom: 0.5rem; }
section p { color: var(--text-secondary); margin-bottom: 0.75rem; }

/* Table */
.table-wrap { overflow-x: auto; }
.guide-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.guide-table th, .guide-table td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
.guide-table th { background: var(--primary-pale); color: var(--primary); font-weight: 600; }
.guide-table tr:last-child td { border-bottom: none; }

/* Red flags */
.red-flags { background: var(--accent-pale); border: 2px solid var(--accent); border-radius: var(--radius); padding: 1.25rem 1.5rem; }
.red-flags h2 { color: #c0392b; }
.flags-list { padding-left: 1.25rem; color: var(--text); margin-bottom: 0.75rem; }
.flags-list li { margin-bottom: 0.35rem; }

/* History */
.history-empty { color: var(--text-secondary); font-style: italic; }
.history-list { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.75rem 0; }
.history-item { display: flex; justify-content: space-between; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 0.75rem; font-size: 0.85rem; }
.history-item time { color: var(--text-secondary); font-size: 0.8rem; }

/* Print card */
.print-card { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 0.75rem; }
.card-item { background: var(--bg); border-radius: 10px; padding: 1rem; }
.card-item h3 { font-size: 0.95rem; color: var(--primary); margin-bottom: 0.4rem; }
.card-item ul { padding-left: 1.25rem; font-size: 0.9rem; color: var(--text-secondary); }
.card-item li { margin-bottom: 0.25rem; }

/* Why this exists */
.why-this-exists { font-size: 0.93rem; }

/* Footer */
.site-footer { margin-top: auto; background: var(--surface); border-top: 2px solid var(--border); padding: 1.25rem 0; font-size: 0.85rem; color: var(--text-secondary); }
.footer-inner { display: flex; flex-direction: column; gap: 0.5rem; }
.footer-links { display: flex; list-style: none; gap: 1rem; }
.footer-links a { color: var(--primary); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .nav-list { flex-wrap: wrap; gap: 0.5rem 0.75rem; }
  .workspace-grid { grid-template-columns: 1fr; }
  .choice-btn { flex: 1 0 45%; }
  .result-header { flex-direction: column; align-items: flex-start; }
}

@media print {
  .site-header, .site-footer, .action-row, .why-this-exists, #history, .nav-list { display: none; }
  body { color: #000; background: #fff; }
  .decoder-workspace { box-shadow: none; border-color: #999; }
}



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