:root {
  --bg: #f7f7f4;
  --surface: #ffffff;
  --text: #1c1f23;
  --muted: #5b6168;
  --border: #e2e2dc;
  --accent: #1f6feb;
  --accent-soft: #e8f0fe;
  --good: #1a7f37;
  --good-soft: #e6f4ea;
  --bad: #c62828;
  --bad-soft: #fdecea;
  --note: #fff8e1;
  --note-border: #f0c36d;
  --radius: 12px;
  --max: 960px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1d2026;
    --text: #e8eaed;
    --muted: #a0a6ad;
    --border: #30343b;
    --accent: #6ea8ff;
    --accent-soft: #1d2a40;
    --good: #5cc97a;
    --good-soft: #17301f;
    --bad: #ff7b72;
    --bad-soft: #3a1c1c;
    --note: #2e2816;
    --note-border: #7a6224;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

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

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  padding-top: 12px;
  padding-bottom: 12px;
}
.logo {
  font-weight: 800;
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--text);
}
.logo span { color: var(--accent); }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.site-nav a { text-decoration: none; color: var(--muted); font-weight: 500; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--accent); }

/* Hero */
.hero { padding: 48px 0 24px; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); line-height: 1.15; margin: 0 0 12px; }
.hero p { font-size: 1.15rem; color: var(--muted); margin: 0; max-width: 640px; }

/* Country cards */
.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin: 24px 0 48px;
}
.country-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, transform .15s;
}
.country-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.country-card .flag { font-size: 2.2rem; line-height: 1; }
.country-card h2 { font-size: 1.2rem; margin: 10px 0 4px; }
.country-card p { margin: 0; color: var(--muted); font-size: .95rem; }

/* Comparison table */
.table-scroll { overflow-x: auto; margin: 16px 0 40px; }
table { border-collapse: collapse; width: 100%; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--accent-soft); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td:first-child { white-space: nowrap; }

/* Country page */
.page-title { padding: 36px 0 8px; }
.page-title h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); margin: 0; line-height: 1.2; }
.page-title .reviewed { color: var(--muted); font-size: .9rem; margin-top: 4px; }

.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; padding: 0; list-style: none; }
.toc a {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  font-size: .95rem;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.fact {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.fact .label { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.fact .value { font-size: 1.15rem; font-weight: 700; margin-top: 2px; }
.fact .sub { font-size: .85rem; color: var(--muted); }

section { margin: 40px 0; }
section > h2 { font-size: 1.6rem; margin: 0 0 12px; padding-top: 8px; border-top: 2px solid var(--border); }

.rule {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 12px 0;
}
.rule h3 { margin: 0 0 6px; font-size: 1.1rem; }
.rule p, .rule ul { margin: 6px 0; }
.rule ul { padding-left: 22px; }

.note {
  background: var(--note);
  border: 1px solid var(--note-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 16px 0;
  font-size: .95rem;
}

/* Sign gallery */
.signs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.sign {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  margin: 0;
  text-align: center;
}
.sign img { width: 110px; height: 110px; object-fit: contain; }
.sign figcaption { margin-top: 8px; font-size: .92rem; }
.sign figcaption strong { display: block; font-size: 1rem; }

@media (max-width: 520px) {
  .signs { grid-template-columns: repeat(2, 1fr); }
  .sign img { width: 90px; height: 90px; }
}

/* Quiz */
.quiz-q {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 14px 0;
}
.quiz-q h3 { margin: 0 0 12px; font-size: 1.05rem; }
.quiz-q h3 .num { color: var(--muted); font-weight: 500; margin-right: 6px; }
.quiz-options { display: grid; gap: 8px; }
.quiz-options button {
  text-align: left;
  font: inherit;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.quiz-options button:hover:not(:disabled) { border-color: var(--accent); }
.quiz-options button:disabled { cursor: default; }
.quiz-options button.correct { background: var(--good-soft); border-color: var(--good); }
.quiz-options button.wrong { background: var(--bad-soft); border-color: var(--bad); }
.quiz-explain { margin: 12px 0 0; font-size: .95rem; }
.quiz-explain.good::before { content: "✓ Correct. "; font-weight: 700; color: var(--good); }
.quiz-explain.bad::before { content: "✗ Not quite. "; font-weight: 700; color: var(--bad); }
.quiz-score {
  position: sticky;
  bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.btn {
  font: inherit;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  border: 0;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

/* Sources & footer */
.sources li { margin: 6px 0; }
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 56px;
  padding: 24px 0 40px;
  color: var(--muted);
  font-size: .9rem;
}
.site-footer p { margin: 6px 0; }
