/**
 * artBuild.css
 * Mode bangun Art Editor (A7b): overlay layar penuh, peta art, panel
 * langkah, navigasi bawah. z-index 990 seperti editor piksel (di bawah
 * notifikasi 1000). Token tema saja (tanpa hex).
 */

body.ae-bm-open { overflow: hidden; }

.ae-bm {
  --ae-bm-map-h: calc(30vh - 24px);
  position: fixed;
  inset: 0;
  z-index: 990;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  color: var(--text-primary);
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}
.ae-bm[hidden],
.ae-bm [hidden] { display: none !important; }

/* ── Bilah atas ─────────────────────────────────────────────────────── */
.ae-bm__top {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--wb-rule);
  background: var(--wb-panel);
}
.ae-bm__title { display: flex; flex: 1; flex-direction: column; min-width: 0; padding: 0 4px; line-height: 1.25; }
.ae-bm__title strong { font-size: 0.95rem; }
.ae-bm__hint { overflow: hidden; color: var(--text-muted); font-size: 0.75rem; text-overflow: ellipsis; white-space: nowrap; }
.ae-bm__top { position: relative; }
.ae-bm__top-pct { flex-shrink: 0; padding: 0 6px; color: var(--text-secondary); font-family: var(--font-mono); font-size: 0.78rem; white-space: nowrap; }
.ae-bm__top-bar { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: transparent; }
.ae-bm__top-fill { display: block; width: 0; height: 100%; background: var(--accent); transition: width 0.2s ease; }
.ae-bm__icon-btn {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
}
.ae-bm__icon-btn:hover { background: var(--bg-hover); }
.ae-bm__icon-btn:focus-visible { outline: var(--focus-outline); outline-offset: 2px; }

/* ── Isi: peta + langkah ────────────────────────────────────────────── */
.ae-bm__body {
  display: grid;
  flex: 1;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  touch-action: pan-y;
}
.ae-bm__map-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-bottom: 1px solid var(--wb-rule);
  background: var(--bg-inset);
}
.ae-bm__map {
  position: relative;
  width: min(100%, calc(var(--ae-bm-map-h) * var(--ae-bm-ar, 1)));
  aspect-ratio: var(--ae-bm-ar, 1);
}
.ae-bm__canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--bg-surface-2);
}
.ae-bm__shade {
  position: absolute;
  right: 0;
  left: 0;
  background: var(--bg-base);
  opacity: 0.72;
  pointer-events: none;
}
.ae-bm__rail { position: absolute; top: 0; right: -10px; bottom: 0; width: 4px; pointer-events: none; }
.ae-bm__rail-row { position: absolute; right: 0; left: 0; min-height: 1px; background: var(--accent); }
.ae-bm__mark {
  position: absolute;
  right: -4px;
  left: -4px;
  min-height: 3px;
  border-radius: 2px;
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}

.ae-bm__side { display: flex; flex-direction: column; min-height: 0; }
.ae-bm__tabs { flex-shrink: 0; margin: 10px 16px 0; }
.ae-bm__step,
.ae-bm__progress {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 14px 16px 20px;
  overflow-y: auto;
}
/* Kolom yang bisa digulir: anak-anaknya tidak boleh menyusut (bilah 8px bisa jadi 0). */
.ae-bm__step > *,
.ae-bm__progress > * { flex-shrink: 0; }
.ae-bm__step-side { display: flex; flex-direction: column; flex-shrink: 0; align-items: flex-end; gap: 8px; }
.ae-bm__done-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--wb-panel-raised);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.ae-bm__done-btn:hover { background: var(--bg-hover); }
.ae-bm__done-btn:focus-visible { outline: var(--focus-outline); outline-offset: 2px; }
.ae-bm__done-btn.is-on { border-color: var(--wb-signal, var(--accent)); background: var(--wb-signal, var(--accent)); color: var(--wb-canvas, var(--bg-base)); }
.ae-bm__step.is-done .ae-bm__step-title::after { content: " ✓"; color: var(--accent); }
.ae-bm__step-coords { margin: 4px 0 0; color: var(--text-secondary); font-family: var(--font-mono); font-size: 0.75rem; }
.ae-bm__step-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ae-bm__step-text { min-width: 0; }
.ae-bm__step-title { margin: 0; font-size: 1.15rem; font-weight: 700; }
.ae-bm__step-place { margin: 2px 0 0; color: var(--text-secondary); font-size: 0.8rem; }
.ae-bm__step-total {
  flex-shrink: 0;
  padding: 3px 10px;
  border: 1px solid var(--wb-rule);
  border-radius: 999px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.ae-bm__strip { display: flex; flex-direction: column; gap: 3px; }
.ae-bm__strip-bar {
  display: flex;
  height: 28px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.ae-bm__seg { flex-basis: 0; min-width: 0; box-shadow: inset -1px 0 0 var(--bg-base); }
.ae-bm__seg.is-air,
.ae-bm__air-swatch {
  background: repeating-conic-gradient(var(--bg-surface-2) 0% 25%, var(--bg-inset) 0% 50%) 0 0 / 8px 8px;
}
.ae-bm__strip-ruler { position: relative; height: 14px; }
.ae-bm__tick {
  position: absolute;
  top: 0;
  padding-left: 2px;
  border-left: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 14px;
}

.ae-bm__label {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ae-bm__prep {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ae-bm__prep-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid var(--wb-rule);
  border-radius: var(--radius-sm);
  background: var(--wb-panel-raised);
}
.ae-bm__prep-name { flex: 1; min-width: 0; overflow: hidden; font-size: 0.82rem; text-overflow: ellipsis; white-space: nowrap; }
.ae-bm__prep-count { font-family: var(--font-mono); font-size: 0.85rem; }

.ae-bm__runs { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; counter-reset: run; }
.ae-bm__run {
  display: grid;
  grid-template-columns: 18px 104px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.ae-bm__run:nth-child(odd) { background: var(--bg-surface-2); }
.ae-bm__run-cols { color: var(--text-secondary); font-family: var(--font-mono); font-size: 0.78rem; white-space: nowrap; }
.ae-bm__run-what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ae-bm__run.is-air .ae-bm__run-what { color: var(--text-muted); font-style: italic; }
.ae-bm__run-xyz { grid-column: 2 / -1; margin-top: -4px; color: var(--text-muted); font-family: var(--font-mono); font-size: 0.72rem; }

/* ── Tab Progres ─────────────────────────────────────────────────────── */
.ae-bm__pct { font-size: 2rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.ae-bm__bar { height: 8px; overflow: hidden; border-radius: 999px; background: var(--bg-surface-2); }
.ae-bm__bar-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.2s ease; }
.ae-bm__next-rows { margin: 0; color: var(--text-secondary); font-family: var(--font-mono); font-size: 0.8rem; }
.ae-bm__blocklist { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.ae-bm__blockrow {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto 56px;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
}
.ae-bm__blockrow .ae-bm__prep-count { text-align: right; }
.ae-bm__stacks { font-size: 0.72rem; white-space: nowrap; }
.ae-bm__note { margin: 0; }
.ae-bm__xyz { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ae-bm__axis { display: flex; align-items: center; gap: 6px; }
.ae-bm__axis span { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.8rem; font-weight: 700; }
.ae-bm__axis .text-input { width: 100%; min-width: 0; min-height: 40px; font-variant-numeric: tabular-nums; }
.ae-bm__facing { width: 100%; min-height: 40px; }
.ae-bm__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--wb-rule); }
.ae-bm__actions .btn { display: inline-flex; align-items: center; gap: 6px; }

/* ── Navigasi bawah ─────────────────────────────────────────────────── */
.ae-bm__nav {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--wb-rule);
  background: var(--wb-panel);
}
.ae-bm__nav .btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.ae-bm__jump { display: flex; flex: 1; flex-direction: column; align-items: stretch; gap: 2px; min-width: 120px; }
.ae-bm__counter { color: var(--text-secondary); font-family: var(--font-mono); font-size: 0.78rem; text-align: center; white-space: nowrap; }
.ae-bm__range { width: 100%; accent-color: var(--accent); }

/* HP: slider selebar layar di atas, dua tombol besar berdampingan (jempol). */
@media (max-width: 560px) {
  .ae-bm__nav { flex-wrap: wrap; gap: 8px; padding: 8px 10px 10px; }
  .ae-bm__jump { flex-basis: 100%; order: -1; }
  .ae-bm__nav .btn { flex: 1 1 0; justify-content: center; }
}

@media (min-width: 900px) {
  .ae-bm { --ae-bm-map-h: calc(100vh - 150px); }
  .ae-bm__body { grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); grid-template-rows: minmax(0, 1fr); }
  .ae-bm__map-wrap { border-right: 1px solid var(--wb-rule); border-bottom: 0; padding: 20px; }
}
