/* ───────── Tokens ───────── */
:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --surface-3: #e3e8f2;
  --text: #0d1526;
  --muted: #5d6679;
  --border: #dde3ee;
  --accent: #0fa968;
  --accent-ink: #ffffff;
  --accent-soft: #dcf5ea;
  --blue: #2a7de1;
  --amber: #f2a516;
  --bad: #e5484d;
  --good: #12a150;
  --shadow: 0 1px 2px rgba(13,21,38,.05), 0 6px 20px rgba(13,21,38,.06);
  --shadow-lg: 0 20px 50px rgba(13,21,38,.18);
  --radius: 16px;
  --nav-h: 66px;
  --hero: linear-gradient(135deg, #0b3d2e 0%, #0f5f45 45%, #1d4f91 100%);
}
:root[data-theme="dark"] {
  --bg: #0a0f1c; --surface: #121a2b; --surface-2: #19233a; --surface-3: #212d48;
  --text: #e8edf7; --muted: #95a0b8; --border: #243150;
  --accent: #22c47f; --accent-ink: #04140c; --accent-soft: #123a2b;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  --shadow-lg: 0 20px 50px rgba(0,0,0,.5);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f1c; --surface: #121a2b; --surface-2: #19233a; --surface-3: #212d48;
    --text: #e8edf7; --muted: #95a0b8; --border: #243150;
    --accent: #22c47f; --accent-ink: #04140c; --accent-soft: #123a2b;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    --shadow-lg: 0 20px 50px rgba(0,0,0,.5);
  }
}

/* ───────── Base ───────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--blue); }
h1, h2, h3 { line-height: 1.2; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.lead { color: var(--muted); margin: 0 0 14px; max-width: 70ch; }
.vtitle { margin: 6px 0 6px; font-size: 1.6rem; }

/* ───────── Top bar ───────── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 16px; padding: 10px 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.25rem; font-weight: 600; text-decoration: none; color: var(--text); white-space: nowrap; }
.brand b { color: var(--accent); font-weight: 800; }
.brand img { border-radius: 8px; }
.tabs { display: flex; gap: 4px; flex: 1; justify-content: center; }
.tabs a {
  display: flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 12px;
  text-decoration: none; color: var(--muted); font-weight: 600; transition: background .15s, color .15s;
}
.tabs a:hover { background: var(--surface-2); color: var(--text); }
.tabs a.active { background: var(--accent); color: var(--accent-ink); }
.icon-btn { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; width: 42px; height: 42px; cursor: pointer; font-size: 1.1rem; color: var(--text); }

main { max-width: 1240px; margin: 0 auto; padding: 18px 24px 40px; min-height: 70vh; }
.view { display: none; }
.view.active { display: block; animation: fade .22s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ───────── Hero ───────── */
.hero {
  background: var(--hero); color: #fff; border-radius: 22px; padding: 28px 28px 24px; margin-bottom: 16px;
  position: relative; overflow: hidden; box-shadow: var(--shadow);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%;
  border: 36px solid rgba(255,255,255,.07);
}
.hero h1 { margin: 0 0 6px; font-size: clamp(1.5rem, 3.5vw, 2.2rem); }
.hero p { margin: 0 0 18px; opacity: .85; max-width: 60ch; }
.searchbox {
  display: flex; align-items: center; gap: 10px; background: #fff; color: #0d1526;
  border-radius: 14px; padding: 4px 6px 4px 14px; max-width: 640px; position: relative; z-index: 1;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.searchbox input { flex: 1; border: 0; outline: 0; background: none; font: inherit; padding: 12px 4px; color: inherit; min-width: 0; }

/* ───────── Chips / filters ───────── */
.filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; font: inherit; font-size: .9rem; font-weight: 500; cursor: pointer; white-space: nowrap;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 14px; transition: all .15s;
}
.chip:hover { border-color: var(--muted); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .n { opacity: .6; font-size: .8em; margin-left: 4px; }

/* ───────── Progress ───────── */
.progress-row { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; font-size: .85rem; color: var(--muted); }
.progress { flex: 1; height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--blue)); border-radius: 99px; transition: width .4s; }

/* ───────── Country grid ───────── */
.region-title { display: flex; align-items: baseline; gap: 8px; margin: 22px 0 10px; font-size: 1.05rem; }
.region-title span { color: var(--muted); font-weight: 500; font-size: .85rem; }
.grid { display: block; }
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.ccard {
  display: flex; flex-direction: column; gap: 8px; padding: 14px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s; position: relative;
}
.ccard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.ccard.learned::after { content: "✓"; position: absolute; top: 10px; right: 12px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: .8rem; font-weight: 800; }
.ccard-head { display: flex; align-items: center; gap: 12px; }
.ccard h3 { margin: 0; font-size: 1.05rem; }
.ccard .sub { font-size: .78rem; color: var(--muted); }
.ccard p { margin: 0; font-size: .88rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.flag { width: 44px; height: 30px; object-fit: cover; border-radius: 5px; box-shadow: 0 0 0 1px rgba(0,0,0,.08); background: var(--surface-3); flex: none; }
.flag.sm { width: 26px; height: 18px; border-radius: 3px; }
.flag.lg { width: 92px; height: 62px; border-radius: 9px; }
.flag.xl { width: 170px; height: 114px; border-radius: 12px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: .74rem; font-weight: 600; background: var(--surface-2); color: var(--muted); padding: 3px 9px; border-radius: 99px; }
.tag.L { background: #fff1c9; color: #7a4b00; }
:root[data-theme="dark"] .tag.L { background: #4a3a10; color: #ffd978; }
.tag.d1 { color: var(--good); } .tag.d3 { color: var(--bad); }
.empty { text-align: center; color: var(--muted); padding: 50px 10px; }

/* search hits */
.hits { display: grid; gap: 8px; margin-bottom: 18px; }
.hit { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: inherit; }
.hit b { display: block; }
.hit span { font-size: .88rem; color: var(--muted); }
mark { background: #ffe58a; color: inherit; border-radius: 3px; padding: 0 2px; }
:root[data-theme="dark"] mark { background: #7a5d00; }

/* ───────── Country page ───────── */
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; color: var(--muted); text-decoration: none; font-weight: 600; }
.back:hover { color: var(--text); }
.cp-head {
  display: flex; gap: 20px; align-items: center; padding: 22px; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 14px;
}
.cp-head h1 { margin: 0 0 4px; font-size: clamp(1.6rem, 4vw, 2.3rem); }
.cp-summary { margin: 8px 0 0; font-size: 1.02rem; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.fact { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px; text-align: center; }
.fact small { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.fact b { font-size: 1.1rem; }
.tips { display: grid; gap: 8px; margin-bottom: 14px; }
.tip { background: var(--accent-soft); border-left: 4px solid var(--accent); padding: 12px 14px; border-radius: 10px; }
.toc { position: sticky; top: 62px; z-index: 5; background: var(--bg); padding: 8px 0; margin-bottom: 6px; }
.sections { columns: 2; column-gap: 12px; }
.sections .sec { break-inside: avoid; margin-bottom: 12px; display: block; }
.sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); scroll-margin-top: 120px; }
.sec h3 { margin: 0 0 8px; display: flex; gap: 8px; align-items: center; font-size: 1.02rem; }
.sec ul { margin: 0; padding-left: 20px; }
.sec li { margin: 5px 0; }
.sec li::marker { color: var(--accent); }
.cp-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.cp-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.cp-nav a { flex: 1; display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; text-decoration: none; color: var(--text); font-weight: 600; }
.cp-nav a.next { justify-content: flex-end; text-align: right; }

/* ───────── Buttons ───────── */
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 12px; padding: 11px 16px; text-decoration: none;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: transform .1s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.good { border-color: var(--good); color: var(--good); }
.btn.bad { border-color: var(--bad); color: var(--bad); }
.btn.big { width: 100%; padding: 15px; font-size: 1.05rem; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; font-size: .85rem; }
kbd { font: 600 .68rem/1 ui-monospace, monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 3px 5px; color: var(--muted); }

/* ───────── Compare ───────── */
#compareRegions { margin: 6px 0 4px; }
.compare { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; margin-top: 10px; }
.compare .region-title { grid-column: 1 / -1; margin: 14px 0 0; }
.crow { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; text-decoration: none; color: inherit; transition: border-color .15s; }
.crow:hover { border-color: var(--accent); }
.crow b { display: block; margin-bottom: 2px; }
.crow ul { margin: 0; padding-left: 18px; font-size: .9rem; color: var(--muted); }

/* ───────── Guides ───────── */
.guides { columns: 2; column-gap: 12px; }
.guides details.guide { break-inside: avoid; margin-bottom: 12px; }
details.guide { scroll-margin-top: 80px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
details.guide summary { cursor: pointer; padding: 16px 18px; font-weight: 700; font-size: 1.05rem; list-style: none; display: flex; gap: 12px; align-items: center; }
details.guide summary::-webkit-details-marker { display: none; }
details.guide summary .gi { width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: 1.2rem; flex: none; }
details.guide summary small { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; }
details.guide summary::after { content: "⌄"; margin-left: auto; color: var(--muted); font-size: 1.3rem; transition: transform .2s; }
details.guide[open] summary::after { transform: rotate(180deg); }
.gbody { padding: 0 18px 18px; }
.gbody h4 { margin: 16px 0 6px; }
.gbody table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.gbody th, .gbody td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.gbody th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; }
.gbody ul, .gbody ol { padding-left: 20px; margin: 6px 0; }
.gbody li { margin-bottom: 6px; }
.flaglist { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.flaglist a, .flaglist span { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 99px; padding: 3px 10px 3px 4px; font-size: .84rem; text-decoration: none; color: var(--text); }

/* ───────── Flashcards ───────── */
.selects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.selects label, .setup label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--muted); }
select {
  width: 100%; font: inherit; font-size: .95rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: 11px 12px;
}
select:focus { outline: 2px solid var(--accent); }
.fc-stats { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.fc-stats span { font-size: .76rem; background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 3px 10px; }
.fc-stats .boxes { display: flex; gap: 3px; align-items: center; }
.flashcard { perspective: 1400px; max-width: 600px; margin: 0 auto; height: 340px; cursor: pointer; outline: none; touch-action: pan-y; }
.fc-inner { position: relative; width: 100%; height: 100%; transition: transform .5s cubic-bezier(.3,.7,.3,1); transform-style: preserve-3d; }
.flashcard.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 26px; text-align: center; font-size: 1.15rem; overflow: auto;
}
.fc-back { transform: rotateY(180deg); }
.fc-face ul { text-align: left; font-size: .95rem; margin: 0; padding-left: 20px; }
.fc-cat { font-size: .75rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }
.fc-hint { font-size: .8rem; color: var(--muted); }
.fc-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; max-width: 600px; margin: 16px auto 8px; }

/* ───────── Quiz ───────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); padding: 22px; }
.setup { max-width: 480px; margin: 10px auto; display: flex; flex-direction: column; gap: 14px; }
.setup h2 { margin: 0; }
#quizGame { max-width: 660px; margin: 0 auto; }
.quiz-head { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 8px; }
.question { margin: 14px 0; text-align: center; font-size: 1.12rem; min-height: 130px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.answers .btn { padding: 12px; min-height: 58px; justify-content: flex-start; text-align: left; font-weight: 500; }
.answers .btn.correct { background: var(--good); border-color: var(--good); color: #fff; }
.answers .btn.wrong { background: var(--bad); border-color: var(--bad); color: #fff; }
.answers .btn:disabled { cursor: default; }
.feedback { min-height: 30px; margin: 12px 0; text-align: center; }
.result .score { font-size: 3.4rem; font-weight: 800; background: linear-gradient(90deg, var(--accent), var(--blue)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 24px 20px; border-top: 1px solid var(--border); }


/* ───────── Zakładki karty kraju ───────── */
.ctabs { position: sticky; top: 62px; z-index: 6; display: flex; gap: 4px; padding: 5px; margin: 4px 0 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); overflow-x: auto; scrollbar-width: none; }
.ctabs::-webkit-scrollbar { display: none; }
.ctabs button { flex: 1 0 auto; font: inherit; font-weight: 600; font-size: .92rem; border: 0; background: none; color: var(--muted); padding: 9px 12px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.ctabs button:hover { background: var(--surface-2); color: var(--text); }
.ctabs button.active { background: var(--accent); color: var(--accent-ink); }
.cp-body { min-height: 200px; }
.cp-body .toc { top: 120px; }
.loading { text-align: center; color: var(--muted); padding: 40px; }
.phead { margin: 22px 0 10px; font-size: 1.08rem; display: flex; align-items: center; gap: 8px; }
.phead span { color: var(--muted); font-weight: 500; font-size: .85rem; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; align-items: start; }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.pcard.noimg { border-left: 4px solid var(--accent); }
.pimg { display: block; width: 100%; padding: 0; border: 0; background: var(--surface-2); cursor: zoom-in; }
.pimg + .pimg { border-top: 1px solid var(--border); }
.pimg img { display: block; width: 100%; height: auto; max-height: 340px; object-fit: contain; }
.ptext { padding: 12px 14px 14px; font-size: .93rem; line-height: 1.5; }
.maplink { display: inline-block; margin-top: 6px; font-size: .8rem; font-weight: 600; text-decoration: none; }

/* galerie */
.segs { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin-bottom: 10px; gap: 2px; }
.seg { font: inherit; font-weight: 600; font-size: .9rem; border: 0; background: none; color: var(--muted); padding: 7px 14px; border-radius: 9px; cursor: pointer; }
.seg.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.ggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.gthumb { position: relative; padding: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; aspect-ratio: 16 / 10; }
.gthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gthumb img[src$=".svg"] { object-fit: contain; padding: 8px; background: #fff; }
.gthumb span { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px; font-size: .7rem; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.75)); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcountry { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px; }
.gname { display: flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; color: var(--text); margin-bottom: 8px; }
.gname span { color: var(--muted); font-weight: 500; font-size: .8rem; }
.gcountry .ggrid { grid-template-columns: repeat(3, 1fr); }
.gcountry .link { margin-top: 6px; }

/* lightbox */
.lb { position: fixed; inset: 0; z-index: 100; background: rgba(4, 8, 16, .94); display: flex; align-items: center; justify-content: center; }
.lb figure { margin: 0; max-width: min(1200px, 92vw); max-height: 92vh; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lb img { max-width: 100%; max-height: 74vh; object-fit: contain; border-radius: 8px; background: #fff1; }
.lb figcaption { color: #e8edf7; font-size: .95rem; line-height: 1.5; max-width: 760px; max-height: 16vh; overflow: auto; text-align: center; padding: 0 8px; }
.lb figcaption a { color: #7cc4ff; }
.lb-n { display: inline-block; font-size: .75rem; opacity: .6; margin-right: 6px; }
.lb-x { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #ffffff22; color: #fff; font-size: 1.2rem; cursor: pointer; z-index: 2; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border: 0; border-radius: 12px; background: #ffffff1a; color: #fff; font-size: 2rem; cursor: pointer; z-index: 2; }
.lb-prev { left: 10px; } .lb-next { right: 10px; }
.lb-nav:hover, .lb-x:hover { background: #ffffff33; }


/* przykłady w quizie / fiszkach */
.qex { margin-top: 14px; text-align: center; }
.qex-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: 8px; }
.qex-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 205px)); gap: 8px; justify-content: center; }
.qex-img { padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.qex-img img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.qex-cap { margin: 10px auto 0; max-width: 620px; font-size: .88rem; color: var(--muted); text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.fc-ex { margin-top: 4px; }
.fc-ex .qex-title { display: none; }
.fc-ex .qex-grid { grid-template-columns: repeat(auto-fit, minmax(110px, 170px)); }

/* ───────── Mobile ───────── */
@media (max-width: 860px) {
  .sections { columns: 1; }
  .guides { columns: 1; }
  .facts { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  body { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
  .topbar { padding: 8px 16px; padding-top: calc(8px + env(safe-area-inset-top)); backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); }
  .brand { flex: 1; }
  .tabs {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; gap: 0; justify-content: space-around;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabs a { flex-direction: column; gap: 1px; padding: 4px 2px; flex: 1; font-size: .7rem; border-radius: 10px; }
  .tabs a .ti { font-size: 1.35rem; transition: transform .15s; }
  .tabs a.active { background: none; color: var(--accent); }
  .tabs a.active .ti { transform: translateY(-2px) scale(1.1); }
  main { padding: 12px 14px 24px; }
  .hero { padding: 20px 18px; border-radius: 18px; }
  .hero p { display: none; }
  .hero h1 { font-size: 1.35rem; margin-bottom: 12px; }
  .cgrid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .ccard { padding: 12px; gap: 6px; }
  .ccard-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .ccard h3 { font-size: 1rem; }
  .ccard .sub { font-size: .72rem; }
  .ccard p { -webkit-line-clamp: 3; font-size: .8rem; line-height: 1.4; }
  .ccard .tags { display: none; }
  .cp-head { flex-wrap: wrap; gap: 14px; padding: 16px; }
  .cp-head .flag.xl { width: 84px; height: 56px; border-radius: 8px; }
  .cp-head > div { flex: 1 1 200px; }
  .cp-summary { font-size: .95rem; }
  .facts { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .fact { padding: 8px 4px; border-radius: 12px; }
  .fact small { font-size: .6rem; letter-spacing: .02em; }
  .fact b { font-size: .92rem; }
  .sec { padding: 14px 14px; }
  .sec li { font-size: .95rem; }
  .cp-nav a { font-size: .85rem; padding: 10px; }
  .toc { top: 56px; }
  .compare { grid-template-columns: 1fr; }
  .chips.wrap { flex-wrap: nowrap; overflow-x: auto; }
  .ctabs { top: 56px; margin-left: -4px; margin-right: -4px; }
  .ctabs button { font-size: .8rem; padding: 8px 9px; flex: 1 0 auto; }
  .cp-body .toc { top: 108px; }
  .pgrid { grid-template-columns: 1fr; }
  .ptext { font-size: .9rem; }
  .ggrid { grid-template-columns: repeat(2, 1fr); }
  .lb-nav { display: none; }
  .lb img { max-height: 66vh; }
  .lb figcaption { max-height: 22vh; font-size: .88rem; }
  .selects { grid-template-columns: 1fr 1fr; }
  .selects label:last-child { grid-column: 1 / -1; }
  .flashcard { height: 330px; }
  .fc-actions { grid-template-columns: 1fr 1fr; }
  .fc-actions #fcFlip { grid-column: 1 / -1; order: -1; }
  kbd { display: none; }
  .answers { grid-template-columns: 1fr; }
  .qex-grid { grid-template-columns: repeat(2, 1fr); }
  .qex-grid .qex-img:nth-child(n+3) { display: none; }
  .flag.xl { width: 150px; height: 100px; }
}
@media (max-width: 380px) {
  .cgrid { grid-template-columns: 1fr; }
}
