:root {
  --bg: #faf7f3;
  --ink: #1d1a17;
  --muted: #7a726a;
  --line: #e7e0d7;
  --card: #fff;
  --accent: #9c4f3c;
  --accent-ink: #fff;
  --soft: #f1ebe3;
  --danger: #a33;
  --radius: 14px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.55 Assistant, system-ui, sans-serif; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

.ribbon { background: var(--ink); color: #f5efe8; text-align: center; font-size: 0.85rem; padding: 7px 16px; }
.top { display: flex; align-items: center; gap: 24px; padding: 18px clamp(16px, 4vw, 48px); border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.logo { font: 700 1.9rem "Frank Ruhl Libre", serif; text-decoration: none; letter-spacing: 0.02em; }
nav { display: flex; gap: 18px; flex: 1; }
nav a { text-decoration: none; color: var(--muted); padding-bottom: 2px; border-bottom: 2px solid transparent; }
nav a.on, nav a:hover { color: var(--ink); border-color: var(--ink); }
.fitting-btn { border: 1px solid var(--ink); background: transparent; border-radius: 999px; padding: 8px 16px; }

.hero { padding: clamp(28px, 6vw, 72px) clamp(16px, 4vw, 48px) 24px; }
.hero h1 { font: 700 clamp(2rem, 5vw, 3.4rem)/1.1 "Frank Ruhl Libre", serif; margin: 0 0 12px; }
.hero p { max-width: 560px; margin: 0; color: var(--muted); font-size: 1.1rem; }

main { padding: 16px clamp(16px, 4vw, 48px) 48px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 28px 20px; }
.card { position: relative; }
.card-img { border: 0; padding: 0; background: var(--soft); width: 100%; aspect-ratio: 2 / 3; overflow: hidden; border-radius: var(--radius); }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.card:hover .card-img img { transform: scale(1.03); }
.card-body { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 10px 2px 0; }
.card h3 { font-size: 1rem; font-weight: 600; margin: 0; }
.price { font-weight: 700; }
.tryon-chip { position: absolute; top: 12px; inset-inline-start: 12px; border: 0; border-radius: 999px; padding: 6px 12px; background: rgba(255, 255, 255, 0.92); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12); font-weight: 600; font-size: 0.85rem; }
.tryon-chip:hover { background: var(--accent); color: var(--accent-ink); }

.foot { display: flex; flex-wrap: wrap; gap: 12px 24px; padding: 24px clamp(16px, 4vw, 48px); border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }
.powered { margin-inline-start: auto; }

/* dialogs */
dialog.sheet { border: 0; border-radius: 20px; padding: 0; width: min(940px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--card); color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); }
dialog::backdrop { background: rgba(29, 26, 23, 0.55); backdrop-filter: blur(2px); }
.x { position: absolute; top: 10px; inset-inline-end: 12px; border: 0; background: transparent; font-size: 1.8rem; line-height: 1; z-index: 2; }
.product { display: grid; grid-template-columns: 1fr 1fr; }
.product img { width: 100%; height: 100%; max-height: 80dvh; object-fit: cover; }
.pinfo { padding: 40px 32px; display: flex; flex-direction: column; gap: 14px; }
.pinfo h2 { font: 700 1.8rem "Frank Ruhl Libre", serif; margin: 0; }
.pinfo .price { font-size: 1.3rem; }
.sizes { display: flex; gap: 8px; }
.sizes span { border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 0.9rem; }
.sizes span.on { border-color: var(--ink); }

.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 12px 22px; font-weight: 700; }
.primary:disabled { opacity: 0.55; cursor: progress; }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 10px 18px; }
.ghost:disabled { color: var(--muted); cursor: not-allowed; }
.link { background: none; border: 0; text-decoration: underline; color: var(--muted); padding: 6px 0; }
.danger { color: var(--danger); }
.tryon { font-size: 1.05rem; }

dialog.room { padding: 28px clamp(16px, 3vw, 32px) 18px; }
.room-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.room-head h2 { font: 700 1.6rem "Frank Ruhl Libre", serif; margin: 0; }
.room section { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; }
.row input { flex: 1; }
input[type="text"], input:not([type]) { font: inherit; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; }
.tips { margin: 0; padding-inline-start: 20px; color: var(--muted); }
.file { display: block; border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; cursor: pointer; background: var(--soft); }
.file input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file:focus-within { border-color: var(--accent); }
.consent { display: flex; flex-direction: column; gap: 10px; font-size: 0.92rem; margin: 6px 0 4px; }
.consent label { display: flex; gap: 10px; align-items: flex-start; }
.consent input { margin-top: 5px; flex: none; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: min(100%, 520px); margin-inline: auto; }
figure { margin: 0; }
figcaption { font-size: 0.85rem; color: var(--muted); padding-top: 6px; }
.pair img, .ph { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: var(--radius); background: var(--soft); }
.ph { display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 16px; }

.stage { display: grid; grid-template-columns: 1fr 170px; gap: 16px; align-items: start; }
.result { position: relative; }
.result img { width: 100%; max-height: 62dvh; object-fit: contain; background: var(--soft); border-radius: var(--radius); }
.busy { position: absolute; inset: 0 0 28px; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; background: rgba(250, 247, 243, 0.82); border-radius: var(--radius); font-weight: 600; }
.side { display: flex; flex-direction: column; gap: 10px; }
.mini img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; background: var(--soft); }
.pick-h { margin: 6px 0 0; font-size: 1rem; }
.strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.thumb { flex: none; width: 64px; aspect-ratio: 2 / 3; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: var(--soft); position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.on { border-color: var(--accent); }
.thumb.done::after { content: "✓"; position: absolute; bottom: 3px; inset-inline-start: 3px; background: var(--accent); color: #fff; font-size: 0.7rem; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; }
.err { margin-top: 12px; background: #fbeceb; color: var(--danger); border-radius: 10px; padding: 10px 14px; }
.room-foot { display: flex; justify-content: space-between; margin-top: 14px; border-top: 1px solid var(--line); padding-top: 8px; }

.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.page { max-width: 820px; margin: 0 auto; padding: 32px 16px 64px; }
.page h1 { font: 700 2rem "Frank Ruhl Libre", serif; }
.page table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.page td, .page th { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: start; vertical-align: middle; }
.page td img { width: 48px; border-radius: 6px; }

@media (max-width: 720px) {
  .top { gap: 12px; flex-wrap: wrap; }
  nav { order: 3; flex-basis: 100%; }
  .fitting-btn { margin-inline-start: auto; padding: 6px 12px; font-size: 0.9rem; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 18px 12px; }
  .product { grid-template-columns: 1fr; }
  .product img { max-height: 50dvh; }
  .pinfo { padding: 20px; }
  .stage { grid-template-columns: 1fr; }
  .side { flex-direction: row; align-items: center; }
  .mini { width: 80px; }
}
