:root {
  font-family: system-ui, sans-serif;
  color: #18352f;
  background: #f4f2e9;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse 800px 420px at 50% 0, #e2ede2, transparent);
}
.masthead {
  background: #112b27;
  color: #fff9e9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right), calc((100% - 656px) / 2)) 12px max(16px, env(safe-area-inset-left), calc((100% - 656px) / 2));
}
.wordmark { display: flex; align-items: center; gap: 10px; font-weight: 750; }
.wordmark img { border-radius: 8px; }
time { color: #d7e9df; font-size: .8125rem; white-space: nowrap; }
main {
  max-width: 680px;
  margin: auto;
  padding: clamp(24px, 6vw, 48px) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
}
.intro { margin: 0 4px clamp(18px, 4vw, 28px); }
.intro p { color: #3d5950; max-width: 52ch; }
h1 { font-family: Georgia, serif; font-size: clamp(2rem, 7vw, 3.5rem); letter-spacing: -.04em; line-height: 1.05; margin: 0 0 10px; }
p { margin: 0; line-height: 1.5; }
.game {
  background: #fffdf7;
  border: 1px solid #d1dcd1;
  border-radius: 20px;
  padding: clamp(12px, 4vw, 26px);
  box-shadow: 0 12px 36px #18352f13;
}
.board { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: clamp(22px, 10vw, 92px); position: relative; }
.column { min-width: 0; }
.column h2 { margin: 0 0 10px; color: #3d5950; font-size: .75rem; letter-spacing: .09em; text-align: center; text-transform: uppercase; }
.tiles { display: grid; gap: 8px; }
#links { position: absolute; width: 100%; height: 100%; pointer-events: none; }
#links path { fill: none; stroke-width: 2.5px; }
button, textarea { font: inherit; }
button {
  cursor: pointer;
  min-height: 44px;
  border-radius: 11px;
  border: 1px solid #9baea3;
  background: #fffefa;
  color: #18352f;
  touch-action: manipulation;
}
button:focus-visible, textarea:focus-visible { outline: 3px solid #6346bd; outline-offset: 2px; }
button:disabled { cursor: default; }
.tiles button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  height: clamp(52px, 10vw, 60px);
  padding: 4px clamp(7px, 2vw, 14px);
  overflow-wrap: anywhere;
  line-height: 1.15;
  font-size: clamp(.79rem, 2.9vw, 1rem);
  font-weight: 650;
}
#countries button { text-align: left; }
.country-name { min-width: 0; }
.tiles img {
  display: block;
  margin: auto;
  width: min(100%, 52px);
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 0 1px #28332b85);
}
.pair-tag {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: clamp(20px, 4vw, 26px);
  height: 23px;
  border-radius: 6px;
  color: #fff;
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
}
#flags .pair-tag { order: -1; }
@media (hover: hover) {
  .tiles button:enabled:hover { box-shadow: inset 0 0 0 1px #527963; }
  .actions button:enabled:hover { box-shadow: 0 2px 6px #18352f30; }
}
.tiles [data-state="linked"] { background: #e9efe9; border-color: #a3b5a8; color: #496158; }
.tiles [data-state="linked"] img { opacity: .62; }
.tiles [aria-pressed="true"] { background: #eae1ff; border: 2px solid #6346bd; }
.tiles [aria-pressed="true"] img { opacity: 1; }
.tiles [data-state="correct"] { background: #ddf2e5; border-color: #347653; }
.tiles [data-state="incorrect"] { background: #fbe5e6; border: 1px dashed #a12940; }
#feedback { margin: 18px 0 10px; padding-top: 14px; border-top: 1px solid #d1dcd1; text-align: center; font-weight: 700; }
#score-grid { margin: 0 0 12px; font-size: clamp(.875rem, 4vw, 1.125rem); text-align: center; }
.actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.actions button { padding: 8px 16px; font-weight: 650; }
.primary { color: #fff; background: #17644f; border-color: #17644f; }
.actions button:disabled { background: #e9ebe4; color: #52655d; border-color: #bac3b8; }
textarea { margin-top: 10px; width: 100%; min-height: 112px; padding: 8px; }
footer { text-align: center; font-size: .75rem; padding: 14px 0 calc(14px + env(safe-area-inset-bottom)); }
