/* ==========================================================================
   MANASIK SIMULATOR — stylesheet
   --------------------------------------------------------------------------
   Struktur:
     1. Token      — custom property, dua tema
     2. Reset      — normalisasi minimal
     3. Primitif   — tombol, kartu, pil, switch
     4. Creator    — layar pembuatan karakter
     5. HUD        — topbar, sidebar, panel misi, minimap
     6. Overlay    — modal, toast, askar, loading
     7. Completion — layar akhir
     8. Responsif  — tablet & ponsel
     9. A11y       — fokus, reduced-motion
   ========================================================================== */

/* ============================ 1. TOKEN ============================ */
:root {
  /* geometri */
  --pad: 48px;
  --card-w: 400px;
  --gap: 24px;
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;

  /* area aman perangkat */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --app-h: 100dvh;

  /* tipografi */
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ar: "Noto Naskh Arabic", "Traditional Arabic", "Amiri", serif;

  /* tema malam (default) */
  --accent: #c4b5fd;
  --accent-soft: rgba(157, 127, 234, .18);
  --accent-glow: rgba(157, 127, 234, .35);
  --cta: #6d4c9e;
  --cta-hover: #805ad5;
  --cta-ink: #ffffff;
  --gold: #d8b97d;
  --warn: #f2c14e;
  --ok: #4ade80;

  --ink: #f3f0f9;
  --ink-2: #cfc7e2;
  --ink-3: #b3aec4;

  --line: rgba(179, 174, 196, .2);
  --line-strong: rgba(216, 185, 125, .42);
  --line-faint: rgba(179, 174, 196, .1);

  --fill: rgba(87, 62, 119, .14);
  --fill-hover: rgba(87, 62, 119, .26);

  --surface: rgba(24, 17, 60, .92);
  --surface-solid: #18113c;
  --deck: rgba(24, 17, 60, .88);
  --deck-line: rgba(216, 185, 125, .2);

  --shadow: 0 24px 60px rgba(10, 7, 30, .65);
  --shadow-sm: 0 12px 36px rgba(10, 7, 30, .6);

  --bg: #0b0f1a;
  --hint-bg: rgba(20, 14, 58, .72);

  /* durasi */
  --t-fast: .16s;
  --t: .26s;
  --t-slow: .42s;
  --ease: cubic-bezier(.2, .8, .25, 1);
}

body.theme-light {
  --accent: #065f46;
  --accent-soft: rgba(16, 185, 129, .13);
  --accent-glow: rgba(16, 185, 129, .24);
  --cta: #047857;
  --cta-hover: #059669;
  --cta-ink: #ffffff;
  --gold: #b7791f;
  --warn: #92400e;
  --ok: #047857;

  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #4b5a70;

  --line: rgba(15, 23, 42, .18);
  --line-strong: rgba(15, 23, 42, .5);
  --line-faint: rgba(15, 23, 42, .08);

  --fill: #f1f5f9;
  --fill-hover: #e2e8f0;

  --surface: rgba(255, 255, 255, .96);
  --surface-solid: #ffffff;
  --deck: rgba(255, 255, 255, .94);
  --deck-line: rgba(15, 23, 42, .12);

  --shadow: 0 25px 60px -10px rgba(15, 23, 42, .18);
  --shadow-sm: 0 10px 30px rgba(15, 23, 42, .1);

  --bg: #f8fafc;
  --hint-bg: rgba(255, 255, 255, .9);
}

/* ============================ 2. RESET ============================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
svg { display: block; flex-shrink: 0; }
canvas { display: block; }

.ar { font-family: var(--font-ar); }
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Scrollbar tipis yang ikut tema. */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: var(--line-strong); }

/* ============================ 3. PRIMITIF ============================ */
#scene {
  position: fixed; inset: 0;
  width: 100%; height: var(--app-h);
  z-index: 0;
  touch-action: none;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; letter-spacing: .01em;
  white-space: nowrap;
  transition: background var(--t-fast), transform var(--t-fast),
              box-shadow var(--t-fast), border-color var(--t-fast);
}
.btn:active { transform: translateY(1px) scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn.primary {
  background: var(--cta); color: var(--cta-ink);
  box-shadow: 0 6px 20px -6px var(--accent-glow);
}
.btn.primary:hover:not(:disabled) {
  background: var(--cta-hover);
  box-shadow: 0 10px 28px -8px var(--accent-glow);
}

.btn.outline { border: 1px solid var(--line-strong); color: var(--ink); }
.btn.outline:hover:not(:disabled) { background: var(--fill-hover); }

.btn.ghost { color: var(--ink-2); }
.btn.ghost:hover:not(:disabled) { background: var(--fill); color: var(--ink); }

.btn.wide { width: 100%; }

/* `display: inline-flex` pada .btn mengalahkan perilaku bawaan atribut
   [hidden], sehingga tombol yang disembunyikan lewat JS tetap tampak.
   Aturan ini mengembalikannya — berlaku untuk semua elemen, bukan hanya
   tombol, supaya tidak ada kejutan serupa di komponen lain. */
[hidden] { display: none !important; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 11px;
  color: var(--ink-2);
  border: 1px solid transparent;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.icon-btn:hover { background: var(--fill-hover); color: var(--ink); border-color: var(--line); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent); border-color: var(--line-strong); }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px;
  border-radius: 99px;
  background: var(--deck);
  border: 1px solid var(--deck-line);
  font-size: 12px; font-weight: 600;
  backdrop-filter: blur(12px) saturate(1.2);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px) saturate(1.3);
}

.field { display: flex; flex-direction: column; gap: 9px; }
.field-label {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3);
}
.field-label .ar {
  font-size: 13px; font-weight: 500; letter-spacing: 0;
  text-transform: none; color: var(--gold);
}

.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--fill);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 14.5px;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.input::placeholder { color: var(--ink-3); opacity: .7; }
.input:focus {
  outline: none;
  border-color: var(--line-strong);
  background: var(--fill-hover);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Grup segmen — dipakai untuk pilihan eksklusif (gender, tipe haji). */
.seg { display: flex; gap: 8px; }
.seg-btn {
  flex: 1;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--fill);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 13px; font-weight: 600;
  transition: all var(--t-fast);
}
.seg-btn:hover { background: var(--fill-hover); color: var(--ink); }
.seg-btn.active {
  background: var(--accent-soft);
  border-color: var(--line-strong);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-soft);
}

/* Switch */
.switch {
  position: relative;
  width: 46px; height: 26px;
  border-radius: 99px;
  background: var(--fill);
  border: 1px solid var(--line);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.switch::after {
  content: ""; position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--ink-3);
  transition: transform var(--t) var(--ease), background var(--t-fast);
}
.switch.active { background: var(--accent-soft); border-color: var(--line-strong); }
.switch.active::after { transform: translateX(20px); background: var(--accent); }
.is-rtl .switch.active::after { transform: translateX(-20px); }

/* Swatch warna */
.swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.swatch {
  width: 32px; height: 32px;
  border-radius: 10px;
  border: 2px solid var(--line);
  transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.swatch:hover { transform: scale(1.1); }
.swatch.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--accent-soft), inset 0 0 0 2px rgba(255, 255, 255, .25);
  transform: scale(1.08);
}

/* Teks bergradien dengan kilau bergerak — dipakai pada judul aksen. */
.shimmer {
  background-image:
    linear-gradient(100deg, transparent 0% 38%, rgba(255, 255, 255, .55) 50%, transparent 62% 100%),
    linear-gradient(90deg, var(--accent), var(--gold));
  background-size: 300% 100%, 100% 100%;
  background-position: -150% 0, 0 0;
  background-repeat: no-repeat;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: shimmerSweep 3.6s ease-in-out infinite;
}
@keyframes shimmerSweep {
  0% { background-position: 100% 0, 0 0; }
  to { background-position: 0 0, 0 0; }
}

/* ============================ 4. CREATOR ============================ */
#creator {
  position: fixed; inset: 0;
  z-index: 20;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: var(--app-h);
  pointer-events: none;
  opacity: 1;
  transition: opacity var(--t-slow) var(--ease);
}
#creator > * { pointer-events: auto; }
#creator.hide { opacity: 0; pointer-events: none; }

.creator-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: calc(14px + var(--safe-top)) calc(var(--pad) + var(--safe-right))
           14px calc(var(--pad) + var(--safe-left));
}

.brand { display: flex; flex-direction: column; gap: 2px; }
.brand-title {
  font-size: 15px; font-weight: 800;
  letter-spacing: .14em;
  color: var(--ink);
}
.brand-sub {
  font-size: 11px; font-weight: 500;
  letter-spacing: .05em;
  color: var(--ink-3);
}

.topbar-tools { display: flex; align-items: center; gap: 8px; }

.basmala {
  font-family: var(--font-ar);
  font-size: 17px;
  color: var(--gold);
  opacity: .9;
  white-space: nowrap;
}

.creator-body {
  display: grid;
  grid-template-columns: var(--card-w) 1fr var(--card-w);
  gap: var(--gap);
  align-items: center;
  padding: 0 calc(var(--pad) + var(--safe-left)) 0 calc(var(--pad) + var(--safe-right));
  min-height: 0;
}

.hero-card {
  display: flex; flex-direction: column; gap: 18px;
  padding: 26px;
  max-height: calc(var(--app-h) - 190px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(1.3);
}

.hero-head { display: flex; flex-direction: column; gap: 8px; }
.hero-ar {
  font-family: var(--font-ar);
  font-size: 21px; font-weight: 500;
  color: var(--gold);
  line-height: 1.5;
}
.hero-title {
  font-size: 23px; font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.01em;
}
.hero-text {
  font-size: 13.5px; line-height: 1.6;
  color: var(--ink-2);
}

.creator-center {
  position: relative;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
  gap: 14px;
  height: 100%;
  min-height: 0;
  padding-bottom: 18px;
  pointer-events: none;
}
.creator-center > * { pointer-events: auto; }

.view-hint {
  padding: 7px 14px;
  border-radius: 99px;
  background: var(--hint-bg);
  border: 1px solid var(--line-faint);
  font-size: 11.5px;
  color: var(--ink-3);
  backdrop-filter: blur(10px);
}

.explore-stack { display: flex; flex-direction: column; gap: 12px; }

.explore-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  text-align: start;
  transition: transform var(--t) var(--ease), border-color var(--t-fast),
              box-shadow var(--t-fast);
}
.explore-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.explore-icon {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--line-strong);
}
.explore-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.explore-name { font-size: 14.5px; font-weight: 700; }
.explore-sub {
  font-size: 11.5px; line-height: 1.4;
  color: var(--ink-3);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden;
}
.explore-go { color: var(--ink-3); flex-shrink: 0; }
.is-rtl .explore-go { transform: scaleX(-1); }

.creator-foot {
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  padding: 16px calc(var(--pad) + var(--safe-right))
           calc(16px + var(--safe-bottom)) calc(var(--pad) + var(--safe-left));
  font-size: 11.5px;
  color: var(--ink-3);
}
.disc-ar { font-family: var(--font-ar); font-size: 13px; color: var(--gold); opacity: .85; }

/* --- drawer kustomisasi --- */
#drawer {
  position: fixed;
  top: 0; bottom: 0;
  inset-inline-start: 0;
  width: min(420px, 92vw);
  z-index: 40;
  display: flex; flex-direction: column;
  background: var(--surface-solid);
  border-inline-end: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateX(-100%);
  transition: transform var(--t-slow) var(--ease);
}
.is-rtl #drawer { transform: translateX(100%); }
#drawer.open { transform: translateX(0); }

#drawerBackdrop {
  position: fixed; inset: 0;
  z-index: 35;
  background: rgba(6, 4, 18, .55);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t) var(--ease);
  backdrop-filter: blur(3px);
}
#drawerBackdrop.open { opacity: 1; pointer-events: auto; }

.drawer-head {
  display: flex; align-items: center; gap: 12px;
  padding: calc(20px + var(--safe-top)) 22px 16px;
  border-bottom: 1px solid var(--line-faint);
}
.drawer-title { flex: 1; font-size: 16px; font-weight: 700; }
.drawer-body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex; flex-direction: column; gap: 22px;
}
.drawer-foot {
  padding: 16px 22px calc(16px + var(--safe-bottom));
  border-top: 1px solid var(--line-faint);
}

/* Baris pilihan busana — kartu dengan ikon + deskripsi. */
.outfit-row { display: flex; flex-direction: column; gap: 8px; }
.outfit-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--fill);
  border: 1px solid var(--line);
  text-align: start;
  transition: all var(--t-fast);
}
.outfit-btn:hover { background: var(--fill-hover); }
.outfit-btn.active { background: var(--accent-soft); border-color: var(--line-strong); }
.outfit-btn .ob-icon { color: var(--ink-3); }
.outfit-btn.active .ob-icon { color: var(--accent); }
.ob-meta { flex: 1; min-width: 0; }
.ob-name { font-size: 13.5px; font-weight: 600; }
.ob-sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

/* ============================ 5. HUD ============================ */
#hud {
  position: fixed; inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-slow) var(--ease);
}
#hud.show { opacity: 1; }
#hud > * { pointer-events: auto; }

/* --- topbar --- */
#topbar {
  position: absolute;
  top: calc(12px + var(--safe-top));
  inset-inline: calc(16px + var(--safe-left));
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
}

.topbar-group {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--deck);
  border: 1px solid var(--deck-line);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px) saturate(1.3);
}

.step-pill { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.step-label {
  font-size: 10.5px; font-weight: 700;
  letter-spacing: .12em;
  color: var(--accent);
}
.step-dots { display: flex; gap: 5px; }
.step-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--line);
  transition: background var(--t), transform var(--t), width var(--t);
}
.step-dot.done { background: var(--ok); }
.step-dot.active { background: var(--accent); width: 18px; border-radius: 99px; }
.step-dot.skipped { background: var(--warn); }

.time-row { display: flex; gap: 3px; }
.time-btn {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px; font-weight: 600;
  color: var(--ink-3);
  transition: all var(--t-fast);
}
.time-btn:hover { background: var(--fill-hover); color: var(--ink); }
.time-btn.active { background: var(--accent-soft); color: var(--accent); }

/* --- sidebar tahapan --- */
#sidebar {
  position: absolute;
  top: calc(84px + var(--safe-top));
  inset-inline-start: calc(16px + var(--safe-left));
  width: 272px;
  max-height: calc(var(--app-h) - 300px);
  display: flex; flex-direction: column;
  border-radius: var(--radius);
  background: var(--deck);
  border: 1px solid var(--deck-line);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px) saturate(1.3);
  overflow: hidden;
  transition: transform var(--t-slow) var(--ease), opacity var(--t) var(--ease);
}
#sidebar.collapsed {
  transform: translateX(calc(-100% - 20px));
  opacity: 0;
}
.is-rtl #sidebar.collapsed { transform: translateX(calc(100% + 20px)); }

.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line-faint);
}
.sidebar-label {
  font-size: 10px; font-weight: 800;
  letter-spacing: .13em;
  color: var(--ink-3);
}
.sidebar-count { font-size: 11px; font-weight: 700; color: var(--accent); }

.sidebar-list {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 8px;
  display: flex; flex-direction: column; gap: 4px;
}

.stage-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  padding: 10px 11px;
  border-radius: var(--radius-sm);
  text-align: start;
  transition: background var(--t-fast);
}
.stage-item:hover { background: var(--fill); }
.stage-item.active { background: var(--accent-soft); }

.stage-num {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--fill);
  border: 1px solid var(--line);
  font-size: 11px; font-weight: 700;
  color: var(--ink-3);
  transition: all var(--t-fast);
}
.stage-item.active .stage-num {
  background: var(--accent); border-color: var(--accent); color: var(--surface-solid);
}
.stage-item.done .stage-num {
  background: var(--ok); border-color: var(--ok); color: #06281a;
}
.stage-item.skipped .stage-num {
  background: var(--warn); border-color: var(--warn); color: #2a1a04;
}

.stage-meta { flex: 1; min-width: 0; }
.stage-name {
  display: flex; align-items: baseline; gap: 7px;
  font-size: 13px; font-weight: 600;
}
.stage-name .ar { font-size: 12px; color: var(--gold); opacity: .8; }
.stage-desc {
  font-size: 10.5px; color: var(--ink-3);
  margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-foot {
  padding: 12px 16px calc(14px);
  border-top: 1px solid var(--line-faint);
}
.motiv-title {
  font-size: 11px; font-weight: 700;
  color: var(--accent);
  margin-bottom: 3px;
}
.motiv-text { font-size: 11px; line-height: 1.45; color: var(--ink-3); }

/* --- panel misi bawah --- */
#panel {
  position: absolute;
  bottom: calc(16px + var(--safe-bottom));
  inset-inline: calc(16px + var(--safe-left));
  max-width: 760px;
  margin-inline: auto;
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--deck);
  border: 1px solid var(--deck-line);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px) saturate(1.3);
  transition: transform var(--t-slow) var(--ease);
}
#panel.collapsed { transform: translateY(calc(100% - 46px)); }

.panel-head { display: flex; align-items: center; gap: 12px; }
.stage-badge {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--line-strong);
}
.panel-titles { flex: 1; min-width: 0; }
.panel-stage {
  display: flex; align-items: baseline; gap: 9px;
  font-size: 16px; font-weight: 700;
}
.panel-stage .ar { font-size: 15px; color: var(--gold); }
.panel-kicker {
  font-size: 10px; font-weight: 700;
  letter-spacing: .12em;
  color: var(--ink-3);
  margin-bottom: 2px;
}

/* Ring progres SVG — stroke-dashoffset dikendalikan JS. */
.ring { position: relative; width: 44px; height: 44px; flex-shrink: 0; }
.ring svg { transform: rotate(-90deg); }
.ring-bg { stroke: var(--line); }
.ring-fg {
  stroke: var(--accent);
  stroke-linecap: round;
  transition: stroke-dashoffset var(--t-slow) var(--ease);
}
.ring-text {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800;
  color: var(--accent);
}

.mission-text { font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }

.tip-row {
  display: flex; gap: 10px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--fill);
  border: 1px solid var(--line-faint);
}
.tip-icon { color: var(--warn); flex-shrink: 0; margin-top: 1px; }
.tip-text { font-size: 12px; line-height: 1.5; color: var(--ink-3); }

/* Panah navigasi digambar CSS, bukan ditulis di kamus: di RTL "kembali"
   menunjuk ke kanan, dan karakter literal di teks terjemahan akan selalu
   salah di salah satu arah. `scaleX(-1)` pada mode RTL membalik keduanya
   sekaligus. */
#prevBtn::before,
#nextBtn::after {
  content: "";
  width: 14px; height: 14px;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: var(--arrow) center / contain no-repeat;
  mask: var(--arrow) center / contain no-repeat;
}
#prevBtn::before { --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5M11 18l-6-6 6-6'/%3E%3C/svg%3E"); }
#nextBtn::after { --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E"); }
.is-rtl #prevBtn::before,
.is-rtl #nextBtn::after { transform: scaleX(-1); }

.panel-nav { display: flex; align-items: center; gap: 10px; }
.panel-nav-right { margin-inline-start: auto; display: flex; gap: 8px; }

/* --- kartu putaran (tawaf/sai) --- */
#circuit {
  position: absolute;
  top: calc(84px + var(--safe-top));
  inset-inline-end: calc(16px + var(--safe-right));
  width: 212px;
  padding: 15px 17px;
  border-radius: var(--radius);
  background: var(--deck);
  border: 1px solid var(--deck-line);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px) saturate(1.3);
  opacity: 0; transform: translateY(-10px);
  pointer-events: none;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
#circuit.show { opacity: 1; transform: none; pointer-events: auto; }

.circuit-label {
  font-size: 10px; font-weight: 800;
  letter-spacing: .13em;
  color: var(--ink-3);
}
.circuit-count {
  display: flex; align-items: baseline; gap: 4px;
  font-size: 34px; font-weight: 800;
  line-height: 1.05;
  color: var(--accent);
  margin: 4px 0 2px;
}
.circuit-total {
  font-size: 17px; font-weight: 600; color: var(--ink-3);
  /* Angka selalu dibaca kiri-ke-kanan walau antarmuka RTL; tanpa ini
     pembilang dan penyebut bertukar tempat dan terbaca "7 / 0". */
  direction: ltr;
  margin-inline-start: 2px;
}
.circuit-count { direction: ltr; }
.is-rtl .circuit-count { justify-content: flex-end; }
.circuit-hint { font-size: 11px; line-height: 1.4; color: var(--ink-3); }

/* Pip putaran — terisi satu per satu. */
.circuit-pips { display: flex; gap: 4px; margin-top: 10px; }
.circuit-pip {
  flex: 1; height: 4px;
  border-radius: 99px;
  background: var(--line);
  transition: background var(--t);
}
.circuit-pip.on { background: var(--accent); }

.circuit-bar {
  height: 4px; margin-top: 8px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}
.circuit-bar-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 99px;
  transition: width var(--t) linear;
}

/* --- minimap --- */
#minimap {
  position: absolute;
  bottom: calc(132px + var(--safe-bottom));
  inset-inline-end: calc(16px + var(--safe-right));
  width: 168px;
  border-radius: var(--radius);
  background: var(--deck);
  border: 1px solid var(--deck-line);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
  overflow: hidden;
  transition: opacity var(--t) var(--ease);
}
#minimap.hide { opacity: 0; pointer-events: none; }
#minimapCanvas { width: 100%; height: 168px; display: block; }
.minimap-compass {
  position: absolute; top: 8px; inset-inline-end: 8px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 9px; font-weight: 800;
  color: var(--gold);
}

/* --- petunjuk kontrol --- */
#controlsHint {
  position: absolute;
  bottom: calc(16px + var(--safe-bottom));
  inset-inline-start: calc(16px + var(--safe-left));
  max-width: 260px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: var(--hint-bg);
  border: 1px solid var(--line-faint);
  font-size: 11px; line-height: 1.5;
  color: var(--ink-3);
  backdrop-filter: blur(10px);
  transition: opacity var(--t) var(--ease);
}
#controlsHint.hide { opacity: 0; pointer-events: none; }
#controlsHint b {
  display: inline-block;
  padding: 1px 5px;
  margin: 0 1px;
  border-radius: 4px;
  background: var(--fill-hover);
  border: 1px solid var(--line);
  font-size: 10px; font-weight: 700;
  color: var(--ink-2);
}

/* --- joystick (sentuh) --- */
#joystick {
  position: absolute;
  bottom: calc(150px + var(--safe-bottom));
  inset-inline-start: calc(26px + var(--safe-left));
  width: 116px; height: 116px;
  border-radius: 50%;
  background: var(--hint-bg);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  display: none;
  touch-action: none;
}
#joystickKnob {
  position: absolute;
  top: 50%; left: 50%;
  width: 46px; height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
  transition: transform .08s linear;
}
body.touch #joystick { display: block; }

/* ============================ 6. OVERLAY ============================ */
.modal {
  position: fixed; inset: 0;
  z-index: 60;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(6, 4, 18, .6);
  backdrop-filter: blur(5px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t) var(--ease);
}
.modal.open { opacity: 1; pointer-events: auto; }

.modal-card {
  width: min(560px, 100%);
  max-height: 88vh;
  display: flex; flex-direction: column;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transform: translateY(14px) scale(.98);
  transition: transform var(--t) var(--ease);
}
.modal.open .modal-card { transform: none; }

.modal-head {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line-faint);
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.modal-body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex; flex-direction: column; gap: 24px;
}
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--line-faint);
}

.section-head { margin-bottom: 11px; }
.section-title { font-size: 13px; font-weight: 700; }
.section-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 9px; }
.choice-card {
  display: flex; align-items: center; gap: 11px;
  padding: 13px;
  border-radius: var(--radius-sm);
  background: var(--fill);
  border: 1px solid var(--line);
  text-align: start;
  transition: all var(--t-fast);
}
.choice-card:hover { background: var(--fill-hover); }
.choice-card.active { background: var(--accent-soft); border-color: var(--line-strong); }
.choice-emoji { font-size: 21px; line-height: 1; }
.choice-name { font-size: 13px; font-weight: 600; }
.choice-sub { font-size: 10.5px; color: var(--ink-3); margin-top: 1px; }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--fill);
  border: 1px solid var(--line-faint);
}
.toggle-label { font-size: 13px; font-weight: 600; }

.ctrl-grid { display: flex; flex-direction: column; gap: 8px; }
.ctrl-row { display: flex; align-items: center; gap: 12px; }
.ctrl-keys { display: flex; gap: 4px; }
.ctrl-key {
  min-width: 26px;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--fill-hover);
  border: 1px solid var(--line);
  font-size: 10.5px; font-weight: 700;
  text-align: center;
  color: var(--ink-2);
}
.ctrl-desc { font-size: 12px; color: var(--ink-3); }

/* --- kartu doa --- */
.dua-card {
  display: flex; flex-direction: column; gap: 11px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--fill);
  border: 1px solid var(--line-strong);
}
.dua-ar {
  font-family: var(--font-ar);
  font-size: 19px; line-height: 2;
  text-align: center;
  color: var(--gold);
  direction: rtl;
}
.dua-tr {
  font-size: 12px; font-style: italic; line-height: 1.6;
  text-align: center;
  color: var(--ink-3);
}
.dua-meaning {
  font-size: 12.5px; line-height: 1.6;
  color: var(--ink-2);
  padding-top: 10px;
  border-top: 1px solid var(--line-faint);
}
.dua-note { font-size: 11px; color: var(--ink-3); font-style: italic; }

/* --- toast --- */
#toastWrap {
  position: fixed;
  top: calc(84px + var(--safe-top));
  left: 50%; transform: translateX(-50%);
  z-index: 70;
  display: flex; flex-direction: column; gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 17px;
  border-radius: 99px;
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  font-size: 13px; font-weight: 600;
  animation: toastIn var(--t) var(--ease);
}
.toast.out { animation: toastOut var(--t) var(--ease) forwards; }
.toast.ok { border-color: var(--ok); }
.toast.ok .toast-icon { color: var(--ok); }
.toast.warn { border-color: var(--warn); }
.toast.warn .toast-icon { color: var(--warn); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-14px) scale(.95); }
  to { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-10px) scale(.96); }
}

/* --- caption askar --- */
#askar {
  position: fixed;
  bottom: calc(190px + var(--safe-bottom));
  left: 50%; transform: translate(-50%, 14px);
  z-index: 50;
  width: min(420px, 90vw);
  padding: 15px 18px;
  border-radius: var(--radius);
  background: var(--surface-solid);
  border: 1px solid var(--warn);
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
#askar.show { opacity: 1; transform: translate(-50%, 0); }

.askar-head {
  display: flex; align-items: center; gap: 9px;
  font-size: 10px; font-weight: 800;
  letter-spacing: .12em;
  color: var(--warn);
  margin-bottom: 8px;
}
.askar-ar {
  font-family: var(--font-ar);
  font-size: 19px; line-height: 1.8;
  color: var(--gold);
  direction: rtl;
  text-align: center;
}
.askar-sub {
  font-size: 12.5px; line-height: 1.5;
  color: var(--ink-2);
  text-align: center;
  margin-top: 5px;
}

/* --- loading tahap --- */
#stageLoading {
  position: fixed; inset: 0;
  z-index: 55;
  display: grid; place-items: center;
  background: var(--bg);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-slow) var(--ease);
}
#stageLoading.show { opacity: 1; pointer-events: auto; }

.loading-card { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.spinner {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-title { font-size: 15px; font-weight: 700; }
.loading-sub { font-family: var(--font-ar); font-size: 15px; color: var(--gold); }

/* --- progress bar atas --- */
#progressTrack {
  position: fixed;
  top: 0; inset-inline: 0;
  z-index: 80;
  height: 2.5px;
  background: transparent;
}
#progressBar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width var(--t) var(--ease);
}

/* --- dropdown bahasa --- */
#langMenu {
  position: fixed;
  z-index: 65;
  min-width: 190px;
  padding: 6px;
  border-radius: var(--radius);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-6px);
  pointer-events: none;
  transition: opacity var(--t-fast), transform var(--t-fast);
}
#langMenu.open { opacity: 1; transform: none; pointer-events: auto; }
.lang-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-align: start;
  transition: background var(--t-fast);
}
.lang-item:hover { background: var(--fill); }
.lang-item.active { background: var(--accent-soft); color: var(--accent); }
.lang-flag { font-size: 18px; }
.lang-name { flex: 1; font-size: 13px; font-weight: 600; }

/* ============================ 7. COMPLETION ============================ */
#completion {
  position: fixed; inset: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  padding: calc(40px + var(--safe-top)) calc(44px + var(--safe-right))
           calc(40px + var(--safe-bottom)) calc(44px + var(--safe-left));
  background: var(--bg);
  overflow-y: auto;
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-slow) var(--ease);
}
#completion.show { opacity: 1; pointer-events: auto; }

.completion-left {
  display: flex; flex-direction: column;
  justify-content: center; gap: 22px;
}
.completion-badge {
  display: inline-flex; align-items: center; gap: 8px;
  align-self: flex-start;
  padding: 7px 15px;
  border-radius: 99px;
  background: var(--accent-soft);
  border: 1px solid var(--line-strong);
  font-size: 10.5px; font-weight: 800;
  letter-spacing: .13em;
  color: var(--accent);
}
.verse-mark {
  font-family: var(--font-ar);
  font-size: clamp(24px, 3.4vw, 40px);
  line-height: 2;
  color: var(--gold);
  direction: rtl;
}
.verse-text {
  font-size: clamp(15px, 1.5vw, 19px);
  line-height: 1.7;
  color: var(--ink-2);
}
.verse-ref { font-size: 12px; font-weight: 600; color: var(--ink-3); }

.completion-right {
  display: flex; flex-direction: column;
  justify-content: center; gap: 18px;
  min-width: 0;
}
.completion-ring-wrap {
  display: flex; align-items: center; gap: 18px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--fill);
  border: 1px solid var(--line);
}
.big-ring { position: relative; width: 84px; height: 84px; flex-shrink: 0; }
.big-ring svg { transform: rotate(-90deg); }
.big-ring-text {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 19px; font-weight: 800;
  color: var(--accent);
}

.summary-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.summary-cell {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--fill);
  border: 1px solid var(--line-faint);
}
.summary-val { font-size: 21px; font-weight: 800; color: var(--accent); }
.summary-key {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .06em;
  color: var(--ink-3);
  margin-top: 3px;
}

.reflection {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: 1px solid var(--line-strong);
}
.reflection-title {
  font-size: 11px; font-weight: 800;
  letter-spacing: .1em;
  color: var(--accent);
  margin-bottom: 7px;
}
.reflection-text { font-size: 13px; line-height: 1.65; color: var(--ink-2); }

.completion-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ============================ 8. RESPONSIF ============================ */
@media (max-width: 1280px) {
  :root { --pad: 28px; --card-w: 340px; --gap: 18px; }
  .basmala { display: none; }
}

@media (max-width: 1024px) {
  .creator-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    gap: 14px;
    padding-bottom: 8px;
  }
  .hero-card { max-height: 38vh; }
  .creator-center { order: -1; min-height: 180px; }
  .explore-stack { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .explore-card { min-width: 230px; }
  .explore-sub { -webkit-line-clamp: 1; }

  #sidebar { width: 236px; }
  #completion { grid-template-columns: 1fr; gap: 26px; }
}

@media (max-width: 720px) {
  :root {
    --pad: 16px;
    --radius-lg: 16px;
    /* Tinggi lembar form; sisanya jadi panggung avatar. */
    --sheet-h: 56vh;
  }

  .creator-topbar { padding-inline: 16px; }
  .brand-sub { display: none; }

  /* Creator di ponsel: panggung avatar mengisi layar, form jadi lembar
     bawah yang digulir di dalam dirinya sendiri.
     
     Dua pendekatan sebelumnya gagal. `max-height: 42vh` membuat kartu
     menutupi avatar; grid tiga baris membuat kartu setinggi isinya sehingga
     tombol terakhir terdorong keluar layar. Lembar dengan tinggi tetap dan
     `overflow-y: auto` di dalamnya menyelesaikan keduanya: avatar punya
     ruang pasti, dan setiap kolom form tetap terjangkau lewat gulir. */
  .creator-body {
    display: block;
    position: relative;
    padding: 0;
  }
  .creator-center {
    /* Properti ditulis terpisah, bukan lewat shorthand `inset`.
       Breakpoint 1024px di atas menyetel `min-height: 180px` dan `order`,
       dan mencampur shorthand dengan properti longhand dari aturan lain
       membuat urutan kaskadenya sulit diprediksi. Eksplisit lebih aman. */
    position: absolute;
    top: 0;
    inset-inline: 0;
    bottom: var(--sheet-h);
    height: auto;
    min-height: 0;
    justify-content: center;
    padding: 0 16px 8px;
  }
  /* Petunjuk geser ditempel ke atas, bukan bawah: sisi bawah panggung
     bersentuhan dengan tepi lembar form dan keduanya saling menimpa. */
  .view-hint {
    position: absolute; top: 8px; left: 50%;
    transform: translateX(-50%);
    font-size: 10px; padding: 4px 10px;
    white-space: nowrap;
  }
  #crResetView { position: absolute; top: 8px; inset-inline-end: 16px; }

  .hero-card {
    position: absolute;
    inset-inline: 10px;
    bottom: 0;
    height: var(--sheet-h);
    padding: 16px;
    max-height: none;
    min-height: 0;
    gap: 14px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  /* Penanda geser, isyarat bahwa panel ini bisa digulir. */
  .hero-card::before {
    content: "";
    position: sticky; top: -4px;
    display: block;
    width: 38px; height: 4px;
    margin: -6px auto 2px;
    border-radius: 99px;
    background: var(--line-strong);
    opacity: .6;
  }
  .hero-ar { font-size: 17px; }
  .hero-title { font-size: 18px; }
  .hero-text {
    font-size: 12px; line-height: 1.5;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
    overflow: hidden;
  }
  .hero-card .btn { padding: 12px 16px; }

  /* Kartu jelajah jadi baris geser horizontal di dalam lembar. */
  .explore-stack {
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 2px;
    margin-top: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .explore-card {
    min-width: 215px; flex: 0 0 auto;
    padding: 11px; gap: 10px;
    scroll-snap-align: start;
  }
  .explore-icon { width: 36px; height: 36px; }
  .explore-name { font-size: 13px; }
  .explore-sub { font-size: 10.5px; -webkit-line-clamp: 1; }

  .creator-foot { padding-block: 10px; font-size: 10px; gap: 6px; }
  .disc-ar { font-size: 11px; }

  /* Topbar: dua kelompok saling menekan di layar sempit. Step-pill
     diprioritaskan (menunjukkan posisi dalam perjalanan), deretan ikon
     dibiarkan menyusut. */
  #topbar { inset-inline: 8px; gap: 6px; align-items: flex-start; }
  .topbar-group { padding: 6px 8px; gap: 4px; flex-shrink: 0; }
  .topbar-group:first-child { flex-shrink: 1; min-width: 0; }
  .time-row { display: none; }
  .step-label { font-size: 9.5px; letter-spacing: .08em; }
  .step-dots { gap: 3px; }
  .step-dot { width: 5px; height: 5px; }
  .step-dot.active { width: 13px; }
  .icon-btn { width: 32px; height: 32px; border-radius: 9px; }
  .icon-btn svg { width: 17px; height: 17px; }

  /* Joystick di sudut bawah, di samping panel — bukan menimpanya.
     Panel diberi ruang sisi supaya keduanya tidak bertabrakan. */
  #joystick {
    width: 96px; height: 96px;
    bottom: calc(14px + var(--safe-bottom));
    inset-inline-start: calc(12px + var(--safe-left));
    z-index: 12;
  }
  #joystickKnob { width: 38px; height: 38px; margin: -19px 0 0 -19px; }
  body.touch #panel { inset-inline-start: calc(118px + var(--safe-left)); }
  body.touch #controlsHint { display: none; }

  /* Di ponsel sidebar jadi lembar bawah, bukan kolom samping. */
  #sidebar {
    top: auto;
    bottom: calc(var(--safe-bottom));
    inset-inline: 10px;
    width: auto;
    max-height: 46vh;
    transform: translateY(calc(100% + 20px));
  }
  #sidebar.open { transform: none; }
  #sidebar.collapsed { transform: translateY(calc(100% + 20px)); }

  #panel { inset-inline: 10px; padding: 12px 13px; gap: 8px; }
  .panel-stage { font-size: 14px; }
  .panel-kicker { font-size: 9px; }
  .mission-text { font-size: 12px; line-height: 1.5; }
  .tip-row { padding: 8px 10px; }
  .tip-text { font-size: 10.5px; }
  .ring { width: 36px; height: 36px; }
  .ring svg { width: 36px; height: 36px; }
  .stage-badge { width: 28px; height: 28px; }
  /* Tombol nav dipadatkan; label panjang seperti "Selesaikan Perjalanan"
     dipotong daripada memaksa panel melebar. */
  .panel-nav { gap: 6px; flex-wrap: wrap; }
  .panel-nav .btn { padding: 9px 12px; font-size: 12.5px; }
  .panel-nav-right { gap: 6px; }
  #nextBtn { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }

  #circuit { width: 150px; padding: 11px 13px; }
  .circuit-count { font-size: 26px; }

  #minimap { width: 118px; bottom: calc(118px + var(--safe-bottom)); }
  #minimapCanvas { height: 118px; }

  #controlsHint { display: none; }

  .modal-card { max-height: 92vh; }
  .modal-body { padding: 16px 18px; gap: 18px; }
  .choice-grid { grid-template-columns: 1fr; }

  #completion { padding: 24px 16px; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .completion-actions .btn { flex: 1; }
}

/* ============================ 9. A11Y ============================ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
  }
  .shimmer { animation: none; background-position: 50% 0; }
}

/* Jeda animasi untuk section di luar viewport (dipasang oleh JS). */
.anim-paused, .anim-paused * { animation-play-state: paused !important; }
