:root {
  --bg: #eef5e8;
  --bg-deep: #d8eadb;
  --panel: rgba(255, 255, 255, 0.76);
  --text: #17312d;
  --muted: #58706c;
  --teal: #13756e;
  --gold: #d9aa42;
  --blue: #3157b9;
  --shadow: 0 24px 60px rgba(18, 44, 39, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    linear-gradient(rgba(244, 248, 239, 0.88), rgba(248, 251, 247, 0.92)),
    url("./assets/malaysia-hero.avif") center top / cover no-repeat,
    radial-gradient(circle at top left, rgba(218, 170, 66, 0.24), transparent 25%),
    radial-gradient(circle at top right, rgba(49, 87, 185, 0.18), transparent 22%),
    linear-gradient(180deg, #f4f8ef 0%, #e7f0e4 55%, #f8fbf7 100%);
}

.game-page {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 40px;
}

.game-topbar,
.game-hero,
.legend-card,
.completion-card,
.ranking-card,
.question-popup {
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  border-radius: 28px;
}

.back-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.eyebrow,
.question-step {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--teal);
}

.topbar-copy h1,
.question-popup h3,
.completion-card h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.score-pill {
  min-width: 110px;
  padding: 10px 14px;
  border-radius: 999px;
  text-align: center;
  background: linear-gradient(135deg, var(--blue), #6e8ef0);
  color: white;
}

.score-pill span {
  display: block;
  font-size: 0.75rem;
  opacity: 0.84;
}

.score-pill strong {
  font-size: 1.2rem;
}

.game-hero {
  display: grid;
  grid-template-columns: 1.45fr 0.55fr;
  gap: 20px;
  padding: 24px;
  border-radius: 30px;
  margin-top: 18px;
  align-items: stretch;
}

.hero-copy p:last-child,
.legend-card p,
.completion-card p,
#popupFeedback {
  color: var(--muted);
  line-height: 1.6;
}

.hero-copy {
  padding-right: 10px;
}

.hero-copy p:last-child {
  margin-top: 0;
  font-size: 1rem;
}

.progress-card {
  padding: 22px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(19, 117, 110, 0.1), rgba(217, 170, 66, 0.18));
}

.progress-card strong {
  display: block;
  margin-bottom: 10px;
  font-size: 1.15rem;
}

.progress-card span {
  color: var(--muted);
}

.map-frame {
  position: relative;
  min-height: 780px;
  border-radius: 34px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.35)),
    linear-gradient(135deg, #d6efe4, #e8f4f1 55%, #dfe9f9);
}

.hero-map-frame {
  min-height: 780px;
}

.map-backdrop {
  position: relative;
  width: 100%;
  height: 100%;
}

.sea-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(18px);
  opacity: 0.7;
}

.sea-glow-a {
  inset: 10% auto auto 8%;
  width: 220px;
  height: 220px;
  background: rgba(49, 87, 185, 0.14);
}

.sea-glow-b {
  inset: auto 10% 8% auto;
  width: 260px;
  height: 260px;
  background: rgba(19, 117, 110, 0.14);
}

.expert-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.leaflet-container {
  font: inherit;
  background: linear-gradient(180deg, #dff1ef, #eef8fb);
}

.leaflet-control-attribution {
  font-size: 0.7rem;
}

.map-pin {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 32px rgba(19, 49, 45, 0.16);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
}

.map-pin::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 6px rgba(217, 170, 66, 0.18);
}

.map-pin.is-done {
  background: rgba(21, 117, 110, 0.92);
  color: white;
}

.map-pin.is-current {
  background: rgba(49, 87, 185, 0.94);
  color: white;
  transform: scale(1.04);
}

.map-attribution-note {
  position: absolute;
  left: 20px;
  bottom: 18px;
  z-index: 500;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 0.82rem;
  box-shadow: 0 12px 24px rgba(19, 49, 45, 0.1);
}

.question-popup {
  position: relative;
  width: 100%;
  padding: 24px;
  border-radius: 28px;
  background: rgba(255, 252, 244, 0.93);
}

.answer-grid {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.answer-button,
.next-button {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(23, 49, 45, 0.1);
  background: white;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.answer-button:hover:not([disabled]) {
  border-color: rgba(19, 117, 110, 0.45);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(19, 49, 45, 0.08);
}

.answer-button.is-correct {
  background: rgba(19, 117, 110, 0.12);
  border-color: rgba(19, 117, 110, 0.6);
}

.answer-button.is-wrong {
  background: rgba(204, 72, 49, 0.08);
  border-color: rgba(204, 72, 49, 0.5);
}

.answer-button[disabled],
.next-button[disabled] {
  cursor: not-allowed;
}

.popup-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.question-step {
  color: var(--blue);
}

.next-button {
  min-width: 124px;
  text-align: center;
  background: linear-gradient(135deg, var(--gold), #efc867);
  font-weight: 800;
}

.next-button[disabled] {
  opacity: 0.5;
}

.question-side {
  display: grid;
  gap: 18px;
  align-content: start;
}

.legend-card,
.completion-card,
.ranking-card {
  padding: 22px;
  border-radius: 28px;
}

.region-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.region-list li {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
}

.region-list li.is-current {
  background: rgba(49, 87, 185, 0.12);
  color: var(--blue);
  font-weight: 800;
}

.region-list li.is-done {
  background: rgba(19, 117, 110, 0.12);
  color: var(--teal);
}

.ranking-section {
  margin-top: 18px;
}

.ranking-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.ranking-head h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.ranking-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.ranking-table {
  display: grid;
  gap: 10px;
}

.ranking-row {
  display: grid;
  grid-template-columns: 90px 1.4fr 1fr 90px;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
}

.ranking-row-head {
  background: rgba(49, 87, 185, 0.08);
  font-weight: 800;
}

.completion-card {
  margin-top: 18px;
}

@media (max-width: 980px) {
  .game-page {
    width: min(100% - 24px, 1280px);
  }

  .game-hero {
    grid-template-columns: 1fr;
  }

  .map-frame {
    min-height: 680px;
  }

  .question-side {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .question-popup {
    grid-column: 1 / -1;
  }

  .ranking-row {
    grid-template-columns: 80px 1.2fr 1fr 80px;
  }
}

@media (max-width: 640px) {
  .game-page {
    width: min(100% - 16px, 1280px);
    padding-top: 16px;
  }

  .game-topbar,
  .popup-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .game-topbar,
  .game-hero,
  .legend-card,
  .completion-card,
  .ranking-card,
  .question-popup {
    border-radius: 22px;
  }

  .game-topbar {
    padding: 14px 16px;
  }

  .topbar-copy h1 {
    font-size: 1.5rem;
  }

  .score-pill {
    min-width: 100%;
  }

  .game-hero {
    padding: 16px;
    gap: 16px;
  }

  .question-side {
    grid-template-columns: 1fr;
  }

  .map-frame {
    min-height: 560px;
  }

  .map-attribution-note {
    left: 12px;
    right: 12px;
    bottom: 12px;
    border-radius: 16px;
    font-size: 0.76rem;
  }

  .question-popup,
  .legend-card,
  .completion-card,
  .ranking-card {
    padding: 16px;
  }

  .answer-button,
  .next-button {
    padding: 13px 14px;
  }

  .ranking-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .ranking-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px 14px;
  }

  .ranking-row span:nth-child(4),
  .ranking-row-head span:nth-child(4) {
    text-align: left;
  }

  .map-pin {
    padding: 8px 10px;
    font-size: 0.8rem;
  }
}
