/* flags-quiz.com — one stylesheet, no framework. iOS-like look: grouped gray background, white cards, blue accent. */
:root {
    --bg: #f2f2f7; --card: #fff; --card-2: #f7f7fa; --text: #1c1c1e; --muted: #6e6e73; --line: #e3e3e8;
    --accent: #007aff; --accent-soft: #e5f0ff; --green: #34c759; --green-soft: #e3f8e8; --red: #ff3b30; --red-soft: #ffe7e5;
    --gold: #ffb800; --orange: #ff9500; --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 20px rgba(0, 0, 0, .06);
    --r: 16px; --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #000; --card: #1c1c1e; --card-2: #2c2c2e; --text: #f5f5f7; --muted: #98989f; --line: #38383a;
        --accent: #0a84ff; --accent-soft: #0a2a4d; --green: #30d158; --green-soft: #0f3a1c; --red: #ff453a; --red-soft: #4a1512;
        --shadow: 0 1px 2px rgba(0, 0, 0, .5); color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #000; --card: #1c1c1e; --card-2: #2c2c2e; --text: #f5f5f7; --muted: #98989f; --line: #38383a;
    --accent: #0a84ff; --accent-soft: #0a2a4d; --green: #30d158; --green-soft: #0f3a1c; --red: #ff453a; --red-soft: #4a1512;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; }
h1 { font-size: clamp(28px, 6vw, 40px); margin: 8px 0 8px; font-weight: 800; color: var(--accent); }
h2 { font-size: 21px; margin: 36px 0 12px; }
p { margin: 0 0 12px; }
svg { width: 20px; height: 20px; flex: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

.wrap { width: 100%; max-width: 920px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.lead { font-size: 18px; color: var(--muted); max-width: 640px; }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.top-in { max-width: 920px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--text); margin-right: auto; }
.logo:hover { text-decoration: none; }
.logo-mark { display: inline-flex; width: 30px; height: 22px; border-radius: 5px; overflow: hidden; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.logo-mark { background: linear-gradient(90deg, #007aff 0 25%, #34c759 0 50%, #ffcc00 0 75%, #ff3b30 0); }
.logo-mark i { display: none; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent-soft); color: var(--accent); display: inline-grid; place-items: center; cursor: pointer; transition: transform .15s; }
.icon-btn:active { transform: scale(.92); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-weight: 700; }
.points { background: #fff4d6; color: #b47b00; }
:root[data-theme="dark"] .points { background: #3a2e05; color: #ffcc00; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .points { background: #3a2e05; color: #ffcc00; } }
.points.bump { animation: bump .45s; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-weight: 650; cursor: pointer; transition: transform .12s, background .2s, box-shadow .2s; }
.btn:hover { text-decoration: none; box-shadow: var(--shadow); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-lg { min-height: 52px; padding: 12px 28px; font-size: 18px; border-radius: 14px; }
.btn-ghost { background: transparent; }

/* Cards and lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-list { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .card-list { grid-template-columns: 1fr 1fr; } }
.quiz-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; color: var(--text); transition: box-shadow .18s, border-color .18s; }
.quiz-card:hover { text-decoration: none; box-shadow: 0 10px 28px rgba(0, 0, 0, .1); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.quiz-icon { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); background: var(--card-2); flex: none; }
.quiz-text { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.quiz-text strong { color: var(--accent); font-size: 17px; }
.quiz-text small { color: var(--muted); }
.stars { display: inline-flex; gap: 2px; color: #d1d1d6; }
.stars svg { width: 18px; height: 18px; }
.stars .on { color: var(--gold); }
.stars-lg svg { width: 34px; height: 34px; }

/* Home */
.hero { text-align: center; padding: 28px 0 8px; }
.hero h1 { font-size: clamp(36px, 8vw, 56px); text-shadow: 0 2px 12px color-mix(in srgb, var(--accent) 25%, transparent); }
.hero .lead { margin: 0 auto 20px; }
.hero-flags { display: flex; justify-content: center; gap: 10px; margin-top: 28px; flex-wrap: wrap; }
.hero-flags img { width: 60px; height: 40px; object-fit: cover; border-radius: 6px; box-shadow: 0 3px 10px rgba(0, 0, 0, .18); animation: float 4s ease-in-out infinite; animation-delay: calc(var(--i) * -.35s); }
.gallery-links { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.gallery-link { padding: 14px; display: flex; flex-direction: column; gap: 4px; color: var(--text); transition: box-shadow .18s, border-color .18s; }
.gallery-link:hover { text-decoration: none; box-shadow: 0 10px 28px rgba(0, 0, 0, .1); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.gallery-link strong { color: var(--accent); }
.gallery-link small { color: var(--muted); }
.mini-flags { display: flex; gap: 4px; margin-bottom: 6px; }
.mini-flags img { width: 36px; height: 24px; object-fit: cover; border-radius: 4px; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.prose { max-width: 720px; }

/* Breadcrumbs, FAQ, how-to */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 14px; color: var(--muted); padding-top: 16px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 650; }
.faq details p { margin: 8px 0 0; color: var(--muted); }
.how ol { margin: 0; padding-left: 22px; }
.how li { margin: 4px 0; }
.quiz-head { padding: 8px 0 4px; }

/* Flag grid (galleries, similar flags) */
.flag-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.flag-grid a { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 12px 8px; height: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 14px; color: var(--text); transition: box-shadow .18s, border-color .18s; }
.flag-grid a:hover { text-decoration: none; box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.flag-grid img { width: 100%; max-width: 140px; height: 84px; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .18)); }
.fg-name { font-weight: 650; font-size: 15px; line-height: 1.25; }
.fg-sub { font-size: 13px; color: var(--muted); }
.flag-grid li[hidden] { display: none; }
.filters { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.search { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; color: var(--muted); }
.search input { border: 0; background: transparent; color: var(--text); font: inherit; padding: 12px 0; width: 100%; outline: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Country page */
.country { display: grid; gap: 20px; margin-top: 12px; }
@media (min-width: 760px) { .country { grid-template-columns: 1.15fr 1fr; align-items: center; } }
.country-flag { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 24px; display: grid; place-items: center; box-shadow: var(--shadow); }
.country-flag img { max-height: 320px; width: auto; border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); animation: rise .5s ease-out; }
.country-info h1 { margin-top: 0; }
.facts { margin: 0 0 16px; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; background: var(--card); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-weight: 600; }
.swatches { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.swatch { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.swatch::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .2); background: var(--c); }
.sw-red { --c: #d52b1e; } .sw-maroon { --c: #8a1538; } .sw-orange { --c: #ff8200; } .sw-yellow { --c: #fcd116; } .sw-green { --c: #009a44; }
.sw-lightblue { --c: #6cace4; } .sw-blue { --c: #0038a8; } .sw-white { --c: #fff; } .sw-black { --c: #000; }
.cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 20px; margin-top: 28px; }
.cta h2 { margin: 0 0 4px; }
.cta p { margin: 0; color: var(--muted); }
.cta-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Language sheet */
.sheet { border: 0; border-radius: 20px; padding: 0; width: min(560px, calc(100% - 24px)); background: var(--card); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.sheet::backdrop { background: rgba(0, 0, 0, .35); backdrop-filter: blur(3px); }
.sheet[open] { animation: rise .25s ease-out; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; padding: 12px; }
.lang-grid a, .foot-langs a { padding: 10px 12px; border-radius: 10px; color: var(--text); }
.lang-grid a:hover { background: var(--card-2); text-decoration: none; }
.lang-grid a[aria-current], .foot-langs a[aria-current] { color: var(--accent); font-weight: 700; }

/* Footer */
.foot { margin-top: 56px; padding: 32px 0 24px; border-top: 1px solid var(--line); background: var(--card); }
.foot-grid { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .foot-grid { grid-template-columns: 1.2fr 1fr 1fr 1fr; } }
.foot-grid nav { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.foot-grid nav a { color: var(--muted); }
.foot-brand { font-weight: 800; font-size: 18px; margin: 0 0 6px; }
.foot-h { font-weight: 700; margin: 0 0 4px; }
.foot-langs { display: flex; flex-wrap: wrap; gap: 2px 4px; margin-top: 24px; font-size: 14px; }
.foot-langs a { padding: 4px 8px; color: var(--muted); }

/* ---------------- Game ---------------- */
.game { margin: 16px 0 8px; padding: 20px; min-height: 360px; position: relative; overflow: hidden; scroll-margin-top: 70px; }
.g-start { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 12px 0; }
.g-start-icon { width: 72px; height: 72px; border-radius: 50%; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
.g-start-meta { margin: 0; color: var(--muted); font-weight: 600; }
.seg { display: inline-flex; flex-wrap: wrap; justify-content: center; background: var(--card-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--muted); transition: background .2s, color .2s; }
.seg input:checked + span { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.seg input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); }
.keys-hint { margin: 0; }

.g-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-weight: 700; }
.g-bar .g-count { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: auto; }
.g-lives { display: inline-flex; gap: 3px; color: var(--red); }
.g-lives svg { width: 20px; height: 20px; transition: transform .3s, opacity .3s; }
.g-lives .lost { opacity: .18; transform: scale(.7); }
.g-streak { display: inline-flex; align-items: center; gap: 3px; color: var(--orange); font-variant-numeric: tabular-nums; }
.g-streak.hot svg { animation: flame .6s ease-in-out infinite alternate; }
.g-progress { height: 6px; background: var(--card-2); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.g-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #5ac8fa); border-radius: inherit; transition: width .45s cubic-bezier(.2, .8, .2, 1); }
.g-timer { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.g-timer.low { color: var(--red); animation: pulse .8s infinite; }
.g-tool { border: 1px solid var(--line); background: var(--card-2); border-radius: 10px; padding: 6px 10px; font-weight: 700; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.g-tool svg { width: 16px; height: 16px; color: #b47b00; }
.g-tool:disabled { opacity: .45; cursor: default; }

.g-q { text-align: center; animation: slideIn .35s cubic-bezier(.2, .8, .2, 1); }
.g-q.out { animation: slideOut .22s ease-in forwards; }
.g-flag { height: clamp(150px, 34vw, 220px); display: grid; place-items: center; margin: 0 auto 14px; }
.g-flag img { max-height: clamp(150px, 34vw, 220px); max-width: min(100%, 360px); width: auto; border-radius: 6px; box-shadow: 0 10px 28px rgba(0, 0, 0, .2); }
.g-prompt { font-size: 19px; font-weight: 700; margin: 0 0 16px; }
.g-prompt b { color: var(--accent); }
.g-opts { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .g-opts { grid-template-columns: 1fr 1fr; } }
.g-opt { position: relative; min-height: 54px; padding: 12px 16px 12px 44px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); font-weight: 650; font-size: 17px; text-align: left; cursor: pointer; transition: transform .12s, border-color .2s, background .2s, opacity .3s; animation: pop .3s backwards; animation-delay: calc(var(--i) * 50ms); }
.g-opt::before { content: attr(data-key); position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; border-radius: 6px; background: var(--card-2); color: var(--muted); font-size: 12px; display: grid; place-items: center; }
.g-opt:hover:not(:disabled) { border-color: var(--accent); }
.g-opt:active:not(:disabled) { transform: scale(.98); }
.g-opt:disabled { cursor: default; }
.g-opt.correct { border-color: var(--green); background: var(--green-soft); animation: correct .45s; }
.g-opt.wrong { border-color: var(--red); background: var(--red-soft); animation: shake .4s; }
.g-opt.dim { opacity: .45; }
.g-opt.gone { opacity: .15; pointer-events: none; }
.g-opts.flags { grid-template-columns: 1fr 1fr; }
.g-opts.flags .g-opt { padding: 12px; display: grid; place-items: center; min-height: 120px; }
.g-opts.flags .g-opt img { max-height: 96px; width: auto; border-radius: 4px; box-shadow: 0 3px 10px rgba(0, 0, 0, .18); }
.g-opts.flags .g-opt::before { top: 12px; transform: none; left: 12px; }
.g-sub { color: var(--muted); font-weight: 600; margin: -8px 0 14px; }
.g-feedback { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; min-height: 52px; margin-top: 14px; }
.g-feedback .msg { font-weight: 800; font-size: 18px; animation: pop .3s; }
.g-feedback .msg.good { color: var(--green); }
.g-feedback .msg.bad { color: var(--red); }
.g-feedback a { font-weight: 700; }
.float-plus { position: absolute; font-weight: 800; color: var(--green); pointer-events: none; animation: floatUp .9s ease-out forwards; }

/* Spelling */
.g-slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 4px 0 16px; }
.g-slot { width: 36px; height: 44px; border-radius: 9px; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 800; font-size: 20px; text-transform: uppercase; background: var(--card); cursor: pointer; transition: border-color .2s, transform .15s; }
.g-slot.filled { border-color: var(--accent); animation: pop .2s; }
.g-slot.fixed { border-color: transparent; background: transparent; cursor: default; width: 14px; }
.g-slot.next { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.g-slots.good .g-slot.filled { border-color: var(--green); background: var(--green-soft); }
.g-slots.bad { animation: shake .4s; }
.g-slots.bad .g-slot.filled { border-color: var(--red); background: var(--red-soft); }
.g-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.g-tile { min-width: 44px; height: 48px; padding: 0 10px; border-radius: 11px; border: 0; background: var(--accent); color: #fff; font-weight: 800; font-size: 20px; text-transform: uppercase; cursor: pointer; box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 60%, #000); transition: transform .1s, opacity .2s; }
.g-tile:active { transform: translateY(2px); box-shadow: none; }
.g-tile.used { opacity: .15; pointer-events: none; }

/* Flashcards */
.fc { display: flex; flex-direction: column; align-items: center; gap: 16px; padding-top: 4px; }
.fc-card { width: min(440px, 100%); aspect-ratio: 4 / 3; perspective: 1400px; cursor: pointer; touch-action: pan-y; animation: pop .3s; transition: transform .26s ease, opacity .26s ease; }
.fc-card.dragging { transition: none; }
.fc-card.fly-right { transform: translateX(120%) rotate(18deg) !important; opacity: 0; }
.fc-card.fly-left { transform: translateX(-120%) rotate(-18deg) !important; opacity: 0; }
.fc-inner { position: relative; width: 100%; height: 100%; transition: transform .55s cubic-bezier(.2, .8, .2, 1); transform-style: preserve-3d; }
.fc-card.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 22px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(0, 0, 0, .12); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 22px; text-align: center; }
.fc-front img { max-width: 88%; max-height: 78%; width: auto; border-radius: 8px; box-shadow: 0 10px 28px rgba(0, 0, 0, .22); }
.fc-back { transform: rotateY(180deg); background: linear-gradient(160deg, var(--card), var(--card-2)); }
.fc-back img { max-height: 64px; width: auto; border-radius: 5px; box-shadow: 0 3px 10px rgba(0, 0, 0, .18); margin-bottom: 6px; }
.fc-back strong { font-size: clamp(24px, 6vw, 32px); line-height: 1.15; color: var(--accent); }
.fc-cap { font-size: 18px; font-weight: 600; }
.fc-region { color: var(--muted); font-size: 14px; }
.fc-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; font-weight: 650; font-size: 14px; }
.fc-link svg { width: 16px; height: 16px; }
.fc-card.lean-right .fc-back { box-shadow: 0 0 0 3px var(--green), 0 14px 40px rgba(0, 0, 0, .12); }
.fc-card.lean-left .fc-back { box-shadow: 0 0 0 3px var(--orange), 0 14px 40px rgba(0, 0, 0, .12); }
.fc-actions { display: flex; gap: 10px; width: min(440px, 100%); }
.fc-actions .btn { flex: 1; min-height: 52px; font-size: 17px; }
.fc-again { color: var(--orange); }
.fc-knew { background: var(--green); border-color: var(--green); }
.fc-stat { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.fc-stat svg { width: 18px; height: 18px; }
.fc-stat.good { color: var(--green); }
.fc-stat.review { color: var(--orange); }
.fc-hint { margin: 0; }

/* Results */
.g-res { text-align: center; animation: slideIn .4s cubic-bezier(.2, .8, .2, 1); }
.g-res .stars-lg { margin: 6px 0 10px; }
.g-res .stars-lg svg { transform: scale(0); animation: starIn .5s cubic-bezier(.3, 1.6, .5, 1) forwards; }
.g-res .stars-lg svg:nth-child(2) { animation-delay: .15s; } .g-res .stars-lg svg:nth-child(3) { animation-delay: .3s; }
.g-score { font-size: 44px; font-weight: 800; margin: 0; font-variant-numeric: tabular-nums; }
.g-badge { display: inline-block; background: var(--gold); color: #3a2a00; font-weight: 800; border-radius: 999px; padding: 4px 12px; font-size: 14px; animation: pop .4s .5s backwards; }
.g-stats { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.g-stats div { background: var(--card-2); border-radius: 12px; padding: 8px 16px; min-width: 96px; }
.g-stats b { display: block; font-size: 20px; }
.g-stats span { font-size: 13px; color: var(--muted); }
.g-mistakes { text-align: left; max-width: 520px; margin: 18px auto 0; }
.g-mistakes h3 { font-size: 17px; margin: 0 0 8px; }
.g-mistakes ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.g-mistakes li a { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; background: var(--card-2); color: var(--text); }
.g-mistakes img { width: 48px; height: 32px; object-fit: contain; flex: none; }
.g-mistakes small { display: block; color: var(--red); text-decoration: line-through; }
.g-over { position: absolute; inset: 0; background: color-mix(in srgb, var(--card) 94%, transparent); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; animation: fade .25s; z-index: 2; }
.g-over h3 { font-size: 26px; margin: 0; color: var(--red); }

/* Toasts and confetti */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 650; box-shadow: 0 12px 30px rgba(0, 0, 0, .25); animation: toastIn .35s cubic-bezier(.2, .8, .2, 1); max-width: calc(100% - 32px); text-align: center; }
.toast small { display: block; font-weight: 500; opacity: .8; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; }

@keyframes slideIn { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes slideOut { to { opacity: 0; transform: translateX(-28px); } }
@keyframes pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes correct { 40% { transform: scale(1.04); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes bump { 40% { transform: scale(1.18); } }
@keyframes float { 50% { transform: translateY(-6px) rotate(-2deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes flame { to { transform: scale(1.18) rotate(6deg); } }
@keyframes pulse { 50% { opacity: .55; } }
@keyframes floatUp { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-40px); } }
@keyframes starIn { to { transform: scale(1); } }
@keyframes fade { from { opacity: 0; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 20px); } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    .g-res .stars-lg svg { transform: none; }
}
@media (max-width: 480px) {
    .hero-flags { gap: 8px; }
    .hero-flags img { width: 52px; height: 35px; }
    .hero-flags img:nth-child(n+11) { display: none; }
}
.legal { max-width: 760px; }
.legal h2 { font-size: 19px; margin-top: 24px; }
.not-found h1 { font-size: 72px; margin-bottom: 0; }

/* Game types of a level or continent */
.mode-list { display: grid; gap: 10px; grid-template-columns: 1fr; width: 100%; max-width: 720px; text-align: left; }
@media (min-width: 640px) { .mode-list { grid-template-columns: 1fr 1fr; } }
.mode-card { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: box-shadow .18s, border-color .18s; }
.mode-card:hover { text-decoration: none; box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.mode-card:disabled { opacity: .6; cursor: default; }
.mode-card img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 2px 6px rgba(0, 0, 0, .12); background: var(--card-2); }
.mode-text { display: flex; flex-direction: column; margin-right: auto; min-width: 0; }
.mode-text strong { color: var(--accent); font-size: 16px; }
.mode-text small { color: var(--muted); font-size: 13px; min-height: 1em; }
.g-quit { margin-left: 2px; padding: 6px 8px; }
.g-quit svg { color: var(--muted); }

/* Maps game */
.g-globe-wrap { display: grid; place-items: center; margin: 0 auto 10px; }
.g-globe { width: min(320px, 78vw); aspect-ratio: 1; touch-action: none; cursor: grab; border-radius: 50%; }
.g-globe:active { cursor: grabbing; }
.g-map-q .g-q { animation: none; }

/* Back button, confirm dialog, reset links */
.g-back { display: inline-flex; align-items: center; gap: 2px; border: 0; background: var(--card-2); color: var(--accent); font-weight: 700; padding: 6px 12px 6px 6px; border-radius: 999px; cursor: pointer; }
.g-back svg { width: 20px; height: 20px; }
.g-bar .g-count { margin-right: auto; }
.confirm { width: min(400px, calc(100% - 32px)); }
.confirm-in { padding: 22px; text-align: center; }
.confirm-in h3 { margin: 0 0 6px; font-size: 20px; }
.confirm-in p { margin: 0 0 16px; }
.confirm-in .g-actions .btn { flex: 1; }
.link-btn { border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; padding: 6px; }
.link-btn:hover { color: var(--red); }
.g-tile.nope { animation: shake .35s; background: var(--red); }
.g-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* Guide article */
.guide h3 { font-size: 17px; margin: 18px 0 6px; }
.guide p { color: var(--muted); }
.guide-types { margin: 0; padding-left: 20px; color: var(--muted); }
.guide-types li { margin: 4px 0; }
.guide-types strong { color: var(--text); }

/* Phones: one calm row of flags instead of floating ones */
@media (max-width: 480px) {
    .hero-flags { flex-wrap: nowrap; justify-content: center; overflow: hidden; }
    .hero-flags img { animation: none; width: 46px; height: 31px; }
    .hero-flags img:nth-child(n+7) { display: none; }
}
.fc-actions .btn { white-space: nowrap; padding: 10px 12px; font-size: 16px; }
.g-count { white-space: nowrap; }
@media (max-width: 480px) {
    .g-bar { gap: 8px; }
    .g-tool .lbl { display: none; }
    .g-lives svg { width: 18px; height: 18px; }
}

/* Reset progress buttons */
.reset-btn { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; margin-top: 6px; padding: 9px 16px 9px 12px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--red) 28%, var(--line)); background: var(--red-soft); color: var(--red); font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; transition: background .2s, color .2s, box-shadow .2s, opacity .2s; }
.reset-btn svg { width: 18px; height: 18px; }
.reset-btn:hover:not(:disabled) { background: var(--red); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--red) 30%, transparent); }
.reset-btn:disabled { background: var(--card-2); color: var(--muted); border-color: var(--line); cursor: default; opacity: .7; }
.reset-btn.spin svg { animation: spin .7s cubic-bezier(.3, .6, .3, 1); }
.g-start .reset-btn { align-self: center; }
@keyframes spin { to { transform: rotate(-360deg); } }
