/* Code Decoder - High-contrast, mobile-first, daylight & night readable styles */
:root {
  --bg-color: #f8fafc;
  --surface-color: #ffffff;
  --surface-muted: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --border-color: #e2e8f0;
  --border-focus: #2563eb;
  --badge-green-bg: #dcfce7;
  --badge-green-text: #14532d;
  --badge-green-border: #86efac;
  --badge-yellow-bg: #fef9c3;
  --badge-yellow-text: #713f12;
  --badge-yellow-border: #fde047;
  --badge-red-bg: #fee2e2;
  --badge-red-text: #7f1d1d;
  --badge-red-border: #fca5a5;
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0b1120;
    --surface-color: #1e293b;
    --surface-muted: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --text-subtle: #94a3b8;
    --border-color: #334155;
    --border-focus: #60a5fa;
    --badge-green-bg: #064e3b;
    --badge-green-text: #ecfdf5;
    --badge-green-border: #059669;
    --badge-yellow-bg: #713f12;
    --badge-yellow-text: #fefce8;
    --badge-yellow-border: #eab308;
    --badge-red-bg: #7f1d1d;
    --badge-red-text: #fef2f2;
    --badge-red-border: #dc2626;
  }
}

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

body {
  font-family: var(--font-family);
  font-size: 18px;
  line-height: 1.5;
  color: var(--text-main);
  background-color: var(--bg-color);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--text-main);
  text-decoration: underline;
  text-underline-offset: 3px;
}
a:hover {
  color: var(--border-focus);
}

.site-container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
  flex: 1;
}

/* Site header / brand (minimal) */
.site-brand {
  margin-bottom: 1.5rem;
  text-align: center;
}
.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--text-main);
}
.site-logo svg {
  width: 28px;
  height: 28px;
  color: #ea580c;
}

/* Hero & Input Section */
.hero-headline {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin-bottom: 1rem;
  text-align: center;
}

.search-form {
  margin-bottom: 1rem;
}
.search-box-wrap {
  display: flex;
  gap: 0.5rem;
}
.search-input {
  flex: 1;
  min-height: 52px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--surface-color);
  color: var(--text-main);
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-input::placeholder {
  color: var(--text-subtle);
  font-weight: 400;
  text-transform: none;
}
.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.search-button {
  min-height: 52px;
  min-width: 52px;
  padding: 0.75rem 1.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 8px;
  background-color: #0f172a;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
@media (prefers-color-scheme: dark) {
  .search-button {
    background-color: #3b82f6;
    color: #ffffff;
  }
}
.search-button:hover {
  opacity: 0.92;
}
.search-button:active {
  transform: scale(0.98);
}

/* Quick chips */
.chips-section {
  margin-bottom: 1.5rem;
}
.chips-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  display: block;
}
.chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.chip-item {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.75rem;
  min-height: 38px;
  font-size: 0.95rem;
  font-weight: 700;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  text-decoration: none;
  transition: all 0.15s ease;
}
.chip-item:hover {
  border-color: var(--border-focus);
  background-color: var(--surface-muted);
}

/* Dynamic error message */
.search-error {
  padding: 0.75rem 1rem;
  background-color: var(--badge-red-bg);
  border: 1px solid var(--badge-red-border);
  color: var(--badge-red-text);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

/* Result Card */
.result-card {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.result-header {
  margin-bottom: 1rem;
}
.code-h1 {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}
.code-official {
  font-size: 0.9rem;
  color: var(--text-subtle);
  font-weight: 500;
}

/* Verdict Badge */
.verdict-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 0.85rem;
  border: 2px solid transparent;
}
.verdict-badge svg {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
}
.verdict-green {
  background-color: var(--badge-green-bg);
  color: var(--badge-green-text);
  border-color: var(--badge-green-border);
}
.verdict-yellow {
  background-color: var(--badge-yellow-bg);
  color: var(--badge-yellow-text);
  border-color: var(--badge-yellow-border);
}
.verdict-red {
  background-color: var(--badge-red-bg);
  color: var(--badge-red-text);
  border-color: var(--badge-red-border);
}

.verdict-why {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-main);
  margin-bottom: 1.25rem;
  padding-left: 0.25rem;
}

/* Sections inside result */
.result-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}
.result-section-title {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-subtle);
  margin-bottom: 0.75rem;
}

/* Causes list */
.causes-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.cause-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.75rem;
  background-color: var(--surface-muted);
  border-radius: 6px;
  font-size: 0.95rem;
  gap: 0.75rem;
}
.cause-name {
  font-weight: 600;
  color: var(--text-main);
  flex: 1;
}
.cause-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.cause-cost {
  font-weight: 700;
  color: var(--text-main);
}
.cause-likelihood {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
}
.likelihood-common {
  background-color: rgba(220, 38, 38, 0.15);
  color: #dc2626;
}
.likelihood-possible {
  background-color: rgba(202, 138, 4, 0.15);
  color: #ca8a04;
}
.likelihood-rare {
  background-color: rgba(71, 85, 105, 0.15);
  color: var(--text-subtle);
}

/* Steps list */
.steps-list {
  list-style: decimal;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.steps-list li {
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text-main);
}

/* Direct replies for AI and search answers */
.direct-reply {
  font-size: 1.025rem;
  line-height: 1.55;
  color: var(--text-main);
  margin-bottom: 0.85rem;
}

/* Symptoms list */
.symptoms-list {
  list-style: disc;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.symptoms-list li {
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text-main);
}

/* Last reviewed metadata */
.last-reviewed {
  font-size: 0.825rem;
  color: var(--text-subtle);
  margin-top: 1rem;
  font-style: italic;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Related codes */
.related-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.related-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.85rem;
  min-height: 40px;
  background-color: var(--surface-muted);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
}
.related-chip:hover {
  border-color: var(--border-focus);
}

/* Calm Disclaimer */
.calm-disclaimer {
  margin-top: 1.25rem;
  padding: 0.75rem 0.85rem;
  border-radius: 6px;
  background-color: var(--surface-muted);
  font-size: 0.825rem;
  line-height: 1.45;
  color: var(--text-subtle);
}

/* About Paragraph */
.about-paragraph {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* Action row (Check another code + Share) */
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}
.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.5rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background-color: var(--surface-color);
  color: var(--text-main);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}
.btn-action:hover {
  background-color: var(--surface-muted);
  border-color: var(--border-focus);
}

/* Ad Slots */
.ad-slot {
  display: none;
}
.ad-slot[data-active="true"] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 1.5rem 0;
  min-height: 100px;
  background-color: var(--surface-muted);
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  text-align: center;
}
.ad-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  margin-bottom: 0.25rem;
}

/* Affiliate Box */
.affiliate-box {
  margin: 1.25rem 0;
  padding: 1rem 1.15rem;
  border: 1px solid #fed7aa;
  background-color: #fff7ed;
  border-radius: 8px;
}
@media (prefers-color-scheme: dark) {
  .affiliate-box {
    background-color: #291809;
    border-color: #7c2d12;
  }
}
.affiliate-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #9a3412;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
@media (prefers-color-scheme: dark) {
  .affiliate-title {
    color: #fdba74;
  }
}
.affiliate-text {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}
.affiliate-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.6rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 6px;
  background-color: #ea580c;
  color: #ffffff;
  text-decoration: none;
  transition: opacity 0.15s ease;
}
.affiliate-link:hover {
  opacity: 0.92;
  color: #ffffff;
}
.affiliate-disclosure {
  font-size: 0.75rem;
  color: var(--text-subtle);
  margin-top: 0.6rem;
  line-height: 1.35;
}

/* Footer */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-subtle);
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
}
.footer-nav a {
  color: var(--text-muted);
  text-decoration: none;
}
.footer-nav a:hover {
  text-decoration: underline;
}

/* Static page (about, privacy, contact, disclosure) content */
.text-content {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
}
.text-content h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 1rem;
}
.text-content p, .text-content ul {
  margin-bottom: 1rem;
  font-size: 0.95rem;
  line-height: 1.6;
}
.text-content ul {
  padding-left: 1.5rem;
}
.back-link {
  display: inline-block;
  margin-bottom: 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
}
