/* =========================================================
   PETA PETUALANGAN SUPER CODER — css/style.css
   ---------------------------------------------------------
   Daftar isi:
    1. Variabel (warna, font, ukuran)
    2. Dasar halaman
    3. HUD (panel progres di atas)
    4. Peta & jalur setapak
    5. START
    6. Zona wilayah
    7. Papan penunjuk (signpost)
    8. Titik exercise (node)
    9. Kabut wilayah terkunci
   10. FINISH
   11. Tombol
   12. Popup (dialog)
   13. Footer & utilitas
   14. Animasi
   15. Layar lebar
   16. Mode kurangi gerakan (prefers-reduced-motion)
   ========================================================= */


/* ---------- 1. Variabel ---------- */
:root {
  /* Kertas peta */
  --color-paper: #FBF0D5;
  --color-paper-light: #FFF9EA;
  --color-paper-dark: #EBD6A8;
  --color-table: #E2C68F;

  /* Tinta (warna teks) */
  --color-ink: #3A2715;
  --color-ink-soft: #5E4630;
  --color-cream: #FFF7E6;
  --color-accent: #B8401F;

  /* Kayu papan penunjuk */
  --color-wood: #8B5A2B;
  --color-wood-dark: #5E3A17;

  /* Jalur setapak */
  --color-trail: #EFD9A7;
  --color-trail-edge: #CDA86A;
  --color-trail-todo: #8A6B47;
  --color-trail-locked: #A79C8C;

  /* Status */
  --color-success: #1E9E57;
  --color-success-dark: #13773F;
  --color-success-light: #E1F4E8;
  --color-locked: #BDB7AE;
  --color-locked-dark: #8F8981;
  --color-locked-ink: #4F4943;
  --color-danger: #B42318;
  --color-danger-dark: #7A160F;

  /* Font */
  --font-heading: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Nunito", "Segoe UI", system-ui, sans-serif;

  /* Ukuran peta & titik */
  --map-max-width: 860px;
  --node-size: 72px;      /* diameter titik exercise (minimal 64px supaya mudah di-tap) */
  --stop-height: 136px;   /* jarak vertikal antar titik */
  --stop-x: 25%;          /* jarak tengah titik dari tepi zona (membuat zigzag) */
  --zone-gap: 28px;       /* jarak antar zona */

  /* Sudut & bayangan */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 28px;
  --radius-pill: 999px;
  --shadow-soft: 0 4px 12px rgba(88, 58, 20, 0.16);
  --shadow-card: 0 20px 50px rgba(60, 38, 12, 0.3);

  /* Lama animasi jalur tergambar (diisi ulang oleh app.js) */
  --draw-duration: 2000ms;
}


/* ---------- 2. Dasar halaman ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Elemen dengan atribut hidden selalu disembunyikan */
[hidden] {
  display: none !important;
}

html {
  scroll-padding-top: 110px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Halaman di belakang popup tidak ikut ter-scroll */
html:has(dialog[open]) {
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-ink);
  background-color: var(--color-table);
  background-image:
    radial-gradient(rgba(94, 58, 23, 0.08) 1px, transparent 1.6px),
    linear-gradient(180deg, #E9D19F 0%, var(--color-table) 100%);
  background-size: 16px 16px, 100% 100%;
}

h1,
h2 {
  font-family: var(--font-heading);
  line-height: 1.15;
}

button {
  font: inherit;
}


/* ---------- 3. HUD (panel progres di atas) ---------- */
.hud {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 249, 234, 0.93);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 3px solid var(--color-wood);
  box-shadow: 0 4px 14px rgba(60, 38, 12, 0.14);
}

.hud__inner {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "brand reset"
    "progress progress";
  align-items: center;
  gap: 8px 16px;
  max-width: var(--map-max-width);
  margin-inline: auto;
  padding: 10px 16px;
}

.hud__brand {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
}

.hud__logo {
  flex: none;
  width: 34px;
  height: 34px;
}

.hud__progress {
  grid-area: progress;
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress {
  flex: 1;
  height: 16px;
  overflow: hidden;
  border: 2px solid rgba(94, 58, 23, 0.25);
  border-radius: var(--radius-pill);
  background: var(--color-paper-dark);
  box-shadow: inset 0 2px 3px rgba(60, 38, 12, 0.18);
}

.progress__fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background-color: var(--color-success);
  background-image: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.22) 0 8px, transparent 8px 16px);
  transition: width 0.6s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.hud__count {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.hud__count strong {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
}

.hud__reset {
  grid-area: reset;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border: 2px solid rgba(94, 58, 23, 0.35);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-ink-soft);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.hud__reset:hover {
  background: var(--color-paper-dark);
  color: var(--color-ink);
}

.hud__reset:focus-visible {
  outline: 3px solid var(--color-ink);
  outline-offset: 2px;
}

.hud__reset svg {
  width: 16px;
  height: 16px;
}


/* ---------- 4. Peta & jalur setapak ---------- */
.map {
  position: relative;
  isolation: isolate;
  width: min(100% - 16px, var(--map-max-width));
  margin: 16px auto 0;
  padding: 28px 14px 36px;
  border-radius: var(--radius-lg);
  background-color: var(--color-paper);
  background-image:
    radial-gradient(ellipse 80% 30% at 50% 0%, rgba(255, 255, 255, 0.65), transparent 70%),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(191, 140, 70, 0.16), transparent 70%),
    radial-gradient(ellipse 60% 40% at 100% 55%, rgba(191, 140, 70, 0.12), transparent 70%);
  box-shadow:
    var(--shadow-card),
    inset 0 0 0 2px rgba(94, 58, 23, 0.18),
    inset 0 0 80px rgba(176, 124, 52, 0.2);
}

/* Bingkai garis putus-putus di tepi peta */
.map::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 2px dashed rgba(94, 58, 23, 0.22);
  border-radius: calc(var(--radius-lg) - 6px);
  pointer-events: none;
}

/* SVG jalur menutupi seluruh peta, tepat di atas latar zona
   tapi di bawah titik exercise */
.trail {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.trail path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Tanah jalur: garis tepi yang lebih gelap + isi berwarna pasir */
.trail__edge {
  stroke: var(--color-trail-edge);
  stroke-width: 30px;
}

.trail__ground {
  stroke: var(--color-trail);
  stroke-width: 22px;
}

/* Garis rute di atas tanah */
.trail__mark {
  stroke-width: 5px;
}

.trail__mark--done {
  stroke-width: 8px; /* warnanya diisi app.js sesuai warna wilayah */
}

.trail__mark--todo {
  stroke: var(--color-trail-todo);
  stroke-dasharray: 9 12;
  opacity: 0.8;
}

.trail__mark--locked {
  stroke: var(--color-trail-locked);
  stroke-dasharray: 9 12;
  opacity: 0.55;
}

.map__compass {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  display: none;
  width: 60px;
  height: 60px;
  transform: rotate(-12deg);
}

.map-error {
  position: relative;
  z-index: 2;
  margin: 32px 8px;
  padding: 16px;
  border: 3px dashed var(--color-danger);
  border-radius: var(--radius-md);
  background: var(--color-paper-light);
  color: var(--color-danger);
  font-weight: 700;
  text-align: center;
}


/* ---------- 5. START ---------- */
.map-start {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 4px 4px 0;
}

.start__welcome {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  max-width: 36rem;
}

/* Maskot hanya muncul kalau file assets/maskot.png ada */
.start__mascot {
  flex: none;
  width: clamp(72px, 22vw, 120px);
  height: auto;
}

.start__bubble {
  position: relative;
  padding: 16px 20px 18px;
  border: 3px solid var(--color-ink);
  border-radius: 22px;
  background: var(--color-paper-light);
  box-shadow: 0 5px 0 rgba(58, 39, 21, 0.85);
}

/* Ekor gelembung bicara, menunjuk ke bendera START */
.start__bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin-top: -8px;
  border-right: 3px solid var(--color-ink);
  border-bottom: 3px solid var(--color-ink);
  background: var(--color-paper-light);
  transform: translateX(-50%) rotate(45deg);
}

/* Kalau ada maskot, ekornya menunjuk ke maskot di sebelah kiri */
.start__welcome.has-mascot .start__bubble::after {
  top: auto;
  bottom: 22px;
  left: 0;
  margin: 0 0 0 -2px;
  transform: translateX(-50%) rotate(135deg);
}

.start__kicker {
  margin: 0;
  color: var(--color-accent);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.start__title {
  margin: 2px 0 6px;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  font-weight: 800;
}

.start__subtitle {
  display: block;
  font-size: 0.6em;
  font-weight: 700;
}

.start__text {
  margin: 0;
  color: var(--color-ink-soft);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  margin: 8px 0 0;
  padding: 8px 16px;
  border: 2px solid rgba(94, 58, 23, 0.15);
  border-radius: var(--radius-pill);
  background: rgba(255, 249, 234, 0.75);
  color: var(--color-ink-soft);
  font-size: 0.85rem;
  font-weight: 700;
  list-style: none;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend__dot {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #FFFFFF;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}

.legend__dot svg {
  width: 13px;
  height: 13px;
}

.legend__dot--open {
  background: #F16529;
}

.legend__dot--done {
  background: var(--color-success);
}

.legend__dot--locked {
  background: var(--color-locked-dark);
}

.start__flag {
  position: relative;
  width: 130px;
  height: 110px;
}

.start__flag-art {
  width: 100%;
  height: 100%;
}

/* Alas bendera = titik awal jalur */
.start__pad {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 72px;
  height: 32px;
  border: 3px solid var(--color-wood-dark);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 35%, #E9C48B, #B98547);
  transform: translate(-50%, 35%);
}


/* ---------- 6. Zona wilayah ---------- */
.zone {
  --zone-tint: color-mix(in srgb, var(--zone-color) 13%, var(--color-paper-light));
  --zone-line: color-mix(in srgb, var(--zone-color) 45%, transparent);
  position: relative;
  margin-top: var(--zone-gap);
  padding: 14px 0 12px;
  border: 3px dashed var(--zone-line);
  border-radius: 40px;
  background-color: var(--zone-tint);
  /* Pola titik-titik halus seperti rumput di peta */
  background-image: radial-gradient(color-mix(in srgb, var(--zone-color) 20%, transparent) 1.4px, transparent 2px);
  background-size: 22px 22px;
}

.zone:first-child {
  margin-top: 40px;
}

/* Baris atas zona: papan penunjuk + pemandangan utama.
   Papan diletakkan di sisi yang tidak dilewati jalur. */
.zone__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  min-height: 104px;
  padding: 0 16px;
}

.zone__header--sign-right {
  flex-direction: row-reverse;
}

.zone__landmark {
  flex: none;
  align-self: flex-start;
  width: min(32%, 190px);
  height: auto;
  aspect-ratio: 2 / 1;
  color: var(--zone-color);
}

.zone__stops {
  margin: 0;
  padding: 0;
  list-style: none;
}


/* ---------- 7. Papan penunjuk (signpost) ---------- */
.signpost {
  position: relative;
  z-index: 5; /* tetap terlihat di atas kabut */
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 50%;
  filter: drop-shadow(0 4px 0 rgba(58, 39, 21, 0.25));
}

.signpost__board {
  padding: 8px 26px 11px 14px;
  border-radius: 8px;
  background-color: var(--color-wood);
  /* Serat kayu */
  background-image: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.07) 0 2px, transparent 2px 9px);
  color: var(--color-cream);
  /* Garis warna wilayah di bagian bawah papan */
  box-shadow: inset 0 -6px 0 var(--zone-color);
  /* Ujung papan berbentuk panah yang menunjuk ke jalur */
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%);
}

.zone__header--sign-right .signpost__board {
  padding: 8px 14px 11px 26px;
  text-align: right;
  clip-path: polygon(16px 0, 100% 0, 100% 100%, 16px 100%, 0 50%);
}

.signpost__kicker {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.signpost__name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.1;
}

.signpost__post {
  width: 12px;
  height: 28px;
  border-radius: 0 0 4px 4px;
  background: var(--color-wood-dark);
}


/* ---------- 8. Titik exercise (node) ---------- */
/* Satu baris = satu titik + judulnya. Titik genap di kiri, ganjil di kanan. */
.stop {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: var(--stop-height);
  padding-inline: calc(var(--stop-x) - var(--node-size) / 2) 12px;
}

.stop--right {
  flex-direction: row-reverse;
  padding-inline: 12px calc(var(--stop-x) - var(--node-size) / 2);
}

.stop__node {
  position: relative;
  z-index: 2;
  flex: none;
  width: var(--node-size);
  height: var(--node-size);
}

.node {
  --node-bg: var(--zone-color);
  --node-ink: var(--zone-ink-large);
  --node-depth: color-mix(in srgb, var(--zone-color) 60%, #000);
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 4px solid var(--color-paper-light);
  border-radius: 50%;
  background-color: var(--node-bg);
  /* Kilau di kiri atas supaya terlihat timbul */
  background-image: radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.42) 0 16%, transparent 46%);
  color: var(--node-ink);
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
  box-shadow:
    0 6px 0 var(--node-depth),
    0 12px 20px rgba(60, 38, 12, 0.3);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  /* Kurva dengan "overshoot" membuat titik membal ringan */
  transition: transform 0.35s cubic-bezier(0.3, 1.8, 0.5, 1), box-shadow 0.2s ease;
}

.node__number {
  margin-top: 2px;
}

.node:focus-visible {
  outline: 4px solid var(--color-ink);
  outline-offset: 6px;
}

@media (hover: hover) {
  .node:not(:disabled):hover {
    transform: translateY(-6px);
    box-shadow:
      0 11px 0 var(--node-depth),
      0 18px 24px rgba(60, 38, 12, 0.26);
  }
}

.node:not(:disabled):active {
  transform: translateY(3px);
  box-shadow:
    0 2px 0 var(--node-depth),
    0 4px 8px rgba(60, 38, 12, 0.25);
  transition-duration: 0.08s;
}

/* Lencana kecil di pojok titik: centang (selesai) atau gembok (terkunci) */
.node__badge {
  position: absolute;
  top: -8px;
  right: -8px;
  display: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 3px solid var(--color-paper-light);
  border-radius: 50%;
  background: var(--color-success);
  color: #FFFFFF;
  box-shadow: 0 2px 0 var(--color-success-dark);
}

.node__badge svg {
  width: 16px;
  height: 16px;
}

/* Status: selesai → warna lebih gelap, lebih datar, ada centang */
.stop.is-done .node {
  --node-bg: color-mix(in srgb, var(--zone-color) 70%, #1C1209);
  --node-ink: #FFFFFF;
  --node-depth: color-mix(in srgb, var(--zone-color) 42%, #000);
  background-image: none;
  box-shadow:
    0 3px 0 var(--node-depth),
    0 6px 12px rgba(60, 38, 12, 0.22);
}

.stop.is-done .node__badge {
  display: grid;
}

/* Status: terkunci → abu-abu dan tidak bisa diklik */
.stop.is-locked .node {
  --node-bg: var(--color-locked);
  --node-ink: var(--color-locked-ink);
  --node-depth: var(--color-locked-dark);
  background-image: none;
  cursor: not-allowed;
}

.stop.is-locked .node__badge {
  display: grid;
  background: var(--color-locked-dark);
  box-shadow: none;
}

/* Titik "?" di wilayah yang belum punya exercise */
.node-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 4px dashed var(--color-locked-dark);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  color: var(--color-locked-ink);
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
}

/* Penanda "Kamu di sini": cincin berdenyut + label di atas titik */
.stop.is-current .stop__node::before {
  content: "";
  position: absolute;
  inset: -6px;
  border: 4px solid var(--zone-color);
  border-radius: 50%;
  pointer-events: none;
  animation: pulse-ring 1.8s ease-out infinite;
}

.here-marker {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  z-index: 3;
  display: none;
  padding: 3px 12px 4px;
  border-radius: var(--radius-pill);
  background: var(--color-ink);
  color: var(--color-cream);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
  transform: translateX(-50%);
  animation: here-bob 1.6s ease-in-out infinite;
}

.here-marker::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -7px;
  border: 7px solid transparent;
  border-top-color: var(--color-ink);
  border-bottom: 0;
}

.stop.is-current .here-marker {
  display: block;
}

/* Judul exercise di sebelah titik */
.stop__label {
  position: relative;
  z-index: 2;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 16rem;
  padding: 8px 14px 9px;
  border: 2px solid color-mix(in srgb, var(--zone-color) 38%, transparent);
  border-radius: var(--radius-md);
  background: rgba(255, 249, 234, 0.95);
  box-shadow: 0 3px 0 rgba(94, 58, 23, 0.14);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stop--right .stop__label {
  text-align: right;
}

.stop__title {
  display: block;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.stop__meta {
  display: block;
  margin-top: 2px;
  color: var(--color-ink-soft);
  font-size: 0.8rem;
  font-weight: 700;
}

.stop__status {
  display: none;
  color: var(--color-success-dark);
}

.stop.is-done .stop__status {
  display: inline;
}

.stop.is-locked .stop__label {
  cursor: default;
  color: var(--color-locked-ink);
}

@media (hover: hover) {
  .stop:not(.is-locked) .stop__label:hover {
    border-color: var(--zone-color);
    transform: translateY(-2px);
  }
}

/* Dekorasi kecil di tepi zona, di samping titik */
.stop__scenery {
  position: absolute;
  top: 50%;
  width: clamp(28px, 8vw, 58px);
  height: clamp(28px, 8vw, 58px);
  color: var(--zone-color);
  pointer-events: none;
  transform: translateY(-20%);
}

.stop--left .stop__scenery {
  left: 2.5%;
}

.stop--right .stop__scenery {
  right: 2.5%;
}

/* Dekorasi tambahan di sisi seberang, hanya di layar lebar */
.stop__scenery--far {
  display: none;
}


/* ---------- 9. Kabut wilayah terkunci ---------- */
.zone__fog {
  position: absolute;
  inset: -3px;
  z-index: 4;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 40px;
  background:
    radial-gradient(closest-side, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0)) 0% 30% / 60% 38% no-repeat,
    radial-gradient(closest-side, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0)) 100% 60% / 65% 40% no-repeat,
    radial-gradient(closest-side, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0)) 25% 100% / 65% 38% no-repeat,
    rgba(232, 228, 222, 0.48);
  -webkit-backdrop-filter: blur(1.5px) grayscale(0.55);
  backdrop-filter: blur(1.5px) grayscale(0.55);
}

.fog__cloud {
  position: absolute;
  width: 42%;
  max-width: 240px;
  height: auto;
  aspect-ratio: 2 / 1;
  opacity: 0.75;
  animation: cloud-drift 14s ease-in-out infinite alternate;
}

.fog__cloud--1 {
  top: 34%;
  left: -12%;
}

.fog__cloud--2 {
  top: 42%;
  right: -10%;
  animation-duration: 18s;
  animation-direction: alternate-reverse;
}

.fog__cloud--3 {
  bottom: 2%;
  left: 18%;
  animation-duration: 16s;
}

.fog__badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  background: rgba(58, 39, 21, 0.9);
  color: var(--color-cream);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.fog__badge svg {
  width: 18px;
  height: 18px;
}


/* ---------- 10. FINISH ---------- */
.map-finish {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 60px;
  text-align: center;
}

/* Garis finish kotak-kotak = titik akhir jalur */
.finish__pad {
  width: 84px;
  height: 32px;
  border: 3px solid var(--color-ink);
  border-radius: 50%;
  background: repeating-conic-gradient(var(--color-ink) 0 25%, var(--color-cream) 0 50%) 50% 50% / 14px 14px;
  box-shadow: 0 3px 0 rgba(58, 39, 21, 0.35);
}

.finish__castle {
  width: clamp(150px, 42vw, 200px);
  height: auto;
  aspect-ratio: 180 / 150;
  margin-top: 8px;
  filter: saturate(0.75);
}

.finish__title {
  margin: 8px 0 0;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.finish__text {
  margin: 0;
  color: var(--color-ink-soft);
  font-weight: 700;
}

.badge-soon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0 0;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--color-ink);
  color: var(--color-cream);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 800;
}

.badge-soon svg {
  width: 16px;
  height: 16px;
}


/* ---------- 11. Tombol ---------- */
.btn {
  --btn-bg: var(--color-paper);
  --btn-ink: var(--color-ink);
  --btn-depth: rgba(94, 58, 23, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 10px 20px;
  border: 3px solid transparent;
  border-radius: 14px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--btn-depth);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--btn-depth);
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--btn-depth);
}

.btn:focus-visible {
  outline: 3px solid var(--color-ink);
  outline-offset: 3px;
}

.btn--primary {
  --btn-bg: var(--zone-color, var(--color-wood));
  --btn-ink: var(--zone-ink, #FFFFFF);
  --btn-depth: color-mix(in srgb, var(--zone-color, var(--color-wood)) 60%, #000);
}

.btn--outline {
  --btn-bg: var(--color-paper-light);
  border-color: rgba(94, 58, 23, 0.3);
}

/* Tombol "Tandai Selesai" saat exercise sudah selesai */
.btn--done {
  --btn-bg: var(--color-success-light);
  --btn-ink: var(--color-success-dark);
  --btn-depth: rgba(19, 119, 63, 0.35);
  border-color: var(--color-success);
}

.btn--danger {
  --btn-bg: var(--color-danger);
  --btn-ink: #FFFFFF;
  --btn-depth: var(--color-danger-dark);
}


/* ---------- 12. Popup (dialog) ---------- */
.dialog {
  width: min(100% - 32px, 30rem);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0; /* isi popup ada di .dialog__inner */
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 24px;
  background: var(--color-paper-light);
  color: var(--color-ink);
  box-shadow: var(--shadow-card);
}

.dialog::backdrop {
  background: rgba(42, 27, 12, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.dialog[open] {
  animation: dialog-in 0.3s cubic-bezier(0.3, 1.4, 0.6, 1);
}

.dialog__inner {
  position: relative;
  padding: 24px 22px 22px;
  border-top: 10px solid var(--zone-color, var(--color-wood));
}

.dialog__close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(94, 58, 23, 0.1);
  color: var(--color-ink);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.dialog__close:hover {
  background: rgba(94, 58, 23, 0.2);
}

.dialog__close:focus-visible {
  outline: 3px solid var(--color-ink);
  outline-offset: 2px;
}

.dialog__close svg {
  width: 20px;
  height: 20px;
}

.dialog__eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding-right: 52px;
}

.region-badge {
  display: inline-flex;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--zone-color);
  color: var(--zone-ink);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1.3;
}

.dialog__number {
  color: var(--color-ink-soft);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dialog__title {
  margin: 10px 0 6px;
  font-size: 1.7rem;
  font-weight: 800;
}

.dialog__desc {
  margin: 0 0 18px;
}

.dialog__facts {
  display: grid;
  gap: 14px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 2px dashed color-mix(in srgb, var(--zone-color, var(--color-wood)) 35%, transparent);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--zone-color, var(--color-wood)) 7%, var(--color-paper-light));
}

.dialog__facts dt {
  color: var(--color-ink-soft);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dialog__facts dd {
  margin: 4px 0 0;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag {
  padding: 3px 10px;
  border: 2px solid color-mix(in srgb, var(--zone-color) 40%, transparent);
  border-radius: var(--radius-pill);
  background: var(--color-paper-light);
  font-size: 0.85rem;
  font-weight: 700;
}

.level-pill {
  display: inline-block;
  padding: 2px 12px;
  border-radius: var(--radius-pill);
  background: var(--color-ink);
  color: var(--color-cream);
  font-size: 0.85rem;
  font-weight: 800;
}

.dialog__status {
  margin: 0 0 16px;
  color: var(--color-ink-soft);
  font-weight: 700;
}

.dialog.is-done .dialog__status {
  color: var(--color-success-dark);
}

.dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.dialog__actions .btn {
  flex: 1 1 12rem;
}

.dialog__nolink {
  margin: 12px 0 0;
  color: var(--color-ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
}

/* Popup konfirmasi reset */
.dialog--confirm {
  width: min(100% - 32px, 25rem);
}

.dialog--confirm .dialog__inner {
  border-top-color: var(--color-danger);
}

.dialog--confirm .dialog__title {
  margin-top: 0;
}


/* ---------- 13. Footer & utilitas ---------- */
.page-footer {
  max-width: var(--map-max-width);
  margin: 0 auto;
  padding: 20px 16px 32px;
  color: var(--color-ink);
  font-size: 0.85rem;
  text-align: center;
}

.page-footer p {
  margin: 4px 0;
}

.storage-warning {
  color: var(--color-danger);
  font-weight: 800;
}

/* Tersembunyi di layar, tetap dibacakan pembaca layar */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--color-ink);
  color: var(--color-cream);
  font-weight: 800;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: none;
}

/* Tempat menyimpan <symbol> SVG, tidak tampil di layar */
.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}


/* ---------- 14. Animasi ---------- */
/* Animasi pembuka hanya aktif selama peta punya class "is-intro" (diatur app.js) */

/* 1) Jalur tergambar dari atas ke bawah */
.map.is-intro .trail__edge,
.map.is-intro .trail__ground {
  stroke-dasharray: 1 2;
  stroke-dashoffset: 1;
  animation: draw-trail var(--draw-duration) linear forwards;
}

/* 2) Garis rute muncul setelah tanahnya tergambar */
.map.is-intro .trail__mark {
  animation: fade-in 0.35s ease-out both;
  animation-delay: var(--delay, 0ms);
}

/* 3) Titik muncul satu per satu saat jalur sampai di sana */
.map.is-intro .stop__node {
  animation: pop-in 0.5s cubic-bezier(0.3, 1.4, 0.6, 1) both;
  animation-delay: var(--pop-delay, 0ms);
}

.map.is-intro .stop__label {
  animation: label-in 0.4s ease-out both;
  animation-delay: calc(var(--pop-delay, 0ms) + 150ms);
}

@keyframes draw-trail {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes pop-in {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  60% {
    opacity: 1;
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes label-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes pulse-ring {
  from {
    opacity: 0.9;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(1.6);
  }
}

@keyframes here-bob {
  0%,
  100% {
    transform: translate(-50%, 0);
  }
  50% {
    transform: translate(-50%, -5px);
  }
}

@keyframes cloud-drift {
  from {
    transform: translateX(-5%);
  }
  to {
    transform: translateX(7%);
  }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
}


/* ---------- 15. Layar lebar ---------- */
@media (min-width: 640px) {
  :root {
    --node-size: 80px;
    --stop-height: 150px;
    --stop-x: 30%;
  }

  .hud__inner {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "brand progress reset";
    gap: 24px;
  }

  .map {
    margin-top: 24px;
    padding: 36px 24px 44px;
  }

  .map__compass {
    display: block;
  }

  .zone__header {
    min-height: 116px;
    padding: 0 24px;
  }

  .signpost__name {
    font-size: 1.3rem;
  }

  .stop__title {
    font-size: 1.15rem;
  }

  .stop__scenery--far {
    display: block;
  }

  /* Dekorasi tambahan diletakkan di sisi yang berlawanan */
  .stop--left .stop__scenery--far {
    right: 3%;
    left: auto;
  }

  .stop--right .stop__scenery--far {
    right: auto;
    left: 3%;
  }

  .dialog__inner {
    padding: 28px 28px 26px;
  }

  .dialog__title {
    font-size: 1.9rem;
  }
}


/* ---------- 16. Mode kurangi gerakan ---------- */
/* Kalau pengguna mengaktifkan "kurangi animasi" di perangkatnya,
   semua animasi dimatikan dan tampilan langsung jadi. */
@media (prefers-reduced-motion: reduce) {
  .map.is-intro .trail__edge,
  .map.is-intro .trail__ground {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
    animation: none;
  }

  .map.is-intro .trail__mark,
  .map.is-intro .stop__node,
  .map.is-intro .stop__label,
  .here-marker,
  .fog__cloud,
  .dialog[open] {
    animation: none;
  }

  /* Cincin "Kamu di sini" tetap terlihat, tapi diam */
  .stop.is-current .stop__node::before {
    opacity: 0.55;
    transform: scale(1.2);
    animation: none;
  }

  .node,
  .btn,
  .stop__label,
  .progress__fill,
  .skip-link {
    transition: none;
  }
}
