:root {
  color-scheme: light;
  --ink: #1d2528;
  --muted: #657278;
  --paper: rgba(250, 251, 248, 0.9);
  --paper-strong: rgba(255, 255, 255, 0.96);
  --line: rgba(39, 51, 55, 0.14);
  --land: #d8ddd7;
  --land-line: #aab4ae;
  --focus: #e56945;
  --focus-dark: #9a3b26;
  --sea: #dce9ec;
  --button: #1e574f;
  --button-ink: #fff;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: var(--sea);
  color: var(--ink);
}

button {
  font: inherit;
}

.app {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
}

.map-stage {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 16% 20%, rgba(255, 255, 255, 0.8), transparent 28%),
    linear-gradient(135deg, #d6e8ed 0%, #edf0e8 58%, #dfe6de 100%);
}

#worldMap {
  width: 100%;
  height: 100%;
  display: block;
}

.app.focused #worldMap {
  cursor: grab;
  touch-action: none;
}

.app.focused #worldMap:active {
  cursor: grabbing;
}

#mapLayer {
  transform-origin: 0 0;
  transition: transform 1250ms cubic-bezier(0.22, 1, 0.36, 1), filter 700ms ease;
  filter: blur(5px) saturate(0.8);
}

.app.focused #mapLayer {
  filter: blur(0) saturate(1);
}

.app.map-interacting #mapLayer {
  transition: filter 700ms ease;
}

.ocean {
  fill: transparent;
}

.country {
  fill: var(--land);
  fill-rule: evenodd;
  stroke: var(--land-line);
  stroke-width: 0.75;
  vector-effect: non-scaling-stroke;
  transition:
    fill 360ms ease,
    stroke 360ms ease,
    opacity 360ms ease;
}

.country.is-muted {
  opacity: 0.56;
}

.country.is-active {
  fill: var(--focus);
  stroke: var(--focus-dark);
  stroke-width: 1.4;
  opacity: 1;
}

.view-tabs {
  position: fixed;
  left: 24px;
  top: 24px;
  z-index: 2;
  display: inline-grid;
  grid-template-columns: repeat(3, auto);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 16px 46px rgba(28, 41, 45, 0.14);
  backdrop-filter: blur(18px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition:
    opacity 260ms ease,
    transform 260ms ease;
}

.app.focused .view-tabs {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.view-tab {
  min-width: 76px;
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #435056;
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 760;
}

.view-tab.is-active {
  background: var(--button);
  color: var(--button-ink);
  box-shadow: 0 8px 20px rgba(30, 87, 79, 0.18);
}

.intro-dialog,
.country-panel {
  position: fixed;
  z-index: 2;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 28px 90px rgba(28, 41, 45, 0.22);
  backdrop-filter: blur(18px);
}

.intro-dialog {
  left: 50%;
  top: 50%;
  width: min(88vw, 430px);
  padding: 30px;
  border-radius: 22px;
  transform: translate(-50%, -50%);
  text-align: center;
  transition:
    opacity 420ms ease,
    transform 420ms ease,
    visibility 420ms ease;
}

.app.focused .intro-dialog {
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -48%) scale(0.97);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--focus-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 22px;
  font-size: clamp(2rem, 8vw, 3.1rem);
  line-height: 1.04;
}

.picked-country {
  display: grid;
  gap: 5px;
  min-height: 88px;
  margin: 0 0 24px;
  place-items: center;
  border-block: 1px solid var(--line);
}

.picked-country span {
  font-size: clamp(2rem, 9vw, 3.4rem);
  font-weight: 850;
  line-height: 1;
}

.picked-country small {
  color: var(--muted);
  font-size: 0.95rem;
}

.intro-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.button,
.icon-button {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.button:active,
.icon-button:active {
  transform: scale(0.97);
}

.button.primary {
  background: var(--button);
  color: var(--button-ink);
  box-shadow: 0 14px 30px rgba(30, 87, 79, 0.22);
}

.button.ghost {
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  border: 1px solid var(--line);
}

.country-panel {
  right: 24px;
  top: 24px;
  bottom: 24px;
  width: min(390px, calc(100vw - 48px));
  padding: 24px;
  overflow: auto;
  border-radius: 18px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(18px);
  transition:
    opacity 420ms ease 760ms,
    transform 420ms ease 760ms;
}

.app.focused .country-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

h2 {
  margin-bottom: 3px;
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 1;
}

.name-en {
  margin-bottom: 0;
  color: var(--muted);
}

.icon-button {
  width: 46px;
  flex: 0 0 46px;
  background: #eef3ef;
  color: var(--button);
  border: 1px solid var(--line);
  font-size: 1.2rem;
}

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 22px;
}

.facts div,
.info-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.46);
}

.facts div {
  min-height: 86px;
  padding: 13px;
}

dt {
  color: var(--muted);
  font-size: 0.78rem;
}

dd {
  margin: 8px 0 0;
  font-weight: 760;
  line-height: 1.35;
}

.bilingual-primary,
.bilingual-secondary {
  display: block;
  overflow-wrap: anywhere;
}

.bilingual-secondary {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 650;
}

.info-block {
  padding: 15px;
  margin-top: 12px;
}

h3 {
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.info-block p {
  margin-bottom: 0;
  color: #344145;
  line-height: 1.62;
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .map-stage {
    height: 58vh;
    min-height: 390px;
  }

  .app {
    min-height: 100svh;
  }

  .intro-dialog {
    top: 47%;
    width: min(92vw, 390px);
    padding: 24px;
    border-radius: 18px;
  }

  .country-panel {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 12px;
    width: auto;
    max-height: 56vh;
    padding: 18px;
    border-radius: 16px;
    transform: translateY(20px);
  }

  .app.focused .country-panel {
    transform: translateY(0);
  }

  .facts {
    grid-template-columns: 1fr;
  }

  .view-tabs {
    left: 12px;
    top: 12px;
  }

  .view-tab {
    min-width: 72px;
    padding: 0 10px;
  }
}
