:root { --ink: #151515; --green: #1f7a4d; --font: "Helvetica Neue", Arial, sans-serif; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #f2f2f0; font-family: var(--font); color: var(--ink); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.top { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: center; align-items: center; padding: 16px 22px; z-index: 5; pointer-events: none; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: .18em; }
.brand svg { width: 28px; height: 18px; }
.brand b { font-size: 15px; letter-spacing: .24em; } .brand span { opacity: .6; }
.cart { position: absolute; right: 22px; top: 12px; pointer-events: auto; display: flex; align-items: center; gap: 4px; border: 0; background: #fff; border-radius: 999px; padding: 8px 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.cart svg { width: 20px; height: 20px; fill: currentColor; } .cart b { font-size: 12px; }

.menu { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 5; display: flex; gap: 2px; background: #fff; border-radius: 999px; padding: 5px;
  box-shadow: 0 8px 30px rgba(0,0,0,.1); max-width: calc(100vw - 24px); overflow-x: auto; }
.menu button { border: 0; background: none; padding: 9px 18px; border-radius: 999px; font-size: 13px; white-space: nowrap; }
.menu button:hover { background: #f0f0ee; }
.menu button[aria-current="true"] { background: var(--ink); color: #fff; }

.hint { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); margin: 0; z-index: 4; font-size: 12px; background: rgba(255,255,255,.85); padding: 5px 12px; border-radius: 999px;
  white-space: nowrap; transition: opacity .6s; }
.tip { position: fixed; z-index: 6; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 5px 9px; border-radius: 8px; transform: translate(14px, 14px); opacity: 0; transition: opacity .15s; white-space: nowrap; }
.tip.on { opacity: 1; }
.tip b { font-weight: 600; } .tip span { opacity: .7; margin-left: 6px; }

/* detail: the 3D product is drawn on the canvas, this layer holds the controls */
.detail { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.detail[hidden] { display: none; }
.detail .card, .detail .step { pointer-events: auto; }
.step { position: absolute; top: 50%; width: 46px; height: 46px; border-radius: 50%; border: 1px solid #ccc; background: #fff; font-size: 18px; transform: translateY(-50%); }
.step.prev { left: 3vw; } .step.next { left: calc(56vw - 46px); }
.drag-hint { position: absolute; left: 28vw; bottom: 90px; transform: translateX(-50%); margin: 0; font-size: 12px; opacity: .55; }
.card { position: absolute; right: 4vw; top: 50%; transform: translateY(-50%); width: min(360px, 36vw); background: #fff; border-radius: 18px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.12);
  animation: cardIn .45s cubic-bezier(.2,.8,.2,1); }
@keyframes cardIn { from { opacity: 0; transform: translate(24px, -50%); } }
.close { position: absolute; right: 14px; top: 14px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: #f2f2f0; }
.cat { margin: 0 0 4px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; opacity: .55; }
.card h2 { margin: 0 0 6px; font-size: 24px; font-weight: 600; letter-spacing: -0.01em; padding-right: 30px; }
.price { margin: 0 0 18px; font-size: 18px; }
.label { margin: 0 0 8px; font-size: 12px; font-weight: 600; } .label span { font-weight: 400; opacity: .6; margin-left: 4px; }
.colours { display: flex; gap: 8px; margin-bottom: 16px; }
.colours button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #ccc; padding: 0; }
.colours button[aria-checked="true"] { box-shadow: 0 0 0 2px var(--ink); }
.sizes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.sizes button { min-width: 46px; border: 1px solid #ccc; background: #fff; border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.sizes button[aria-checked="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.qty-row { display: flex; gap: 8px; }
.qty { display: flex; align-items: center; border: 1px solid #ccc; border-radius: 999px; }
.qty button { width: 36px; height: 42px; border: 0; background: none; font-size: 18px; } .qty output { min-width: 18px; text-align: center; font-size: 14px; }
.add { flex: 1; border: 0; border-radius: 999px; background: var(--green); color: #fff; font-weight: 600; font-size: 14px; }
.add:hover { background: #176240; }
.note { margin: 12px 0 0; font-size: 11px; opacity: .55; }

/* where the 3D model comes from: icon + words, never colour alone */
.source { display: inline-flex; align-items: center; gap: 6px; margin: -8px 0 16px; padding: 4px 10px 4px 8px; border-radius: 999px; font-size: 12px; background: #f2f2f0; }
.source::before { content: ""; width: 10px; height: 10px; flex: none; }
.source[data-kind="scan"]::before { border-radius: 50%; background: var(--ink); }                      /* filled dot: real scan */
.source[data-kind="mock"]::before { border-radius: 2px; border: 1.5px dashed var(--ink); width: 7px; height: 7px; } /* dashed square: placeholder */
.source[data-kind="model"]::before { border-radius: 2px; border: 1.5px solid var(--ink); width: 7px; height: 7px; background: linear-gradient(135deg, var(--ink) 50%, transparent 50%); } /* half-filled square: modelled sample */
.source[data-kind="local"]::before { border-radius: 50%; border: 2px solid var(--ink); width: 6px; height: 6px; } /* ring: your own file */
.try { display: flex; align-items: baseline; gap: 6px; margin-top: 10px; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; width: fit-content; }
.try small { opacity: .5; text-decoration: none; }
.try input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.try:focus-within { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }

.load { position: absolute; left: 28vw; top: 50%; transform: translate(-50%, 120px); margin: 0; font-size: 12px; background: rgba(255,255,255,.92); padding: 6px 12px; border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0,0,0,.08); white-space: nowrap; font-variant-numeric: tabular-nums; }
.load[hidden] { display: none; }
.drop { position: fixed; inset: 12px; z-index: 8; display: grid; place-items: center; border: 2px dashed var(--ink); border-radius: 20px; background: rgba(245,245,243,.85); pointer-events: none; text-align: center; font-size: 15px; }
.drop[hidden] { display: none; }
.drop small { font-size: 12px; opacity: .6; }

.toast { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); z-index: 9; background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 13px; opacity: 0; transition: opacity .3s; pointer-events: none; }
.toast.on { opacity: 1; }

@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  .brand span { display: none; }
  .card { left: 10px; right: 10px; top: auto; bottom: 78px; width: auto; transform: none; padding: 16px; animation: none; max-height: 52vh; overflow: auto; }
  .card h2 { font-size: 19px; } .price { margin-bottom: 10px; }
  .step { top: 26%; } .step.prev { left: 10px; } .step.next { left: auto; right: 10px; }
  .drag-hint { left: 50%; bottom: auto; top: 46%; }
  .load { left: 50%; top: 40%; transform: translateX(-50%); }
  .menu button { padding: 8px 12px; }
}
@media (prefers-reduced-motion: reduce) { .card { animation: none; } }
