:root {
  --brand: #2E9BDB;
  --brand-dark: #1D6FA0;
  --brand-tint: #EAF5FC;
  --navy: #0F2A47;
  --sale: #D6273C;
  --ink: #1a1a1a;
  --ink-soft: #55585c;
  --line: #e7e5e3;
  --panel: #fafaf9;
  --bg: #ffffff;
  --success: #1e8e4f;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ---------- Header ---------- */
.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: relative;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  position: relative;
  padding-bottom: 3px;
  border-bottom: 2.5px solid #16181a;
}
.brand-icon-wrap { position: relative; flex-shrink: 0; margin-bottom: 1px; }
.brand-icon { width: 34px; height: 34px; display: block; }
.brand-reg {
  position: absolute;
  top: -5px;
  right: -9px;
  font-size: 8px;
  font-weight: 700;
  color: #2a2a2a;
  border: 1px solid #2a2a2a;
  border-radius: 50%;
  width: 11px;
  height: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-word {
  font-family: "Arial Rounded MT Bold", "Segoe UI", Verdana, var(--font);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.01em;
  color: var(--brand);
}
.brand-tag {
  font-size: 9px;
  color: var(--ink-soft);
  font-weight: 600;
  white-space: nowrap;
  margin-top: 2px;
}
.navtabs { display: flex; gap: 4px; }
.navtab {
  border: none;
  background: transparent;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 999px;
  transition: background .15s, color .15s;
}
.navtab:hover { background: var(--brand-tint); color: var(--brand-dark); }
.navtab.active { background: var(--brand); color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--ink-soft); }
.demo-pill {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: var(--ink);
  color: #fff;
  padding: 4px 9px;
  border-radius: 5px;
}

/* ---------- Layout ---------- */
.app { height: calc(100% - 60px); display: flex; }
.viewer-col { flex: 1 1 auto; position: relative; background: #fff; min-width: 0; }
.panel-col {
  width: 400px;
  flex: 0 0 400px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ---------- Viewer ---------- */
#viewer-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

.dim-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: opacity .15s;
}
.dim-line { stroke: #7a7d82; stroke-width: 1.2; }
.dim-group.dim-width .dim-line, .dim-group.dim-height .dim-line { stroke: #8b8e93; }
.dim-label-bg { fill: #ffffff; stroke: #e2e0dd; stroke-width: 1; rx: 4; ry: 4; }
.dim-label {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  fill: var(--ink);
  text-anchor: middle;
  dominant-baseline: middle;
}
.viewer-hint {
  position: absolute;
  bottom: 20px;
  left: 24px;
  font-size: 11.5px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.85);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  pointer-events: none;
}
.viewer-nav {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
}
.viewer-arrow {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink);
  transition: border-color .15s, color .15s;
}
.viewer-arrow:hover { border-color: var(--brand); color: var(--brand); }
.viewer-dots { display: flex; gap: 5px; }
.viewer-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.viewer-dot.active { background: var(--brand); width: 16px; border-radius: 4px; }

.viewer-fab {
  position: absolute;
  bottom: 20px;
  right: 24px;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--ink-soft);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  transition: border-color .15s, color .15s, background .15s;
}
.viewer-fab:hover { border-color: var(--brand); color: var(--brand); }
.viewer-fab.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.viewer-topleft {
  position: absolute; top: 18px; left: 22px;
  font-size: 11px; color: var(--ink-soft);
  background: rgba(255,255,255,.85);
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line);
}
.viewer-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.72);
  font-size: 13px; color: var(--ink-soft);
  gap: 10px;
  transition: opacity .2s;
  pointer-events: none;
}
.viewer-loading.hidden { opacity: 0; }
.spinner {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: absolute;
  top: 20px; right: 24px;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }

/* ---------- Panel ---------- */
.panel-scroll { flex: 1 1 auto; overflow-y: auto; padding: 20px 22px 10px; scroll-behavior: smooth; }
.panel-scroll::-webkit-scrollbar { width: 7px; }
.panel-scroll::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }
#steps { transition: opacity .16s ease; }
#steps.fading { opacity: 0.35; }

.p-title { font-size: 19px; font-weight: 700; margin: 0 0 2px; letter-spacing: -0.01em; }
.p-sku { font-size: 11px; color: var(--ink-soft); margin-bottom: 8px; }
.p-rating { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 18px; }
.stars { color: #e8a92d; letter-spacing: 1px; }

.step {
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.step:last-child { border-bottom: none; }
.step-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.step-num {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  transition: border-color .15s, background .15s;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 92px;
}
.chip .chip-sub { font-size: 10.5px; color: var(--ink-soft); font-weight: 500; }
.chip:hover { border-color: var(--brand); }
.chip.active { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-dark); }

.thumb-row { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb-btn {
  width: 74px; height: 74px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: #fff center/contain no-repeat;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.thumb-btn:hover { border-color: var(--brand); }
.thumb-btn.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-tint); }
.thumb-btn .thumb-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.thumb-label {
  font-size: 10px;
  text-align: center;
  color: var(--ink-soft);
  margin-top: 3px;
  max-width: 74px;
}
.thumb-wrap { display: flex; flex-direction: column; align-items: center; }

.swatch-row { display: flex; flex-wrap: wrap; gap: 12px; }
.swatch-wrap { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 54px; }
.swatch {
  width: 34px; height: 34px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
  outline: 1px solid var(--line);
  position: relative;
  transition: outline-color .15s, transform .1s;
}
.swatch:hover { transform: scale(1.06); }
.swatch.active { outline: 2px solid var(--brand); outline-offset: 2px; }
.swatch .premium-dot {
  position: absolute; top: -2px; right: -2px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ink); color: #fff; font-size: 7px;
  display: flex; align-items: center; justify-content: center;
}
.swatch-label { font-size: 10px; color: var(--ink-soft); text-align: center; line-height: 1.2; }

.module-row { display: flex; flex-direction: column; gap: 10px; }
.module-item {
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  background: #fff;
  transition: border-color .15s, background .15s;
}
.module-item.active { border-color: var(--brand); background: var(--brand-tint); }
.module-left { display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 600; }
.module-checkbox {
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1.5px solid #c7c5c2;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff;
  flex-shrink: 0;
}
.module-item.active .module-checkbox { background: var(--brand); border-color: var(--brand); }
.module-price { font-size: 12px; color: var(--ink-soft); font-weight: 600; }

.texture-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  cursor: pointer;
  user-select: none;
}
.tt-track {
  width: 34px; height: 19px;
  border-radius: 999px;
  background: #d9d7d3;
  position: relative;
  transition: background .15s;
  flex-shrink: 0;
}
.texture-toggle.active .tt-track { background: var(--brand); }
.tt-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
  transition: left .15s;
}
.texture-toggle.active .tt-thumb { left: 17px; }
.tt-label { font-size: 12px; color: var(--ink-soft); }
.tt-label strong { color: var(--ink); font-weight: 700; }

.stepper-row { display: flex; align-items: center; gap: 14px; }
.stepper-btn {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff;
  font-size: 15px; cursor: pointer; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.stepper-btn:hover { border-color: var(--brand); color: var(--brand); }
.stepper-btn:disabled { opacity: .35; cursor: not-allowed; }
.stepper-val { font-size: 14px; font-weight: 700; min-width: 90px; text-align: center; }

/* ---------- Price bar ---------- */
.pricebar {
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 14px 22px 18px;
  flex-shrink: 0;
}
.price-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.price-main { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.price-strike { font-size: 13px; color: #b3b1ae; text-decoration: line-through; margin-left: 8px; font-weight: 500; }
.price-emi { font-size: 11.5px; color: var(--ink-soft); }
.price-save {
  font-size: 11px;
  font-weight: 700;
  color: var(--sale);
  background: #FCEBED;
  display: inline-block;
  padding: 3px 8px;
  border-radius: 5px;
  margin-bottom: 10px;
}
.cta {
  width: 100%;
  border: none;
  background: var(--brand);
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  padding: 13px 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, transform .05s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.cta:hover { background: var(--brand-dark); }
.cta:active { transform: scale(.99); }
.cta-note { text-align: center; font-size: 10.5px; color: #a9a7a3; margin-top: 8px; }

/* scrollbar for panel on firefox */
.panel-scroll { scrollbar-width: thin; }

@media (max-width: 980px) {
  .panel-col { width: 340px; flex-basis: 340px; }
  .brand-tag { display: none; }
}

/* ---------- Mobile (phones, ~375-430px portrait) ----------
   Below 980px the panel just narrows (see above), but the viewer/panel
   split stays side-by-side, which breaks on real phone widths: the
   panel-col's fixed 340px alone leaves almost no room for the 3D viewer,
   and the bottom-row viewer controls (.viewer-hint / .viewer-nav /
   .viewer-fab), all sized and spaced for a wide desktop viewer, collide
   with each other once that column narrows further. This stacks the
   viewer above the panel instead of squeezing them side-by-side, removes
   the decorative drag/zoom hint text that was the main source of overlap
   with the nav dots, and enlarges the small icon buttons to a real touch
   target size (>=44px, Apple/Google's minimum recommendation) without
   touching anything above 760px (i.e. desktop/tablet layout is untouched). */
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .viewer-col { flex: 0 0 auto; width: 100%; height: 46vh; min-height: 240px; }
  .panel-col {
    width: 100%;
    height: auto;
    flex: 1 1 auto;
    min-height: 0;
    border-left: none;
    border-top: 1px solid var(--line);
  }
  .panel-scroll { min-height: 0; padding: 16px 16px 8px; }
  .pricebar { padding: 12px 16px 16px; }

  .topbar { padding: 0 14px; gap: 8px; }
  .demo-pill { display: none; }
  .navtabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; max-width: 46vw; }
  .navtabs::-webkit-scrollbar { display: none; }
  .navtab { white-space: nowrap; padding: 8px 12px; font-size: 12.5px; }

  /* The hint text ("Drag to rotate / Scroll to zoom") sat at left:24px and
     routinely overlapped the centered prev/next nav dots once the viewer
     was this narrow — it's purely a decorative tip, so hide it here rather
     than fight for space; drag/pinch is discoverable without it on touch. */
  .viewer-hint { display: none; }

  .viewer-fab, .viewer-arrow { width: 44px; height: 44px; }
  .viewer-nav { bottom: 14px; gap: 12px; }
  .viewer-fab { bottom: 14px; right: 14px; }
  .viewer-topleft { top: 12px; left: 12px; max-width: 55%; font-size: 10.5px; }
  .toast { top: 12px; right: 12px; left: auto; max-width: 65%; }
}

@media (max-width: 400px) {
  .viewer-col { height: 42vh; min-height: 220px; }
  .p-title { font-size: 17px; }
  .price-main { font-size: 19px; }
}
