/**
 * mapArt.css
 * Lembar Map art (A9a3, MapArtSheet.js). Kerangka lembar memakai kelas
 * `ae-gen-sheet` (artGenerate.css): HP = pratinjau menempel di atas +
 * formulir bergulir; ≥ 900 px = jendela tengah dua kolom.
 */

.ae-map-sheet [hidden] { display: none !important; }

/* ── Pratinjau ─────────────────────────────────────────────────────── */
.ae-map__preview { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.ae-map__views { width: 100%; }
.ae-map__views .kit-seg__btn { flex: 1; justify-content: center; }
.ae-map__views .kit-seg__btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ae-map__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 210px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background:
    repeating-conic-gradient(rgba(255, 255, 255, 0.07) 0 25%, rgba(0, 0, 0, 0.14) 0 50%) 0 0 / 16px 16px,
    var(--bg-inset);
}
.ae-map__frame {
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--wb-rule), 0 6px 18px rgba(0, 0, 0, 0.35);
}
.ae-map__canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
/* Garis batas antar-peta: satu sel latar = satu peta 128 × 128. */
.ae-map__grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.85) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.85) 1px, transparent 1px);
  background-position: -1px -1px;
  mix-blend-mode: difference;
}
.ae-map__busy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-primary);
  font-size: 12px;
}

.ae-map__stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.ae-map__stats .kit-stat { min-width: 0; padding: 6px 8px; }
.ae-map__stats .kit-stat__value { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Formulir ──────────────────────────────────────────────────────── */
.ae-map__form,
.ae-map__export { display: flex; flex-direction: column; gap: 10px; }
.ae-map__form .kit-seg,
.ae-map__export .kit-seg { width: 100%; }
.ae-map__form .kit-seg__btn,
.ae-map__export .kit-seg__btn { flex: 1; justify-content: center; }
.ae-map__group {
  margin: 8px 0 -2px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ae-map__group--export { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--wb-rule); }
.ae-map__hint { margin: -4px 0 0; font-size: 12px; }
.ae-map__accuracy {
  margin: 0;
  padding: 8px 10px;
  border-left: 3px solid var(--status-success);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  font-size: 12px;
}
.ae-map__accuracy.is-estimate { border-left-color: var(--status-warn); }

.ae-map__counts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ae-map__count { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ae-map__count-label,
.ae-map__coord-label { color: var(--text-secondary); font-size: 12px; font-weight: 600; }

/* ── Export ────────────────────────────────────────────────────────── */
.ae-map__coords { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ae-map__coord { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ae-map__coord .text-input { width: 100%; min-width: 0; font-family: var(--font-mono); }
.ae-map__where {
  margin: 0;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
}
.ae-map__export .btn--primary { align-self: stretch; justify-content: center; }
.ae-map__place { display: flex; flex-direction: column; gap: 10px; }
.ae-map__id { max-width: 220px; }

/* Tombol masuk di kartu Export halaman. */
.ae-export__maprow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--wb-rule);
}
.ae-export__maprow .kit-note { flex: 1 1 180px; margin: 0; font-size: 12px; }

/* ── Kalibrasi Bedrock (A9b) ── */
.ae-map-calib { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ae-map-calib[hidden] { display: none; }
.ae-map-calib__status { margin: 0; padding-left: 10px; border-left: 3px solid var(--status-warn); }
.ae-map-calib__status.is-active { border-left-color: var(--status-success); }
.ae-map-calib__steps { margin: 0; padding-left: 20px; color: var(--text-secondary); font-size: 0.82rem; line-height: 1.5; }
.ae-map-calib__steps li + li { margin-top: 2px; }
.ae-map-calib__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ae-map-calib__actions .btn[hidden],
.ae-map-calib__result[hidden] { display: none; }
.ae-map-calib__result {
  display: flex; flex-direction: column; gap: 8px; padding: 10px;
  border-radius: var(--radius-sm); background: var(--bg-inset);
}
/* 24 kotak papan (8 warna × gelap/datar/terang) seperti terbaca di screenshot */
.ae-map-calib__swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; max-width: 180px; }
.ae-map-calib__swatch { display: block; height: 12px; border-radius: 2px; }
.ae-map-calib__numbers { margin: 0; font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-primary); overflow-wrap: anywhere; }

/* HP: pratinjau menempel di atas — dibuat ringkas supaya formulir tetap
   punya ruang di layar pendek (bilah URL + tab peramban). */
@media (max-width: 899px) {
  .ae-map__stage { height: clamp(140px, 30dvh, 220px); }
  .ae-map__views .kit-seg__btn { padding-top: 6px; padding-bottom: 6px; }
  .ae-map__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin-top: 6px; }
  .ae-map__stats .kit-stat { flex-direction: row; align-items: baseline; gap: 6px; padding: 4px 8px; }
  .ae-map__stats .kit-stat__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ae-map-sheet .ae-gen__notices { max-height: 72px; overflow-y: auto; }
}

@media (min-width: 900px) {
  .ae-map-sheet { width: min(1100px, calc(100vw - 48px)); height: min(820px, calc(100vh - 48px)); }
  .ae-map__side { width: 50%; }
  .ae-map__preview { flex: 1; }
  .ae-map__stage { flex: 1; height: auto; min-height: 260px; }
}
