:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #14283a;
  background: #f3f4ed;
  --border: #d8dfd7;
  --muted: #4e625f;
  --green: #145548;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.masthead { background: #fcfdf8; border-bottom: 1px solid var(--border); }
.header-inner { max-width: 1160px; margin: auto; padding: 14px 24px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.brand { font-weight: 750; font-size: 1.16rem; display: flex; gap: 10px; align-items: center; margin-right: auto; }
.mark { background: var(--green); color: white; border-radius: 10px; width: 36px; text-align: center; line-height: 36px; }
nav { display: flex; gap: 6px; }
nav button { border-color: transparent; background: transparent; }
button, select, input { font: inherit; color: inherit; }
button, select { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; background: #fff; cursor: pointer; }
button:hover, button[aria-pressed="true"] { background: #deeee5; color: #124a3e; }
button, label { font-weight: 650; }
:focus-visible { outline: 3px solid #387c6a; outline-offset: 3px; }
main { max-width: 1160px; margin: auto; padding: clamp(24px, 5vh, 44px) 24px; }
.intro { margin-bottom: 32px; }
h1 { font: 500 clamp(2.6rem, 6vw, 5.1rem)/1.04 Georgia, serif; letter-spacing: -.045em; margin: 0; }
.intro p { color: var(--muted); font-size: 1.08rem; }
#quiz-view .intro {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 20px;
  margin-bottom: 18px;
}
#quiz-view .intro h1 {
  font-size: clamp(1.5rem, 2.35vw, 2rem);
  line-height: 1.2;
  letter-spacing: -.025em;
}
#quiz-view .intro p { margin: 0; font-size: .9rem; line-height: 1.45; }
.game-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.game-options button { display: grid; gap: 8px; text-align: start; padding: 24px; }
.game-options strong { font-size: 1.2rem; color: var(--green); }
.game-options span { color: var(--muted); font-weight: 400; }
.game-title { color: var(--green); font-weight: 700; margin: 0 0 8px; }
.scoreboard { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.scoreboard > span { background: #fcfdf8; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.scoreboard strong { margin-inline-start: 6px; color: var(--green); font-variant-numeric: tabular-nums; }
.layout { display: grid; grid-template-columns: 1.38fr 1fr; gap: 20px; align-items: start; }
.flag-card, .answer-card, .gallery-card { border: 1px solid var(--border); border-radius: 20px; margin: 0; }
.flag-card { padding: clamp(20px, 5vw, 60px); min-height: 330px; display: grid; place-items: center; background: #e5ece5; }
img { display: block; height: auto; max-width: 100%; box-shadow: 0 9px 24px #14283a26; }
#flag { max-height: 260px; }
.answer-card { background: #fcfdf8; padding: clamp(18px, 3vw, 30px); }
.wager-controls { align-items: center; margin-bottom: 14px; }
.wager-controls input { width: min(100%, 9rem); margin: 0; }
#wager-result { margin-bottom: 0; }
input { display: block; width: 100%; padding: 12px; margin: 10px 0 14px; border: 1px solid #a0b1a8; border-radius: 10px; background: white; }
.actions, .hint-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.primary, .primary:hover { background: var(--green); color: white; border-color: transparent; }
.primary:hover { filter: brightness(1.17); }
.first { color: var(--muted); overflow-wrap: anywhere; }
h2 { font-size: 1rem; }
#help { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 6px; }
#hint-panel { margin-top: 12px; padding: 12px; background: #eaf1ea; border-radius: 10px; }
#clue:empty { display: none; }
#clue { margin: 0; }
#result { margin: 16px 0; border-radius: 10px; padding: 12px; font-weight: 650; }
#result[data-outcome="correct"] { background: #dcefe1; }
#result[data-outcome="incorrect"] { background: #f8e1e1; }
#result-message { margin: 0 0 8px; }
#result-names { margin: 0; padding: 0; list-style: none; }
#result-names li { display: flex; flex-wrap: wrap; column-gap: 8px; align-items: baseline; }
#result-names li + li { margin-top: 4px; }
.result-language { color: var(--muted); font-size: .85rem; font-weight: 400; }
.gallery-card { padding: 16px; background: #fcfdf8; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 16px; }
.gallery-image { height: 110px; display: grid; place-items: center; }
.gallery-image img { max-height: 110px; }
.gallery-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; max-width: 800px; }
.gallery-filters label { display: grid; gap: 6px; }
.gallery-filters input, .gallery-filters select { width: 100%; margin: 0; }
#gallery-count { color: var(--muted); }
figcaption { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 10px 20px; justify-content: space-between; }
a { color: var(--green); }
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .flag-card { min-height: 0; }
  .header-inner { gap: 10px; }
}
.leaderboard-controls { align-items: center; }
.leaderboard-table { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: #fcfdf8; }
.leaderboard-table table { width: 100%; border-collapse: collapse; text-align: start; font-variant-numeric: tabular-nums; }
.leaderboard-table th, .leaderboard-table td { padding: 12px; border-bottom: 1px solid var(--border); text-align: start; }
.leaderboard-table th { background: #e6eee4; }
.leaderboard-table td { white-space: nowrap; }
.leaderboard-table tr:last-child td { border-bottom: 0; }
