:root {
  --panel: rgba(17, 21, 40, 0.84);
  --panel-line: rgba(255, 255, 255, 0.08);
  --text: #f4f6fb;
  --muted: #a3abc4;
  --accent: #5b82ff;
  --accent-soft: rgba(91, 130, 255, 0.18);
  --chip: rgba(255, 255, 255, 0.07);
  --chip-hover: rgba(255, 255, 255, 0.12);
}

html, body { margin: 0; height: 100%; overflow: hidden; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Kartu info + kontrol ---------- */
#info {
  position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 10;
  max-width: 460px; margin: 0 auto;
  background: var(--panel); color: var(--text);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--panel-line); border-radius: 18px;
  padding: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transform: translateY(140%); transition: transform .35s cubic-bezier(.2,.8,.2,1);
}
#info.show { transform: translateY(0); }

.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.head h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: .1px; }
.head .price {
  flex: none; font-size: 14px; font-weight: 700; color: #fff;
  background: var(--accent); border-radius: 999px; padding: 4px 10px;
}
.desc { margin: 4px 0 0; font-size: 13px; color: var(--muted); line-height: 1.4; }

.toolbar { display: flex; align-items: center; gap: 8px; margin-top: 8px; min-height: 44px; }
.spacer { flex: 1; }
.segmented.mode { margin-top: 12px; }
.segmented.mode button { flex: 1; justify-content: center; }

/* Segmented control (mode & lantai) */
.segmented {
  display: flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--chip);
}
.segmented button {
  display: flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 12px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .2s, color .2s;
}
.segmented button.active { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(91,130,255,.35); }
.segmented button:not(.active):hover { color: var(--text); }

/* Tombol ikon bulat (putar, zoom) */
.icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  border: 0; border-radius: 12px; background: var(--chip); color: var(--text);
  cursor: pointer; transition: background .2s, color .2s, transform .1s;
}
.icon-btn:hover { background: var(--chip-hover); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent); }
.icon-btn.active .icon { animation: spin 2.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Baris pilihan lantai */
#floor-row { display: none; align-items: center; gap: 8px; }
#floor-row .label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
#floor-row .segmented button { min-width: 40px; justify-content: center; padding: 0 12px; }

button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Layar sempit: tampilkan ikon saja pada tombol mode */
@media (max-width: 340px) {
  #floor-row .label .txt { display: none; }
}

/* ---------- Logo kiri atas ---------- */
#brand {
  position: fixed; z-index: 11;
  top: max(12px, env(safe-area-inset-top)); left: 12px;
  display: flex; align-items: center; justify-content: center;
  width: 60px; height: 64px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--panel-line);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
#brand img { height: 50px; width: auto; display: block; }

/* ---------- Switch AR / 3D, kanan tengah ---------- */
#view-switch {
  position: fixed; z-index: 11; right: 12px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 4px; padding: 4px;
  border-radius: 18px; background: var(--panel); border: 1px solid var(--panel-line);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
#view-switch button {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  width: 52px; height: 56px; border: 0; border-radius: 14px;
  background: transparent; color: var(--muted); cursor: pointer;
  font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .4px;
  transition: color .25s;
}
#view-switch button[aria-checked="true"] { color: #fff; }
#view-switch button:not([aria-checked="true"]):hover { color: var(--text); }
#view-switch .thumb {
  position: absolute; left: 4px; top: 4px; width: 52px; height: 56px; border-radius: 14px;
  background: var(--accent); box-shadow: 0 4px 12px rgba(91,130,255,.45);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
}
body.mode-3d #view-switch .thumb { transform: translateY(60px); }

/* ---------- Petunjuk singkat ---------- */
#hint {
  position: fixed; z-index: 12; left: 50%; top: max(24px, env(safe-area-inset-top));
  transform: translate(-50%, -12px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 180px); text-align: center;
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--panel); color: var(--text); border: 1px solid var(--panel-line);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  transition: opacity .3s, transform .3s;
}
#hint.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Mode 3D ---------- */
body.mode-3d { background: radial-gradient(120% 90% at 50% 35%, #eef2f9 0%, #cfd8e6 60%, #b4c0d4 100%); }
body.mode-3d .mindar-ui-overlay { display: none !important; }
body.mode-3d a-scene canvas { cursor: grab; }

/* ---------- Layar loading ---------- */
#loader .loader-logo { height: 96px; width: auto; margin-bottom: 6px; }
#loader {
  position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  background: #10142a; color: #fff; transition: opacity .4s ease;
}
#loader.done { opacity: 0; pointer-events: none; }
#loader .bar { width: 70%; max-width: 320px; height: 8px; border-radius: 4px; background: #2a3058; overflow: hidden; }
#loader .fill { height: 100%; width: 0%; background: var(--accent); transition: width .2s ease; }
#loader .label { font-size: 15px; }
/* Sembunyikan loading bawaan MindAR selama model dimuat */
body.loading-model .mindar-ui-loading { display: none !important; }
