:root {
  --bg: #0d1528;
  --surface: #16243e;
  --text: #eef3ff;
  --muted: #a4b4d0;
  --line: #2b3d5d;
  --accent: #9cbaff;
  --accent-ink: #12264d;
  --land: #718caf;
  --ocean: #132c4b;
  --radius: 8px;
  color-scheme: light;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}
@font-face {
  font-family: "Karshvar Flags";
  src: url("./fonts/NotoColorEmoji-flagsonly.ttf") format("truetype");
  font-display: block;
}
@font-face {
  font-family: Vazir;
  src: url("./fonts/Vazir-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Vazir;
  src: url("./fonts/Vazir-Bold.woff2") format("woff2");
  font-weight: 600 900;
  font-display: swap;
}
html[lang="fa"] {
  font-family: Vazir, Tahoma, sans-serif;
}
* {
  box-sizing: border-box;
}
html {
  background: #f7f9ff;
}
html[data-theme="dark"] {
  background: #0d1528;
  color-scheme: dark;
}
html,
body {
  height: 100%;
  overflow: hidden;
}
body {
  margin: 0;
  height: 100dvh;
  min-height: 0;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  background-image: radial-gradient(
    ellipse at 85% 10%,
    #376be315,
    transparent 55%
  );
}
html:not([data-theme="dark"]) {
  --bg: #f7f9ff;
  --surface: #edf2fd;
  --text: #182b4b;
  --muted: #596b88;
  --line: #d4dff1;
  --accent: #285ce1;
  --accent-ink: #fff;
  --land: #8ca9cf;
  --ocean: #e5edfb;
  color-scheme: light;
}
button,
input,
summary {
  font: inherit;
  border-radius: var(--radius);
}
button,
summary {
  cursor: pointer;
}
button,
a,
input,
summary {
  touch-action: manipulation;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
a {
  color: var(--accent);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
[hidden] {
  display: none !important;
}
header {
  position: relative;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  width: min(1200px, 100%);
  padding: 12px 28px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  gap: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  font-size: 28px;
  letter-spacing: -1.2px;
  font-weight: 800;
  text-decoration: none;
  direction: inherit;
  color: var(--text);
}
.settings {
  display: flex;
  gap: 5px;
  align-items: center;
}
.settings button,
.language-picker summary {
  height: 32px;
  min-height: 32px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
}
.settings button {
  width: 32px;
  font-size: 18px;
}
.settings :is(button, summary):focus:not(:focus-visible) {
  outline: none;
}
.language-picker {
  position: relative;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.header-actions .language-picker summary {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-size: 12px;
}
.header-actions .language-picker summary:hover {
  background: color-mix(in srgb, currentColor 10%, transparent);
}
.header-actions .language-options {
  width: 156px;
}
.header-actions .language-options a {
  min-height: 44px;
  color: var(--text);
}
[dir="rtl"] .header-actions .language-options {
  left: 0;
  right: auto;
}
.language-picker summary {
  list-style: none;
  min-width: 46px;
  font-size: 11px;
  gap: 5px;
  line-height: 1;
  user-select: none;
}
.language-picker summary::-webkit-details-marker {
  display: none;
}
.language-options {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 6px);
  width: 124px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 5px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 5px 16px #0002;
  z-index: 20;
  direction: ltr;
}
.language-options a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
}
.language-options a:hover,
.language-options a[aria-current="page"] {
  color: var(--text);
  background: var(--surface);
}
main {
  width: min(1128px, calc(100% - 48px));
  margin: 12px auto 20px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
h1,
h2,
p {
  margin-top: 0;
}
p {
  color: var(--muted);
  line-height: 1.7;
}
h1 {
  font-size: clamp(30px, 4vw, 48px);
  letter-spacing: -1.6px;
  line-height: 1.2;
  margin-bottom: 14px;
}
h2 {
  letter-spacing: -0.6px;
}
html[dir="rtl"] h1,
html[dir="rtl"] h2 {
  letter-spacing: 0;
}
.intro {
  margin-bottom: 22px;
  max-width: 700px;
}
.intro h1 {
  font-size: clamp(27px, 3vw, 38px);
}
.intro p {
  font-size: 14px;
  margin-bottom: 0;
}

.primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  width: 100%;
  min-height: 50px;
  padding: 14px 20px;
  border-radius: var(--radius);
  font-weight: 700;
  text-decoration: none;
  transition:
    transform 0.18s ease,
    filter 0.18s ease;
}
.primary:hover {
  filter: brightness(1.07);
}
.text-button {
  display: block;
  background: transparent;
  border: 0;
  color: var(--muted);
  min-height: 40px;
  padding: 8px 10px;
  margin: 6px auto;
  text-decoration: none;
  text-align: center;
}
.welcome {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: center;
  max-width: 100%;
  position: relative;
}
.welcome-copy {
  max-width: 490px;
  position: relative;
  z-index: 1;
}
.welcome-copy h1 {
  font-size: clamp(40px, 5.5vw, 70px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -2.7px;
}
.welcome-copy p {
  font-size: 17px;
  max-width: 370px;
  margin-bottom: 30px;
}
.welcome-copy .primary {
  max-width: 260px;
  min-height: 56px;
  box-shadow: 0 12px 25px #285ce125;
}
@media (min-width: 761px) {
  html[data-page="home"] .welcome {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }
  html[data-page="home"] .welcome-copy {
    max-width: none;
    min-width: 0;
  }
  html[data-page="home"] .welcome-copy h1 {
    font-size: clamp(23px, 2.6vw, 38px);
    line-height: 1.35;
    letter-spacing: -0.8px;
    white-space: nowrap;
  }
  html[dir="rtl"][data-page="home"] .welcome-copy h1 {
    letter-spacing: 0;
  }
}
.welcome-art {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  max-height: min(66dvh, 520px);
  width: 100%;
  order: 2;
}
#continentSelection {
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#chooseTitle {
  font-size: 20px;
  margin-bottom: 16px;
}
.continent-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  min-height: 0;
}
.continent-card {
  position: relative;
  min-height: 150px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: var(--surface);
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: flex-end;
  text-decoration: none;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.continent-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px #1d469b12;
}
.continent-card strong {
  font-size: 22px;
  z-index: 1;
}
.continent-card span {
  font-size: 11px;
  color: var(--muted);
  z-index: 1;
}
.continent-card .continent-number {
  position: absolute;
  top: 16px;
  inset-inline-start: 20px;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
}
.continent-art {
  position: absolute;
  inset-inline-end: -9px;
  top: 10px;
  width: 50%;
  height: 112px;
  opacity: 0.38;
  pointer-events: none;
}
.continent-card:nth-child(2n) .continent-art {
  transform: rotate(-6deg);
}
html[data-page="continents"] .continent-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: clamp(44px, 9dvh, 80px) auto auto 4px;
  justify-content: stretch;
  align-content: start;
  gap: 8px;
  min-height: 0;
  min-width: 0;
  padding: 12px;
  container-type: inline-size;
}
html[data-page="continents"] .continent-card strong {
  font-size: clamp(12px, 10cqi, 20px);
  line-height: 1.5;
  white-space: nowrap;
}
html[data-page="continents"] .continent-card .continent-art,
html[data-page="continents"] .continent-card .continent-art-placeholder {
  position: relative;
  inset: auto;
  grid-row: 1;
  grid-column: 1;
  justify-self: center;
  width: 86%;
  height: 100%;
  max-width: 144px;
  object-fit: contain;
  transform: none;
}
html[data-page="continents"] .continent-card .continent-number {
  top: 10px;
  inset-inline-start: 12px;
  font-size: 10px;
}
html[data-page="continents"] .continent-card:not(.image-ready) .continent-art {
  opacity: 0;
}
.continent-card .continent-count {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 6px;
  align-items: center;
  font-size: 11px;
  line-height: 1.5;
}
.continent-count bdi {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.continent-card .continent-count span {
  font-size: 10px;
}
.continent-progress {
  height: 4px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}
.continent-progress > div {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}
.game-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  flex: 0 0 auto;
}
.game-navigation .text-button {
  margin: 0;
}
.game {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 32px;
  margin-top: 8px;
}
.globe-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ocean);
  overflow: hidden;
  contain: layout paint;
}
#globe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
#globe:active {
  cursor: grabbing;
}
#globe:focus:not(:focus-visible) {
  outline: none;
}
#globe:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -4px;
  border-radius: var(--radius);
}

.map-controls {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 10px;
  display: flex;
  gap: 5px;
  z-index: 2;
}
.map-controls button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  display: grid;
  place-items: center;
  box-shadow: 0 2px 7px #0002;
}
.answer-panel {
  align-self: center;
  min-width: 0;
}
.progress {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.progress-track {
  height: 4px;
  border-radius: var(--radius);
  background: var(--line);
  margin: 10px 0 24px;
  overflow: hidden;
}
#bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}
.question h2 {
  font-size: 28px;
  margin: 10px 0;
}

label {
  display: block;
  font-size: 12px;
  margin-bottom: 8px;
}
input {
  width: 100%;
  display: block;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 14px;
  font-size: 16px;
  margin-bottom: 10px;
}
#answer:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}
#feedback {
  line-height: 1.6;
  margin: 14px 0;
  color: var(--accent);
}
#feedback:empty,
#selectionStatus:empty {
  display: none;
}
.session-note {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 18px;
}
.gesture {
  display: none;
}
footer {
  flex-wrap: wrap;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px max(24px, calc((100vw - 1128px) / 2))
    calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  flex: 0 0 auto;
}
footer a {
  color: inherit;
  min-height: 24px;
  display: flex;
  align-items: center;
}
footer a {
  text-decoration: none;
}
footer a[aria-current="page"],
footer a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
dialog {
  width: min(460px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
dialog::backdrop {
  background: #081329aa;
  backdrop-filter: blur(3px);
}
dialog h2 {
  font-size: 24px;
}
dialog p {
  font-size: 15px;
}
.dialog-actions {
  display: flex;
  gap: 10px;
}
.dialog-actions button {
  flex: 1;
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}
.dialog-actions .primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.content-page {
  max-width: 660px;
  width: 100%;
  margin: auto;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.content-page h1 {
  font-size: 36px;
}
.content-page p {
  font-size: 16px;
}
.content-page .primary {
  margin-top: 24px;
  max-width: 300px;
}
.source-link {
  display: inline-block;
  margin-top: 8px;
}
.results-page {
  text-align: center;
  max-width: 520px;
}
.results-page .primary {
  margin-inline: auto;
}
.results-score {
  display: block;
  font-size: clamp(48px, 8vw, 80px);
  font-weight: 800;
  letter-spacing: -3px;
  color: var(--accent);
  margin: 24px 0;
  direction: ltr;
}
.results-badge {
  display: inline-grid;
  place-items: center;
  width: 68px;
  height: 68px;
  background: #ffbd4a;
  color: #182b4b;
  font-size: 36px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  transform: rotate(-8deg);
}
@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(-3deg);
  }
  50% {
    transform: translateY(-12px) rotate(3deg);
  }
}

@media (max-width: 760px) {
  header {
    padding: 10px 18px;
  }
  .brand {
    font-size: 26px;
  }
  main {
    width: calc(100% - 32px);
    margin: 8px auto 12px;
  }
  .welcome {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
  }
  .welcome-art {
    order: 0;
    min-height: 0;
    height: 100%;
    max-height: 44dvh;
    max-width: 430px;
    margin: auto;
    aspect-ratio: 1;
  }
  .welcome-copy {
    text-align: center;
    max-width: 100%;
  }
  .welcome-copy h1 {
    font-size: clamp(32px, 8vw, 44px);
    letter-spacing: -1.4px;
    margin-bottom: 12px;
  }
  .welcome-copy p {
    font-size: 14px;
    margin: 0 auto 22px;
    max-width: 300px;
  }
  .welcome-copy .primary {
    max-width: none;
    min-height: 50px;
  }

  .intro {
    margin-bottom: 18px;
  }
  .intro h1 {
    font-size: 28px;
  }
  .intro p {
    font-size: 13px;
  }
  #chooseTitle {
    font-size: 18px;
    margin-bottom: 12px;
  }
  .continent-choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .continent-card {
    min-height: 124px;
    padding: 14px;
    gap: 6px;
  }
  .continent-card strong {
    font-size: 18px;
  }
  .continent-card .continent-number {
    top: 12px;
    inset-inline-start: 14px;
  }
  .continent-art {
    height: 90px;
    width: 55%;
    top: 10px;
  }
  .game {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 12px;
  }
  .progress-track {
    margin: 6px 0 10px;
  }

  .question h2 {
    font-size: 21px;
    margin: 6px 0 10px;
  }
  input {
    padding: 11px;
    margin-bottom: 8px;
  }
  .primary {
    min-height: 44px;
    padding: 12px;
  }
  label {
    font-size: 11px;
    margin-bottom: 6px;
  }
  .text-button {
    margin: 0 auto;
    min-height: 40px;
    padding: 8px;
  }
  #feedback {
    margin: 8px 0;
    font-size: 14px;
  }

  footer {
    font-size: 10px;
    padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  }
  .content-page {
    padding: 22px;
  }
  .content-page h1 {
    font-size: 29px;
  }
  .content-page p {
    font-size: 14px;
  }
  .content-page .primary {
    max-width: none;
  }
}
@media (max-height: 620px) and (max-width: 599px) {
  header {
    padding-block: 6px;
  }
  .welcome-art {
    max-height: 29dvh;
  }
  .welcome-copy h1 {
    font-size: 30px;
  }
  .welcome-copy p {
    margin-bottom: 14px;
  }
  .intro p {
    display: none;
  }
  .intro h1 {
    font-size: 23px;
  }
  .continent-card {
    min-height: 90px;
    padding: 12px;
  }
  .continent-card strong {
    font-size: 16px;
  }
  .continent-art {
    height: 72px;
  }
  .question {
    display: none;
  }
  .progress-track {
    margin-bottom: 6px;
  }
  .content-page {
    padding: 18px;
  }
  .content-page p {
    line-height: 1.55;
    font-size: 13px;
  }
  .results-score {
    margin: 12px 0;
  }
  .results-badge {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
  }
}
@media (max-height: 580px) and (min-width: 600px) {
  header {
    padding-block: 6px;
  }
  main {
    margin-block: 0 8px;
  }
  .welcome {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr);
    gap: 20px;
  }
  .welcome-art {
    order: 2;
    max-height: 70dvh;
  }
  .welcome-copy {
    text-align: start;
  }
  .welcome-copy h1 {
    font-size: clamp(28px, 4vw, 44px);
  }
  .welcome-copy p {
    font-size: 14px;
    margin: 0 0 18px;
  }
  .welcome-copy .primary {
    max-width: 230px;
  }
  .intro {
    margin-bottom: 10px;
  }
  .intro h1 {
    font-size: 25px;
  }
  .intro p {
    display: none;
  }
  .continent-choices {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }
  .continent-card {
    min-height: 94px;
    padding: 12px;
  }
  .continent-card strong {
    font-size: 18px;
  }
  .continent-art {
    height: 76px;
  }
  .continent-card .continent-number {
    top: 10px;
    inset-inline-start: 12px;
  }
  .game {
    grid-template-columns: 1.2fr 1fr;
    grid-template-rows: minmax(0, 1fr);
    gap: 24px;
  }

  .question h2 {
    font-size: 22px;
    margin: 8px 0;
  }
  .progress-track {
    margin: 6px 0 8px;
  }
  input {
    padding: 10px;
    margin-bottom: 8px;
  }
  .primary {
    min-height: 42px;
    padding: 10px;
  }
  .text-button {
    min-height: 36px;
    margin: 0 auto;
  }
  .game-navigation {
    min-height: 36px;
  }
  .content-page {
    padding: 20px;
  }
  .content-page p {
    font-size: 14px;
  }
  .results-score {
    margin: 8px 0;
  }
  .results-badge {
    display: none;
  }
}
@media (pointer: coarse) {
  .settings button,
  .language-picker summary {
    min-height: 36px;
    height: 36px;
  }
  .settings button {
    width: 36px;
  }
  .language-options {
    width: 150px;
  }
  .language-options a {
    min-height: 44px;
  }
  .map-controls button {
    width: 44px;
    height: 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

html[lang="fa"] .brand {
  font-family: Vazir, Tahoma, sans-serif;
  letter-spacing: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

#answerForm {
  display: contents;
}
.answer-panel {
  display: grid;
  grid-template-rows: auto auto auto 58px 54px 44px;
  gap: 8px;
  align-content: center;
}
.answer-panel .question {
  grid-row: 3;
}
#answer {
  grid-row: 4;
}
#feedback {
  grid-row: 4;
  overflow: auto;
  margin: 0;
  align-self: center;
  max-height: 58px;
}
#check,
#next {
  grid-row: 5;
  margin: 0;
  height: 54px;
}
#skip {
  grid-row: 6;
  margin: 0;
}

html[dir="rtl"] .language-options {
  left: 0;
  right: auto;
}
html[data-page="explore"] #gameSection {
  display: flex;
  flex: 1;
  min-height: 0;
}
html[data-page="explore"] .globe-panel {
  width: 100%;
  flex: 1;
}
.explore-heading h1 {
  font-size: clamp(22px, 3vw, 32px);
  margin-bottom: 6px;
}
.explore-heading p {
  font-size: 13px;
  margin-bottom: 8px;
}
#exploreContinents {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
#exploreContinents a {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  text-decoration: none;
}
#exploreContinents a[aria-current] {
  background: var(--accent);
  color: var(--accent-ink);
}
.country-labels text {
  font-size: 7px;
  font-family: inherit;
  font-weight: 600;
  fill: #071a32;
  paint-order: stroke;
  stroke: #f7f9ffe6;
  stroke-width: 1px;
  stroke-linejoin: round;
}
html[data-theme="dark"] .country-labels text {
  fill: #f5f8ff;
  stroke: #132c4b;
}
.label-leaders line {
  stroke: var(--text);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  opacity: 0.8;
}
.label-leaders circle {
  fill: var(--text);
  stroke: var(--ocean);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
}
.country-labels .country-flag {
  font-family:
    "Karshvar Flags", "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji",
    sans-serif;
  font-size: 0.8em;
  stroke: none;
  direction: ltr;
  unicode-bidi: isolate;
}
.country-labels .country-population {
  font-weight: 400;
  font-size: 0.9em;
}

.home-earth {
  width: 86%;
  height: 86%;
  object-fit: contain;
  filter: drop-shadow(0 25px 30px #10264f30);
  animation: float 7s ease-in-out infinite;
}
@media (max-width: 760px) {
  .welcome-art {
    grid-row: 1;
  }
  .welcome-copy {
    grid-row: 2;
    padding-bottom: env(safe-area-inset-bottom);
  }
}

html[data-page="home"] main {
  position: relative;
  isolation: isolate;
}
html[data-page="home"] body {
  --bg: #060c18;
  --surface: #13233a;
  --text: #f1f5ff;
  background: #060c18;
  color: #f1f5ff;
  --line: #293951;
  --muted: #afbed6;
  color-scheme: dark;
}
html[data-page="home"] .brand {
  color: #f1f5ff;
}
html[data-page="home"] .welcome-copy p {
  color: #b7c5dd;
}
html[data-page="home"] main::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1px 1px at 10% 20%, #9bb8dd 98%, transparent),
    radial-gradient(1px 1px at 80% 65%, #b1c7e4 98%, transparent),
    radial-gradient(ellipse at 25% 50%, #10233c, transparent 62%);
  background-size:
    310px 250px,
    470px 390px,
    100% 100%;
}
.home-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
.home-canvas:active {
  cursor: grabbing;
}
.welcome-art.globe-ready {
  aspect-ratio: 1;
}

.answer-panel {
  grid-template-columns: minmax(0, 1fr);
}
.answer-panel > *,
#answer,
#check {
  grid-column: 1;
}
@media (max-height: 600px) {
  .answer-panel {
    grid-template-rows: auto auto auto 44px 44px 32px;
    gap: 4px;
  }
  #check,
  #next {
    height: 44px;
    min-height: 44px;
  }
  #answer {
    margin: 0;
    height: 44px;
  }
  #feedback {
    max-height: 44px;
  }
}

.space-traffic {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  perspective: 900px;
}
html[data-page="home"] header,
html[data-page="home"] footer {
  position: relative;
  z-index: 2;
}
html[data-page="home"] .welcome-copy {
  z-index: 2;
}
.passing-ship {
  position: absolute;
  left: 0;
  top: 22%;
  width: clamp(65px, 8vw, 145px);
  height: auto;
  opacity: 0;
  filter: drop-shadow(0 8px 10px #0008);
  will-change: transform, opacity;
}
.passing-ship.crossing {
  animation: ship-crossing 38s linear infinite;
  animation-delay: 2s;
}
.passing-ship.returning {
  top: 72%;
  animation: ship-returning 43s linear infinite;
  animation-delay: 15s;
}
.passing-ship.departing {
  top: 12%;
  animation: ship-departing 47s linear infinite;
  animation-delay: 27s;
}
@keyframes ship-crossing {
  0% {
    opacity: 0;
    transform: translate3d(-25vw, 8vh, -300px) rotate(-9deg) scale(0.45);
  }
  2% {
    opacity: 0.75;
  }
  24% {
    opacity: 0.85;
  }
  28%,
  100% {
    opacity: 0;
    transform: translate3d(120vw, -5vh, 160px) rotate(-9deg) scale(1.1);
  }
}
@keyframes ship-returning {
  0% {
    opacity: 0;
    transform: translate3d(120vw, 0, 100px) rotate(169deg) scale(0.9);
  }
  2% {
    opacity: 0.8;
  }
  20% {
    opacity: 0.65;
  }
  25%,
  100% {
    opacity: 0;
    transform: translate3d(-25vw, 12vh, -350px) rotate(169deg) scale(0.35);
  }
}
@keyframes ship-departing {
  0% {
    opacity: 0;
    transform: translate3d(80vw, 65vh, 150px) rotate(-150deg) scale(1.1);
  }
  2% {
    opacity: 0.8;
  }
  18% {
    opacity: 0.55;
  }
  24%,
  100% {
    opacity: 0;
    transform: translate3d(24vw, -15vh, -650px) rotate(-150deg) scale(0.12);
  }
}
@media (max-width: 760px) {
  .passing-ship {
    width: 75px;
  }
  .passing-ship.departing {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .space-traffic {
    display: none;
  }
}

html[data-page="explore"] main {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0;
}
html[data-page="explore"] .explore-heading {
  position: absolute;
  inset-block-start: 12px;
  inset-inline-start: 12px;
  z-index: 3;
  max-width: min(160px, calc(100% - 24px));
  max-height: calc(100% - 72px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 4px 18px #0002;
}
html[data-page="explore"] .explore-heading > h1,
html[data-page="explore"] .explore-heading > p {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
#explorePanel summary {
  padding: 10px;
  font-size: 12px;
  font-weight: 600;
}
#explorePanel #exploreContinents {
  flex-direction: column;
  flex-wrap: nowrap;
  padding: 0 8px;
  margin: 0;
  gap: 0;
}
#explorePanel #exploreContinents a {
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  font-size: 11px;
}
.population-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  margin-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  cursor: pointer;
  min-height: 44px;
}
.population-switch input {
  appearance: none;
  flex: 0 0 30px;
  width: 30px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
}
.population-switch input::before {
  content: "";
  display: block;
  width: 12px;
  height: 12px;
  margin: 2px;
  border-radius: 50%;
  background: var(--muted);
}
.population-switch input:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.population-switch input:checked::before {
  background: var(--accent-ink);
  transform: translateX(12px);
}
[dir="rtl"] .population-switch input:checked::before {
  transform: translateX(-12px);
}
html[data-page="explore"] #gameSection {
  margin-top: 0;
  gap: 0;
}
html[data-page="explore"] .globe-panel {
  border-inline: 0;
  border-bottom: 0;
  border-radius: 0;
}
html[data-page="explore"] .map-controls {
  bottom: max(12px, env(safe-area-inset-bottom));
}
@media (max-width: 760px) {
  html[data-page="explore"] main {
    margin-top: 0;
  }
  html[data-page="explore"] .explore-heading {
    inset-block-start: 8px;
    inset-inline-start: 8px;
  }
  #explorePanel #exploreContinents a {
    min-height: 40px;
  }
}

.menu-toggle {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.menu-toggle:hover {
  background: color-mix(in srgb, currentColor 10%, transparent);
}
.menu-toggle {
  transition:
    background-color 150ms ease,
    box-shadow 150ms ease;
}
.menu-toggle:active {
  background: color-mix(in srgb, currentColor 16%, transparent);
}
.menu-toggle:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .menu-toggle {
    transition: none;
  }
}
dialog.app-drawer {
  --drawer-offset: 100%;
  position: fixed;
  inset-block: 0;
  inset-inline-start: auto;
  inset-inline-end: 0;
  margin: 0;
  width: min(320px, calc(100% - 40px));
  height: 100dvh;
  max-height: 100dvh;
  max-width: none;
  padding: max(16px, env(safe-area-inset-top)) 16px
    max(16px, env(safe-area-inset-bottom));
  border: 0;
  border-inline-start: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg);
  color: var(--text);
  overflow-y: auto;
  overscroll-behavior: contain;
}
dialog.app-drawer[open] {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: drawer-enter 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
[dir="rtl"] dialog.app-drawer {
  --drawer-offset: -100%;
}
dialog.app-drawer.is-closing {
  animation: drawer-exit 180ms ease-in both;
}
.app-drawer::backdrop {
  background: #07101e80;
  backdrop-filter: none;
  animation: drawer-backdrop-enter 220ms ease-out both;
}
.app-drawer.is-closing::backdrop {
  animation: drawer-backdrop-exit 180ms ease-in both;
}
@keyframes drawer-enter {
  from {
    transform: translateX(var(--drawer-offset));
  }
  to {
    transform: translateX(0);
  }
}
@keyframes drawer-exit {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(var(--drawer-offset));
  }
}
@keyframes drawer-backdrop-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes drawer-backdrop-exit {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  dialog.app-drawer[open],
  .app-drawer::backdrop {
    animation: none;
  }
}
.drawer-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
}
.drawer-heading strong {
  font-size: 18px;
}
.drawer-heading .menu-toggle {
  font-size: 28px;
  font-weight: 300;
}
.app-drawer .site-menu nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.app-drawer .site-menu a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}
.app-drawer .site-menu a:hover,
.app-drawer .site-menu a[aria-current="page"] {
  background: var(--surface);
  color: var(--accent);
}
.app-drawer .drawer-settings {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.drawer-settings h2 {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 12px 4px;
}
.app-drawer .drawer-settings button,
.app-drawer .language-picker summary {
  width: 100%;
  height: auto;
  min-height: 48px;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  justify-content: flex-start;
  gap: 12px;
  font-size: 14px;
  text-align: start;
}
.app-drawer .drawer-settings button:hover,
.app-drawer .language-picker summary:hover {
  background: var(--surface);
}
.app-drawer .language-picker {
  order: 1;
}
.app-drawer #theme {
  order: 2;
}
.app-drawer #resetOpen {
  order: 3;
}
.app-drawer #languageMenuLabel {
  flex: 1;
}
.app-drawer #languageLabel {
  color: var(--muted);
  font-size: 12px;
}
.app-drawer .language-options {
  position: static;
  width: 100%;
  margin-top: 4px;
  padding: 4px;
  box-shadow: none;
  background: var(--surface);
  border: 0;
}
.app-drawer .language-options a {
  min-height: 44px;
}
.drawer-footer {
  margin-top: auto;
  padding: 16px 12px 0;
  color: var(--muted);
  font-size: 11px;
  border-top: 1px solid var(--line);
}
footer.simple-footer {
  justify-content: center;
  padding: 4px 12px calc(4px + env(safe-area-inset-bottom));
  min-height: 24px;
  font-size: 10px;
}
html[data-page="sources"] main {
  overflow-y: auto;
}
.sources-page section {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.sources-page h2 {
  font-size: 18px;
  margin: 0 0 8px;
}
@media (max-width: 760px) and (orientation: portrait) {
  html[data-page="home"] main {
    width: calc(100% - 40px);
    margin: 0 auto;
    overflow-y: auto;
  }
  html[data-page="home"] .welcome {
    flex: 0 0 auto;
    width: 100%;
    margin-block: auto;
    padding-block: 20px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 16px;
    align-content: center;
  }
  html[data-page="home"] .welcome-art {
    width: min(100%, 320px, 38dvh);
    height: auto;
    max-height: none;
    aspect-ratio: 1;
    margin: 0 auto;
  }
  html[data-page="home"] .welcome-copy {
    width: 100%;
    padding: 0;
  }
  html[data-page="home"] .welcome-copy h1 {
    font-size: clamp(26px, 7.4vw, 36px);
    line-height: 1.35;
    margin: 0 0 12px;
  }
  html[data-page="home"] .welcome-copy p {
    line-height: 1.8;
    margin: 0 auto 22px;
  }
  html[data-page="home"] .welcome-copy .primary {
    width: 100%;
    max-width: 340px;
    margin-inline: auto;
  }
}

.welcome-art:not(.globe-ready):not(.globe-failed)::after {
  content: "";
  width: 30px;
  height: 30px;
  border: 2px solid #7895bb33;
  border-top-color: #9dbbdf;
  border-radius: 50%;
  animation: globe-loading 1.2s linear infinite;
}
@keyframes globe-loading {
  to {
    transform: rotate(360deg);
  }
}
.home-canvas {
  animation: globe-reveal 0.25s ease-out;
}
@keyframes globe-reveal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.answer-entry {
  grid-row: 4;
  grid-column: 1;
  position: relative;
  min-width: 0;
  align-self: stretch;
}
.answer-entry #answer {
  height: 100%;
  margin: 0;
}
.country-suggestions {
  position: absolute;
  inset-inline: 0;
  bottom: calc(100% + 6px);
  max-height: min(240px, 35dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px #0003;
  padding: 4px;
  z-index: 10;
}
.country-suggestions [role="option"] {
  padding: 10px 12px;
  min-height: 44px;
  line-height: 1.5;
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--text);
  touch-action: manipulation;
}
.country-suggestions [role="option"]:hover,
.country-suggestions [aria-selected="true"] {
  background: var(--accent);
  color: var(--accent-ink);
}

.continent-art-placeholder,
.skeleton-line {
  background: linear-gradient(
    100deg,
    var(--line) 20%,
    var(--surface) 45%,
    var(--line) 70%
  );
  background-size: 240% 100%;
  animation: continent-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius);
}
.continent-card .continent-art-placeholder {
  position: absolute;
  inset-inline-end: 16px;
  top: 16px;
  width: 34%;
  height: 92px;
  opacity: 0.55;
}
.skeleton-line {
  display: block;
  width: 105px;
  height: 14px;
  margin-block: 1px;
}
.continent-card:not(.image-ready) .continent-art {
  opacity: 0;
}
.continent-card.image-ready .continent-art-placeholder {
  display: none;
}
@keyframes continent-shimmer {
  to {
    background-position: -140% 0;
  }
}

html[data-page="about"] main {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-block: 12px;
}
.about-page {
  width: 100%;
  max-width: 78ch;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}
.about-page h1 {
  font-size: clamp(28px, 4vw, 40px);
  margin-bottom: 24px;
}
.about-page p {
  font-size: 16px;
  line-height: 1.9;
  margin-bottom: 22px;
}

.about-page .source-link {
  display: block;
  width: fit-content;
}

/* Present in the HTML so slow module downloads never leave a blank map. */
main:has(.map-loading) {
  position: relative;
}
.map-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px;
  text-align: center;
  background: var(--bg);
  color: var(--accent);
}
.map-skeleton {
  width: min(76%, 62dvh, 620px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(
    100deg,
    var(--surface) 25%,
    var(--line) 50%,
    var(--surface) 75%
  );
  background-size: 220% 100%;
  animation: map-skeleton-shimmer 2s ease-in-out infinite;
}
@keyframes map-skeleton-shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -20% 0;
  }
}
.map-loading p {
  margin: 0;
  font-size: 14px;
  color: var(--text);
  max-width: 30ch;
}
.map-loading a {
  color: var(--muted);
  font-size: 12px;
  padding: 10px 16px;
  min-height: 44px;
}
.map-loading a:hover {
  color: var(--accent);
}
.map-loading.load-failed .map-skeleton {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  .map-skeleton {
    animation: none;
  }
}

/* A shared, compact editorial layout for About and Sources. */
html:is([data-page="about"], [data-page="sources"]) main {
  width: min(880px, calc(100% - 48px));
  margin: 0 auto;
  padding-block: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.info-page,
.about-page.info-page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.info-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 24px;
  align-items: center;
  padding: 24px 28px;
  margin-bottom: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.info-hero img {
  display: block;
  width: 100%;
  height: auto;
}
.info-page .info-hero h1 {
  font-size: clamp(26px, 3.5vw, 36px);
  margin: 0 0 10px;
  line-height: 1.4;
}
.info-page .info-intro {
  font-size: 14px;
  margin: 0;
  line-height: 1.8;
}
.info-content {
  padding: 0 28px 20px;
  max-width: 76ch;
}
.info-page #aboutBody p {
  font-size: 15px;
  line-height: 2;
  margin: 0 0 20px;
}
.info-page a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 13px;
  text-underline-offset: 4px;
}
.source-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.sources-page .source-cards section {
  margin: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.sources-page .source-cards h2 {
  font-size: 18px;
  margin: 0 0 12px;
}
.sources-page .source-cards p {
  font-size: 14px;
  line-height: 1.9;
  margin: 0 0 12px;
}
@media (max-width: 600px) {
  html:is([data-page="about"], [data-page="sources"]) main {
    width: calc(100% - 32px);
    padding-block: 16px;
  }
  .info-hero {
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 8px;
    padding: 18px 16px;
    margin-bottom: 20px;
    border-radius: var(--radius);
  }
  .info-page .info-hero h1 {
    font-size: 24px;
    margin-bottom: 6px;
  }
  .info-page .info-intro {
    font-size: 12px;
  }
  .info-content {
    padding: 0 4px 16px;
  }
  .info-page #aboutBody p {
    font-size: 14px;
    line-height: 1.95;
  }
  .source-cards {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .sources-page .source-cards section {
    padding: 20px;
  }
}

.nearby-mode {
  padding: 24px;
  margin-block: 24px;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
}
.nearby-mode label {
  display: block;
  margin-block: 20px 8px;
  font-weight: 600;
}
.country-picker {
  margin-bottom: 16px;
}
.country-picker input {
  display: block;
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.country-picker input::placeholder {
  color: var(--muted);
}
.nearby-mode > .primary {
  width: 100%;
}

.mode-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-block: 32px;
}
.mode-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: start;
  padding: 32px;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.mode-card strong {
  font-size: 1.4rem;
}
.mode-card span {
  color: var(--muted);
  line-height: 1.6;
}
.mode-card:hover {
  border-color: var(--text);
}
.mode-card:focus-visible {
  outline: 3px solid #5286ff;
  outline-offset: 4px;
}
#modeChoices[hidden],
#continentChoices[hidden],
#nearbyMode[hidden] {
  display: none;
}

.mode-card {
  text-decoration: none;
}

.update-dialog {
  max-width: min(440px, calc(100vw - 40px));
}
.update-dialog p {
  line-height: 1.6;
}
.update-dialog .dialog-actions {
  flex-wrap: wrap;
}
.update-dialog .dialog-actions button {
  flex: 1 0 max-content;
  white-space: nowrap;
  font-size: 13px;
  padding-inline: 12px;
}

.answer-panel.has-feedback .question[hidden] {
  /* Reserve the question's space while showing feedback in the same area. */
  display: block !important;
  visibility: hidden;
}
.has-feedback #feedback {
  grid-row: 3 / 5;
  align-self: stretch;
  min-height: 0;
  max-height: none;
  contain: size;
  overflow: auto;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.feedback-message {
  display: block;
  font-size: 0.9rem;
  line-height: 1.5;
}
.feedback-country {
  display: block;
  margin-top: 4px;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
@media (max-height: 600px) {
  .has-feedback #feedback {
    padding: 10px 14px;
  }
}

/* Reading pages use document scrolling, rather than a narrow nested scroll area. */
html:is([data-page="about"], [data-page="sources"]) {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}
html:is([data-page="about"], [data-page="sources"]) body {
  height: auto;
  min-height: 100dvh;
  overflow: visible;
}
html:is([data-page="about"], [data-page="sources"]) main {
  flex: 1 0 auto;
  overflow: visible;
  min-height: auto;
}
body > header,
body > footer {
  flex-shrink: 0;
}
body {
  min-height: 100svh;
}

/* Native page transitions: no click interception or navigation delay. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
  ::view-transition-group(root) {
    animation-duration: 140ms;
  }
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 140ms;
    animation-timing-function: ease-out;
  }
  ::view-transition {
    pointer-events: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}

/* Keep the active form above mobile keyboards; allow scrolling on small screens. */
html.keyboard-open body {
  height: var(--keyboard-height);
  min-height: 0;
}
html.keyboard-open body > header,
html.keyboard-open body > footer,
html.keyboard-open .game-navigation {
  display: none;
}
html.keyboard-open main {
  min-height: 0;
  overflow-y: auto;
  margin-block: 6px;
  padding-bottom: 8px;
}
html.keyboard-open .game {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(110px, 1fr) auto;
  gap: 6px;
  min-height: 310px;
  margin-top: 0;
}
html.keyboard-open .answer-panel {
  grid-template-rows: auto auto auto 44px 44px 32px;
  gap: 4px;
}
html.keyboard-open .question h2 {
  font-size: 17px;
  margin: 2px 0;
}
html.keyboard-open .progress-track {
  margin: 0;
}
html.keyboard-open #check,
html.keyboard-open #next {
  height: 44px;
  min-height: 44px;
  padding: 8px;
}
html.keyboard-open .country-suggestions {
  max-height: min(140px, 35vh);
}
html.keyboard-open .country-picker .country-suggestions {
  top: calc(100% + 4px);
  bottom: auto;
}

@media (max-height: 620px) and (max-width: 599px) {
  .answer-panel.has-feedback .question[hidden] {
    display: none !important;
  }
}

.brand-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
}

.update-check-status {
  margin: 0;
  padding: 0 16px 8px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Quiet, compact navigation with comfortable touch targets. */
dialog.app-drawer {
  width: min(288px, calc(100% - 48px));
  padding-inline: 16px;
}
dialog.app-drawer[open] {
  gap: 16px;
}
.drawer-heading {
  padding-inline: 8px;
}
.drawer-heading strong {
  font-size: 16px;
}
.app-drawer .site-menu nav {
  gap: 2px;
}
.app-drawer .site-menu a {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 6px;
}
.app-drawer .site-menu a[aria-current="page"] {
  background: transparent;
  box-shadow: inset 3px 0 var(--accent);
  font-weight: 700;
}
[dir="rtl"] .app-drawer .site-menu a[aria-current="page"] {
  box-shadow: inset -3px 0 var(--accent);
}
.app-drawer .drawer-settings {
  gap: 2px;
  padding-top: 14px;
}
.app-drawer .drawer-settings button,
.app-drawer .language-picker summary {
  min-height: 44px;
  padding: 8px 12px;
}
.app-drawer::backdrop {
  background: #07101e55;
}

@media (max-width: 640px) {
  html[data-selection-page="countries"] #continentSelection {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: min-content;
  }
  html[data-selection-page="countries"] #nearbyMode {
    margin-block-start: auto;
    margin-block-end: max(16px, env(safe-area-inset-bottom));
  }
  html[data-selection-page="countries"] #chooseTitle {
    flex-shrink: 0;
  }
  html[data-selection-page="countries"].keyboard-open #nearbyMode {
    margin-block-start: 12px;
  }
}

/* Subtle separators keep menu items easy to scan in both themes. */
.app-drawer .site-menu a,
.app-drawer .drawer-settings > button,
.app-drawer .language-picker summary {
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.app-drawer .site-menu nav > a:last-child,
.app-drawer .drawer-settings > #resetOpen {
  border-bottom: 0;
}

/* Separate groups with whitespace, not an extra rule after the final link. */
.app-drawer .drawer-settings {
  border-top: 0;
}

.app-drawer .site-menu a,
.app-drawer .drawer-settings > button,
.app-drawer .language-picker summary {
  border-bottom-color: color-mix(in srgb, currentColor 12%, transparent);
}
.app-drawer .drawer-footer {
  border-top-color: color-mix(in srgb, currentColor 12%, transparent);
}

html[data-page="blog"] {
  height: auto;
  min-height: 100%;
  overflow-y: auto;
}
html[data-page="blog"] body {
  height: auto;
  min-height: 100dvh;
  overflow: visible;
}
html[data-page="blog"] main {
  flex: 1 0 auto;
  overflow: visible;
}
.blog-page {
  width: min(100%, 820px);
  margin: 24px auto 64px;
}
.blog-heading {
  display: block;
  padding: 32px 0;
  border-bottom: 1px solid var(--line);
}
.blog-heading h1 {
  font-size: clamp(28px, 5vw, 46px);
  line-height: 1.35;
  letter-spacing: -0.5px;
}
.blog-eyebrow,
.blog-number {
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.blog-languages {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.blog-languages a {
  padding-block: 8px;
}
.blog-contents {
  line-height: 2;
  padding-block: 20px;
}
.blog-place {
  position: relative;
  padding-block: 28px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 24px;
}
.blog-place h2 {
  margin-block: 8px 16px;
  font-size: 25px;
}
.blog-place p {
  font-size: 18px;
  line-height: 1.95;
  max-width: 70ch;
}
.blog-source {
  font-size: 14px;
}
.blog-note {
  margin-block: 24px;
  padding: 24px;
  background: var(--surface);
  border-radius: var(--radius);
}
.blog-note h2 {
  font-size: 18px;
}
.blog-cta {
  padding-block: 28px;
}
.blog-cta .primary {
  display: inline-flex;
  text-decoration: none;
  white-space: normal;
  text-align: center;
}
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 20px;
  margin-block: 28px;
}
.blog-card {
  display: block;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
.blog-card:hover {
  border-color: var(--accent);
  background: var(--surface);
}
.blog-card span {
  font-size: 12px;
  color: var(--muted);
}
.blog-card h2 {
  font-size: 22px;
  line-height: 1.5;
  margin-top: 12px;
}
.blog-card p {
  font-size: 14px;
  margin-bottom: 0;
}

/* Blog cards must override the generic inline-flex information-page links. */
.blog-page .blog-grid {
  gap: 24px;
  align-items: stretch;
}
.blog-page a.blog-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  padding: 0;
  overflow: hidden;
  text-align: start;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}
.blog-card .blog-cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  margin: 0;
}
.blog-card .blog-card-copy {
  display: block;
  padding: 24px;
}
.blog-card .blog-card-language {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.blog-card .blog-card-copy h2 {
  margin: 10px 0 12px;
  font-size: 22px;
  line-height: 1.45;
  color: var(--text);
}
.blog-card .blog-card-copy p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  margin: 0;
  font-size: 15px;
  line-height: 1.75;
  color: var(--muted);
}
.blog-page a.blog-card:hover {
  border-color: var(--accent);
}
.blog-page a.blog-card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
@media (max-width: 640px) {
  .blog-page .blog-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .blog-card .blog-card-copy {
    padding: 20px;
  }
}

/* Keep the index heading compact so articles appear immediately. */
.blog-page:has(> .blog-grid) {
  margin-block: 0 32px;
}
.blog-page:has(> .blog-grid) .blog-heading {
  padding-block: 8px 12px;
  border-bottom: 0;
  min-height: 0;
}
.blog-page:has(> .blog-grid) .blog-heading h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.3;
}
.blog-page > .blog-grid {
  margin-block: 8px 0;
}
html[data-page="blog"] #selectionStatus:empty {
  display: none;
}

:root {
  --answer-correct: #27946b;
  --answer-wrong: #d95b68;
  --answer-revealed: #8792a5;
}
.app-drawer .site-menu .history-open {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  text-align: start;
}
.app-drawer .site-menu .history-open:hover {
  background: var(--surface);
}
.app-drawer .site-menu nav > a:has(+ .history-open) {
  border-bottom: 1px solid color-mix(in srgb, currentColor 12%, transparent);
}
.history-dialog {
  width: min(620px, calc(100% - 32px));
  max-height: 85dvh;
  overflow-y: auto;
  background: var(--bg);
  color: var(--text);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.history-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.history-heading h2 {
  margin: 0;
  font-size: 22px;
}
.history-note {
  margin-top: 16px;
  font-size: 13px;
}
.history-list {
  padding: 0;
  list-style: none;
}
.history-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding-block: 14px;
  border-bottom: 1px solid var(--line);
}
.history-row p,
.history-row time {
  width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
}
.history-row time {
  font-size: 12px;
  color: var(--muted);
}
.history-status {
  font-size: 13px;
}
.correct {
  --status-color: var(--answer-correct);
}
.wrong {
  --status-color: var(--answer-wrong);
}
.revealed {
  --status-color: var(--answer-revealed);
}
.history-status::before,
.answer-legend span::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-inline-end: 6px;
  border-radius: 50%;
  background: var(--status-color);
}
.answer-legend {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 20px);
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 9px;
  line-height: 1.4;
  pointer-events: none;
}
.answer-legend span::before {
  width: 6px;
  height: 6px;
  margin-inline-end: 4px;
}
.history-globe {
  display: block;
  width: 100%;
  height: min(48dvh, 480px);
  touch-action: none;
  cursor: grab;
}
.history-globe:active {
  cursor: grabbing;
}
.history-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin-block: 12px 20px;
}
.history-dialog label {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
}
.history-dialog select {
  width: 100%;
  min-height: 44px;
  padding: 8px;
  font: inherit;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
}

html[data-page="history"] {
  height: auto;
  min-height: 100%;
  overflow-y: auto;
}
html[data-page="history"] body {
  height: auto;
  min-height: 100dvh;
  overflow: visible;
}
html[data-page="history"] main {
  flex: 1 0 auto;
}
.history-page {
  width: min(100%, 960px);
  margin: 12px auto 32px;
}
.history-page h1 {
  font-size: 28px;
  margin-block: 0 12px;
}
.history-page .history-globe {
  height: min(58dvh, 600px);
}
.history-page label {
  display: block;
  margin-block: 12px 8px;
}
.history-page select {
  width: 100%;
  min-height: 44px;
  padding: 10px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
.history-page .primary {
  display: inline-flex;
  padding: 14px 24px;
  text-decoration: none;
}
html[data-page="history"] #selectionStatus:empty {
  display: none;
}
.history-progress {
  display: block;
  width: 100%;
  height: 10px;
  margin-block: 0 20px;
  accent-color: var(--accent);
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}
.history-progress::-webkit-progress-bar {
  background: var(--surface);
  border-radius: 999px;
}
.history-progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 999px;
}
.history-progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: 999px;
}
#historyProgressLabel {
  font-size: 14px;
  margin-bottom: 8px;
}

/* A compact visual journey between the page title and the controls. */
html:is([data-selection-page="modes"], [data-selection-page="countries"]) main {
  overflow-y: auto;
}
html:is([data-selection-page="modes"], [data-selection-page="countries"])
  #continentSelection {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.journey-art {
  display: flex;
  flex: 1 1 180px;
  min-height: 100px;
  max-height: 380px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.journey-art svg {
  display: block;
  width: min(100%, 520px);
  height: 100%;
  max-height: 340px;
}
.mode-choices {
  gap: 16px;
  margin-block: 16px 24px;
}
.mode-card {
  border-radius: 8px;
  border-color: var(--line);
  padding: 24px;
  gap: 12px;
  background: var(--surface);
  container-type: inline-size;
  min-width: 0;
}
.mode-card strong {
  font-size: clamp(12px, 5cqi, 1.2rem);
  line-height: 1.5;
  white-space: nowrap;
}
.mode-card .mode-recommendation {
  font-size: 0.75em;
  font-weight: 400;
  color: inherit;
}
.mode-card span {
  font-size: 0.95rem;
}
.nearby-mode {
  border-radius: 8px;
  border-color: var(--line);
  background: var(--bg);
  margin-block: 12px 16px;
}
.country-picker input,
.nearby-mode > .primary {
  border-radius: 8px;
}
html.keyboard-open .journey-art {
  display: none;
}
@media (max-width: 640px) {
  .journey-art {
    flex-basis: 140px;
    max-height: 340px;
  }
  .mode-choices {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .mode-card {
    padding: 18px 20px;
    gap: 6px;
  }
  .nearby-mode {
    padding: 20px;
  }
}
@media (max-height: 600px) {
  .journey-art {
    display: none;
  }
}

/* Keep page content and site navigation on the same compact grid. */
:root {
  --container-width: 1040px;
}
body > header {
  width: min(var(--container-width), calc(100% - 32px));
  padding-inline: 0;
}
html main,
html:is([data-page="about"], [data-page="sources"]) main {
  width: min(var(--container-width), calc(100% - 32px));
}
.blog-page,
.history-page {
  width: 100%;
}

/* Align the menu with the same container edge in both text directions. */
@media (min-width: 761px) {
  dialog.app-drawer {
    inset-inline-end: max(16px, calc((100% - var(--container-width)) / 2));
    inset-block-start: var(--menu-top, 80px);
    inset-block-end: auto;
    height: auto;
    max-height: calc(100dvh - var(--menu-top, 80px) - 16px);
    padding-block: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 16px 40px #07101e40;
  }
  @keyframes drawer-enter {
    from {
      transform: translateY(-16px);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
  @keyframes drawer-exit {
    from {
      transform: translateY(0);
      opacity: 1;
    }
    to {
      transform: translateY(-16px);
      opacity: 0;
    }
  }
}

/* Compact desktop quiz controls sit at the bottom-right of the map. */
@media (min-width: 761px) {
  html[data-page="play"] #gameSection {
    position: relative;
    display: block;
    min-height: 420px;
  }
  html[data-page="play"] .globe-panel {
    position: absolute;
    inset: 0;
  }
  html[data-page="play"] .answer-panel {
    position: absolute;
    left: auto;
    right: 16px;
    top: auto;
    bottom: 16px;
    transform: none;
    z-index: 3;
    width: 280px;
    grid-template-rows: auto auto auto 44px 44px 36px;
    gap: 6px;
    max-height: calc(100% - 40px);
    overflow: visible;
    padding: 14px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 3px 12px #07101e16;
  }
  html[data-page="play"] .answer-panel .question {
    font-size: 18px;
    margin-block: 4px 8px;
  }
  html[data-page="play"] .answer-panel .progress-track {
    margin: 2px 0 4px;
  }
  html[data-page="play"] .answer-panel :is(#answer, #check, #next) {
    height: 44px;
    min-height: 44px;
    padding: 8px 10px;
    font-size: 14px;
  }
  html[data-page="play"] .answer-panel #skip {
    min-height: 36px;
    padding: 4px 0;
    font-size: 12px;
  }
}

/* Compact mobile answer card beneath the map. */
@media (max-width: 760px) {
  html[data-page="play"] .answer-panel {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    grid-template-rows: auto auto auto 44px 44px 44px;
    gap: 4px;
  }
  html[data-page="play"] .answer-panel .progress-track {
    margin: 2px 0 4px;
  }
  html[data-page="play"] .answer-panel .question {
    margin: 0;
  }
  html[data-page="play"] .answer-panel .question h2 {
    font-size: 18px;
    margin: 4px 0 8px;
  }
  html[data-page="play"] .answer-panel :is(#answer, #check, #next) {
    height: 44px;
    min-height: 44px;
    padding: 8px 10px;
  }
  html[data-page="play"] .answer-panel #answer {
    font-size: 16px;
  }
  html[data-page="play"] .answer-panel #skip {
    min-height: 44px;
    padding: 6px 0;
    font-size: 12px;
  }
  html[data-page="play"].keyboard-open .answer-panel {
    padding: 8px;
    gap: 2px;
  }
}

@media (min-width: 761px) {
  html[data-page="play"] .country-suggestions {
    max-height: min(240px, 45dvh);
    z-index: 20;
  }
}

/* Stable rows keep the card and primary action still between answers. */
html[data-page="play"] .answer-panel,
html[data-page="play"] .answer-panel.has-feedback {
  grid-template-rows: auto auto 64px 44px 44px 36px;
  align-content: start;
}
html[data-page="play"] .answer-panel .question {
  align-self: center;
  margin: 0;
}
html[data-page="play"] .answer-panel .question h2 {
  font-size: 18px;
  margin: 0;
}
html[data-page="play"] .answer-panel.has-feedback .question[hidden] {
  display: none !important;
}
html[data-page="play"] .answer-panel.has-feedback #feedback {
  grid-row: 3 / 5;
  contain: size;
  padding: 10px 12px;
  border-inline-start-width: 2px;
  max-height: none;
  overflow: auto;
}
html[data-page="play"] .answer-panel.has-feedback #next {
  grid-row: 5;
}
html[data-page="play"] .answer-panel.has-feedback .feedback-message {
  font-size: 13px;
}
html[data-page="play"] .answer-panel.has-feedback .feedback-country {
  font-size: 22px;
  margin-top: 3px;
}
@media (max-width: 760px) {
  html[data-page="play"] .answer-panel,
  html[data-page="play"] .answer-panel.has-feedback {
    grid-template-rows: auto auto 44px 44px 44px 44px;
  }
}

/* Keep the primary action at the bottom; feedback replaces the input area. */
html[data-page="play"] .answer-panel,
html[data-page="play"] .answer-panel.has-feedback {
  grid-template-rows: auto auto 72px 44px 44px;
}
html[data-page="play"] .answer-panel .question {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  justify-content: space-between;
  gap: 6px 10px;
  min-width: 0;
  height: 100%;
}
html[data-page="play"] .answer-panel .question h2 {
  flex: 1 0 auto;
  white-space: nowrap;
  font-size: 16px;
}
html[data-page="play"] .answer-panel .question #skip {
  flex: 0 1 auto;
  max-width: 100%;
  min-height: 28px;
  padding: 4px 7px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  text-decoration: none;
}
html[data-page="play"] .answer-panel .question #skip:hover {
  border-color: var(--accent);
  color: var(--text);
}
html[data-page="play"] .answer-panel :is(#check, #next),
html[data-page="play"] .answer-panel.has-feedback #next {
  grid-row: 5;
}
html[data-page="play"] .answer-panel.has-feedback #feedback {
  grid-row: 3 / 5;
  margin-block: 0 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Use the same blue palette with softer fills on dark surfaces. */
html[data-theme="dark"] .info-hero img[src$="sources-globe.svg"] {
  content: url("./art/sources-globe-dark.svg");
}
html[data-theme="dark"] .info-hero img[src$="about-atlas.svg"] {
  content: url("./art/about-atlas-dark.svg");
}
html[data-theme="dark"] .continent-card.image-ready .continent-art {
  opacity: 0.6;
  filter: brightness(1.35) saturate(0.8);
}

/* Page shells exist in the HTML, before any app modules or data arrive. */
main {
  position: relative;
}
.page-skeleton {
  display: none;
}
html[data-loading] main > :not(#pageSkeleton) {
  visibility: hidden;
}
html[data-loading] main {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}
html[data-loading] {
  height: 100%;
  overflow: hidden;
}
html[data-loading] body {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
html[data-loading] .page-skeleton {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 6;
  padding: 24px 28px;
  overflow: hidden;
  background: var(--bg);
  color: var(--muted);
}
.page-skeleton-shapes {
  display: grid;
  gap: 20px;
  max-width: 1144px;
  margin-inline: auto;
}
.page-skeleton-block {
  border-radius: var(--radius);
  background: linear-gradient(
    100deg,
    var(--surface) 20%,
    var(--line) 45%,
    var(--surface) 70%
  );
  background-size: 240% 100%;
  animation: continent-shimmer 1.5s ease-in-out infinite;
}
.page-skeleton-line {
  height: 14px;
  width: 100%;
  margin-block: 10px;
}
.page-skeleton-line.short {
  width: 45%;
}
.page-skeleton-line.medium {
  width: 75%;
}
.page-skeleton-heading {
  height: 28px;
}
.page-skeleton-card {
  display: grid;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}
.page-skeleton-card .page-skeleton-line {
  margin: 0;
}
.page-skeleton[data-layout="modes"] .page-skeleton-shapes,
.page-skeleton[data-layout="countries"] .page-skeleton-shapes {
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(60px, 1fr) auto;
  gap: 12px;
}
.page-skeleton[data-layout="modes"] .page-skeleton-shapes {
  grid-template-rows: minmax(60px, 1fr) auto auto;
}
.page-skeleton[data-layout="play"] .page-skeleton-shapes,
.page-skeleton[data-layout="explore"] .page-skeleton-shapes {
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}
.page-skeleton[data-layout="explore"] .page-skeleton-shapes {
  grid-template-rows: auto auto minmax(0, 1fr);
}
.page-skeleton-game {
  min-height: 0;
}
.page-skeleton[data-layout="play"] .page-skeleton-map,
.page-skeleton[data-layout="explore"] .page-skeleton-map {
  min-height: 0;
  height: 100%;
}
.page-skeleton[data-layout="play"] .page-skeleton-card {
  align-content: center;
}
.page-skeleton:is([data-layout="modes"], [data-layout="countries"])
  .page-skeleton-globe {
  height: min(100%, 30dvh, 300px);
  width: auto;
  min-height: 0;
  margin: 0 auto;
  align-self: center;
}
.page-skeleton-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.page-skeleton-cards:is(.continents, .blog) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.page-skeleton-globe {
  width: min(100%, 34dvh, 340px);
  aspect-ratio: 1;
  border-radius: 50%;
  margin: 16px auto;
}
.page-skeleton[data-layout="results"] .page-skeleton-globe {
  width: min(100%, 24dvh, 240px);
}
.page-skeleton-map {
  width: 100%;
  min-height: min(52dvh, 500px);
}
.page-skeleton-input {
  height: 44px;
  margin-block: 20px;
}
.page-skeleton-button {
  height: 44px;
  width: min(100%, 240px);
  margin-block: 20px 0;
}
.page-skeleton-cover {
  aspect-ratio: 1200 / 630;
}
.page-skeleton-continent-art {
  height: clamp(44px, 9dvh, 80px);
  width: 64%;
  justify-self: center;
}
.page-skeleton-cards.continents .page-skeleton-card {
  padding: 12px;
  gap: 8px;
}
.page-skeleton-hero,
.page-skeleton-game {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 28px;
  align-items: center;
}
.page-skeleton-hero .page-skeleton-globe {
  width: min(100%, 52dvh, 500px);
}
html[data-loading] .page-skeleton[data-layout="home"] {
  --surface: #9cbaff12;
  --line: #9cbaff24;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px 0;
  background: transparent;
}
.page-skeleton[data-layout="home"] .page-skeleton-shapes {
  width: 100%;
}
.page-skeleton[data-layout="home"] .page-skeleton-hero > div:first-child {
  max-width: 490px;
}
.page-skeleton[data-layout="home"] .page-skeleton-hero .page-skeleton-globe {
  width: min(66%, 32dvh, 320px);
}
.page-skeleton[data-layout="home"] .page-skeleton-heading {
  height: 36px;
  width: min(90%, 420px);
}
.page-skeleton[data-layout="home"]
  .page-skeleton-line:not(.page-skeleton-heading) {
  max-width: 370px;
}
.page-skeleton[data-layout="home"] .page-skeleton-button {
  height: 56px;
  width: min(100%, 260px);
}
.page-skeleton-game {
  align-items: stretch;
}
.page-skeleton-info {
  padding-block: 24px;
}
#pageLoadingStatus {
  font-size: 14px;
  text-align: center;
}
html[data-loading="true"] #pageLoadingStatus {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
html[data-loading="failed"] .page-skeleton-shapes {
  display: none;
}
html[data-loading="failed"] .page-skeleton {
  text-align: center;
  padding-block: 64px;
}
#pageLoadingRetry {
  display: inline-block;
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
@media (max-width: 760px) {
  html[data-loading] .page-skeleton {
    padding: 16px 12px;
  }
  .page-skeleton-cards,
  .page-skeleton-cards:is(.continents, .blog),
  .page-skeleton-hero,
  .page-skeleton-game {
    grid-template-columns: minmax(0, 1fr);
  }
  .page-skeleton-cards.continents {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .page-skeleton-cards.blog > :not(:first-child) {
    display: none;
  }
  .page-skeleton-hero {
    gap: 16px;
  }
  .page-skeleton[data-layout="home"] .page-skeleton-hero .page-skeleton-globe {
    grid-row: 1;
    width: min(70%, 28dvh, 240px);
  }
  .page-skeleton[data-layout="home"] .page-skeleton-hero > div:first-child {
    grid-row: 2;
    width: 100%;
    justify-self: center;
  }
  .page-skeleton-card {
    padding: 16px;
  }
  .page-skeleton-game {
    grid-template-rows: minmax(80px, 1fr) auto;
    gap: 12px;
  }
  .page-skeleton-game .page-skeleton-card {
    gap: 8px;
  }
  .page-skeleton-game :is(.page-skeleton-input, .page-skeleton-button) {
    margin-block: 4px 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .page-skeleton-block {
    animation: none;
  }
}

.map-controls button.satellite-toggle {
  width: auto;
  padding-inline: 10px;
  font-size: 12px;
  font-family: inherit;
}
.map-controls button.satellite-toggle[aria-pressed="true"] {
  background: #245c43;
  color: white;
  border-color: #a4dbb6;
}

/* Compact Explore controls, with comfortable touch targets. */
#explorePanel #exploreContinents a {
  min-height: 26px;
  padding: 3px 7px;
}
#explorePanel .population-switch {
  min-height: 32px;
  padding: 5px 8px;
  margin-top: 0;
  gap: 7px;
}
@media (pointer: coarse) {
  #explorePanel #exploreContinents a,
  #explorePanel .population-switch {
    min-height: 36px;
  }
}

@media (min-width: 761px) {
  .explore-settings-bar {
    position: absolute;
    z-index: 4;
    inset-block-start: 12px;
    inset-inline-start: 190px;
    inset-inline-end: 12px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
    pointer-events: none;
  }
  .explore-settings-bar .population-switch {
    pointer-events: auto;
    margin: 0;
    min-height: 34px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 2px 8px #0002;
    white-space: nowrap;
  }
}

.marine-labels text {
  font-family: inherit;
  font-style: italic;
  fill: #d2edff;
  stroke: #18354d;
  paint-order: stroke;
  stroke-linejoin: round;
  opacity: 0.6;
}

.satellite-credit {
  position: absolute;
  inset-inline-end: 8px;
  bottom: 8px;
  z-index: 2;
  padding: 2px 5px;
  background: #10243fcc;
  color: #d2edff;
  border-radius: 4px;
  font-size: 9px;
}
.satellite-credit[hidden] {
  display: none;
}

.satellite-download {
  position: absolute;
  inset-inline-start: 8px;
  bottom: 8px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border-radius: 6px;
  background: #10243fb3;
  color: #edf6ff;
  font-size: 10px;
  pointer-events: none;
}
.satellite-download[hidden] {
  display: none;
}
.satellite-download::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 1.5px solid #edf6ff55;
  border-top-color: #edf6ff;
  border-radius: 50%;
  animation: satellite-spin 0.8s linear infinite;
}
@keyframes satellite-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .satellite-download::before {
    animation: none;
  }
}
