@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/nunito/nunito-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/nunito/nunito-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --bg: #f6f3ea;
  --ink: #172026;
  --muted: #5f6b72;
  --panel: #fffdf7;
  --line: #d8d1bd;
  --water: #79c7dc;
  --land: #d9cf92;
  --land-active: #f7cd78;
  --land-selected: #f28f62;
  --button: #245c73;
  --button-ink: #ffffff;
  --shadow: 0 18px 50px rgba(23, 32, 38, 0.16);
  --font-ui: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--font-ui);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
}

button {
  font: inherit;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  width: 100%;
  min-height: 100dvh;
  overflow: hidden;
}

.app-shell.panel-closed {
  grid-template-columns: minmax(0, 1fr);
}

.map-stage {
  position: relative;
  min-width: 0;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 46% 42%, rgba(255, 250, 220, 0.5), transparent 34%),
    linear-gradient(180deg, #f8f0dc 0%, #e5f3ef 100%);
  isolation: isolate;
}

.map {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 45% 36%, #aee4ed 0%, #78c7dc 50%, #4fa6c4 100%);
  filter: saturate(1.08) contrast(0.96);
}

.map-stage::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  content: "";
  pointer-events: none;
}

.map-stage::before {
  background:
    radial-gradient(circle at 39% 28%, rgba(255, 255, 232, 0.34), transparent 16%),
    radial-gradient(circle at 45% 45%, rgba(255, 244, 198, 0.08), transparent 37%),
    linear-gradient(110deg, rgba(255, 255, 255, 0.08), transparent 38%, rgba(76, 126, 116, 0.08));
  mix-blend-mode: soft-light;
}

.map-stage::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  content: "";
  pointer-events: none;
  background:
    repeating-linear-gradient(
      18deg,
      rgba(88, 75, 47, 0.018) 0,
      rgba(88, 75, 47, 0.018) 1px,
      transparent 1px,
      transparent 7px
    );
  opacity: 0.42;
  mix-blend-mode: multiply;
}

.maplibregl-control-container {
  z-index: 3;
}

.country-label,
.water-label,
.poi-graphic-marker,
.capital-marker {
  z-index: 2;
}

.poi-graphic-marker {
  width: var(--poi-width, 90px);
  pointer-events: none;
  transform-origin: center;
}

.poi-graphic-image {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 3px 3px rgba(72, 61, 39, 0.2));
}

.poi-graphic-marker.is-hidden,
.poi-graphic-marker.is-outside-globe {
  display: none;
}

.label-toggle-control {
  overflow: hidden;
}

.label-toggle-button {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  padding: 0;
}

.label-toggle-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: #5f6b72;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.label-toggle-button.is-active .label-toggle-icon {
  stroke: #245c73;
}

.random-country-map-button .label-toggle-icon {
  stroke: #245c73;
}

.random-country-map-button .label-toggle-icon circle {
  fill: #245c73;
  stroke: none;
}

.continent-label {
  max-width: 140px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: rgba(62, 51, 34, 0.5);
  text-shadow:
    0 1px 4px rgba(255, 245, 215, 0.85),
    0 0 14px rgba(255, 245, 215, 0.5);
  pointer-events: none;
  text-align: center;
  white-space: normal;
}

.continent-label.maplibregl-marker-covered,
.continent-label.is-outside-globe {
  visibility: hidden;
}

.country-label {
  max-width: 92px;
  padding: 3px 7px;
  border: 1px solid rgba(101, 87, 55, 0.18);
  border-radius: 999px;
  background: rgba(255, 250, 232, 0.78);
  box-shadow: 0 2px 7px rgba(91, 73, 44, 0.1);
  color: #574d35;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.1;
  pointer-events: none;
  text-align: center;
  white-space: normal;
}

.water-label {
  max-width: 118px;
  padding: 3px 8px;
  border: 1px solid rgba(239, 252, 255, 0.32);
  border-radius: 999px;
  background: rgba(50, 112, 137, 0.24);
  color: rgba(247, 254, 255, 0.88);
  font-size: 12px;
  font-style: italic;
  font-weight: 760;
  line-height: 1.1;
  pointer-events: none;
  text-align: center;
  text-shadow: 0 1px 2px rgba(22, 68, 91, 0.48);
  white-space: normal;
}

.country-label.maplibregl-marker-covered,
.water-label.maplibregl-marker-covered {
  display: none;
}

.water-label.is-outside-globe {
  visibility: hidden;
}

.capital-marker {
  display: grid;
  justify-items: center;
  gap: 3px;
  pointer-events: none;
  transform: translateY(2px);
}

.capital-pin {
  width: 15px;
  height: 15px;
  border: 2px solid #172026;
  border-radius: 50% 50% 50% 0;
  background: #d62828;
  box-shadow: 0 2px 5px rgba(23, 32, 38, 0.28);
  transform: rotate(-45deg);
}

.capital-pin::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #fffdf7;
}

.capital-label {
  max-width: 120px;
  padding: 3px 6px;
  border: 1px solid rgba(23, 32, 38, 0.28);
  border-radius: 6px;
  background: rgba(255, 253, 247, 0.92);
  box-shadow: 0 2px 8px rgba(23, 32, 38, 0.18);
  color: #172026;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  white-space: normal;
}

.map-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  padding: 32px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(142, 202, 230, 0.95) 0 34%, transparent 35%),
    #f6f3ea;
}

.map-fallback[hidden],
.country-details[hidden] {
  display: none;
}

.map-fallback h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
}

.map-fallback p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.map-fallback code {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
}

.info-panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100dvh;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.info-panel[hidden] {
  display: none;
}

.close-panel-button {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: 16px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}

.close-panel-button:hover {
  background: var(--bg);
  color: var(--ink);
}

.country-label--flag {
  font-size: 20px;
  padding: 0 2px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.panel-heading {
  display: block;
  padding-right: 38px;
}

.info-panel h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.12;
}

.speak-action {
  position: fixed;
  bottom: max(18px, env(safe-area-inset-bottom));
  right: max(16px, env(safe-area-inset-right));
  z-index: 12;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 253, 247, 0.94);
  box-shadow: 0 8px 22px rgba(23, 32, 38, 0.16);
  color: var(--muted);
  cursor: pointer;
}

.speak-action.is-active {
  border-color: rgba(36, 92, 115, 0.45);
  background: #245c73;
  color: #ffffff;
}

.speak-action.is-speaking {
  background: #1d4f63;
}

.speak-action.is-speaking::after {
  position: absolute;
  inset: -5px;
  border: 2px solid rgba(36, 92, 115, 0.28);
  border-radius: 50%;
  animation: speak-pulse 1.4s ease-out infinite;
  content: "";
}

.speak-action:hover {
  color: var(--button);
}

.speak-action.is-active:hover {
  color: #ffffff;
  background: #1d4f63;
}

.speak-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.speak-icon--stop {
  display: none;
}

.speak-action.is-speaking .speak-icon--play {
  display: none;
}

.speak-action.is-speaking .speak-icon--stop {
  display: block;
}

@keyframes speak-pulse {
  from {
    opacity: 0.8;
    transform: scale(0.86);
  }

  to {
    opacity: 0;
    transform: scale(1.18);
  }
}

.intro {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.welcome {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.welcome-hints {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f4ea;
  list-style: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.welcome-section-title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.welcome-suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.welcome-suggestion {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.welcome-suggestion:hover {
  border-color: #a8bfc9;
  background: #f0f7fb;
}

.welcome-flag {
  font-size: 24px;
  line-height: 1;
}

.welcome-name {
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.2;
}

.welcome-continents {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.welcome-continent {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--button);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.welcome-continent:hover {
  background: var(--button);
  border-color: var(--button);
  color: var(--button-ink);
}

.country-details p {
  margin: 0;
  font-size: 17px;
  line-height: 1.55;
}

.country-details {
  display: grid;
  gap: 14px;
  padding-top: 4px;
}

.facts {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.fact {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8ef;
}

.fact dt {
  color: #56745f;
  font-size: 13px;
  font-weight: 750;
}

.fact dd {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.story {
  display: grid;
  gap: 12px;
  padding: 14px 0 2px;
  color: var(--ink);
}

.topic-overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.topic-overview-card {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 154px;
  padding: 10px;
  border: 1px solid rgba(122, 104, 68, 0.22);
  border-radius: 12px;
  background: #fbf8ef;
  box-shadow: 0 4px 12px rgba(91, 73, 44, 0.08);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.topic-overview-card:hover {
  border-color: rgba(36, 92, 115, 0.36);
  background: #fffaf0;
}

.topic-overview-image {
  display: block;
  overflow: hidden;
  border-radius: 9px;
  background: #e6dcc4;
}

.topic-overview-image img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.topic-overview-card--flag .topic-overview-image img {
  object-fit: contain;
  background: #f1ead8;
}

.topic-overview-label {
  font-size: 15px;
  font-weight: 850;
  line-height: 1.15;
}

.topic-overview-teaser {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.topic-back-button {
  justify-self: start;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbf8ef;
  color: var(--button);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
}

.topic-back-button:hover {
  background: #eef6f6;
  border-color: rgba(36, 92, 115, 0.34);
}

.topic-next-button {
  justify-self: end;
  min-height: 44px;
  margin-top: 8px;
  padding: 9px 14px;
  border: 1px solid #3e6f83;
  border-radius: 999px;
  background: #d9edf3;
  color: #183846;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
}

.topic-next-button:hover {
  background: #c7e4ee;
}

.random-country-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #3e6f83;
  border-radius: 10px;
  background: #245c73;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 850;
}

.random-country-button:hover {
  background: #1d4f63;
}

.welcome-suggestions .random-country-button {
  justify-content: flex-start;
  min-height: 0;
  padding: 10px 12px;
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
  font-weight: inherit;
  text-align: left;
}

.welcome-suggestions .random-country-button:hover {
  border-color: #a8bfc9;
  background: #f0f7fb;
}

.welcome-suggestions .random-country-button span:first-child {
  font-size: 24px;
  line-height: 1;
}

.welcome-suggestions .random-country-button span:last-child {
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
}

.topic-tabs {
  display: flex;
  gap: 8px;
  margin: 2px -2px 0;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: none;
}

.topic-tabs::-webkit-scrollbar {
  display: none;
}

.topic-chip {
  flex: 0 0 auto;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbf8ef;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  padding: 8px 12px;
  white-space: nowrap;
}

.topic-chip.is-active {
  border-color: #3e6f83;
  background: #d9edf3;
  color: #183846;
}

.topic-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8ef;
  color: var(--ink);
  padding: 14px;
}

.topic-card.is-dragging {
  transition: none;
}

.topic-card.is-swipe-resetting {
  transition: transform 0.18s ease-out;
}

.topic-card h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
}

.topic-image {
  display: grid;
  gap: 6px;
  margin: 0 0 2px;
}

.topic-image img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  object-fit: cover;
  background: #e6dcc4;
}

.topic-image--flag img {
  object-fit: contain;
  background: #f1ead8;
}

.topic-image figcaption {
  display: grid;
  gap: 4px;
}

.topic-image-caption {
  color: var(--ink);
  font-size: 13px;
  font-style: italic;
  line-height: 1.4;
}

.topic-image-credit {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.topic-image a {
  color: inherit;
}

.maplibregl-popup-content {
  border-radius: 8px;
  box-shadow: var(--shadow);
  font: 14px/1.3 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .map-stage {
    min-height: 62dvh;
  }

  .info-panel {
    min-height: 38dvh;
    max-height: 44dvh;
    overflow: auto;
    border-top: 1px solid var(--line);
    border-left: 0;
    box-shadow: 0 -12px 34px rgba(23, 32, 38, 0.14);
  }

  .info-panel h1 {
    font-size: 25px;
  }

  .app-shell.panel-closed .map-stage {
    min-height: 100dvh;
  }
}
