:root {
  --bg: #f6f3ee; --surface: #ffffff; --surface-2: #efebe4; --line: #e3ddd3;
  --text: #17151a; --muted: #6b6560; --accent: #634cff; --accent-soft: #ebe7ff;
  --good: #11804c; --good-soft: #e1f4ea; --bad: #c0362c; --bad-soft: #fbe6e3; --warn-soft: #fff3d6;
  --display: "Instrument Serif", Georgia, serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow: 0 1px 2px rgb(30 20 10 / 0.05), 0 10px 30px -14px rgb(30 20 10 / 0.18);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2 { font-family: var(--display); font-weight: 400; letter-spacing: -0.01em; line-height: 1.05; margin: 0; }
h1 { font-size: clamp(34px, 7vw, 52px); }
h2 { font-size: 28px; }
button, input, select { font: inherit; color: inherit; }
.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 11.5px; font-weight: 700; color: var(--accent); margin: 0 0 6px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* Header */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; justify-content: space-between; min-height: 58px; }
.logo { font: 400 30px var(--display); text-decoration: none; letter-spacing: -0.02em; }
.nav { display: flex; gap: 4px; }
.nav a { text-decoration: none; padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 14.5px; color: var(--muted); }
.nav a[aria-current="true"] { background: var(--text); color: var(--bg); }
main { padding: 22px 0 70px; outline: none; }
.page { animation: rise 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* Buttons and chips */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 999px; padding: 10px 20px; font-weight: 600; font-size: 15px; cursor: pointer; border: 1px solid transparent; text-decoration: none; transition: transform 0.12s, background 0.15s; }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--text); color: var(--bg); }
.btn.ghost { background: var(--surface); border-color: var(--line); }
.btn.big { padding: 14px 26px; font-size: 16.5px; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: 0.4; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 0; align-items: center; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 13px; font-size: 14px; font-weight: 500; cursor: pointer; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip small { color: var(--muted); font-size: 11.5px; }
.chip:disabled { opacity: 0.4; }
.chip.colour i, .dots i { width: 13px; height: 13px; border-radius: 50%; background: var(--c); border: 1px solid rgb(0 0 0 / 0.15); display: inline-block; }
.chip-row select { border: 1px dashed var(--line); background: transparent; border-radius: 999px; padding: 6px 10px; font-size: 13.5px; color: var(--muted); max-width: 150px; }

/* Empty state */
.empty { text-align: center; max-width: 560px; margin: 6vh auto 0; display: grid; gap: 14px; justify-items: center; }
.empty p { margin: 0; font-size: 17px; }
.empty-art { display: flex; gap: 10px; margin-bottom: 8px; }
.empty-art i { width: 70px; height: 92px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.empty-art i:nth-child(2) { transform: translateY(-10px) rotate(3deg); background: var(--accent-soft); }
.empty-art i:nth-child(1) { transform: rotate(-4deg); }

/* Closet */
.page-head { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { flex: 1 1 auto; }
.page-head p { margin: 0 0 6px; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; scrollbar-width: none; }
.filter { white-space: nowrap; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 14px; cursor: pointer; display: inline-flex; gap: 6px; }
.filter b { color: var(--muted); font-weight: 600; }
.filter[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.filter[aria-selected="true"] b { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(160px, 45%), 1fr)); gap: 12px; }
.card { background: var(--surface); border-radius: 18px; overflow: hidden; text-decoration: none; box-shadow: var(--shadow); transition: transform 0.2s; display: block; }
.card:hover { transform: translateY(-3px); }
.thumb { aspect-ratio: 1; background: radial-gradient(circle at 50% 40%, #fff, var(--surface-2)); display: grid; place-items: center; }
.thumb img { width: 88%; height: 88%; object-fit: contain; filter: drop-shadow(0 6px 10px rgb(0 0 0 / 0.12)); }
.card-text { padding: 9px 12px 12px; display: grid; gap: 2px; }
.card-text b { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-text span { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dots { display: inline-flex; gap: 3px; }

/* Adding */
.back { display: inline-block; margin-bottom: 10px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.picker { max-width: 620px; display: grid; gap: 14px; }
.picker p { margin: 0; }
.pick-row { display: flex; gap: 10px; flex-wrap: wrap; }
.tips { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 14.5px; display: grid; gap: 4px; }
.loading-ai { max-width: 520px; display: grid; gap: 10px; }
.loading-ai p { margin: 0; }
.loading-ai progress { width: 100%; height: 10px; accent-color: var(--accent); }
.editor { max-width: 720px; }
.canvas-wrap { position: relative; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); background: #000; line-height: 0; }
.canvas-wrap canvas { width: 100%; height: auto; max-height: 64vh; object-fit: contain; display: block; }
.canvas-wrap .overlay { position: absolute; inset: 0; cursor: crosshair; }
.status { color: var(--muted); margin: 12px 0; min-height: 1.5em; }
.review-grid, .item-page { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 26px; align-items: start; }
@media (max-width: 760px) { .review-grid, .item-page { grid-template-columns: 1fr; } }
.item-img { background: radial-gradient(circle at 50% 40%, #fff, var(--surface-2)); border-radius: 22px; aspect-ratio: 1; display: grid; place-items: center; box-shadow: var(--shadow); position: sticky; top: 76px; }
@media (max-width: 760px) { .item-img { position: static; max-width: 420px; } }
.item-img img { width: 86%; height: 86%; object-fit: contain; filter: drop-shadow(0 10px 18px rgb(0 0 0 / 0.14)); }
.tag-editor { display: grid; gap: 14px; margin-top: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.field input { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.notice { border-radius: 14px; padding: 10px 14px; margin-top: 12px; font-size: 14.5px; }
.notice.warn { background: var(--warn-soft); }
.dupe { display: inline-flex; align-items: center; gap: 6px; margin: 4px 8px 0 0; font-weight: 600; }
.dupe img { width: 34px; height: 34px; object-fit: contain; background: #fff; border-radius: 8px; }
.error { color: var(--bad); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50; background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow); transition: opacity 0.4s, transform 0.4s; }
.toast.good { background: var(--good); }
.toast.error { background: var(--bad); }
.toast.out { opacity: 0; transform: translate(-50%, 10px); }
@media (prefers-reduced-motion: reduce) { .page { animation: none; } .card, .btn, .toast { transition: none; } }

/* Find a look */
.hero-find { max-width: 640px; margin: 4vh auto 0; text-align: center; display: grid; gap: 14px; justify-items: center; }
.hero-find .lede { font-size: 18px; margin: 0; max-width: 34em; }
.drop { width: 100%; border: 2px dashed color-mix(in srgb, var(--text) 22%, transparent); border-radius: 22px; padding: 38px 18px; display: grid; gap: 4px; cursor: pointer; background: var(--surface); box-shadow: var(--shadow); transition: border-color 0.2s, transform 0.2s; }
.drop b { font-size: 18px; }
.drop:hover, .drop.over { border-color: var(--accent); transform: translateY(-2px); }
.row.center { justify-content: center; margin: 0; }
.working { max-width: 460px; margin: 10vh auto; display: grid; gap: 12px; justify-items: center; text-align: center; }
.working progress { width: 100%; accent-color: var(--accent); }
.step { margin: 0; font-weight: 600; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 4px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.recent { margin-top: 44px; }
.recent h2 { margin-bottom: 12px; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; filter: none; }

/* A look */
.look { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: 26px; align-items: start; }
@media (max-width: 820px) { .look { grid-template-columns: 1fr; } }
.look-left { position: sticky; top: 76px; }
@media (max-width: 820px) { .look-left { position: static; } }
.look-frame { position: relative; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); line-height: 0; background: #000; }
.look-photo { width: 100%; height: auto; display: block; max-height: 78vh; object-fit: contain; }
.look-over { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.pieces { display: grid; gap: 12px; }
.piece { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; background: var(--surface); border-radius: 18px; padding: 12px; box-shadow: var(--shadow); border: 2px solid transparent; cursor: pointer; transition: border-color 0.2s; }
.piece.sel { border-color: var(--tint); }
.piece-img { position: relative; aspect-ratio: 1; border-radius: 12px; background: radial-gradient(circle at 50% 40%, #fff, var(--surface-2)); display: grid; place-items: center; }
.piece-img img { width: 90%; height: 90%; object-fit: contain; }
.badge { position: absolute; top: -6px; left: -6px; width: 26px; height: 26px; border-radius: 50%; background: var(--tint); color: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center; border: 2px solid #fff; }
.piece-body { display: grid; gap: 8px; align-content: start; min-width: 0; }
.piece-head { display: flex; gap: 8px; align-items: start; }
.piece-head h3 { margin: 0; font: 600 17px/1.25 var(--body); flex: 1; }
.icon-x { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.chip.small { padding: 3px 10px; font-size: 12.5px; }
.shop { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.shop-link { font-size: 13px; font-weight: 600; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); text-decoration: none; }
.shop-link:hover { background: var(--accent-soft); color: var(--accent); }
.disclosure { margin-top: 20px; }

/* Exact matches */
.btn.small { padding: 7px 14px; font-size: 13.5px; }
.matches { display: grid; gap: 6px; }
.match-row { display: grid; grid-auto-flow: column; grid-auto-columns: 132px; gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.match { display: grid; gap: 2px; text-decoration: none; scroll-snap-align: start; font-size: 13px; }
.match-img { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.match-img img { width: 100%; height: 100%; object-fit: cover; }
.match .exact { position: absolute; left: 6px; top: 6px; background: var(--good); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.match b { font-size: 14px; margin-top: 4px; }
.match-title { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
