/* ---------- Ikon ---------- */
.icon {
  width: 1.75rem; height: 1.75rem; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2.25;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon-fill { fill: currentColor; stroke: none; }

/* ---------- Tombol ---------- */
.btn {
  --edge: var(--gold-600);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.75rem;
  min-height: var(--touch);
  padding: 0 2rem 0.25rem;
  border: 0; border-radius: var(--r-control);
  font-family: var(--font-display); font-size: 1.625rem; font-weight: 700; line-height: 1;
  white-space: nowrap;
  background: var(--gold-400); color: var(--navy-900);
  /* Tepi bawah solid memberi kedalaman ringan seperti tombol fisik */
  box-shadow: inset 0 -0.375rem 0 var(--edge), 0 0.25rem 0.75rem rgb(28 43 75 / 0.18);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}
@media (hover: hover) { .btn:hover { background: var(--gold-300); } }
.btn:active:not(:disabled) {
  transform: translateY(0.25rem);
  box-shadow: inset 0 -0.125rem 0 var(--edge), 0 0.125rem 0.375rem rgb(28 43 75 / 0.18);
}
.btn-lg { min-height: 5.5rem; padding: 0 2.75rem 0.25rem; font-size: 2.125rem; border-radius: 1.25rem; }
.btn-lg .icon { width: 2.25rem; height: 2.25rem; }

.btn-secondary { --edge: var(--cream-300); background: var(--cream-50); color: var(--navy-900); }
@media (hover: hover) { .btn-secondary:hover { background: #fff; } }
.btn-teal { --edge: var(--teal-700); background: var(--teal-500); color: #fff; }
@media (hover: hover) { .btn-teal:hover { background: #17aea4; } }
.btn-danger { --edge: var(--coral-700); background: var(--coral-500); color: #fff; }
@media (hover: hover) { .btn-danger:hover { background: #f37a60; } }

.btn:disabled {
  --edge: var(--cream-300);
  background: var(--cream-200); color: var(--text-3);
  cursor: not-allowed; box-shadow: inset 0 -0.375rem 0 var(--edge);
}

/* Tombol HUD: ikon selalu dengan label teks */
.btn-hud {
  --edge: var(--cream-300);
  min-height: 4rem; padding: 0 1.25rem 0.25rem 1rem; gap: 0.5rem;
  font-size: 1.375rem; border-radius: var(--r-control);
  background: var(--cream-50); color: var(--navy-900);
}
@media (hover: hover) { .btn-hud:hover { background: #fff; } }
.btn-hud[aria-pressed="false"] { color: var(--text-3); }
.btn-hud.btn-icon-only,
.btn-icon-only {
  width: 4rem; min-width: 4rem; padding: 0 0 0.25rem;
  justify-content: center; gap: 0;
}

.btn-round {
  width: var(--touch); padding: 0 0 0.25rem; border-radius: 50%;
}
.btn-round.btn-lg { width: 5.5rem; } /* samakan dengan min-height btn-lg agar tetap bulat */

/* ---------- Panel dan kartu ---------- */
.panel {
  position: relative;
  background: var(--surface);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
  padding: 2rem;
  display: flex; flex-direction: column; gap: 1.5rem;
  min-height: 0;
}
.panel-fill { flex: 1; }
.panel-scroll { overflow-y: auto; overscroll-behavior: contain; }
.panel-meta { font-size: var(--fs-meta); color: var(--text-3); }
.panel h2 { font-size: var(--fs-title); color: var(--text); }
.panel .lead { font-size: var(--fs-body); color: var(--text-2); }
.panel-actions { display: flex; flex-direction: column; gap: 0.75rem; margin-top: auto; }
.panel-actions .btn { width: 100%; }

/* ---------- Statistik HUD ---------- */
.stat {
  display: inline-flex; align-items: center; gap: 0.625rem;
  height: 4rem; padding: 0 1.25rem 0 0.75rem;
  border-radius: var(--r-control);
  background: rgb(28 43 75 / 0.72);
  color: var(--cream-50);
  font-family: var(--font-display); font-size: 1.625rem;
}
.stat .icon { width: 2.25rem; height: 2.25rem; }
/* Level, koin, dan bintang menyatu dalam satu kapsul krem yang senada dengan tombol HUD */
.stat-group {
  display: inline-flex; align-items: center; height: 4rem; padding: 0 0.5rem;
  border-radius: var(--r-control); background: var(--cream-50); color: var(--navy-900);
  box-shadow: inset 0 -0.25rem 0 var(--cream-300);
}
.stat-group .stat { height: 100%; padding: 0 1.25rem 0.25rem 1rem; background: none; color: inherit; border-radius: 0; }
.stat-group .stat + .stat { border-left: 0.125rem solid var(--line); }
.stat-group .meter { background: rgb(28 43 75 / 0.14); }
.stat-level { gap: 0.75rem; }
.stat-level .lv {
  display: grid; place-items: center;
  width: 2.75rem; height: 2.75rem; border-radius: 0.75rem;
  background: var(--gold-400); color: var(--navy-900); font-size: 1.375rem;
}
.stat-level .meter { width: 7rem; }

.meter {
  position: relative; height: 0.875rem; border-radius: 0.5rem;
  background: rgb(255 251 243 / 0.22); overflow: hidden;
}
.meter > span {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  border-radius: inherit; background: var(--gold-400);
  transition: width var(--t-enter) var(--ease);
}

/* ---------- Kiko dan balon bicara ---------- */
.bubble {
  position: relative;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-card);
  padding: 1.25rem 1.5rem;
  font-size: var(--fs-body);
  box-shadow: var(--shadow-soft);
}
.bubble-tail-left::before {
  content: ""; position: absolute; left: -0.75rem; bottom: 1.5rem;
  border: 0.75rem solid transparent; border-left: 0; border-right-color: var(--surface);
}
.kiko-line {
  display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; align-items: start;
}
.kiko-avatar {
  width: 5.5rem; height: 5.5rem; border-radius: 50%;
  background: #d9ecfb; overflow: hidden; flex: none;
}
.kiko-avatar img { width: 100%; height: 125%; object-fit: cover; object-position: 50% 8%; }
.kiko-line .bubble { box-shadow: none; background: var(--surface-2); }
.kiko-line .bubble::before {
  content: ""; position: absolute; left: -0.75rem; top: 1.75rem;
  border: 0.75rem solid transparent; border-left: 0; border-right-color: var(--surface-2);
}
.kiko-line .speaker { display: block; font-size: var(--fs-meta); color: var(--teal-700); margin-bottom: 0.25rem; font-family: var(--font-display); }

/* ---------- Daftar tantangan pada pengantar wilayah ---------- */
.challenge-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.challenge {
  display: grid; grid-template-columns: 3.5rem 1fr auto; gap: 1rem; align-items: center;
  padding: 1rem 1.25rem 1rem 1rem;
  border-radius: var(--r-card);
  background: var(--surface-2);
}
.challenge .no {
  display: grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: 1rem;
  background: var(--cream-50); color: var(--navy-900);
  font-family: var(--font-display); font-size: 1.75rem; box-shadow: inset 0 0 0 0.125rem var(--line);
}
.challenge .title { font-family: var(--font-display); font-size: 1.625rem; display: block; }
.challenge .mech { display: flex; align-items: center; gap: 0.375rem; font-size: var(--fs-meta); color: var(--text-3); margin-top: 0.25rem; }
.challenge .mech .icon { width: 1.25rem; height: 1.25rem; stroke-width: 2.5; }
.challenge.is-next .no { background: var(--gold-400); box-shadow: none; }

.stars { display: inline-flex; gap: 0.125rem; color: var(--cream-300); }
.stars .icon { width: 1.75rem; height: 1.75rem; }
.stars .on { color: var(--gold-600); }

/* ---------- Penanda wilayah di peta ---------- */
.map-node {
  position: absolute;
  display: block;
  border: 0; padding: 0; background: transparent;
  border-radius: 1.25rem;
}
.map-tag { position: absolute; transform: translate(-50%, 0.125rem); pointer-events: none; white-space: nowrap; }
.map-node:focus:not(:focus-visible) { outline: none; }
.map-tag {
  display: inline-flex; align-items: center; gap: 0.375rem;
  height: 2.25rem; padding: 0 0.75rem;
  border-radius: 0.75rem;
  background: rgb(28 43 75 / 0.86); color: var(--cream-50);
  font-family: var(--font-display); font-size: 1.125rem;
}
.map-tag .icon { width: 1.25rem; height: 1.25rem; stroke-width: 2.5; }
.map-tag .icon-fill { color: var(--gold-400); }
.map-tag.is-done { background: var(--leaf-700); }
.map-tag.is-locked { background: rgb(255 251 243 / 0.94); color: var(--navy-700); }
.map-pin {
  position: absolute; z-index: 2; pointer-events: none;
  width: 6.5rem; transform: translate(-50%, -96%);
  filter: drop-shadow(0 0.5rem 0.5rem rgb(28 43 75 / 0.35));
}

/* ---------- Langkah dan titik progres ---------- */
.dots { display: flex; gap: 0.625rem; align-items: center; }
.dots span {
  width: 1rem; height: 1rem; border-radius: 50%;
  background: rgb(28 43 75 / 0.18);
  transition: background-color var(--t-base) var(--ease), width var(--t-base) var(--ease);
}
.dots span.is-done { background: var(--leaf-500); }
.dots span.is-current { width: 2.5rem; border-radius: 0.5rem; background: var(--gold-600); }
.dots-on-dark span { background: rgb(255 251 243 / 0.35); }
.progress-label { font-family: var(--font-display); font-size: 1.5rem; color: var(--cream-50); text-shadow: 0 0.125rem 0.375rem rgb(28 43 75 / 0.5); }
.chip-dark {
  display: inline-flex; align-items: center; gap: 1rem;
  height: 4rem; padding: 0 1.5rem; border-radius: var(--r-control);
  background: rgb(28 43 75 / 0.72);
}

/* ---------- Overlay (jeda, pengaturan, konfirmasi) ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 30;
  display: grid; place-items: center;
  background: rgb(28 43 75 / 0.55);
}
.dialog {
  width: min(40rem, calc(100vw - 4rem));
  max-height: calc(100vh - 4rem);
  max-height: calc(100dvh - 4rem);
  background: var(--surface); border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
  padding: 2.5rem;
  display: flex; flex-direction: column; gap: 1.5rem;
}
.dialog h2 { font-size: var(--fs-title); }
.dialog .lead { font-size: var(--fs-body); color: var(--text-2); }
.dialog-actions { display: grid; gap: 0.75rem; }
.dialog-actions .btn { width: 100%; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.setting {
  display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: center;
  padding: 1rem 0; border-top: 0.125rem solid var(--line);
}
.setting:first-of-type { border-top: 0; }
.setting .name { font-family: var(--font-display); font-size: 1.625rem; }
.setting .desc { font-size: var(--fs-meta); color: var(--text-3); margin-top: 0.25rem; }

.switch {
  position: relative; width: 6rem; height: 3.5rem; border-radius: 1.75rem; border: 0;
  background: var(--cream-300);
  transition: background-color var(--t-base) var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 0.375rem; left: 0.375rem;
  width: 2.75rem; height: 2.75rem; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-soft);
  transition: transform var(--t-base) var(--ease);
}
.switch[aria-checked="true"] { background: var(--teal-500); }
.switch[aria-checked="true"]::after { transform: translateX(2.5rem); }

/* ---------- Toast Kiko ---------- */
#toasts {
  position: absolute; z-index: 40; left: 50%; bottom: 2rem; transform: translateX(-50%);
  display: grid; gap: 0.75rem; justify-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 1rem;
  max-width: 50rem;
  padding: 0.75rem 1.75rem 0.75rem 0.75rem;
  border-radius: 1.5rem;
  background: var(--navy-900); color: var(--cream-50);
  font-size: 1.5rem;
  box-shadow: var(--shadow-panel);
}
.toast .kiko-avatar { width: 4rem; height: 4rem; }

/* ---------- Model pecahan (panduan) ---------- */
.table-card {
  position: relative;
  width: 100%; height: 100%;
  background: var(--surface);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}
.cake { width: 34rem; max-width: 100%; height: auto; overflow: visible; }
/* touch-action: none agar browser sentuh tidak mengambil alih gestur seret (pointercancel) */
.model .piece { touch-action: none; cursor: grab; transition: transform var(--t-base) var(--ease), opacity var(--t-base) var(--ease); }
.model .piece:focus-visible { outline: none; }
.model .piece:focus-visible > path:first-child,
.model .piece.is-selected > path:first-child { stroke: var(--navy-900); stroke-width: 7; }
.model .piece.is-selected { transform: translateY(-0.5rem); }

.stepper { display: flex; align-items: center; gap: 1.25rem; }
.stepper .value {
  min-width: 6rem; text-align: center;
  font-family: var(--font-display); font-size: 3.5rem; color: var(--navy-900);
}
.stepper > div { display: grid; justify-items: center; }
.stepper-label { font-size: var(--fs-meta); color: var(--text-3); text-align: center; }

.tray {
  position: relative;
  display: grid; place-items: center;
  width: 22rem; height: 20rem;
  margin-top: 2.5rem;
  border-radius: 2rem;
  border: 0.25rem dashed var(--cream-300);
  background: var(--surface-2);
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.tray .tray-label {
  position: absolute; top: -2.75rem; left: 0;
  font-family: var(--font-display); font-size: 1.375rem; color: var(--text-3);
}
.tray.is-target { border-color: var(--teal-500); }
.tray.is-over { background: #e3f5f2; border-color: var(--teal-700); border-style: solid; }
.tray svg { width: 100%; height: 100%; }

.frac {
  display: inline-grid; justify-items: center; align-items: center;
  font-family: var(--font-display); color: var(--navy-900); line-height: 1;
}
.frac .bar { width: 100%; height: 0.08em; border-radius: 0.04em; background: currentColor; margin: 0.08em 0; }
.frac-xl { font-size: 9rem; }
.frac-btn {
  min-width: 1.4em; padding: 0.04em 0.18em 0.08em; border: 0; border-radius: 0.18em;
  background: var(--surface-2); color: inherit; font: inherit; line-height: 1;
  box-shadow: inset 0 -0.06em 0 var(--cream-300);
  transition: background-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
@media (hover: hover) { .frac-btn:hover { background: #fff; } }
.frac-btn:active { transform: translateY(0.03em); }
.frac-btn.is-right { background: #dff3e2; box-shadow: inset 0 -0.06em 0 var(--leaf-500); }
.frac-btn.is-wrong { background: #fde6df; box-shadow: inset 0 -0.06em 0 var(--coral-500); }

.term {
  display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: center;
  font-size: 1.5rem; color: var(--text-2);
}
.term b { font-family: var(--font-display); font-weight: 700; font-size: 1.75rem; color: var(--navy-900); }
.term .num-badge {
  display: grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: 1rem;
  font-family: var(--font-display); font-size: 2rem; background: var(--surface-2);
}

.feedback {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 1rem 1.25rem; border-radius: var(--r-card);
  font-size: 1.5rem;
}
.feedback .icon { width: 2rem; height: 2rem; margin-top: 0.125rem; }
.feedback-ok { background: #e3f4e5; color: #1f5a28; }
.feedback-try { background: #fff0d6; color: #6b4a06; }

.tool-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.tool-list li .btn-hud { width: 100%; justify-content: flex-start; }
.tool-list li { display: grid; grid-template-columns: 11rem 1fr; gap: 1.25rem; align-items: center; font-size: 1.5rem; color: var(--text-2); }
.tool-list .btn-hud { pointer-events: none; }

.empty-activity {
  display: grid; justify-items: center; gap: 1.25rem; text-align: center;
  max-width: 44rem; padding: 3rem;
  background: rgb(255 251 243 / 0.94); border-radius: var(--r-panel); box-shadow: var(--shadow-panel);
}
.empty-activity h2 { font-size: var(--fs-title); }
.empty-activity p { font-size: var(--fs-body); color: var(--text-2); }

/* Rekap kompetensi: 7 konsep dalam dua kolom agar muat satu layar tanpa gulir */
.dialog-wide { width: min(76rem, calc(100vw - 4rem)); overflow-y: auto; }
.comp-list { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem 2.5rem; }
.comp-row { display: grid; gap: 0.5rem; align-content: start; padding-top: 1rem; border-top: 0.125rem solid var(--line); }
.comp-head { display: flex; justify-content: space-between; gap: 1rem; font-family: var(--font-display); font-size: 1.625rem; }
.comp-meta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.5rem; font-size: var(--fs-meta); color: var(--text-3); }

/* ---------- Panduan Bermain (User Guide) ---------- */
.guide-tabs {
  display: flex; gap: 0.75rem; align-items: center; justify-content: flex-start;
  overflow-x: auto; padding: 0.25rem 0.5rem 0.5rem;
  scrollbar-width: none;
}
.guide-tabs::-webkit-scrollbar { display: none; }
.guide-tab-btn {
  display: inline-flex; align-items: center; gap: 0.625rem;
  min-height: 4rem; padding: 0 1.5rem 0.25rem;
  border-radius: var(--r-control);
  background: var(--surface-2); color: var(--navy-700);
  border: 0.125rem solid transparent;
  font-family: var(--font-display); font-size: 1.45rem; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  box-shadow: inset 0 -0.25rem 0 var(--cream-300);
  transition: all var(--t-fast) var(--ease);
}
.guide-tab-btn:hover { background: #fff; color: var(--navy-900); }
.guide-tab-btn.is-active {
  background: var(--gold-400); color: var(--navy-900);
  box-shadow: inset 0 -0.25rem 0 var(--gold-600), 0 0.25rem 0.75rem rgb(28 43 75 / 0.14);
}
.guide-scroll {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 0.5rem 0.25rem;
}
.guide-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(28rem, 1fr));
  gap: 1.25rem;
}
.guide-card {
  display: flex; flex-direction: column; gap: 0.75rem;
  padding: 1.5rem 1.75rem; border-radius: var(--r-card);
  background: var(--surface); border: 0.125rem solid var(--line);
  box-shadow: var(--shadow-soft);
}
.guide-card-head {
  display: flex; align-items: center; gap: 0.875rem;
  font-family: var(--font-display); font-size: 1.75rem; color: var(--navy-900);
}
.guide-card-ic {
  display: grid; place-items: center;
  width: 3.25rem; height: 3.25rem; border-radius: 0.875rem;
  background: var(--surface-2); color: var(--teal-700); flex: none;
}
.guide-card p {
  font-size: 1.4rem; color: var(--text-2); line-height: 1.45;
}
.guide-card .badge-pill {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.875rem; border-radius: 999px;
  background: var(--surface-2); font-family: var(--font-display);
  font-size: 1.25rem; color: var(--navy-900); width: fit-content;
}

/* Tujuan Pembelajaran (Kurikulum Merdeka) */
.objectives-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.objectives-banner {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  padding: 1.5rem 1.75rem;
  border-radius: var(--r-card);
  background: var(--surface);
  border: 0.125rem solid var(--gold-400);
  box-shadow: var(--shadow-soft);
}
.objectives-banner-head {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.objectives-banner-titles {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.objectives-banner-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--navy-900);
}
.objectives-banner-quote {
  margin: 0;
  padding: 0.875rem 1.25rem;
  border-radius: 0.875rem;
  background: var(--surface-2);
  border-left: 0.375rem solid var(--teal-500);
}
.objectives-banner-quote p {
  margin: 0;
  font-size: 1.4rem;
  color: var(--navy-900);
  line-height: 1.5;
  font-style: italic;
}
.objectives-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem 1.75rem;
  border-radius: var(--r-card);
  background: var(--surface);
  border: 0.125rem solid var(--line);
  box-shadow: var(--shadow-soft);
  transition: border-color var(--t-fast) var(--ease);
}
.objectives-card:hover {
  border-color: var(--teal-500);
}
.objectives-card-head {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.objectives-badge-wrap {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.875rem;
  background: var(--surface-2);
  border: 0.0625rem solid var(--line);
  flex: none;
  padding: 0.25rem;
}
.objectives-badge-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.objectives-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}
.objectives-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.objectives-meta .badge-pos {
  background: var(--navy-900);
  color: #fff;
  font-weight: 700;
}
.objectives-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--navy-900);
}
.objectives-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-top: 0.0625rem dashed var(--line);
  padding-top: 0.75rem;
}
.objectives-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.objectives-label {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--teal-700);
  letter-spacing: 0.01em;
}
.objectives-label-interaction {
  color: var(--navy-700);
}
.objectives-text {
  margin: 0;
  font-size: 1.35rem;
  color: var(--text-2);
  line-height: 1.45;
}
.objectives-interaction-text {
  font-size: 1.3rem;
  color: var(--text-3);
}
