:root {
  color-scheme: light;
  /* Pearl & champagne. --gold = decorative accent (borders, fills); --gold-2 = accent TEXT, darkened for 4.5:1 on ivory */
  --bg: #fbf8f3; --bg-2: #ffffff; --card: #ffffff; --field: #ffffff; --line: rgba(42, 36, 32, .12);
  --text: #2a2420; --muted: #6e635a; --gold: #c9a46a; --gold-2: #7a5a2b; --on-gold: #2a1f12;
  --danger: #b4423a; --live: #e5483d; --shadow: 0 18px 40px -24px rgba(90, 64, 30, .35);
  --glass: rgba(20, 16, 12, .55); /* controls floating over the camera video */
  --serif: 'Cormorant', Georgia, serif; --sans: 'Montserrat', system-ui, sans-serif;
  --radius: 18px; --ease: cubic-bezier(.22, 1, .36, 1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
body::before { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background: radial-gradient(900px 600px at 85% -10%, rgba(201, 164, 106, .16), transparent 60%); }
img, canvas { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.05; margin: 0; letter-spacing: -.01em; }
.eyebrow { font-size: 12px; letter-spacing: .32em; text-transform: uppercase; color: var(--gold-2); font-weight: 500; }
.muted { color: var(--muted); margin: 0; }
.wrap { width: min(1400px, 100% - 32px); margin-inline: auto; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 26px;
  border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer;
  font: 500 13px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; text-decoration: none;
  transition: transform .25s var(--ease), background .25s, border-color .25s, color .25s; }
.btn:hover { border-color: var(--gold); color: var(--gold-2); }
.btn:active { transform: scale(.97); }
.btn.gold { background: linear-gradient(135deg, #ecd9b0, var(--gold) 55%, #a9824a); color: var(--on-gold); border: 0; box-shadow: 0 12px 28px -12px rgba(169, 130, 74, .7); }
.btn.gold:hover { color: var(--on-gold); filter: brightness(1.06); }
.btn.sm { min-height: 40px; padding: 0 16px; font-size: 11px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--gold-2); font: 500 12px var(--sans); text-decoration: underline; cursor: pointer; min-height: 32px; padding: 0 6px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; position: relative; transition: border-color .2s; }
.icon-btn:hover { border-color: var(--gold); }
.icon-btn svg { width: 20px; height: 20px; }
.badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--gold); color: var(--on-gold); font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.badge[data-n="0"] { display: none; }

/* Nav */
.nav { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); background: rgba(251, 248, 243, .78); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.logo { font-family: var(--serif); font-size: 26px; letter-spacing: .06em; text-decoration: none; }
.logo span { color: var(--gold-2); }

/* Studio: mirror left, lens panel right */
.studio { display: grid; grid-template-columns: minmax(0, 1fr) 420px; height: calc(100dvh - 65px); }
.mirror { position: relative; margin: 16px; border-radius: 28px; overflow: hidden; border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 40%, #ffffff, #efe5d6 75%); box-shadow: var(--shadow); }
.mirror canvas { width: 100%; height: 100%; object-fit: contain; }
.mirror canvas:not(.live) { height: 58%; margin: 3% auto 0; } /* idle lens sits above the CTA text */
.mirror canvas.live { object-fit: cover; transform: scaleX(-1); } /* real mirror */
.mirror-cta { position: absolute; inset: auto 0 0 0; padding: 48px 24px 32px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
  background: linear-gradient(rgba(251, 248, 243, 0), rgba(251, 248, 243, .94) 45%); }
.mirror-cta h1 { font-size: clamp(28px, 3vw, 42px); max-width: 22ch; }
.privacy { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.status { min-height: 1.4em; margin: 0; font-size: 14px; color: var(--muted); }
.status.err { color: var(--danger); }
.mirror-bar { position: absolute; top: 16px; left: 16px; right: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mirror-bar .btn { background: var(--glass); color: #fff; border-color: rgba(255,255,255,.25); backdrop-filter: blur(10px); }
.live-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--glass); color: #fff; backdrop-filter: blur(10px); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.hint { flex: 1; text-align: center; font-size: 13px; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.8); }

.panel { border-left: 1px solid var(--line); background: rgba(255, 255, 255, .55); padding: 28px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
.sel { display: flex; align-items: center; gap: 16px; }
.sel canvas { width: 96px; height: 96px; flex: none; }
.sel h2 { font-size: 40px; margin: 4px 0; }
.price { color: var(--gold-2); font-weight: 500; font-size: 20px; }
.lens-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.lens-opt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 10px; min-height: 44px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted); font: 500 11px/1.2 var(--sans); box-shadow: 0 6px 16px -12px rgba(90, 64, 30, .4); text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s, transform .25s var(--ease); }
.lens-opt canvas { width: 100%; aspect-ratio: 1; }
.lens-opt:hover { transform: translateY(-2px); border-color: var(--gold); }
.lens-opt[aria-checked="true"] { border-color: var(--gold); background: #f8efe0; color: var(--gold-2); box-shadow: 0 0 0 1px var(--gold); }
.lens-opt[data-out] { opacity: .5; }
.range-labels { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
input[type=range] { accent-color: var(--gold); min-height: 32px; padding: 0; border: 0; background: none; }
.field output { color: var(--gold-2); margin-left: 6px; letter-spacing: 0; }
.foot { font-size: 12px; text-align: center; }

@media (max-width: 900px) {
  .studio { grid-template-columns: 1fr; height: auto; }
  .mirror { height: 62dvh; margin: 12px; }
  .panel { border-left: 0; padding: 8px 16px 32px; overflow: visible; }
}

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--text); background: var(--field); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 48px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }
select option { background: var(--bg-2); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; align-self: start; }
.qty button { width: 44px; height: 44px; border: 0; background: none; color: var(--text); font-size: 18px; cursor: pointer; }
.qty output { min-width: 28px; text-align: center; }

/* Cards (back-office product grid) */
.card { text-align: left; background: var(--card); box-shadow: var(--shadow); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--text); cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 6px; transition: transform .45s var(--ease), border-color .3s; }
.card:hover { transform: translateY(-4px); border-color: var(--gold); }
.card canvas { width: 100%; }
.card .meta { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 6px; }
.card h3 { font-size: 26px; }
.card .price { font-size: 16px; white-space: nowrap; }
.card .sub { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* Dialogs */
dialog { border: 1px solid var(--line); background: var(--bg-2); color: var(--text); border-radius: 24px; padding: 0; width: min(1080px, 100% - 24px); max-height: calc(100dvh - 24px); }
dialog::backdrop { background: rgba(42, 36, 32, .35); backdrop-filter: blur(6px); }
dialog[open] { animation: pop .45s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.98); } }
dialog.narrow { width: min(560px, 100% - 24px); }
.close { position: absolute; top: 14px; right: 14px; z-index: 2; }
dialog.drawer { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(440px, 100%); border-radius: 0; border-width: 0 0 0 1px; flex-direction: column; }
dialog.drawer[open] { display: flex; animation: slide .45s var(--ease); }
@keyframes slide { from { transform: translateX(100%); } }
.drawer header { padding: 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.drawer header h2 { font-size: 34px; }
.lines { flex: 1; overflow: auto; padding: 8px 24px; }
.line { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.line canvas { width: 64px; height: 64px; }
.line h3 { font-size: 22px; }
.line small { color: var(--muted); display: block; }
.line .remove { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 12px; padding: 6px 0; }
.totals { padding: 20px 24px 28px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.totals div { display: flex; justify-content: space-between; color: var(--muted); }
.totals .grand { color: var(--text); font-size: 20px; font-family: var(--serif); }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }
.form { padding: 40px 36px 32px; display: flex; flex-direction: column; gap: 16px; }
.form h2 { font-size: 44px; }
.form .err { color: var(--danger); font-size: 14px; min-height: 1.4em; margin: 0; }
.success { text-align: center; padding: 56px 36px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.success svg { width: 56px; height: 56px; color: var(--gold); }
.success h2 { font-size: 44px; }
.success p { color: var(--muted); margin: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
