/* ═══════════════════════════════════════════════════
   AURUM — Virtual Jewel Try-On
   Layout: Wide left catalog + Right preview panel
═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=Inter:wght@300;400;500;600&display=swap');

:root {
  --obsidian:     #0a0806;
  --charcoal:     #141210;
  --graphite:     #1e1b18;
  --graphite-lt:  #2a2520;
  --stone:        #3d3830;
  --ash:          #6b6358;
  --mist:         #a09488;
  --pearl:        #e8ddd0;
  --ivory:        #f5f0e8;

  --gold-deep:    #8b6914;
  --gold:         #c9a84c;
  --gold-bright:  #e2c06a;
  --gold-pale:    #f0d898;
  --gold-glow:    rgba(201, 168, 76, 0.12);
  --gold-border:  rgba(201, 168, 76, 0.25);

  --surface-0:    #0a0806;
  --surface-1:    #111009;
  --surface-2:    #1a1712;
  --surface-3:    #24201a;
  --surface-4:    #2e2922;

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Inter', system-ui, sans-serif;

  --shadow-sm:    0 1px 4px rgba(0,0,0,0.4);
  --shadow-md:    0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:    0 8px 40px rgba(0,0,0,0.6);
  --shadow-gold:  0 0 24px rgba(201, 168, 76, 0.12);
  --radius:       12px;
  --radius-sm:    8px;
  --radius-xs:    5px;
  --transition:   all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--obsidian);
  color: var(--pearl);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
.app-shell{
    width:95vw;
    height:92vh;

    max-width:1600px;

    display:grid;

    grid-template-columns:
        36%
        64%;

    border-radius:28px;

    overflow:hidden;

    border:1px solid rgba(255,255,255,.06);

    box-shadow:
      0 0 0 1px rgba(255,255,255,.04),
      0 0 80px rgba(120,70,255,.18),
      0 0 40px rgba(201,168,76,.08),
      0 40px 100px rgba(0,0,0,.75);

    background:
    linear-gradient(
      135deg,
      #0d0915 0%,
      #0b090f 40%,
      #090707 100%
    );
}

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--stone); border-radius: 2px; }

/* ═══════════════════ LEFT PANEL ═══════════════════ */
.sidebar {
  grid-column: 1;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  height: 100%;
  background:
  linear-gradient(
    180deg,
    #1a1612 0%,
    #110f0c 40%,
    #0a0806 100%
  );
  border-right: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
}

/* Brand */
.sidebar-brand {
  padding: 20px 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--gold-deep), var(--gold-bright));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(201,168,76,0.3);
}

.brand-text { display: flex; flex-direction: column; }
.brand-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--ivory);
  letter-spacing: 0.05em;
  line-height: 1;
}
.brand-sub {
  font-size: 9px;
  color: var(--ash);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-top: 3px;
}

/* Category Tabs */
.category-section {
  padding: 14px 22px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.category-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ash);
  margin-bottom: 10px;
}

.category-tabs { display: flex; gap: 6px; flex-wrap: wrap; }

.tab {
  padding: 5px 13px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent;
  color: var(--mist);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: var(--transition);
}

.tab:hover { border-color: var(--gold-border); color: var(--gold-pale); background: var(--gold-glow); }
.tab.active {
  background: linear-gradient(135deg, var(--gold-deep), var(--gold));
  border-color: transparent;
  color: var(--obsidian);
  font-weight: 600;
}

/* ── CATALOG — scrollable, fills remaining space ── */
.catalog-section {
  overflow-y: auto;
  padding: 16px 22px;
}

.catalog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;  /* 3 columns — more products visible */
  gap: 10px;
}

/* Skeleton */
.skeleton-card {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--radius-sm);
  aspect-ratio: 0.85;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Product Card */
.jewel-card {
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.jewel-card:hover {
  border-color: var(--gold);
  transform: translateY(-6px);

  box-shadow:
      0 12px 30px rgba(0,0,0,0.35),
      0 0 25px rgba(201,168,76,0.25);
}

.jewel-card.selected {
  border-color: var(--gold-bright);

  box-shadow:
      0 0 0 2px var(--gold),
      0 0 20px rgba(201,168,76,.35);
}

.jewel-card-img-wrap {
  position: relative;
  aspect-ratio: 0.95;
  overflow: hidden;
  background: #ffffff;
}

.jewel-card img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 8px;
  display: block;
  transition: transform 0.4s ease;
}

.jewel-card:hover img { transform: scale(1.06); }

.jewel-card-cat {
  position: absolute; top: 5px; left: 5px;
  background: rgba(10,8,6,0.78);
  color: var(--gold-pale);
  font-size: 7px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 3px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(201,168,76,0.18);
}

.jewel-card-body { padding: 7px 8px 9px; }

.jewel-card-name {
  font-size: 10px;
  font-weight: 500;
  color: var(--pearl);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.jewel-card-price {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--gold);
  font-weight: 500;
}

/* ── SELECTED PANEL — below catalog ── */
.selected-panel {
  background: var(--surface-2);
  border-top: 1px solid rgba(201,168,76,0.15);
  padding: 10px 16px;
  display: none;
  flex-direction: column;
  gap: 8px;
}

.selected-panel.visible { display: flex; }

.selected-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sel-thumb {
  width: 46px; height: 46px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--gold-border);
  background: var(--surface-3);
  flex-shrink: 0;
}

.sel-info { flex: 1; min-width: 0; }
.sel-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--ivory);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sel-brand { font-size: 10px; color: var(--ash); margin-top: 1px; }
.sel-price {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--gold-bright);
  margin-top: 2px;
}

.controls-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.form-group { display: flex; flex-direction: column; gap: 4px; }

.form-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ash);
}

.form-select {
  width: 100%;
  padding: 7px 10px;
  background: var(--surface-3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-family: var(--font-body);
  color: var(--pearl);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%236b6358' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: var(--transition);
}

.form-select:focus { border-color: var(--gold-border); }
.form-select option { background: var(--surface-3); }

.action-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}

.btn-gold {
  padding: 10px;
  background: linear-gradient(135deg, var(--gold-deep), var(--gold), var(--gold-bright));
  color: var(--obsidian);
  border: none;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 10px rgba(201,168,76,0.25);
}

.btn-gold:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 4px 18px rgba(201,168,76,0.4); }

.btn-outline {
  padding: 10px;
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: var(--transition);
}

.btn-outline:hover { background: var(--gold-glow); border-color: var(--gold); color: var(--gold-bright); }

.btn-cart {
  width: 100%;
  padding: 10px;
  background: var(--surface-3);
  color: var(--mist);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.btn-cart:hover { background: var(--surface-4); color: var(--ivory); border-color: rgba(255,255,255,0.14); }

/* Footer */
.sidebar-footer {
  padding: 10px 22px;
  border-top: 1px solid rgba(255,255,255,0.05);
  font-size: 10px;
  color: var(--stone);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-1);
}

.dot-live {
  width: 6px; height: 6px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(74,222,128,0.6);
  flex-shrink: 0;
  animation: pulse-dot 2.5s ease infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 8px rgba(74,222,128,0.6); }
  50% { box-shadow: 0 0 3px rgba(74,222,128,0.2); }
}

/* ═══════════════════ RIGHT PANEL ═══════════════════ */
.canvas {
  grid-column: 2;
  position: relative;
  background: var(--obsidian);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  height:100%;
}

/* Ambient glow */
.canvas::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(201,168,76,0.04) 0%, transparent 65%);
  pointer-events: none;
}

/* Welcome / empty state */
.welcome-state {
    width: 100%;
    max-width: 700px;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    text-align: center;
}

.welcome-gem {
  font-size: 48px;
  color: var(--gold);
  opacity: 0.25;
  margin-bottom: 28px;
  font-family: var(--font-display);
}

.welcome-title {
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: 300;
  color: var(--ivory);
  line-height: 1;
  margin-bottom: 16px;
}

.welcome-title em {
  font-style: italic;
  color: var(--gold-bright);
}

.welcome-sub {
  font-size: 13px;
  color: var(--ash);
  line-height: 1.8;
  margin-bottom: 40px;
  max-width: 320px;
}

.welcome-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 300px;
  text-align: left;
}

.welcome-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.step-num {
  width: 26px; height: 26px;
  border: 1px solid var(--gold-border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  color: var(--gold);
  flex-shrink: 0;
  font-weight: 600;
  margin-top: 1px;
}

.step-body { display: flex; flex-direction: column; gap: 2px; }
.step-title { font-size: 13px; font-weight: 500; color: var(--pearl); }
.step-desc  { font-size: 11px; color: var(--ash); line-height: 1.5; }

/* Divider */
.welcome-divider {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, transparent, var(--stone), transparent);
  margin: 4px 0 4px 12px;
}

/* 3D / AR viewer area */
.viewer-area {
  width: 100%;
  height: 100%;
  position: relative;
  display: none;
}

.viewer-area.active { display: flex; align-items: center; justify-content: center; }

.model-wrap {
  width: min(540px, 90%);
  aspect-ratio: 1 / 1.1;
  max-height: 85vh;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  background: var(--surface-1);
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: var(--shadow-lg), var(--shadow-gold);
}

.model-viewer-el {
  width: 100%; height: 100%;
  --poster-color: transparent;
  background: radial-gradient(ellipse at 50% 40%, var(--surface-3) 0%, var(--obsidian) 100%);
}

/* Product info overlay (right panel top) */
.viewer-product-bar {
  position: absolute;
  top: 20px; left: 50%;
  transform: translateX(-50%);
  background: rgba(10,8,6,0.82);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(201,168,76,0.18);
  border-radius: 30px;
  padding: 8px 20px 8px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
  white-space: nowrap;
}

.vbar-thumb {
  width: 32px; height: 32px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--gold-border);
}

.vbar-name {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--ivory);
  font-weight: 500;
}

.vbar-price {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--gold);
  font-weight: 600;
}

.vbar-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold-pale);
  background: rgba(201,168,76,0.12);
  border: 1px solid rgba(201,168,76,0.2);
  padding: 2px 8px;
  border-radius: 10px;
}

.btn-ghost {
  position: absolute;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  padding: 9px 22px;
  background: rgba(10,8,6,0.82);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--mist);
  cursor: pointer;
  transition: var(--transition);
  z-index: 10;
  white-space: nowrap;
}

.btn-ghost:hover { border-color: var(--gold-border); color: var(--gold-pale); }

/* AR view */
.result-ar {
  width: 100%; height: 100%;
  position: absolute;
  inset: 0;
  background: var(--obsidian);
  display: none;
}

.result-ar.active { display: block; }

.result-ar a-scene {
  width: 100%; height: 100%;
  position: absolute;
  top: 0; left: 0;
}

#btnStopAr {
  position: absolute;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: rgba(10,8,6,0.85);
  color: var(--gold-pale);
  border-color: var(--gold-border);
  padding: 9px 22px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  border: 1px solid var(--gold-border);
  backdrop-filter: blur(12px);
  transition: var(--transition);
}

#btnStopAr:hover { border-color: var(--gold); color: var(--gold-bright); }

/* Spinner */
.spinner-overlay {
  position: absolute; inset: 0;
  background: rgba(10,8,6,0.9);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.spinner-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.shimmer-ring {
  width: 50px; height: 50px;
  border-radius: 50%;
  border: 2px solid rgba(201,168,76,0.12);
  border-top-color: var(--gold);
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.spinner-text { font-size: 14px; color: var(--pearl); font-weight: 400; letter-spacing: 0.03em; }
.spinner-sub  { font-size: 11px; color: var(--ash); margin-top: -10px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 28px; right: 28px;
  background: var(--surface-3);
  color: var(--pearl);
  padding: 11px 18px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateY(0); }

/* ═══════════════════════════════════════════════════
   CAMERA + RESULT STATES
═══════════════════════════════════════════════════ */

/* State containers */
.state {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  inset: 0;
  padding-top: 40px;
}

/* ── Welcome state ── */
.welcome-state {
    width: 100%;
    max-width: 700px;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    text-align: center;
}

.welcome-gem {
  font-size: 40px;
  color: var(--gold);
  opacity: 0.3;
  margin-bottom: 24px;
}

.welcome-title {
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: 300;
  color: var(--ivory);
  line-height: 1;
  margin-bottom: 16px;
}

.welcome-title em { font-style: italic; color: var(--gold-bright); }

.welcome-sub {
  font-size: 13px;
  color: var(--ash);
  line-height: 1.8;
  margin-bottom: 36px;
  max-width: 320px;
}

.welcome-steps { display: flex; flex-direction: column; gap: 18px; width: 100%; max-width: 300px; text-align: left; }

.welcome-step { display: flex; align-items: flex-start; gap: 14px; }

.step-num {
  width: 26px; height: 26px;
  border: 1px solid var(--gold-border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--gold); flex-shrink: 0; font-weight: 600;
}

.step-body { display: flex; flex-direction: column; gap: 2px; padding-top: 3px; }
.step-title { font-size: 13px; font-weight: 500; color: var(--pearl); }
.step-desc  { font-size: 11px; color: var(--ash); line-height: 1.5; }

/* ── Camera Panel ── */
.camera-panel{
    width: min(560px, 92%);
    max-height: 90vh;

    background: rgba(25,18,12,0.70);
    backdrop-filter: blur(18px);

    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 24px;

    overflow: hidden;
    display: flex;
    flex-direction: column;

    box-shadow:
        0 20px 60px rgba(0,0,0,0.40),
        0 0 30px rgba(201,168,76,0.12);
}

.camera-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.camera-product-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface-3);
  border: 1px solid var(--gold-border);
  border-radius: 20px;
  padding: 5px 12px 5px 6px;
}

.camera-product-pill img {
  width: 26px; height: 26px;
  border-radius: 5px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.1);
}

.camera-product-pill span {
  font-size: 12px;
  color: var(--pearl);
  font-weight: 500;
}

.pill-badge {
  font-size: 9px !important;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold) !important;
  background: rgba(201,168,76,0.1);
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid var(--gold-border);
  font-weight: 600 !important;
}

.icon-btn {
  width: 32px; height: 32px;
  background: var(--surface-3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 50%;
  color: var(--mist);
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.icon-btn:hover { background: var(--surface-4); color: var(--pearl); border-color: rgba(255,255,255,0.15); }
.ml-auto { margin-left: auto; }

/* Camera viewport */
.camera-viewport {
  position: relative;
  flex: 1;
  background: #000;
  overflow: hidden;
  min-height: 300px;
  max-height: 420px;
}

#videoFeed {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transform: scaleX(-1); /* mirror */
}

.captured-photo {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

/* Guide frame overlay */
.camera-guide {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
}

.guide-frame {
  width: 65%; aspect-ratio: 3/4;
  position: relative;
}

.guide-corner {
  position: absolute;
  width: 20px; height: 20px;
  border-color: rgba(201,168,76,0.6);
  border-style: solid;
}

.guide-corner.tl { top: 0; left: 0; border-width: 2px 0 0 2px; border-radius: 3px 0 0 0; }
.guide-corner.tr { top: 0; right: 0; border-width: 2px 2px 0 0; border-radius: 0 3px 0 0; }
.guide-corner.bl { bottom: 0; left: 0; border-width: 0 0 2px 2px; border-radius: 0 0 0 3px; }
.guide-corner.br { bottom: 0; right: 0; border-width: 0 2px 2px 0; border-radius: 0 0 3px 0; }

.guide-hint {
  margin-top: 16px;
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.45);
  padding: 4px 12px;
  border-radius: 10px;
  backdrop-filter: blur(4px);
}

/* Camera controls */
.camera-controls {
  padding: 16px 20px 20px;
  background: var(--surface-2);
  border-top: 1px solid rgba(255,255,255,0.05);
}

.cam-btn-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 10px;
}

.cam-btn-shutter {
  width: 62px; height: 62px;
  border-radius: 50%;
  background: var(--white, #fff);
  border: 3px solid rgba(255,255,255,0.4);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.08);
}

.cam-btn-shutter:hover { transform: scale(1.06); box-shadow: 0 0 0 6px rgba(255,255,255,0.12); }
.cam-btn-shutter:active { transform: scale(0.96); }

.shutter-inner {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #fff;
  display: block;
}

.cam-btn-secondary {
  padding: 8px 16px;
  background: var(--surface-3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  color: var(--mist);
  font-size: 12px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; gap: 6px;
}

.cam-btn-secondary:hover { background: var(--surface-4); color: var(--pearl); }

.cam-btn-apply {
  padding: 11px 32px;
  background: linear-gradient(135deg, var(--gold-deep), var(--gold), var(--gold-bright));
  color: var(--obsidian);
  border: none;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(201,168,76,0.35);
  letter-spacing: 0.03em;
}

.cam-btn-apply:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 6px 24px rgba(201,168,76,0.5); }

.cam-hint { font-size: 11px; color: var(--ash); text-align: center; }

/* ── Result Panel ── */
.result-panel {
  width: min(560px, 92%);
  max-height: 90vh;
  background: var(--surface-1);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.result-product-info { display: flex; align-items: center; gap: 10px; }

.result-sel-thumb {
  width: 36px; height: 36px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--gold-border);
}

.result-sel-name {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--ivory);
  font-weight: 500;
}

.result-sel-price {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--gold);
  font-weight: 500;
}

.result-actions-top { display: flex; gap: 8px; }

.result-img-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--surface-0);
  min-height: 300px;
  max-height: 440px;
}

.result-img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}

.result-overlay-badge {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(10,8,6,0.82);
  backdrop-filter: blur(8px);
  border: 1px solid var(--gold-border);
  border-radius: 14px;
  padding: 4px 12px;
  font-size: 10px;
  font-weight: 600;
  color: var(--gold-pale);
  letter-spacing: 0.08em;
}

.result-footer {
  padding: 14px 18px;
  background: var(--surface-2);
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  gap: 10px;
}

.full-w { flex: 1; }

/* ── 3D Viewer ── */
.viewer-wrap {
  width: min(600px, 94%);
  height: min(650px, 85vh);
  background: var(--surface-1);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.viewer-top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.vbar-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-pale);
  background: rgba(201,168,76,0.1);
  border: 1px solid var(--gold-border);
  padding: 3px 10px;
  border-radius: 10px;
}

.vbar-name {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--ivory);
  font-weight: 500;
}

.vbar-price {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--gold);
  font-weight: 600;
}

.model-viewer-el {
  flex: 1;
  width: 100%;
  --poster-color: transparent;
  background: radial-gradient(ellipse at 50% 40%, var(--surface-3) 0%, var(--obsidian) 100%);
}

/* Canvas layout */
.canvas {
  grid-column: 2;
  position: relative;
  background: var(--obsidian);
  overflow: hidden;
}

.canvas::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(201,168,76,0.04) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

/* Spinner */
.spinner-overlay {
  position: absolute; inset: 0;
  background: rgba(10,8,6,0.9);
  backdrop-filter: blur(16px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}

.spinner-box { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.shimmer-ring { width: 50px; height: 50px; border-radius: 50%; border: 2px solid rgba(201,168,76,0.12); border-top-color: var(--gold); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-text { font-size: 14px; color: var(--pearl); letter-spacing: 0.03em; }
.spinner-sub  { font-size: 11px; color: var(--ash); margin-top: -10px; }

.toast {
  position: fixed; bottom: 28px; right: 28px;
  background: var(--surface-3); color: var(--pearl);
  padding: 11px 18px; border-radius: var(--radius-xs);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 12px; font-weight: 500;
  box-shadow: var(--shadow-lg); z-index: 200;
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none; max-width: 280px;
}
.toast.show { opacity: 1; transform: translateY(0); }

#arCanvas{
    position:absolute;
    top:0;
    left:0;
    width:100%;
    height:100%;
    pointer-events:none;
    display:block;          /* add this */
}

#liveVideo{
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;          /* add this — removes the baseline gap */
    transform:scaleX(-1);   /* keep this if you have the mirror */
}

/* ── Enlarge the Live AR view only ── */
#stateLiveAR .camera-panel {
  width: min(1000px, 96%);
  max-height: 94vh;
}

#stateLiveAR .camera-viewport {
  max-height: none;              /* remove the 420px cap */
  height: min(74vh, 700px);      /* make it much taller */
}