/* Flag Quiz / Capital Quiz (browser versions). Shared stylesheet: copied into each game by
   _src/webgames/build.mjs. The game sets <html data-game="flag|capital">, which picks the accent. */
:root {
  --navy: #2B3155;
  --sky-top: #7FA6E6;
  --sky-mid: #C9C7F0;
  --sky-bottom: #FDE3EC;
  --bg: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 42%, var(--sky-bottom) 100%);
  --bg-solid: #C9C7F0;
  --surface: #FFFFFF;
  --surface-2: #F2F4FA;
  --surface-3: #E6E9F4;
  --text: #2B3155;
  --muted: #565D80;
  --line: rgba(43, 49, 85, 0.14);
  --line-strong: rgba(43, 49, 85, 0.28);
  --on-sky: #2B3155;
  --header-bg: rgba(43, 49, 85, 0.88);
  --shadow: 0 6px 20px rgba(43, 49, 85, 0.12);
  --shadow-lift: 0 10px 26px rgba(43, 49, 85, 0.18);
  --correct: #17693A;
  --correct-bg: #E1F3E7;
  --correct-line: #2E9A57;
  --wrong: #B3261E;
  --wrong-bg: #FDE7E4;
  --wrong-line: #E0574B;
  --star: #F2A900;
  --star-off: #CBD0E2;
  --focus: #1B4FD1;
  --radius: 20px;
  --radius-sm: 14px;
  /* accent (flag game: blue) */
  --accent: #1F5FC4;
  --accent-ink: #FFFFFF;
  --accent-text: #1A53AE;
  --accent-soft: #E3ECFB;
  --accent-line: #8FB1EA;
  color-scheme: light;
}
html[data-game="capital"] {
  --accent: #EBA918;
  --accent-ink: #1F2547;
  --accent-text: #7A4F00;
  --accent-soft: #FCF1D6;
  --accent-line: #E6C46B;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: linear-gradient(180deg, #1A2046 0%, #1B1F3D 45%, #261C36 100%);
    --bg-solid: #1B1F3D;
    --surface: #242A50;
    --surface-2: #2C3360;
    --surface-3: #363E70;
    --text: #EEF0FA;
    --muted: #B4BADB;
    --line: rgba(238, 240, 250, 0.14);
    --line-strong: rgba(238, 240, 250, 0.3);
    --on-sky: #EEF0FA;
    --header-bg: rgba(20, 25, 56, 0.72);
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    --shadow-lift: 0 10px 26px rgba(0, 0, 0, 0.4);
    --correct: #8BE3A8;
    --correct-bg: #1C3D2C;
    --correct-line: #4CBF77;
    --wrong: #FFAAA1;
    --wrong-bg: #4A2226;
    --wrong-line: #F0786C;
    --star: #FFC93D;
    --star-off: #4F5788;
    --focus: #9DC0FF;
    --accent: #8DB5FF;
    --accent-ink: #0F1733;
    --accent-text: #A9C6FF;
    --accent-soft: #2B3A6C;
    --accent-line: #5674B8;
    color-scheme: dark;
  }
  :root[data-game="capital"]:not([data-theme="light"]) {
    --accent: #F4C451;
    --accent-ink: #1F2547;
    --accent-text: #F6CF6E;
    --accent-soft: #4A4030;
    --accent-line: #A88A3E;
  }
}
:root[data-theme="dark"] {
  --bg: linear-gradient(180deg, #1A2046 0%, #1B1F3D 45%, #261C36 100%);
  --bg-solid: #1B1F3D;
  --surface: #242A50;
  --surface-2: #2C3360;
  --surface-3: #363E70;
  --text: #EEF0FA;
  --muted: #B4BADB;
  --line: rgba(238, 240, 250, 0.14);
  --line-strong: rgba(238, 240, 250, 0.3);
  --on-sky: #EEF0FA;
  --header-bg: rgba(20, 25, 56, 0.72);
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  --shadow-lift: 0 10px 26px rgba(0, 0, 0, 0.4);
  --correct: #8BE3A8;
  --correct-bg: #1C3D2C;
  --correct-line: #4CBF77;
  --wrong: #FFAAA1;
  --wrong-bg: #4A2226;
  --wrong-line: #F0786C;
  --star: #FFC93D;
  --star-off: #4F5788;
  --focus: #9DC0FF;
  --accent: #8DB5FF;
  --accent-ink: #0F1733;
  --accent-text: #A9C6FF;
  --accent-soft: #2B3A6C;
  --accent-line: #5674B8;
  color-scheme: dark;
}
:root[data-theme="dark"][data-game="capital"] {
  --accent: #F4C451;
  --accent-ink: #1F2547;
  --accent-text: #F6CF6E;
  --accent-soft: #4A4030;
  --accent-line: #A88A3E;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg-solid); }
body {
  font-family: 'Poppins', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg-solid);
  background-image: var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
html[lang="ko"] body { word-break: keep-all; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
button:disabled { cursor: default; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 10px; }
[tabindex="-1"]:focus { outline: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: 12px; font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 10px; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: var(--header-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.top .wrap { display: flex; align-items: center; gap: 10px; height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; }
.brand img { width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-links { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.top-link { display: inline-flex; align-items: center; gap: 6px; color: #fff; text-decoration: none; font-size: 14px; font-weight: 600; padding: 7px 11px; border-radius: 999px; white-space: nowrap; min-height: 38px; }
.top-link:hover { background: rgba(255, 255, 255, 0.2); }
.top-link svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
.top-link.lang { border: 1px solid rgba(255, 255, 255, 0.6); }
.top-link.icon-only { padding: 7px 9px; }
.hide-sm { display: none; }
@media (min-width: 720px) { .hide-sm { display: inline-flex; } }

main { flex: 1; width: 100%; padding: 18px 0 32px; }
.view:focus { outline: none; }

/* Cards and common bits */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.side > .card + .card { margin-top: 14px; }
.eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
html[lang="ko"] .eyebrow { letter-spacing: 0.02em; }
h1, h2, h3 { line-height: 1.25; }
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; color: var(--on-sky); }
.page-head h1 { font-size: clamp(22px, 4vw, 28px); }
.muted { color: var(--muted); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface); color: var(--text); box-shadow: var(--shadow); flex-shrink: 0; text-decoration: none; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 11px 20px; border-radius: 999px; font-weight: 700; font-size: 15.5px; text-decoration: none; background: var(--surface-2); color: var(--text); border: 1.5px solid var(--line); transition: background 0.15s ease, transform 0.15s ease; text-align: center; }
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.navy { background: var(--navy); color: #fff; border-color: transparent; }
.btn.danger { background: var(--wrong-bg); color: var(--wrong); border-color: var(--wrong-line); }
.btn svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
.btn kbd, .choice kbd { font: inherit; }
.btn .kbd-hint { font-size: 12px; font-weight: 600; opacity: 0.8; border: 1px solid currentColor; border-radius: 6px; padding: 0 6px; line-height: 18px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row .btn { flex: 1 1 140px; }

.stars { display: inline-flex; gap: 2px; color: var(--star-off); }
.stars svg { width: 1em; height: 1em; fill: currentColor; }
.stars .on { color: var(--star); }

/* Home */
.home { display: grid; gap: 16px; }
.hero { display: flex; gap: 14px; align-items: center; }
.hero img { width: 64px; height: 64px; border-radius: 18px; flex-shrink: 0; box-shadow: var(--shadow); }
.hero h1 { font-size: clamp(22px, 4.6vw, 30px); }
.hero p { color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.crumbs { font-size: 13.5px; color: var(--on-sky); margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.crumbs a { color: var(--on-sky); font-weight: 600; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span[aria-hidden] { opacity: 0.8; }

.modes { display: grid; gap: 8px; margin-top: 16px; }
.mode { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 2px solid transparent; min-height: 64px; }
.mode:hover { border-color: var(--line-strong); }
.mode[aria-checked="true"] { background: var(--accent-soft); border-color: var(--accent); }
.mode .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); flex-shrink: 0; display: grid; place-items: center; }
.mode[aria-checked="true"] .dot { border-color: var(--accent); }
.mode[aria-checked="true"] .dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.mode .m-title { font-weight: 700; font-size: 15px; display: block; }
.mode .m-desc { font-size: 13px; color: var(--muted); display: block; }
.mode .m-stat { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.mode .m-stat svg { width: 14px; height: 14px; fill: var(--star); }

.progress-box { margin-top: 16px; display: grid; gap: 10px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 10px 6px; text-align: center; }
.stat b { display: block; font-size: 18px; line-height: 1.2; }
.stat span { font-size: 12px; color: var(--muted); }
.bar { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.4s ease; }
.bar-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-weight: 600; }
.home-actions { display: grid; gap: 10px; margin-top: 16px; }
.browse-link { display: flex; align-items: center; gap: 12px; text-decoration: none; padding: 14px 16px; }
.browse-link:hover { box-shadow: var(--shadow-lift); }
.browse-link svg { width: 26px; height: 26px; fill: var(--accent-text); flex-shrink: 0; }
.browse-link b { display: block; }
.browse-link small { color: var(--muted); font-size: 13px; }
.browse-link .chev { margin-left: auto; }

.tier + .tier { margin-top: 22px; }
.tier-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.tier-head h2 { font-size: 16px; }
.tier-head span { font-size: 13px; color: var(--muted); }
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 8px; }
.level { position: relative; aspect-ratio: 1; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: var(--surface-2); border: 2px solid var(--line); color: var(--text); font-weight: 700; font-size: 19px; min-height: 56px; transition: transform 0.12s ease; }
.level:not(:disabled):hover { transform: translateY(-2px); border-color: var(--accent-line); }
.level .stars { font-size: 12px; }
.level.current { background: var(--accent-soft); border-color: var(--accent); }
.level.done { background: var(--surface); border-color: var(--correct-line); }
.level.done.s1, .level.done.s2 { border-color: var(--accent-line); }
.level.locked { color: var(--muted); background: var(--surface-2); opacity: 0.75; }
.level.locked svg.lock { width: 20px; height: 20px; fill: currentColor; }
.level .new { position: absolute; top: -7px; right: -5px; background: var(--accent); color: var(--accent-ink); font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 99px; letter-spacing: 0.02em; }

.about { margin-top: 18px; }
.about h2 { font-size: 17px; margin-bottom: 8px; }
.about p + p { margin-top: 8px; }
.about p, .about li { color: var(--muted); font-size: 14.5px; }
.about ul { margin: 8px 0 0 20px; }

@media (min-width: 900px) {
  .home { grid-template-columns: 360px 1fr; align-items: start; gap: 20px; }
  .home .side { position: sticky; top: 76px; }
  .levels { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
}

/* Quiz */
.quiz { display: grid; gap: 14px; }
.quiz-top { display: flex; align-items: center; gap: 10px; }
.quiz-top .qtitle { flex: 1; min-width: 0; color: var(--on-sky); font-weight: 700; font-size: 15px; line-height: 1.3; }
.quiz-top .qtitle small { display: block; font-weight: 600; font-size: 12.5px; opacity: 0.95; }
.hint-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-weight: 700; font-size: 14px; color: var(--text); }
.hint-btn svg { width: 18px; height: 18px; fill: var(--star); }
.hint-btn:disabled { opacity: 0.55; }
.dots { display: flex; gap: 6px; }
.dots i { flex: 1; height: 8px; border-radius: 99px; background: var(--surface); opacity: 0.7; box-shadow: inset 0 0 0 1px var(--line); }
.dots i.now, .dots i.ok, .dots i.bad { opacity: 1; }
.dots i.now { background: var(--surface); box-shadow: inset 0 0 0 2px var(--accent); }
.dots i.ok { background: var(--correct-line); }
.dots i.bad { background: var(--wrong-line); }
.qcard { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 22px 18px; }
.qcard .prompt { font-size: 14.5px; color: var(--muted); font-weight: 600; }
.qcard h2:focus { outline: none; }
.qflag { width: min(100%, 440px); aspect-ratio: 4 / 3; max-height: 36vh; border-radius: 12px; overflow: hidden; background: var(--surface-2); box-shadow: 0 0 0 1px var(--line), 0 4px 14px rgba(43, 49, 85, 0.12); }
.qflag img { width: 100%; height: 100%; object-fit: contain; }
.qflag.small { width: 112px; max-height: none; border-radius: 8px; }
.qname { font-size: clamp(26px, 6vw, 40px); font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.qsub { font-size: 14px; color: var(--muted); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { position: relative; display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 12px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 2px solid var(--line); box-shadow: var(--shadow); text-align: left; font-weight: 600; font-size: 15.5px; line-height: 1.3; transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease; overflow-wrap: anywhere; }
.choice:not(:disabled):hover { border-color: var(--accent); transform: translateY(-1px); }
.choice .key { flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.choice .label { flex: 1; min-width: 0; }
.choice .mark { flex-shrink: 0; width: 22px; height: 22px; display: none; }
.choice .mark svg { width: 22px; height: 22px; fill: currentColor; }
.choice .mini { width: 36px; aspect-ratio: 4 / 3; border-radius: 4px; overflow: hidden; flex-shrink: 0; box-shadow: 0 0 0 1px var(--line); background: var(--surface-2); }
.choice .mini img { width: 100%; height: 100%; object-fit: cover; }
.choice.is-correct { background: var(--correct-bg); border-color: var(--correct-line); color: var(--correct); }
.choice.is-correct .mark, .choice.is-wrong .mark { display: block; }
.choice.is-wrong { background: var(--wrong-bg); border-color: var(--wrong-line); color: var(--wrong); }
.choice.is-dim { opacity: 0.55; }
.choice.is-out { opacity: 0.35; text-decoration: line-through; }
.choice:disabled { cursor: default; }
/* flag choices (reverse flag mode) */
.choices.flags .choice { flex-direction: column; align-items: stretch; padding: 10px; gap: 8px; }
.choices.flags .choice .key { position: absolute; top: 6px; left: 6px; z-index: 1; background: var(--surface); }
.choices.flags .choice .mark { position: absolute; top: 6px; right: 6px; z-index: 1; background: var(--surface); border-radius: 50%; }
.choices.flags .fimg { aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--surface-2); box-shadow: 0 0 0 1px var(--line); }
.choices.flags .fimg img { width: 100%; height: 100%; object-fit: contain; }
.choices.flags .caption { font-size: 13.5px; text-align: center; min-height: 1.3em; }
.feedback { min-height: 132px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.feedback .fb-idle { color: var(--muted); font-size: 14px; text-align: center; }
.feedback .fb-msg { display: flex; align-items: flex-start; gap: 10px; font-size: 15.5px; }
.feedback .fb-msg svg { width: 26px; height: 26px; fill: currentColor; flex-shrink: 0; }
.feedback.ok .fb-msg { color: var(--correct); }
.feedback.bad .fb-msg { color: var(--wrong); }
.feedback .fb-msg strong { display: block; font-size: 17px; }
.feedback .fb-msg span { color: var(--text); }
.feedback .fb-note { font-size: 13.5px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.feedback .btn { align-self: stretch; }
.quiz-meta { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 99px; background: var(--surface); color: var(--muted); box-shadow: var(--shadow); }
.chip.bad { color: var(--wrong); }
.kbd-help { display: none; }
@media (hover: hover) and (pointer: fine) { .kbd-help { display: block; } }
@media (max-width: 379px) {
  .choice { font-size: 14.5px; padding: 10px; gap: 8px; }
  .choice .key { width: 22px; height: 22px; font-size: 12px; }
  .choices:not(.flags) .choice .mini { display: none; }
}
@media (min-width: 900px) {
  .quiz { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; gap: 18px 22px; }
  .quiz > .quiz-top, .quiz > .dots { grid-column: 1 / -1; }
  .quiz .qcard { min-height: 420px; justify-content: center; padding: 30px; }
  .quiz .qflag { max-height: 330px; }
  .quiz .qflag.small { width: 200px; max-height: none; }
  .quiz .answer-col { display: grid; gap: 14px; }
  .choices:not(.flags) { grid-template-columns: 1fr; }
  .choice { min-height: 62px; }
}
.answer-col { display: grid; gap: 14px; }

/* Result */
.result { display: grid; gap: 14px; }
.res-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 18px; background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); }
.res-hero .res-level { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.res-hero h1 { font-size: clamp(26px, 5vw, 34px); }
.res-hero .stars { font-size: 42px; gap: 6px; margin: 4px 0; }
.res-hero .stars svg { filter: drop-shadow(0 2px 3px rgba(43, 49, 85, 0.2)); }
.res-hero .stars .on { animation: pop 0.45s cubic-bezier(.2, 1.6, .5, 1) both; }
.res-hero .stars .on:nth-child(2) { animation-delay: 0.12s; }
.res-hero .stars .on:nth-child(3) { animation-delay: 0.24s; }
@keyframes pop { from { transform: scale(0.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.res-hero p { color: var(--muted); font-size: 14.5px; }
.res-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.res-stats .stat b { font-size: 20px; }
.res-stats .stat.ok b { color: var(--correct); }
.res-stats .stat.bad b { color: var(--wrong); }
.review h2 { font-size: 16px; margin-bottom: 10px; }
.review ul { list-style: none; }
.review li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.review li:first-child { border-top: 0; }
.review .thumb { width: 48px; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; flex-shrink: 0; box-shadow: 0 0 0 1px var(--line); background: var(--surface-2); }
.review .thumb img { width: 100%; height: 100%; object-fit: cover; }
.review .r-body { flex: 1; min-width: 0; }
.review .r-main { font-weight: 600; overflow-wrap: anywhere; }
.review .r-sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.review .r-sub.bad { color: var(--wrong); }
.review .r-note { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tag { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 99px; white-space: nowrap; }
.tag.ok { background: var(--correct-bg); color: var(--correct); }
.tag.bad { background: var(--wrong-bg); color: var(--wrong); }
.all-clear { display: flex; gap: 10px; align-items: center; color: var(--correct); font-weight: 600; }
.all-clear svg { width: 24px; height: 24px; fill: currentColor; }
/* Ad slot hook: empty and hidden; takes no space until a future ad integration fills and shows it. */
.ad-slot[hidden] { display: none !important; }
@media (min-width: 900px) {
  .result { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 18px 22px; }
  .result .res-left { display: grid; gap: 14px; position: sticky; top: 76px; }
}
.res-left, .res-right { display: grid; gap: 14px; }

/* Settings */
.settings { max-width: 680px; margin: 0 auto; }
.set-group + .set-group { margin-top: 14px; }
.set-group h2 { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
html[lang="ko"] .set-group h2 { letter-spacing: 0.02em; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.set-row:first-of-type { border-top: 0; }
.set-row .s-label { font-weight: 600; }
.set-row > span:first-child:not(.s-label) { flex: 1 1 180px; min-width: 0; }
.set-row.sw-row { flex-wrap: nowrap; }
.set-row.sw-row > span:first-child { flex: 1 1 auto; }
.set-row .s-desc { display: block; font-size: 13px; color: var(--muted); font-weight: 500; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button { min-height: 40px; padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(43, 49, 85, 0.18); }
.switch { width: 54px; height: 32px; border-radius: 99px; background: var(--surface-3); border: 2px solid var(--line-strong); position: relative; flex-shrink: 0; transition: background 0.15s ease; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.15s ease; }
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(22px); }
.links-list { list-style: none; display: grid; gap: 4px; }
.links-list a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; font-weight: 600; text-decoration: none; border-top: 1px solid var(--line); }
.links-list li:first-child a { border-top: 0; }
.links-list a:hover { color: var(--accent-text); }
.credit { font-size: 13px; color: var(--muted); margin-top: 10px; }

dialog { margin: auto; border: 0; border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 22px; width: min(92vw, 420px); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
dialog::backdrop { background: rgba(20, 24, 50, 0.55); }
dialog h2 { font-size: 19px; margin-bottom: 8px; }
dialog p { color: var(--muted); margin-bottom: 18px; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lift); z-index: 60; max-width: calc(100vw - 32px); text-align: center; }

/* List page */
.list-head { color: var(--on-sky); margin-bottom: 14px; }
.list-head h1 { font-size: clamp(24px, 4.6vw, 34px); }
.list-head p { opacity: 0.95; margin-top: 4px; max-width: 760px; }
.filters { display: grid; gap: 10px; padding: 12px; margin-bottom: 14px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 999px; padding: 0 14px; border: 2px solid transparent; }
.search:focus-within { border-color: var(--accent); }
.search svg { width: 20px; height: 20px; fill: var(--muted); flex-shrink: 0; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; min-height: 44px; font-size: 16px; outline: none; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.chips button { flex-shrink: 0; min-height: 36px; padding: 5px 13px; border-radius: 999px; background: var(--surface-2); font-weight: 600; font-size: 13.5px; color: var(--muted); border: 1.5px solid transparent; }
.chips button[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }
@media (min-width: 720px) { .filters { position: sticky; top: 58px; z-index: 10; } }
.count { font-size: 13px; color: var(--muted); font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; list-style: none; }
.entry { display: flex; align-items: flex-start; gap: 12px; padding: 12px; background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow); height: 100%; }
#list > li { scroll-margin-top: 80px; }
@media (min-width: 720px) { #list > li { scroll-margin-top: 230px; } }
.entry .eflag { width: 84px; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; flex-shrink: 0; box-shadow: 0 0 0 1px var(--line); background: var(--surface-2); }
.entry .eflag img { width: 100%; height: 100%; object-fit: cover; }
.entry .ebody { min-width: 0; flex: 1; }
.entry h2 { font-size: 15.5px; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.entry .cap { display: flex; flex-direction: column; font-size: 14px; margin-top: 4px; overflow-wrap: anywhere; }
.entry .cap .lbl { order: 0; font-size: 12px; color: var(--muted); font-weight: 600; }
.entry .n-en, .entry .n-ko { order: 1; }
html[lang="en"] .entry .n-ko, html[lang="ko"] .entry .n-en { order: 2; font-size: 13px; font-weight: 500; color: var(--muted); }
.entry .cap .n-en, .entry .cap .n-ko { font-weight: 600; }
html[lang="en"] .entry .cap .n-ko, html[lang="ko"] .entry .cap .n-en { font-weight: 500; font-size: 12.5px; }
.entry .meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.entry .note { font-size: 12.5px; color: var(--muted); margin-top: 6px; border-left: 3px solid var(--accent-line); padding-left: 8px; }
.entry .look { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.entry .look a { color: var(--accent-text); font-weight: 600; text-decoration: none; }
.entry .look a:hover { text-decoration: underline; }
#list > li:target .entry { box-shadow: 0 0 0 3px var(--accent), var(--shadow); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.lang-ko, .lang-en { display: none; }
html[lang="ko"] .lang-ko, html[lang="en"] .lang-en { display: inline; }
html[lang="ko"] div.lang-ko, html[lang="en"] div.lang-en, html[lang="ko"] p.lang-ko, html[lang="en"] p.lang-en { display: block; }

/* Footer */
.foot { padding: 20px 0 30px; text-align: center; font-size: 13.5px; color: var(--muted); }
.foot nav { display: flex; justify-content: center; gap: 6px 16px; flex-wrap: wrap; margin-bottom: 6px; }
.foot a { color: var(--text); font-weight: 600; text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.foot .card { padding: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0s !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
