/* ============================================================================
   countrygame.live — design system
   Direction: clean, modern, data-forward. Cartographic palette (ink · teal ·
   amber), Bricolage Grotesque display + Hanken Grotesk body with tabular figures.
   Every ad slot reserves height up front → zero layout shift (CLS) for CWV.
   ========================================================================== */

/* ---- Fonts (self-request via Google Fonts; swap to self-host for prod CWV) -- */
@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700&family=Hanken+Grotesk:wght@400;500;600;700&display=swap");

:root {
  /* palette */
  --paper: #f5f6f3;
  --surface: #ffffff;
  --surface-2: #fbfcfa;
  --ink: #171b1d;
  --muted: #5d666c;
  --faint: #6d757c; /* darkened for AA contrast on white (was #98a1a6) */
  --line: #e6e8e3;
  --line-strong: #d4d7d0;

  --accent: #0f766e; /* teal — "water" */
  --accent-strong: #0b5c55;
  --accent-soft: #dff1ee;
  --amber: #c9761b; /* amber — "routes/land" (decorative: borders, fills) */
  --amber-ink: #8a5011; /* darker amber for text (AA on amber-soft + white) */
  --amber-soft: #f8ecd9;

  --win-bg: #e7f4f1;
  --win-ink: #0b5c55;

  /* type */
  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --num: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;

  /* scale */
  --maxw: 1120px;
  --gap: clamp(1rem, 2.5vw, 2rem);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(23, 27, 29, 0.04), 0 1px 3px rgba(23, 27, 29, 0.06);
  --shadow: 0 4px 14px rgba(23, 27, 29, 0.06), 0 1px 3px rgba(23, 27, 29, 0.05);
}

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  /* subtle cartographic grid texture */
  background-image:
    linear-gradient(rgba(15, 118, 110, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 118, 110, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: center top;
  font-feature-settings: "tnum" 1, "cv05" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gap);
}

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ---- Header ---------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 246, 243, 0.82);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.28rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand:hover {
  text-decoration: none;
}
.brand .globe {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-size: 0.95rem;
  box-shadow: var(--shadow-sm);
}
.brand .tld {
  color: var(--accent);
}
.nav {
  margin-left: auto;
  display: flex;
  gap: 1.4rem;
  font-size: 0.96rem;
  font-weight: 500;
}
.nav a {
  color: var(--muted);
}
.nav a:hover {
  color: var(--ink);
  text-decoration: none;
}
@media (max-width: 640px) {
  .nav {
    display: none;
  }
}

/* ---- Ad slots -------------------------------------------------------------
   HIDDEN for launch. We use AdSense Auto Ads — the loader in layout.js lets
   Google place ads automatically, so these manual placeholders stay hidden.
   (Showing fake "Advertisement" boxes to the AdSense reviewer can hurt
   approval.) The slot markers + sizing are kept so you can switch to MANUAL
   units later: drop a real <ins class="adsbygoogle"> inside each .ad-slot in
   the templates and change `display: none` below to `display: grid`.
   -------------------------------------------------------------------------- */
.ad-slot {
  display: none; /* launch: hidden. Set to `grid` to show manual ad units. */
  --h: 90px;
  min-height: var(--h);
  place-items: center;
  margin: 1.5rem auto;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.ad-slot.leaderboard {
  --h: 90px;
  max-width: 728px;
}
.ad-slot.in-content {
  --h: 280px;
  max-width: 336px;
}

/* ---- Breadcrumb ------------------------------------------------------------ */
.breadcrumb {
  font-size: 0.85rem;
  color: var(--muted);
  padding-top: 1.4rem;
}
.breadcrumb a {
  color: var(--muted);
}
.breadcrumb span {
  color: var(--faint);
  padding: 0 0.4rem;
}

/* ---- Page hero ------------------------------------------------------------- */
.page-hero {
  padding: 1.6rem 0 0.6rem;
}
.eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: -0.025em;
  line-height: 1.08;
  color: var(--ink);
  margin: 0.2em 0 0.4em;
}
h1 {
  font-size: clamp(2rem, 5.5vw, 3.1rem);
}
h2 {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  margin-top: 2.4rem;
}
h3 {
  font-size: 1.2rem;
}
.lede {
  font-size: 1.12rem;
  color: var(--muted);
  max-width: 62ch;
}

/* ---- Country identity block ----------------------------------------------- */
.country-id {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
}
.flag {
  width: 84px;
  aspect-ratio: 3 / 2;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
  object-fit: cover;
  background: var(--surface);
}
.flag.sm {
  width: 46px;
}
.flag.lg {
  width: 120px;
}

/* ---- Stat grid (country page) --------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 1rem;
  margin: 1.6rem 0;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.stat-card .label {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.stat-card .value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.62rem;
  letter-spacing: -0.02em;
  margin-top: 0.35rem;
  font-variant-numeric: tabular-nums;
}
.stat-card .sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

/* ---- Comparison table ------------------------------------------------------ */
.cmp {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin: 1.4rem 0;
}
.cmp-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.cmp-head .side {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}
.cmp-head .side.right {
  justify-content: flex-end;
  text-align: right;
}
.cmp-head .cname {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmp-head .vs {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--amber-ink);
  font-size: 0.95rem;
  padding: 0.15rem 0.55rem;
  border: 1.5px solid var(--amber);
  border-radius: 999px;
  background: var(--amber-soft);
}
.cmp-row {
  padding: 0.95rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.cmp-row:last-child {
  border-bottom: 0;
}
.cmp-row .metric {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: center;
  margin-bottom: 0.5rem;
}
.cmp-bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  align-items: center;
}
.cmp-val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}
.cmp-val.right {
  justify-content: flex-end;
}
.cmp-val .winner-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}
.bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-top: 0.4rem;
}
.bar-track.right {
  direction: rtl;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}
.bar-fill.lose {
  background: var(--line-strong);
}
.win-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--win-ink);
  background: var(--win-bg);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  margin-top: 0.55rem;
}
.cmp-row .win-line {
  text-align: center;
}

/* ---- Charts (build-time SVG) ---------------------------------------------- */
.chart {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.3rem 1.4rem 1.1rem;
  margin: 0;
}
.chart-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.8rem;
}
.chart-sub {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--faint);
  letter-spacing: 0;
}
.trend-chart svg,
.radar-chart svg { overflow: visible; }
.chart-legend {
  display: flex;
  justify-content: center;
  gap: 1.4rem;
  margin-top: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}
.chart-legend .lg {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.chart-legend .sw {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

/* ---- Country page: metric groups + radar ---------------------------------- */
.metric-group-h {
  font-size: 1.05rem;
  margin: 1.4rem 0 0.2rem;
}
.metric-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.metric-grid .stat-card { padding: 0.9rem 1rem; }
.metric-grid .value { font-size: 1.3rem; }
.src-note {
  font-size: 0.82rem;
  color: var(--faint);
  margin: 0 0 0.4rem;
}
.country-radar-wrap {
  max-width: 460px;
  margin: 1.4rem auto 0;
}

/* ---- Grouped comparison sections ------------------------------------------ */
.section-lead {
  margin: 2.4rem 0 0.6rem;
}
.cmp-group {
  margin: 1rem 0;
}
.cmp-head-sm {
  padding: 0.7rem 1.1rem;
}
.cmp-head-sm .flag.sm {
  width: 34px;
}
.cmp-head-sm .cname-sm {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmp-head-sm .side {
  gap: 0.5rem;
}
.group-title {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: center;
  white-space: nowrap;
}
/* on narrow screens the flags identify each side — drop the names to give the
   group title room (avoids "China" → "C." truncation) */
@media (max-width: 560px) {
  .cmp-head-sm .cname-sm { display: none; }
}

/* ---- Governance / politics (Phase B) -------------------------------------- */
.gov {
  margin: 2rem 0;
}
.gov-type-badge {
  display: inline-block;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  margin-bottom: 1rem;
}
.gov-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.gov-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
}
.gov-card .gov-role {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.gov-card .gov-office {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  margin: 0.25rem 0 0.4rem;
}
.gov-card p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.5;
}
.gov-cell {
  font-size: 0.95rem !important;
  font-weight: 600;
  line-height: 1.35;
  align-items: flex-start;
}
.gov-explainers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.4rem;
}
.gov-explainers h3 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}
.gov-explainers p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}
@media (max-width: 640px) {
  .gov-explainers { grid-template-columns: 1fr; gap: 1.1rem; }
}

/* ---- Travel + affiliate --------------------------------------------------- */
.travel-block {
  margin: 2rem 0;
}
.aff-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin-top: 0.9rem;
}
.aff-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.aff-cta {
  display: block;
  text-align: center;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  border: 1.5px solid var(--accent);
}
.aff-cta:hover {
  background: var(--accent-strong);
  text-decoration: none;
}
.aff-cta.ghost {
  background: var(--surface);
  color: var(--accent-strong);
}
.aff-cta.ghost:hover {
  background: var(--accent-soft);
}
.aff-note {
  font-size: 0.8rem;
  color: var(--faint);
  margin-top: 0.7rem;
  text-align: center;
}

/* ---- Prose (original written content — AdSense signal) -------------------- */
.prose {
  max-width: 68ch;
}
.prose p {
  margin: 0 0 1.1rem;
}
.prose .prose-lede {
  font-size: 1.14rem;
  line-height: 1.55;
  color: var(--ink);
  font-weight: 500;
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin-bottom: 1.4rem;
}
.prose h2 {
  margin-top: 2rem;
}

/* ---- Related links / chips ------------------------------------------------ */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0 2rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.chip:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}

/* ---- FAQ ------------------------------------------------------------------- */
.faq details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.7rem;
  box-shadow: var(--shadow-sm);
}
.faq summary {
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: "+";
  float: right;
  color: var(--accent);
  font-weight: 700;
}
.faq details[open] summary::after {
  content: "−";
}
.faq details p {
  margin: 0.7rem 0 0;
  color: var(--muted);
}

/* ---- Footer ---------------------------------------------------------------- */
.site-footer {
  margin-top: 3.5rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.site-footer .wrap {
  padding-top: 2.2rem;
  padding-bottom: 2.4rem;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 1.5rem;
}
.site-footer h2 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  margin: 0 0 0.7rem;
}
.site-footer a {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
  padding: 0.15rem 0;
}
.site-footer .legal {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 1.2rem;
  color: var(--faint);
  font-size: 0.83rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .site-footer .wrap {
    grid-template-columns: 1fr 1fr;
  }
}

/* Consent UI is rendered by Google's certified CMP (AdSense Privacy &
   messaging), so no custom cookie-banner styles are needed here. */

/* ---- Motion: staggered page-load reveal ----------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(10px);
    animation: rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }
  .reveal:nth-child(2) { animation-delay: 0.05s; }
  .reveal:nth-child(3) { animation-delay: 0.1s; }
  .reveal:nth-child(4) { animation-delay: 0.15s; }
  .reveal:nth-child(5) { animation-delay: 0.2s; }
}
@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 480px) {
  body { font-size: 16px; }
  .cmp-head .cname { font-size: 1rem; }
  .cmp-val { font-size: 0.92rem; }
}

/* ---- Home hero ------------------------------------------------------------- */
.home-hero {
  padding: clamp(2.5rem, 7vw, 5rem) 0 1.5rem;
  text-align: center;
}
.home-hero h1 {
  font-size: clamp(2.3rem, 6.5vw, 4rem);
  max-width: 15ch;
  margin-inline: auto;
}
.home-hero .lede {
  margin: 0.6rem auto 0;
  font-size: 1.18rem;
  text-align: center;
}
.home-hero .accent-word {
  color: var(--accent);
  position: relative;
  white-space: nowrap;
}

/* compare search */
.compare-search {
  margin: 2rem auto 0;
  max-width: 660px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.4rem 0.4rem 0.35rem;
}
.compare-search input {
  font: inherit;
  border: 0;
  background: transparent;
  padding: 0.75rem 1rem;
  min-width: 0;
  border-radius: 999px;
  color: var(--ink);
}
.compare-search input:focus {
  outline: 2px solid var(--accent-soft);
  outline-offset: 0;
}
.compare-search .cs-select {
  font: inherit;
  font-weight: 500;
  border: 0;
  background: transparent;
  padding: 0.75rem 2.2rem 0.75rem 1rem;
  min-width: 0;
  width: 100%;
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  /* custom chevron */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%230f766e' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  text-overflow: ellipsis;
}
.compare-search .cs-select:focus {
  outline: 2px solid var(--accent-soft);
  outline-offset: 0;
}
.compare-search .cs-select:invalid {
  color: var(--faint); /* placeholder-like until a country is chosen */
}
.compare-search .vs-mini {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--amber-ink);
  font-size: 0.85rem;
}
.compare-search button {
  font: inherit;
  font-weight: 600;
  border: 0;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 0.75rem 1.4rem;
  transition: background 0.15s ease;
}
.compare-search button:hover {
  background: var(--accent-strong);
}
.search-hint {
  text-align: center;
  color: var(--faint);
  font-size: 0.85rem;
  margin-top: 0.7rem;
}
@media (max-width: 560px) {
  .compare-search {
    grid-template-columns: 1fr;
    border-radius: var(--radius);
    padding: 0.5rem;
    gap: 0.4rem;
  }
  .compare-search .vs-mini { padding: 0.2rem; }
  .compare-search button { width: 100%; }
}

/* section headings on home */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 2.6rem 0 0.4rem;
}
.section-head a {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

/* comparison card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1.2rem 0;
}
.cmp-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  display: block;
}
.cmp-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
  text-decoration: none;
}
.cmp-card .flags {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}
.cmp-card .flags .vs-mini {
  font-family: var(--font-display);
  color: var(--amber-ink);
  font-weight: 700;
  font-size: 0.78rem;
}
.cmp-card .title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.cmp-card .meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

/* countries index search + region groups */
.country-search { margin: 1.4rem 0 0.5rem; }
.country-search input {
  font: inherit;
  width: 100%;
  max-width: 420px;
  padding: 0.75rem 1.1rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
}
.country-search input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.country-search-empty { color: var(--muted); margin-top: 0.8rem; }
.region-group { margin-top: 1.8rem; }
.region-group h2 { display: flex; align-items: baseline; gap: 0.6rem; }
.region-count {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--faint);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
}

/* country tile grid (index) */
.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.7rem;
  margin: 1.2rem 0;
}
.country-tile {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.country-tile:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}
.country-tile .name {
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}
.country-tile .sub {
  font-size: 0.8rem;
  color: var(--faint);
}

/* country-of-the-day feature */
.feature {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.4rem;
  align-items: center;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin: 1.2rem 0;
}
.feature .flag { width: 110px; }
.feature.quiz-feature {
  background: linear-gradient(135deg, var(--amber-soft), var(--surface));
}
.quiz-feature-emoji { font-size: 4rem; line-height: 1; }
.quiz-feature-links { display: inline-block; margin-left: 1rem; font-size: 0.9rem; font-weight: 600; }
.feature h3 { margin: 0.1rem 0 0.3rem; font-size: 1.5rem; }
.feature p { margin: 0 0 0.7rem; color: var(--muted); }
@media (max-width: 520px) {
  .feature { grid-template-columns: 1fr; text-align: center; }
  .feature .flag { margin-inline: auto; }
}

/* contact form */
.form-row { margin-bottom: 1rem; }
.form-row label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}
.form-row input,
.form-row textarea {
  font: inherit;
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}
.form-row input:focus,
.form-row textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}
.btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 0.7rem 1.6rem;
}
.btn:hover { background: var(--accent-strong); text-decoration: none; }

.btn.ghost {
  background: transparent;
  color: var(--accent-strong);
  border: 1.5px solid var(--line-strong);
}
.btn.ghost:hover {
  background: var(--surface);
  border-color: var(--accent);
}

/* ---- Quiz hub cards -------------------------------------------------------- */
.quiz-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  display: flex;
  flex-direction: column;
}
.quiz-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
  text-decoration: none;
}
.quiz-card .q-emoji { font-size: 2.6rem; line-height: 1; }
.quiz-card .q-tag {
  align-self: flex-start;
  margin: 0.8rem 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}
.quiz-card .q-play {
  margin-top: auto;
  padding-top: 0.9rem;
  font-weight: 600;
  color: var(--accent-strong);
}

/* ---- Quiz engine (flags / capitals) --------------------------------------- */
.quiz-loading { color: var(--faint); padding: 2rem 0; }
.quiz {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.2rem, 3vw, 2rem);
  max-width: 640px;
  margin-inline: auto;
}
.quiz-bar {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}
.quiz-score { color: var(--accent-strong); }
.quiz-progress {
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.6rem 0 1.3rem;
}
.quiz-progress > div {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width 0.3s ease;
}
.q-flag { text-align: center; margin-bottom: 1rem; }
.q-flag img {
  display: inline-block;
  width: 220px;
  max-width: 70%;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.q-text { text-align: center; font-weight: 600; margin: 0 0 1.2rem; }
.q-text-big {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.quiz-options { display: grid; gap: 0.65rem; }
.quiz-opt {
  font: inherit;
  font-weight: 600;
  text-align: left;
  padding: 0.85rem 1.1rem;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.1s ease;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt.correct {
  border-color: var(--accent);
  background: var(--win-bg);
  color: var(--win-ink);
}
.quiz-opt.wrong {
  border-color: #d9534f;
  background: #fdecea;
  color: #b0322e;
}
.quiz-next { margin-top: 1.2rem; width: 100%; }

.quiz-end { text-align: center; padding: 1rem 0; }
.quiz-end-score {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 4rem;
  color: var(--accent);
  line-height: 1;
}
.quiz-end-score span { color: var(--faint); font-size: 2rem; }
.quiz-end-msg { font-weight: 600; font-size: 1.1rem; margin: 0.4rem 0 1.4rem; }
.quiz-end-actions { display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap; }
.quiz-end-links { margin-top: 1.4rem; font-size: 0.9rem; color: var(--muted); }

/* ---- Daily challenge ------------------------------------------------------- */
.daily {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.2rem, 3vw, 2rem);
  max-width: 620px;
  margin-inline: auto;
}
.daily-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.1rem;
}
.daily-no {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.daily-clue-count { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.clue-list { list-style: none; padding: 0; margin: 0 0 1.2rem; display: grid; gap: 0.5rem; }
.clue {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  opacity: 0.55;
}
.clue.shown {
  opacity: 1;
  border-color: var(--accent);
  background: var(--accent-soft);
}
.clue-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
}
.clue.shown .clue-label { color: var(--accent-strong); }
.clue-value { font-weight: 600; text-align: right; }
.guess-history { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.guess-chip {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}
.guess-chip.no { background: #fdecea; color: #b0322e; }
.guess-chip.ok { background: var(--win-bg); color: var(--win-ink); }
.daily-form { display: flex; gap: 0.5rem; margin-bottom: 0.8rem; }
.daily-form input {
  font: inherit;
  flex: 1;
  min-width: 0;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}
.daily-form input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.reveal-clue {
  font: inherit;
  width: 100%;
  padding: 0.65rem;
  background: transparent;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}
.reveal-clue:hover:not(:disabled) { border-color: var(--amber); color: var(--amber); }
.reveal-clue:disabled { opacity: 0.5; cursor: default; }

.daily-result { text-align: center; padding: 0.5rem 0; }
.daily-squares { font-size: 2rem; letter-spacing: 6px; margin-bottom: 0.8rem; }
.daily-headline { margin: 0.2rem 0; }
.daily-score { font-weight: 600; color: var(--accent-strong); margin: 0.2rem 0 1rem; }
.daily-streak {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--amber-soft);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.daily-answer { color: var(--muted); margin-bottom: 1.2rem; }
.daily-next { margin-top: 1.2rem; color: var(--faint); font-size: 0.9rem; }

/* 404 */
.notfound {
  text-align: center;
  padding: clamp(3rem, 10vw, 7rem) 0;
}
.notfound .big {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(4rem, 18vw, 9rem);
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.04em;
}
