:root {
  --gold: #B88A2E;
  --gold-light: #F4E2B7;
  --gold-dark: #7B5A1E;
  --bg: #F7F4EF;
  --surface: #FFFFFF;
  --surface2: #F1ECE4;
  --surface3: #E8DFD3;
  --border: rgba(61, 45, 27, 0.12);
  --border-hover: rgba(184, 138, 46, 0.45);
  --text: #211A14;
  --text-muted: rgba(33, 26, 20, 0.58);
  --text-soft: rgba(33, 26, 20, 0.38);
  --shadow-soft: 0 18px 55px rgba(54, 43, 29, 0.10);
  --shadow-card: 0 10px 26px rgba(54, 43, 29, 0.07);
  --radius: 16px;
  --panel-w: 360px;
  --transition: 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-weight: 400;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

/* ─── LAYOUT ───────────────────────────────────────── */
.layout {
  display: flex;
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 14%, rgba(244, 226, 183, 0.55), transparent 28%),
    linear-gradient(135deg, #FFFFFF 0%, #F7F4EF 46%, #EFE7DA 100%);
}

/* ─── SIDEBAR ───────────────────────────────────────── */
.sidebar {
  width: var(--panel-w);
  min-width: var(--panel-w);
  height: 100vh;
  min-height: 100vh;
  max-height: 100vh;
  background: rgba(255, 255, 255, 0.82);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 10;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 3px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  z-index: 2;
}

.sidebar-header {
  padding: 34px 28px 24px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.58));
}

.brand-label {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: 8px;
}

.brand-title {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: 32px;
  letter-spacing: -0.035em;
  color: var(--text);
  line-height: 1;
}

.brand-title em {
  font-style: italic;
  color: var(--gold);
  font-weight: 500;
}

.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 18px 24px;
  -webkit-overflow-scrolling: touch;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 5px;
}

.sidebar-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(33, 26, 20, 0.16);
  border-radius: 999px;
}

.sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(184, 138, 46, 0.52);
}

/* ─── SECTIONS ───────────────────────────────────────── */
.section {
  overflow: hidden;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}

.section-toggle {
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 17px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  transition: background var(--transition), transform var(--transition);
}

.section-toggle:hover {
  background: rgba(184, 138, 46, 0.07);
}

.section-toggle-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.section-num {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface2);
  color: var(--gold-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.section-title {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}

.section-arrow {
  width: 16px;
  height: 16px;
  color: var(--gold-dark);
  transition: transform var(--transition);
  flex-shrink: 0;
}

.section.open .section-arrow {
  transform: rotate(180deg);
}

.section-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.section.open .section-body {
  max-height: 720px;
}

.section-inner {
  padding: 2px 18px 20px;
}

/* ─── DIAMOND QTY ───────────────────────────────────────── */
.stones-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.stone-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 13px 6px 12px;
  cursor: pointer;
  text-align: center;
  transition: transform var(--transition), border-color var(--transition), background var(--transition), color var(--transition), box-shadow var(--transition);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 76px;
}

.stone-btn:hover {
  border-color: var(--border-hover);
  color: var(--text);
  background: #FFFDF8;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(54, 43, 29, 0.08);
}

.stone-btn.active {
  border-color: rgba(184, 138, 46, 0.72);
  color: var(--gold-dark);
  background: linear-gradient(180deg, #FFF9EA, #FFFFFF);
  box-shadow: inset 0 0 0 1px rgba(184, 138, 46, 0.10), 0 8px 18px rgba(184, 138, 46, 0.12);
}

.stone-icon {
  font-size: 18px;
  line-height: 1;
}

.stone-label {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

.clamping-row {
  margin-top: 6px;
}

.clamping-btn {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 12px 14px;
  cursor: pointer;
  text-align: center;
  transition: transform var(--transition), border-color var(--transition), background var(--transition), color var(--transition), box-shadow var(--transition);
  border-radius: 14px;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.clamping-btn:hover {
  border-color: var(--border-hover);
  color: var(--text);
  background: #FFFDF8;
  transform: translateY(-1px);
}

.clamping-btn.active {
  border-color: rgba(184, 138, 46, 0.72);
  color: var(--gold-dark);
  background: linear-gradient(180deg, #FFF8E8, #FFFFFF);
  box-shadow: 0 8px 18px rgba(184, 138, 46, 0.12);
}

/* ─── METAL SWATCH ───────────────────────────────────────── */
.ring-label {
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 9px;
  margin-top: 16px;
  font-weight: 700;
}

.ring-label:first-child {
  margin-top: 0;
}

.metal-row {
  display: flex;
  gap: 10px;
  margin-bottom: 4px;
}

.metal-btn {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 14px 0 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform var(--transition), border-color var(--transition), background var(--transition), box-shadow var(--transition);
  border-radius: 14px;
}

.metal-btn:hover {
  border-color: var(--border-hover);
  background: #FFFDF8;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(54, 43, 29, 0.08);
}

.metal-btn.active {
  border-color: rgba(184, 138, 46, 0.72);
  background: linear-gradient(180deg, #FFF8E8, #FFFFFF);
  box-shadow: inset 0 0 0 1px rgba(184, 138, 46, 0.10), 0 8px 18px rgba(184, 138, 46, 0.12);
}

.metal-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  box-shadow: inset 0 -4px 7px rgba(0,0,0,0.20), 0 8px 16px rgba(54,43,29,0.12);
  position: relative;
  overflow: hidden;
}

.metal-swatch::after {
  content: '';
  position: absolute;
  top: 5px;
  left: 7px;
  width: 10px;
  height: 5px;
  background: rgba(255,255,255,0.55);
  border-radius: 50%;
  transform: rotate(-28deg);
}

.swatch-gold {
  background: radial-gradient(circle at 38% 28%, #FFE7A5, #C89A3C, #7C5819);
}

.swatch-rose {
  background: radial-gradient(circle at 38% 28%, #F6C0A4, #C9795B, #8B3B22);
}

.swatch-silver {
  background: radial-gradient(circle at 38% 28%, #FFFFFF, #C8C4BD, #77716B);
}

.metal-name {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.metal-btn.active .metal-name {
  color: var(--gold-dark);
}

/* ─── SLIDERS ───────────────────────────────────────── */
.slider-group {
  margin-bottom: 18px;
}

.slider-group:last-child {
  margin-bottom: 0;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.slider-name {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  line-height: 1.3;
}

.slider-value {
  min-width: 40px;
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 800;
  color: var(--gold-dark);
  letter-spacing: -0.01em;
  background: #FFF8E8;
  border: 1px solid rgba(184, 138, 46, 0.24);
  padding: 4px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.slider-track {
  position: relative;
  height: 6px;
  background: var(--surface3);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(54, 43, 29, 0.08);
}

.slider-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  border-radius: 999px;
  pointer-events: none;
}

input[type="range"] {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  transform: translateY(-50%);
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  height: 28px;
  margin: 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(184, 138, 46, 0.12), 0 8px 16px rgba(54,43,29,0.16);
  transition: box-shadow var(--transition), transform 0.2s;
  cursor: grab;
}

input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 6px rgba(184, 138, 46, 0.18), 0 10px 20px rgba(54,43,29,0.18);
  transform: scale(1.08);
}

input[type="range"]::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.02);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(184, 138, 46, 0.12);
  cursor: grab;
}

/* ─── SIDEBAR FOOTER ───────────────────────────────────────── */
.sidebar-footer {
  padding: 16px 28px 24px;
  border-top: 1px solid var(--border);
  flex: 0 0 auto;
  background: rgba(255,255,255,0.88);
}

.order-btn {
  width: 100%;
  background: var(--text);
  border: 1px solid var(--text);
  color: #FFFFFF;
  padding: 15px 0;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition), color var(--transition);
  border-radius: 999px;
  box-shadow: 0 12px 24px rgba(33, 26, 20, 0.18);
}

.order-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.36s cubic-bezier(0.4, 0, 0.2, 1);
}

.order-btn:hover::before {
  transform: scaleX(1);
}

.order-btn:hover {
  color: #FFFFFF;
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(184, 138, 46, 0.24);
}

.order-btn span {
  position: relative;
  z-index: 1;
}

/* ─── VIEWER ───────────────────────────────────────── */
.viewer {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  height: 100vh;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 72%, rgba(184, 138, 46, 0.12), transparent 28%),
    linear-gradient(135deg, #FFFFFF 0%, #F8F4EC 50%, #EFE7DA 100%);
}

.viewer::before {
  content: '';
  position: absolute;
  inset: 18px;
  background:
    linear-gradient(90deg, rgba(184, 138, 46, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(184, 138, 46, 0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  border: 1px solid rgba(184, 138, 46, 0.10);
  border-radius: 30px;
  pointer-events: none;
  z-index: 1;
}

/* Corner ornaments */
.corner {
  position: absolute;
  width: 34px;
  height: 34px;
  z-index: 5;
  pointer-events: none;
  opacity: 0.65;
}

.corner svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 6px 10px rgba(54, 43, 29, 0.08));
}

.corner-tl {
  top: 26px;
  left: 26px;
}

.corner-tr {
  top: 26px;
  right: 26px;
  transform: scaleX(-1);
}

.corner-bl {
  bottom: 26px;
  left: 26px;
  transform: scaleY(-1);
}

.corner-br {
  bottom: 26px;
  right: 26px;
  transform: scale(-1);
}

/* viewer label */
.viewer-label {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  opacity: 0.82;
  transition: opacity var(--transition);
}

.viewer:hover .viewer-label {
  opacity: 0.45;
}

.viewer-label-text {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-dark);
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(184, 138, 46, 0.18);
  padding: 7px 10px;
  border-radius: 999px;
  backdrop-filter: blur(12px);
}

.viewer-label-line {
  width: 1px;
  height: 20px;
  background: linear-gradient(to bottom, var(--gold), transparent);
}

/* iframe */
#pcIframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: transparent;
}

/* Loading overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(244, 226, 183, 0.70), transparent 28%),
    linear-gradient(135deg, #FFFFFF 0%, #F8F4EC 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  z-index: 20;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-diamond {
  width: 56px;
  height: 56px;
  position: relative;
  animation: rotateDiamond 3s linear infinite;
  filter: drop-shadow(0 12px 22px rgba(184, 138, 46, 0.20));
}

@keyframes rotateDiamond {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--gold-dark);
  letter-spacing: -0.02em;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.5;
  }

  50% {
    opacity: 1;
  }
}

.loading-dots {
  display: flex;
  gap: 7px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0.3;
  animation: dotPulse 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotPulse {
  0%,
  80%,
  100% {
    opacity: 0.2;
    transform: scale(1);
  }

  40% {
    opacity: 1;
    transform: scale(1.35);
  }
}

/* ─── NOTIFICATION TOAST ───────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 32px;
  left: calc(var(--panel-w) + ((100vw - var(--panel-w)) / 2));
  transform: translateX(-50%) translateY(80px);
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(184, 138, 46, 0.34);
  box-shadow: 0 16px 40px rgba(54, 43, 29, 0.16);
  backdrop-filter: blur(14px);
  padding: 12px 22px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-dark);
  z-index: 100;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s;
  opacity: 0;
  pointer-events: none;
  border-radius: 999px;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ─── SEPARATOR ───────────────────────────────────────── */
.sep {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ─── TOP BAR VIEWER ───────────────────────────────────────── */
.viewer-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 32px;
  z-index: 5;
  pointer-events: none;
}

.view-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(33, 26, 20, 0.10);
  padding: 9px 12px;
  border-radius: 999px;
  backdrop-filter: blur(12px);
}

.view-hint-icon {
  width: 14px;
  height: 14px;
  color: var(--gold-dark);
}

/* ─── TABLET SIDE PANEL TUNING ───────────────────────────────────────── */
@media (max-width: 1024px) {
  :root {
    --panel-w: 330px;
  }

  .sidebar-header {
    padding: 28px 22px 20px;
  }

  .brand-title {
    font-size: 28px;
  }

  .sidebar-scroll {
    padding: 14px;
  }

  .section-toggle,
  .section-inner {
    padding-left: 14px;
    padding-right: 14px;
  }

  .stones-grid {
    gap: 8px;
  }

  .stone-label,
  .metal-name {
    font-size: 9px;
  }
}

/* ─── MOBILE FIXED 100VH LAYOUT
   50vh iframe/viewer + 50vh fixed UI
   Only .sidebar-scroll scrolls vertically
───────────────────────────────────────── */
@media (max-width: 900px) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
    inset: 0;
  }

  .layout {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  .viewer {
    order: 1;
    width: 100%;
    height: 50dvh;
    min-height: 50dvh;
    max-height: 50dvh;
    flex: 0 0 50dvh;
    overflow: hidden;
  }

  #pcIframe {
    width: 100%;
    height: 100%;
  }

  .sidebar {
    order: 2;
    width: 100%;
    min-width: 100%;
    height: 50dvh;
    min-height: 50dvh;
    max-height: 50dvh;
    flex: 0 0 50dvh;
    overflow: hidden;
    border-right: none;
    border-top: 1px solid var(--border);
    box-shadow: 0 -10px 35px rgba(54, 43, 29, 0.10);
  }

  .sidebar::before {
    left: 18px;
    right: 18px;
  }

  .sidebar-header {
    flex: 0 0 auto;
    padding: 14px 18px 12px;
  }

  .brand-label {
    font-size: 9px;
    margin-bottom: 5px;
  }

  .brand-title {
    font-size: 24px;
  }

  .sidebar-scroll {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 14px 18px;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-footer {
    flex: 0 0 auto;
    padding: 12px 18px 14px;
  }

  .section {
    margin-bottom: 10px;
    border-radius: 16px;
  }

  .section-toggle {
    padding: 13px 14px;
  }

  .section-inner {
    padding: 2px 14px 16px;
  }

  .section.open .section-body {
    max-height: 1000px;
  }

  .section-title {
    font-size: 11px;
    letter-spacing: 0.1em;
  }

  .section-num {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }

  .stones-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .stone-btn {
    min-height: 62px;
    padding: 9px 5px;
    border-radius: 12px;
  }

  .stone-icon {
    font-size: 14px;
  }

  .stone-label,
  .metal-name {
    font-size: 8px;
  }

  .clamping-btn {
    padding: 11px 12px;
    font-size: 10px;
  }

  .ring-label {
    margin-top: 12px;
    margin-bottom: 7px;
    font-size: 10px;
  }

  .metal-row {
    gap: 8px;
  }

  .metal-btn {
    padding: 10px 0 9px;
    border-radius: 12px;
  }

  .metal-swatch {
    width: 24px;
    height: 24px;
  }

  .slider-group {
    margin-bottom: 14px;
  }

  .slider-header {
    margin-bottom: 8px;
  }

  .slider-name {
    font-size: 10px;
  }

  .slider-value {
    min-width: 36px;
    font-size: 10px;
    padding: 3px 7px;
  }

  .viewer::before {
    inset: 10px;
    border-radius: 20px;
    background-size: 32px 32px;
  }

  .viewer-top {
    height: 48px;
    justify-content: center;
    padding: 0 12px;
  }

  .view-hint {
    font-size: 8px;
    letter-spacing: 0.08em;
    padding: 7px 9px;
  }

  .view-hint-icon {
    width: 12px;
    height: 12px;
  }

  .viewer-label {
    bottom: 12px;
  }

  .viewer-label-text {
    font-size: 8px;
    letter-spacing: 0.16em;
    padding: 6px 8px;
  }

  .viewer-label-line {
    height: 14px;
  }

  .corner {
    width: 24px;
    height: 24px;
  }

  .corner-tl {
    top: 14px;
    left: 14px;
  }

  .corner-tr {
    top: 14px;
    right: 14px;
  }

  .corner-bl {
    bottom: 14px;
    left: 14px;
  }

  .corner-br {
    bottom: 14px;
    right: 14px;
  }

  .loading-diamond {
    width: 44px;
    height: 44px;
  }

  .loading-text {
    font-size: 15px;
  }

  .loading-overlay {
    gap: 16px;
  }

  .toast {
    left: 50%;
    bottom: calc(50dvh + 12px);
    max-width: calc(100vw - 28px);
    width: max-content;
    white-space: normal;
    text-align: center;
    font-size: 9px;
    padding: 9px 14px;
  }
}

/* ─── SMALL MOBILE ───────────────────────────────────────── */
@media (max-width: 480px) {
  .sidebar-header {
    padding: 12px 14px 10px;
  }

  .brand-title {
    font-size: 22px;
  }

  .brand-label {
    font-size: 8px;
  }

  .sidebar-scroll {
    padding: 10px 10px 16px;
  }

  .section-toggle {
    padding: 12px;
  }

  .section-inner {
    padding: 2px 12px 14px;
  }

  .section-toggle-left {
    gap: 9px;
  }

  .section-title {
    font-size: 10px;
  }

  .stones-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
  }

  .stone-btn {
    min-height: 56px;
    padding: 8px 4px;
  }

  .stone-icon {
    font-size: 13px;
  }

  .stone-label,
  .metal-name {
    font-size: 7.5px;
    letter-spacing: 0.05em;
  }

  .metal-swatch {
    width: 22px;
    height: 22px;
  }

  .slider-name {
    font-size: 9px;
  }

  input[type="range"]::-webkit-slider-thumb {
    width: 17px;
    height: 17px;
  }

  input[type="range"]::-moz-range-thumb {
    width: 17px;
    height: 17px;
  }
}

/* ─── EXTRA SMALL MOBILE ───────────────────────────────────────── */
@media (max-width: 360px) {
  .brand-title {
    font-size: 20px;
  }

  .section-title {
    font-size: 9px;
    letter-spacing: 0.08em;
  }

  .section-num {
    width: 22px;
    height: 22px;
  }

  .stones-grid {
    gap: 6px;
  }

  .stone-btn {
    min-height: 52px;
  }

  .corner {
    display: none;
  }

  .view-hint {
    font-size: 7px;
  }
}

/* ─── 100DVH FALLBACK ───────────────────────────────────────── */
@supports not (height: 100dvh) {
  @media (max-width: 900px) {
    .layout {
      height: 100vh;
      min-height: 100vh;
      max-height: 100vh;
    }

    .viewer {
      height: 50vh;
      min-height: 50vh;
      max-height: 50vh;
      flex-basis: 50vh;
    }

    .sidebar {
      height: 50vh;
      min-height: 50vh;
      max-height: 50vh;
      flex-basis: 50vh;
    }

    .toast {
      bottom: calc(50vh + 12px);
    }
  }
}