/* Cody — "Fitting Room". Tokens first; every text color below was contrast-checked against its surface (see docs/DESIGN.md). */
:root {
  color-scheme: light dark;
  --bg: #F7F4EE; --surface: #FFFFFF; --surface-2: #EFEBE3;
  --ink: #1A1816; --muted: #5F5A52; --subtle: #6B655F;
  --line: #E4DED3; --line-strong: #8C867D;
  --accent: #C2381E; --on-accent: #FFFFFF; --accent-soft: #FBE6DF; --accent-soft-ink: #A82E16;
  --success: #1F6B45; --danger: #B3261E; --warn-bg: #FFF4DC; --warn-ink: #8A5A00;
  --scrim: rgb(26 24 22 / .45);
  --glass: rgb(255 255 255 / .74); --glass-ink: #1A1816; --card-bg: rgb(255 255 255 / .86);
  --shadow-1: 0 1px 2px rgb(26 24 22 / .06), 0 4px 12px rgb(26 24 22 / .06);
  --shadow-2: 0 8px 28px rgb(26 24 22 / .14);
  --shadow-card: 0 6px 16px rgb(26 24 22 / .22);
  --font: 'Pretendard Std Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', system-ui, sans-serif;
  --t-body: 15px; --t-label: 14px; --t-caption: 13px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r-sm: 10px; --r-md: 16px; --r-lg: 24px; --r-xl: 32px; --r-full: 999px;
  --ease-out: cubic-bezier(.2, .7, .2, 1); --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --d-fast: 120ms; --d-base: 200ms;
  --hit: 44px;
  --rail: 76px; --top: 64px;
  --stage-h: min(calc(100dvh - 230px), 820px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14120F; --surface: #1D1A17; --surface-2: #26221E;
    --ink: #F3EFE8; --muted: #B1AAA0; --subtle: #928B81;
    --line: #332E29; --line-strong: #6F685F;
    --accent: #FF8A6B; --on-accent: #14120F; --accent-soft: #3A241D; --accent-soft-ink: #FFB5A0;
    --success: #5FD39A; --danger: #FF8F86; --warn-bg: #2E2412; --warn-ink: #F2C36B;
    --scrim: rgb(0 0 0 / .6);
    --glass: rgb(29 26 23 / .78); --glass-ink: #F3EFE8; --card-bg: rgb(29 26 23 / .88);
    --shadow-1: 0 1px 2px rgb(0 0 0 / .35), 0 4px 12px rgb(0 0 0 / .3);
    --shadow-2: 0 8px 28px rgb(0 0 0 / .5); --shadow-card: 0 6px 16px rgb(0 0 0 / .5);
  }
}
:root[data-theme="dark"] {
  --bg: #14120F; --surface: #1D1A17; --surface-2: #26221E;
  --ink: #F3EFE8; --muted: #B1AAA0; --subtle: #928B81;
  --line: #332E29; --line-strong: #6F685F;
  --accent: #FF8A6B; --on-accent: #14120F; --accent-soft: #3A241D; --accent-soft-ink: #FFB5A0;
  --success: #5FD39A; --danger: #FF8F86; --warn-bg: #2E2412; --warn-ink: #F2C36B;
  --scrim: rgb(0 0 0 / .6);
  --glass: rgb(29 26 23 / .78); --glass-ink: #F3EFE8; --card-bg: rgb(29 26 23 / .88);
  --shadow-1: 0 1px 2px rgb(0 0 0 / .35), 0 4px 12px rgb(0 0 0 / .3);
  --shadow-2: 0 8px 28px rgb(0 0 0 / .5); --shadow-card: 0 6px 16px rgb(0 0 0 / .5);
}

*, *::before, *::after { box-sizing: border-box; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
html { -webkit-text-size-adjust: 100%; }
body { word-break: keep-all; overflow-wrap: break-word; margin: 0; background: radial-gradient(900px 520px at 78% -8%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%), radial-gradient(700px 480px at 4% 12%, color-mix(in srgb, var(--ink) 4%, transparent), transparent 70%), var(--bg); background-attachment: fixed; color: var(--ink); font: 450 var(--t-body)/1.6 var(--font); font-synthesis: none; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; padding: 0; -webkit-tap-highlight-color: transparent; }
button:disabled, button[aria-disabled="true"] { cursor: not-allowed; }
button:disabled { opacity: .5; }
a { color: inherit; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); }
.zone-card:focus-visible { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--accent) !important; }
.icon { width: 20px; height: 20px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -100px; left: 8px; z-index: 50; background: var(--surface); padding: 12px 16px; border-radius: var(--r-sm); }
.skip-link:focus { top: 8px; }
.muted { color: var(--muted); }
h1, h2, h3, .page-head p, .note, .callout, .empty-state p, .modal-copy { text-wrap: balance; }
.eyebrow { font-size: var(--t-caption); font-weight: 650; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; margin-bottom: var(--s2); }
.note { font-size: var(--t-caption); line-height: 1.6; color: var(--muted); }
.tag { display: inline-block; border-radius: var(--r-full); background: var(--surface-2); padding: 2px 10px; font-size: var(--t-caption); color: var(--muted); font-weight: 600; white-space: nowrap; flex-shrink: 0; justify-self: start; }
.plus { margin: 0 .35em; color: var(--accent); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100dvh; }
.rail { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; align-items: center; gap: var(--s6); padding: var(--s5) 0; border-right: 1px solid var(--line); background: var(--bg); }
.rail__brand { display: grid; justify-items: center; gap: 4px; text-decoration: none; font-weight: 750; letter-spacing: -.02em; font-size: var(--t-label); }
.brand-mark { width: 40px; height: 40px; border-radius: 14px; background: var(--ink); color: var(--bg); display: grid; place-items: center; }
.rail__items { display: flex; flex-direction: column; gap: var(--s2); width: 100%; padding: 0 8px; }
.nav-item { min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: var(--r-md); color: var(--muted); font-size: var(--t-caption); font-weight: 600; transition: background var(--d-fast), color var(--d-fast); }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-soft-ink); }
.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; height: var(--top); display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: 0 var(--s6); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.topbar__title { display: flex; align-items: baseline; gap: var(--s3); }
.topbar__title strong { font-size: 18px; letter-spacing: -.01em; }
.topbar__title span { font-size: var(--t-caption); color: var(--muted); }
.topbar__actions { display: flex; align-items: center; gap: var(--s4); }
.status { display: flex; align-items: center; gap: 6px; font-size: var(--t-caption); color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.main { padding: var(--s5) var(--s6) var(--s7); max-width: 1480px; margin: 0 auto; }
.main:focus { outline: none; }

/* ---------- buttons ---------- */
.btn { min-height: var(--hit); display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); padding: 0 var(--s4); border-radius: var(--r-full); font-size: var(--t-label); font-weight: 650; white-space: nowrap; text-decoration: none; transition: background var(--d-fast), transform var(--d-fast), box-shadow var(--d-fast); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.block { width: 100%; min-height: 48px; }
.btn.small { min-height: 44px; padding: 0 var(--s3); }
.btn .icon { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(.94); }
.btn.outline { border: 1.5px solid var(--line-strong); color: var(--ink); background: transparent; }
.btn.outline:hover { background: var(--surface-2); }
.btn.soft { background: var(--accent-soft); color: var(--accent-soft-ink); }
.btn.ghost { color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); }
.btn[aria-disabled="true"] { opacity: .55; }
.tiny-button { min-height: 44px; padding: 0 var(--s2); font-size: var(--t-caption); font-weight: 600; color: var(--muted); }
.tiny-button.danger { color: var(--danger); }
.text-button { display: inline-flex; gap: 6px; align-items: center; font-size: var(--t-label); color: var(--muted); }
.button-row { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }

/* ---------- chips, tabs, forms ---------- */
.tabs { display: inline-flex; gap: var(--s1); padding: 4px; background: var(--surface-2); border-radius: var(--r-full); flex-wrap: wrap; }
.tabs button { min-height: 44px; padding: 0 var(--s4); border-radius: var(--r-full); font-size: var(--t-label); font-weight: 600; color: var(--muted); }
.tabs button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.chip-group { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span { min-height: var(--hit); display: inline-flex; align-items: center; padding: 0 var(--s4); border-radius: var(--r-full); border: 1.5px solid var(--line-strong); font-size: var(--t-label); font-weight: 600; color: var(--muted); }
.chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-soft-ink); }
.chip input:checked + span::before { content: '✓'; margin-right: 6px; }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); }
.form-field { display: flex; flex-direction: column; gap: var(--s2); font-size: var(--t-label); font-weight: 600; margin: var(--s4) 0; border: 0; padding: 0; min-width: 0; }
.form-field legend { padding: 0; margin-bottom: var(--s2); }
.form-field input[type="text"], .form-field input:not([type]), .form-field select, .search-input, .filters select { min-height: var(--hit); padding: 0 var(--s3); border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font-size: var(--t-body); font-weight: 450; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.form-grid .form-field { margin: var(--s4) 0 0; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-error { color: var(--danger); font-size: var(--t-caption); line-height: 1.6; min-height: 20px; margin-top: var(--s2); }
.consent-row { min-height: 44px; display: flex; gap: var(--s3); align-items: flex-start; font-size: var(--t-label); line-height: 1.6; color: var(--ink); padding: var(--s2) 0; }
.consent-row input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.upload-zone { overflow: hidden; min-width: 0; overflow-wrap: anywhere; display: grid; place-items: center; gap: var(--s2); text-align: center; padding: var(--s5); border: 2px dashed var(--line-strong); border-radius: var(--r-md); background: var(--surface-2); color: var(--muted); font-size: var(--t-label); font-weight: 600; margin: var(--s4) 0; }
.upload-zone .icon { width: 28px; height: 28px; }
.upload-zone { position: relative; cursor: pointer; }
.upload-zone strong { color: var(--ink); font-size: var(--t-body); }
.upload-zone__btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; margin-top: var(--s2); padding: 0 var(--s5); border: 1.5px solid var(--line-strong); border-radius: var(--r-full); background: var(--surface); color: var(--ink); font-weight: 600; }
.upload-zone:hover:not(:has(input:disabled)) { border-color: var(--accent); }
.upload-zone:hover:not(:has(input:disabled)) .upload-zone__btn { border-color: var(--accent); }
.upload-zone:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.upload-zone:has(input:disabled) .upload-zone__btn::after { content: ' · 동의 후 가능'; font-weight: 400; color: var(--muted); }
.upload-zone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
/* the native input stays in the DOM (keyboard, screen readers, drop/paste) but its own "파일 선택 / 선택된 파일 없음" row is not shown */
.upload-zone input { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; opacity: 0; }
.callout { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--surface-2); font-size: var(--t-label); line-height: 1.5; margin-top: var(--s4); flex-wrap: wrap; }
.callout.warn { background: var(--warn-bg); color: var(--warn-ink); margin: 0 0 var(--s3); }
.callout .btn { margin-left: auto; }

/* ---------- page heads, banners, panels ---------- */
.banner { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s4); min-height: 44px; border-radius: var(--r-full); background: var(--surface-2); font-size: var(--t-label); color: var(--muted); margin-bottom: var(--s4); }
.banner .icon { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }
.banner > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.banner button { flex-shrink: 0; margin-left: auto; display: inline-flex; gap: 6px; align-items: center; min-height: 44px; font-weight: 650; color: var(--accent-soft-ink); white-space: nowrap; }
.page-head { margin-bottom: var(--s4); }
.page-head h1 { font-size: clamp(32px, 4.2vw, 44px); line-height: 1.15; letter-spacing: -.02em; font-weight: 750; }
.page-head h1 .count { color: var(--accent); }
.page-head p:last-child { color: var(--muted); margin-top: var(--s3); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); flex-wrap: wrap; }
.section-head h2, .card-panel__head h2, .home__panel h2 { font-size: 22px; line-height: 1.3; letter-spacing: -.01em; font-weight: 700; }
.card-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5); box-shadow: var(--shadow-1); }
.card-panel__head { display: flex; justify-content: space-between; gap: var(--s3); align-items: flex-start; margin-bottom: var(--s4); }
.card-panel__head p { color: var(--muted); font-size: var(--t-label); margin-top: var(--s1); }
.empty-state { border: 2px dashed var(--line-strong); border-radius: var(--r-lg); padding: var(--s6) var(--s5); text-align: center; background: var(--surface); }
.empty-state > .icon { width: 32px; height: 32px; color: var(--accent); margin-bottom: var(--s3); }
.empty-state h3 { font-size: 17px; }
.empty-state p { color: var(--muted); font-size: var(--t-label); margin: var(--s2) auto var(--s4); max-width: 380px; }

/* ---------- home: stage | summary, looks underneath ---------- */
.home { display: grid; grid-template-columns: minmax(200px, 250px) minmax(0, 1fr) minmax(280px, 340px); gap: var(--s5); align-items: start; }
.home > * { min-width: 0; }
.home__side { grid-column: 1; grid-row: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); align-content: start; }
.home__stage { grid-column: 2; grid-row: 1; }
.home__panel { grid-column: 3; grid-row: 1; }
.look-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.stage__hint[hidden] { display: none; }
.home__stage { display: flex; justify-content: center; min-width: 0; }
.home__panel { position: sticky; top: calc(var(--top) + var(--s4)); display: grid; gap: var(--s3); }
.home__panel h2 { font-size: 24px; }
.dock-bar { display: grid; gap: var(--s3); }
.slots { display: grid; gap: var(--s2); }
.slot { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; min-height: 64px; padding: var(--s2); border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-align: left; transition: border-color var(--d-fast), background var(--d-fast); }
.slot:hover { border-color: var(--line-strong); }
.slot.is-open { border-color: var(--accent); background: var(--accent-soft); }
.slot__tile { width: 56px; height: 56px; aspect-ratio: auto; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface-2); }
.slot__tile .icon { width: 22px; height: 22px; color: var(--subtle); }
.slot__text { display: grid; gap: 1px; min-width: 0; }
.slot__text em { font-style: normal; font-size: 12px; font-weight: 750; letter-spacing: .06em; color: var(--accent); }
.slot__text strong { font-size: var(--t-label); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot.is-empty .slot__text strong { color: var(--muted); font-weight: 600; }
.slot__go { padding-right: var(--s2); font-size: var(--t-caption); font-weight: 650; color: var(--muted); }
.slot.is-open .slot__go { color: var(--accent); }
.actions { display: grid; grid-template-columns: 1fr; gap: var(--s2); margin-top: var(--s2); }
.actions.has-aside { grid-template-columns: 1fr 44px; }
.icon-btn.outlined { border: 1.5px solid var(--line-strong); color: var(--ink); }
.tools { display: flex; flex-wrap: wrap; gap: var(--s1); }
.tools .btn { flex: 1 1 auto; }
.reason { display: flex; gap: var(--s2); align-items: flex-start; font-size: var(--t-caption); line-height: 1.6; color: var(--warn-ink); background: var(--warn-bg); padding: var(--s3); border-radius: var(--r-sm); }
.reason .icon { width: 16px; height: 16px; margin-top: 2px; }
.reason.quiet { background: none; color: var(--muted); padding: 0; }
.filters { display: flex; gap: var(--s2); }
.filters select { padding-right: var(--s2); font-size: var(--t-label); font-weight: 600; }
.look-list { display: grid; gap: var(--s3); }
.look-card { display: grid; grid-template-columns: 148px 1fr; align-items: stretch; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-md); overflow: hidden; text-align: left; transition: border-color var(--d-fast), box-shadow var(--d-fast), transform var(--d-fast); }
.look-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); transform: translateY(-1px); }
.look-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.look-card__art { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 6px; background: var(--surface-2); }
.tile { display: block; aspect-ratio: 3 / 4; border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.tile img, .tile .garment-art { width: 100%; height: 100%; object-fit: contain; display: block; }
.look-card__copy { padding: var(--s3); display: grid; align-content: center; gap: 2px; min-width: 0; }
.look-card__no { font-style: normal; font-size: 11px; font-weight: 750; letter-spacing: .08em; color: var(--accent); }
.look-card__copy strong { font-size: var(--t-label); }
.look-card__names, .look-card__why { font-size: var(--t-caption); color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.look-card__why { color: var(--subtle); }

/* ---------- stage ---------- */
.stage { width: 100%; display: grid; justify-items: center; gap: var(--s2); }
.stage__frame { --s: 1; position: relative; width: min(100%, calc(var(--stage-h) * 2 / 3)); aspect-ratio: 2 / 3; background: radial-gradient(120% 70% at 50% 18%, var(--surface) 0%, var(--surface-2) 62%, color-mix(in srgb, var(--surface-2) 86%, var(--ink)) 100%); box-shadow: var(--shadow-2), inset 0 0 0 1px var(--line); border-radius: var(--r-xl); overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: pan-y; --z-ut: .22; --z-ub: .48; --z-lt: .52; --z-lb: .85; }
.stage__frame[data-zoomed="true"] { cursor: grab; }
.stage__frame[data-zoomed="true"]:active { cursor: grabbing; }
.stage__world { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.stage__layer { position: absolute; inset: 0; display: grid; place-items: center; }
.stage__photo { width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.mannequin-art { width: 100%; height: 92%; pointer-events: none; }
.stage__shade { position: absolute; inset: 0; background: var(--ink); opacity: 0; pointer-events: none; transition: opacity var(--d-base); }
.stage__frame[data-busy="true"] .stage__shade { opacity: .18; }
.stage__frame[data-busy="true"] .stage__layer { filter: saturate(.7); }

.stage__frame { isolation: isolate; }
.stage__zone { position: absolute; left: 0; right: 0; z-index: 2; transition: opacity var(--d-fast) linear; }
.stage__zone--upper { top: calc(var(--z-ut) * 100%); height: calc((var(--z-ub) - var(--z-ut)) * 100%); }
.stage__zone--lower { top: calc(var(--z-lt) * 100%); height: calc((var(--z-lb) - var(--z-lt)) * 100%); }
.stage__frame[data-zoomed="true"] .stage__zone, .stage__frame[data-hide-cards="true"] .stage__zone, .stage__frame[data-adjusting="true"] .stage__zone { opacity: 0; pointer-events: none; }
.zone__count { position: absolute; left: var(--s3); top: -22px; font-size: var(--t-caption); font-weight: 700; color: var(--glass-ink); background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 1px 10px; border-radius: var(--r-full); z-index: 3; }
.zone__count:empty { display: none; }
.zone__clip { position: absolute; inset: 0; overflow: hidden; }
.zone__track { --drag: 0px; height: 100%; display: flex; gap: var(--gap, 8px); padding-left: calc((var(--frame-w, 360px) - var(--card-w, 160px)) / 2); transform: translateX(calc(var(--index, 0) * -1 * (var(--card-w, 160px) + var(--gap, 8px)) + var(--drag))); transition: transform var(--d-base) var(--ease-out); }
.stage__zone { --index: 0; }
.zone__track.is-dragging, .is-instant .zone__track, .is-instant .zone-card { transition: none; }
.zone-card { flex: 0 0 var(--card-w, 160px); height: 100%; display: flex; flex-direction: column; border-radius: var(--r-md); background: var(--card-bg); box-shadow: var(--shadow-card); transform: scale(.8); opacity: .78; transition: transform var(--d-base) var(--ease-spring), opacity var(--d-base); overflow: hidden; padding: 6px 6px 0; }
.zone-card[aria-checked="true"] { transform: scale(1); opacity: 1; outline: 2px solid var(--accent); outline-offset: -2px; }
.zone-card__art { position: relative; flex: 1; min-height: 0; overflow: hidden; border-radius: var(--r-sm); background: var(--surface); }
.zone-card__art .garment-art, .zone-card__art .photo-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.zone-card__name { flex: 0 0 28px; line-height: 28px; padding: 0 4px; font-size: var(--t-caption); font-weight: 650; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.zone-empty { margin: 0 auto; align-self: center; min-height: var(--hit); display: inline-flex; align-items: center; gap: var(--s2); padding: 0 var(--s4); border-radius: var(--r-full); border: 2px dashed var(--line-strong); background: var(--glass); color: var(--glass-ink); font-size: var(--t-label); font-weight: 650; }
.zone__clip:has(.zone-empty) .zone__track { padding-left: 0; justify-content: center; transform: none; }
.stage__arrow, .hud-btn { min-width: var(--hit); min-height: var(--hit); border-radius: var(--r-full); display: inline-grid; place-items: center; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); color: var(--glass-ink); box-shadow: var(--shadow-1); }
.hud-btn:disabled, .stage__arrow:disabled { opacity: .35; }
.stage__arrow { position: absolute; top: 50%; translate: 0 -50%; z-index: 4; }
.stage__arrow::after { content: ''; position: absolute; inset: -6px; }
.stage__arrow--prev { left: var(--s2); }
.stage__arrow--next { right: var(--s2); }
.stage__arrow:disabled { display: none; }
.stage__pill { position: absolute; left: var(--s3); top: var(--s3); z-index: 5; padding: 6px 12px; border-radius: var(--r-full); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); color: var(--glass-ink); font-size: var(--t-caption); font-weight: 700; box-shadow: var(--shadow-1); max-width: calc(100% - 80px); }
.stage[data-kind="ai"] .stage__pill { background: var(--accent); color: var(--on-accent); }
.stage__tools { position: absolute; right: var(--s3); top: var(--s3); z-index: 5; display: flex; flex-direction: column; gap: var(--s2); }
.stage__tools [hidden] { display: none; }
.hud-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.stage__hud { position: absolute; left: 50%; bottom: var(--s3); translate: -50% 0; z-index: 5; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: var(--r-full); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow-2); }
.stage__hud .hud-btn { background: none; box-shadow: none; backdrop-filter: none; }
.hud-zoom { min-width: 48px; text-align: center; font-size: var(--t-label); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--glass-ink); }
.stage__dock { position: absolute; left: var(--s3); right: var(--s3); bottom: 72px; z-index: 5; display: grid; gap: var(--s2); }
.dock-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: 4px; border-radius: var(--r-full); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow-1); }
.dock-row .hud-btn { background: none; box-shadow: none; backdrop-filter: none; }
.dock-label { flex: 1; text-align: center; font-size: var(--t-label); font-weight: 650; color: var(--glass-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage__stale { position: absolute; left: var(--s3); bottom: var(--s3); z-index: 5; width: 64px; display: grid; gap: 2px; padding: 4px; border-radius: var(--r-sm); background: var(--warn-bg); color: var(--warn-ink); border: 2px solid var(--warn-ink); font-size: 12px; font-weight: 700; text-align: center; }
.stage__stale[hidden], .stage__busy[hidden], .stage__error[hidden], .stage__handles[hidden] { display: none; }
.stage__stale img { width: 100%; aspect-ratio: 2 / 3; object-fit: contain; border-radius: 6px; background: var(--surface); }
.stage__busy { position: absolute; left: var(--s3); right: var(--s3); bottom: 72px; z-index: 6; display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow-2); color: var(--glass-ink); }
.stage__busy strong { font-size: var(--t-label); }
.stage__busy p { font-size: var(--t-caption); color: var(--muted); font-variant-numeric: tabular-nums; }
.stage__busy > div { flex: 1; min-width: 0; }
.stage__spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--accent); animation: spin 1s linear infinite; flex-shrink: 0; }
.stage__error { position: absolute; left: var(--s3); right: var(--s3); top: 56px; z-index: 6; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--surface); color: var(--danger); border: 1.5px solid var(--danger); font-size: var(--t-label); font-weight: 600; box-shadow: var(--shadow-2); }
.stage__error span { flex: 1 1 100%; }
.stage__note { font-size: var(--t-caption); line-height: 1.6; color: var(--muted); text-align: center; width: min(100%, calc(var(--stage-h) * 2 / 3)); }
.stage__hint { font-size: var(--t-caption); color: var(--subtle); text-align: center; width: min(100%, calc(var(--stage-h) * 2 / 3)); }
.stage__handles { position: absolute; inset: 0; z-index: 6; }
.handle { position: absolute; left: 0; right: 0; height: 0; border-top: 2px dashed var(--accent); cursor: ns-resize; touch-action: none; }
.handle::before { content: ''; position: absolute; left: 0; right: 0; top: -22px; height: 44px; }
.handle span { position: absolute; right: var(--s3); top: -14px; padding: 2px 10px; border-radius: var(--r-full); background: var(--accent); color: var(--on-accent); font-size: var(--t-caption); font-weight: 700; }
.stage__frame[data-adjusting="true"] .stage__hud { visibility: hidden; } /* the adjust buttons take the HUD's place */
.handle-actions { position: absolute; left: 50%; bottom: var(--s3); translate: -50% 0; display: flex; gap: var(--s2); background: var(--glass); padding: 4px; border-radius: var(--r-full); }
.stage-full { border: 0; padding: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: var(--bg); color: var(--ink); }
.stage-full__bar { position: absolute; top: 0; left: 0; right: 0; z-index: 5; display: flex; justify-content: space-between; padding: var(--s3); }
.stage-full__bar .stage__pill { position: static; }
.stage-full__frame { position: absolute; inset: 0; overflow: hidden; cursor: grab; touch-action: none; outline: none; user-select: none; }
.stage-full__frame:active { cursor: grabbing; }
.stage-full__frame[data-zoomed="false"] { cursor: zoom-in; }
.stage-full__world { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
/* the box is exactly the viewport and the picture is contained inside it, so the whole body (shoes included) is visible at 1× */
.stage-full__img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.stage-full__hint { position: fixed; left: 50%; bottom: calc(var(--s3) + 64px); transform: translateX(-50%); margin: 0; padding: var(--s1) var(--s3); border-radius: var(--r-full); background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--muted); font-size: var(--t-caption); white-space: nowrap; pointer-events: none; }
@media (hover: none) { .stage-full__hint { display: none; } }
.stage-full__hud { z-index: 6; position: fixed; }

/* ---------- wardrobe ---------- */
.wardrobe-tools { display: flex; gap: var(--s3); align-items: center; margin: var(--s4) 0 var(--s5); flex-wrap: wrap; }
.wardrobe-tools .search-input { margin-left: auto; }
.search-input { width: min(100%, 280px); }
.wardrobe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--s4); }
.wardrobe-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-1); transition: transform var(--d-base) var(--ease-out), box-shadow var(--d-base); }
.wardrobe-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.wardrobe-card .visual { aspect-ratio: 3 / 4; background: var(--surface-2); display: grid; place-items: center; padding: 0; overflow: hidden; }
.wardrobe-card .garment-art { width: 78%; height: 78%; }
.wardrobe-card .photo-thumb { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.wardrobe-card .visual { position: relative; }
.badge { position: absolute; left: 10px; top: 10px; padding: 2px 10px; border-radius: var(--r-full); background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--glass-ink); font-size: var(--t-caption); font-weight: 650; box-shadow: var(--shadow-1); }
.wardrobe-card .details { padding: var(--s3) var(--s4) var(--s3); display: grid; gap: 2px; }
.wardrobe-card .cat { font-size: var(--t-caption); font-weight: 650; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wardrobe-card .meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s1) var(--s2); margin-top: var(--s1); }
.swatch-label { display: inline-flex; align-items: center; white-space: nowrap; }
.wardrobe-card h3 { font-size: 15px; font-weight: 650; line-height: 1.35; overflow-wrap: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: calc(1.35em * 2); }
.wardrobe-card p { font-size: var(--t-caption); color: var(--muted); }
.card-actions { display: flex; align-items: center; gap: var(--s1); margin-top: var(--s2); }
.card-actions .btn { flex: 1; }
.icon-btn { min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; border-radius: var(--r-full); color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.danger:hover { color: var(--danger); }
.icon-btn .icon { width: 18px; height: 18px; }
.color-dot { display: inline-block; border-radius: 50%; width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .18); }

/* ---------- lookbook ---------- */
.saved-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s4); }
.saved-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.saved-card__art { height: 200px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; padding: var(--s3); }
.saved-card__art .garment-art, .saved-card__art .photo-thumb { height: 100%; width: 50%; object-fit: contain; }
.saved-card__copy { padding: var(--s4); display: grid; gap: var(--s2); }
.saved-card__copy strong { font-size: 16px; overflow-wrap: anywhere; }
.saved-card__copy p { font-size: var(--t-label); color: var(--muted); }
.outfit-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-top: var(--s2); }
.outfit-actions .btn { flex: 1 1 auto; }
.outfit-actions .icon-btn { flex: 0 0 44px; }

/* ---------- profile ---------- */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: var(--s4); align-items: start; }
.profile-placeholder { background: var(--surface-2); border-radius: var(--r-md); min-height: 260px; display: grid; place-items: center; }
.profile-placeholder .icon { width: 56px; height: 56px; color: var(--subtle); }
.profile-placeholder img { width: 100%; height: 320px; object-fit: contain; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); font-weight: 650; }
.dev-info { margin-top: var(--s4); font-size: var(--t-label); color: var(--muted); }
.dev-info summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.portrait-comparison { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin-top: var(--s3); }
.portrait-comparison figure { margin: 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); }
.portrait-comparison figcaption { font-size: var(--t-caption); padding: var(--s2) var(--s3); background: var(--surface); }
.portrait-comparison img { display: block; width: 100%; height: 300px; object-fit: contain; }
.transparent-result { background-color: var(--surface) !important; background-image: linear-gradient(45deg, var(--surface-2) 25%, transparent 25%), linear-gradient(-45deg, var(--surface-2) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--surface-2) 75%), linear-gradient(-45deg, transparent 75%, var(--surface-2) 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
.portrait-wait { height: 300px; display: grid; place-items: center; font-size: var(--t-label); color: var(--muted); }
.portrait-actions, .rotation-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s3) 0; }
.portrait-actions a, .rotation-actions a { text-decoration: none; }
.rotation-stage { width: min(100%, 280px); aspect-ratio: 1 / 2; overflow: hidden; margin: var(--s4) auto; position: relative; border-radius: var(--r-md); touch-action: pan-y; cursor: grab; background: var(--surface-2); }
.rotation-stage:active { cursor: grabbing; }
.rotation-strip { display: block; width: 400%; height: 100%; max-width: none; pointer-events: none; user-select: none; object-fit: fill; }
.rotation-original { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.rotation-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2); }
.rotation-controls .btn { font-size: var(--t-caption); }
.rotation-range { display: block; font-size: var(--t-label); color: var(--muted); margin: var(--s4) auto; max-width: 420px; text-align: center; }
.rotation-range input { display: block; width: 100%; margin-top: var(--s3); accent-color: var(--accent); }

/* ---------- garment images: every garment box is 3:4, whatever the source size ---------- */
.garment-preview { margin: 0 auto; width: min(220px, 60%); text-align: center; }
.garment-preview img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: contain; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.garment-preview figcaption { font-size: var(--t-caption); color: var(--muted); margin-top: var(--s2); line-height: 1.5; }

.segmented { display: inline-flex; gap: var(--s1); padding: 4px; margin-top: var(--s2); background: var(--surface-2); border-radius: var(--r-full); }
.segmented button { min-height: 40px; padding: 0 var(--s3); border-radius: var(--r-full); font-size: var(--t-label); font-weight: 600; color: var(--muted); white-space: nowrap; }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* ---------- dialog, toast ---------- */
dialog { border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5); width: min(560px, calc(100% - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); max-height: 90dvh; }
dialog::backdrop { background: var(--scrim); backdrop-filter: blur(4px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.modal-head h2 { font-size: 22px; letter-spacing: -.01em; }
.modal-close { min-width: var(--hit); min-height: var(--hit); display: grid; place-items: center; color: var(--muted); border-radius: var(--r-full); }
.modal-close:hover { background: var(--surface-2); }
.modal-copy { font-size: var(--t-label); line-height: 1.7; color: var(--muted); margin-bottom: var(--s4); }
.modal-footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s5); }
.modal-photo { max-height: 160px; width: 100%; object-fit: contain; border-radius: var(--r-sm); background: var(--surface-2); display: block; }
.modal-photo.tall { max-height: 56dvh; }
.tryon-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: var(--s2); margin: var(--s3) 0 var(--s4); }
.tryon-inputs figure { margin: 0; background: var(--surface-2); border-radius: var(--r-sm); padding: var(--s2); }
.tryon-inputs img { width: 100%; height: 130px; object-fit: contain; }
.tryon-inputs figcaption { text-align: center; font-size: var(--t-caption); padding-top: var(--s1); overflow-wrap: anywhere; }
#toast { position: fixed; bottom: calc(var(--s5) + env(safe-area-inset-bottom)); left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: var(--r-full); font-size: var(--t-label); font-weight: 600; z-index: 100; box-shadow: var(--shadow-2); transition: var(--d-base); max-width: calc(100% - 32px); text-align: center; }
#toast.visible { opacity: 1; transform: translate(-50%, 0); }

@keyframes spin { to { transform: rotate(360deg); } }
.garment-art { filter: drop-shadow(0 6px 5px rgb(58 52 40 / .12)); }
.garment-art .seam { fill: none; stroke: #555246; stroke-opacity: .23; stroke-width: 1.5; }
.garment-art .texture { fill: none; stroke: #7b7464; stroke-opacity: .1; stroke-width: 1; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .home { grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); }
  .home__stage { grid-column: 1; }
  .home__panel { grid-column: 2; }
  .home__side { grid-column: 1 / -1; grid-row: 2; }
  .recent-list { grid-auto-flow: column; grid-auto-columns: minmax(210px, 1fr); overflow-x: auto; padding-bottom: var(--s2); }
  .look-list { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}
@media (max-width: 1000px) and (min-width: 761px) {
  .home { grid-template-columns: 1fr; }
  .home__stage, .home__panel, .home__side { grid-column: auto; grid-row: auto; }
  .home__side { order: 3; }
  .home__panel { position: static; width: min(100%, 560px); margin: 0 auto; order: 2; }
  .home__stage { order: 1; }
  :root { --stage-h: min(calc(100dvh - 230px), 760px); }
}
@media (max-width: 760px) {
  .search-input { width: 100%; }
  .card-actions { flex-wrap: wrap; }
  .card-actions .btn { flex: 1 1 100%; }
  .card-actions .icon-btn { flex: 1 1 0; }
  .shell { display: block; }
  .rail { position: fixed; z-index: 20; inset: auto 0 0 0; height: calc(60px + env(safe-area-inset-bottom)); padding: 0 var(--s2) env(safe-area-inset-bottom); flex-direction: row; justify-content: center; gap: 0; border-right: 0; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
  .rail__brand { display: none; }
  .rail__items { flex-direction: row; justify-content: space-around; padding: 0; }
  .nav-item { flex: 1; min-height: 56px; }
  .topbar { height: 56px; padding: 0 var(--s4); }
  .topbar__title span { display: none; }
  .topbar__actions { gap: var(--s3); min-width: 0; }
  .status { min-width: 0; }
  .status span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .main { padding: var(--s3) var(--s4) calc(80px + env(safe-area-inset-bottom)); }
  .main:has(.home) { padding-bottom: calc(250px + env(safe-area-inset-bottom)); }
  .home { grid-template-columns: 1fr; gap: var(--s4); }
  .home__stage, .home__panel, .home__side { grid-column: auto; grid-row: auto; }
  .home__panel { position: static; order: 2; }
  .home__side { order: 3; }
  :root { --stage-h: max(340px, calc(100dvh - 416px)); }
  /* The two main actions stay reachable above the tab bar without scrolling. */
  /* Slot chips and the one main action stay reachable above the tab bar without scrolling. */
  .home__panel .dock-bar { position: fixed; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom)); z-index: 15; gap: var(--s2); padding: 8px var(--s4) 10px; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .home__panel .actions { margin: 0; }
  .slots { grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--s2); }
  .slot { grid-template-columns: 1fr; justify-items: center; min-height: 0; gap: 2px; padding: 4px 2px; text-align: center; }
  .slot__tile { width: 44px; height: 44px; }
  .slot__text strong, .slot__go { display: none; }
  .slot__text em { letter-spacing: 0; }
  .stage__hint { display: none; }
  .look-list { grid-template-columns: 1fr; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .portrait-comparison img, .portrait-wait { height: 220px; }
  .wardrobe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
  .saved-grid { grid-template-columns: 1fr; }
  .banner { font-size: var(--t-caption); }
  dialog { padding: var(--s4); }
  .tryon-inputs img { height: 96px; }
  #toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; scroll-behavior: auto !important; }
}

/* ---------- layer (겉옷) slot: shares the torso zone with the base top ---------- */
.stage__zone--outer { top: calc(var(--z-ut) * 100%); height: calc((var(--z-ub) - var(--z-ut)) * 100%); }
.stage__zone--dress { top: calc(var(--z-ut) * 100%); height: calc((var(--z-lb) - var(--z-ut)) * 100%); }
.stage__zone--shoes { top: calc(var(--z-lt) * 100%); height: calc((var(--z-lb) - var(--z-lt)) * 100%); }
.stage__zone[hidden] { display: none; }
.zone-card--none .zone-card__art { display: grid; place-items: center; align-content: center; gap: var(--s1); color: var(--muted); background: var(--surface-2); border: 2px dashed var(--line-strong); font-size: var(--t-caption); font-weight: 650; }
.zone-card--none .zone-card__art .icon { width: 28px; height: 28px; }
.zone__count:empty { display: none; }
.look-card__art.has-outer { grid-template-columns: 1fr 1fr 1fr; }
.look-card:has(.has-outer) { grid-template-columns: 188px 1fr; }
.look-card__copy strong small { font-size: var(--t-caption); font-weight: 600; color: var(--muted); }
.saved-card__art.tiles-3 .photo-thumb, .saved-card__art.tiles-3 .garment-art { width: 33%; }
.saved-card__art.tiles-4 .photo-thumb, .saved-card__art.tiles-4 .garment-art { width: 25%; }

/* ---------- portrait retouch options ---------- */
.retouch { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s3) var(--s4); margin: var(--s3) 0; display: grid; gap: var(--s1); }
.retouch legend { padding: 0 var(--s2); font-size: var(--t-caption); font-weight: 700; color: var(--muted); }
.retouch__row { display: flex; gap: var(--s3); align-items: flex-start; min-height: 44px; padding: var(--s1) 0; cursor: pointer; }
.retouch__row input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.retouch__row span { display: grid; gap: 1px; }
.retouch__row strong { font-size: var(--t-label); }
.retouch__row small { font-size: var(--t-caption); color: var(--muted); }
.retouch[disabled] { opacity: .6; }

/* ---------- starter closet ---------- */
dialog.wide { width: min(880px, calc(100% - 32px)); }
.button-row.center { justify-content: center; }
.starter-filters { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }
.starter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: var(--s3); max-height: 52dvh; overflow: auto; padding: 2px; margin: 0 -2px; }
.starter-tile { position: relative; display: grid; gap: 2px; padding: var(--s2); border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-align: left; transition: border-color var(--d-fast), background var(--d-fast); }
.starter-tile:hover:not(:disabled) { border-color: var(--line-strong); }
.starter-tile.is-picked { border-color: var(--accent); background: var(--accent-soft); }
.starter-tile:disabled { opacity: .55; }
.starter-tile .tile { border-radius: var(--r-sm); background: var(--surface-2); }
.starter-tile .garment-art { width: 100%; height: 100%; padding: 8%; }
.starter-tile__name { font-size: var(--t-label); font-weight: 650; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: var(--s1); }
.starter-tile__meta { font-size: var(--t-caption); color: var(--muted); }
.starter-tile__check { position: absolute; right: 10px; top: 10px; min-width: 26px; height: 26px; padding: 0 7px; display: grid; place-items: center; border-radius: var(--r-full); font-size: var(--t-caption); font-weight: 700; background: var(--glass); color: var(--glass-ink); }
.starter-tile.is-picked .starter-tile__check { background: var(--accent); color: var(--on-accent); }
.starter-tile__check:empty { display: none; }
.starter-tile__check .icon { width: 16px; height: 16px; }
.starter-footer { justify-content: space-between; position: sticky; bottom: 0; background: var(--surface); padding-top: var(--s3); margin-top: var(--s3); }
@media (max-width: 760px) { .starter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 46dvh; } .starter-footer .btn { flex: 1; } }

/* Drawn garments are designed for a light backdrop: keep it light in dark mode so black pieces stay visible. */
.tile:has(.garment-art), .visual:has(.garment-art), .zone-card__art:has(.garment-art), .starter-tile .tile { background: #ece8e0; }

/* ---------- try-on result style ---------- */
.style-choice { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s2) var(--s4); margin: var(--s3) 0; display: grid; gap: var(--s1); }
.style-choice legend { padding: 0 var(--s2); font-size: var(--t-caption); font-weight: 700; color: var(--muted); }
.style-choice__row { display: flex; gap: var(--s3); align-items: flex-start; min-height: 44px; padding: var(--s1) 0; cursor: pointer; }
.style-choice__row input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.style-choice__row span { display: grid; gap: 1px; }
.style-choice__row strong { font-size: var(--t-label); }
.style-choice__row small { font-size: var(--t-caption); color: var(--muted); line-height: 1.5; }

/* ---------- affiliate cards (off until the programme terms are confirmed) ---------- */
.shop { display: grid; gap: var(--s2); padding-top: var(--s4); border-top: 1px solid var(--line); }
.shop__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.shop__head h2 { font-size: 18px; }
.shop__preview { font-size: var(--t-caption); font-weight: 650; color: var(--warn-ink); background: var(--warn-bg); padding: 2px 10px; border-radius: var(--r-full); }
.shop__disclosure { display: flex; gap: var(--s2); align-items: flex-start; margin: 0; font-size: var(--t-caption); line-height: 1.55; font-weight: 600; color: var(--ink); }
.shop__disclosure .icon { width: 16px; height: 16px; margin-top: 2px; flex: none; }
.shop__list { display: grid; gap: var(--s2); margin: 0; padding: 0; list-style: none; }
.shop-card { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: var(--s3); align-items: center; padding: var(--s2); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.shop-card__art { width: 56px; height: 56px; border-radius: var(--r-sm); background: var(--surface-2); }
.shop-card__art .garment-art { width: 100%; height: 100%; padding: 8%; }
.shop-card__body { display: grid; gap: 1px; min-width: 0; }
.shop-card__body strong { font-size: var(--t-label); font-weight: 700; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.shop-card__body small { font-size: var(--t-caption); color: var(--muted); }
.shop-card__ad { justify-self: start; font-style: normal; font-size: 11px; font-weight: 750; letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line-strong); border-radius: var(--r-full); padding: 0 7px; }
.shop-card__go { grid-column: 1 / -1; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 44px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); font-size: var(--t-label); font-weight: 700; text-decoration: none; }
.shop-card__go .icon { width: 16px; height: 16px; }
.shop-card__go.is-preview { background: var(--surface-2); color: var(--muted); font-weight: 600; }
.shop__notice { margin: 0; font-size: var(--t-caption); line-height: 1.55; color: var(--muted); }

/* ---------- profile: one calm column ---------- */
.profile-stack { display: grid; gap: var(--s4); width: min(100%, 680px); margin: 0 auto; }
.photo-card__row { display: grid; grid-template-columns: minmax(120px, 190px) minmax(0, 1fr); gap: var(--s4); align-items: center; }
.photo-card__side { display: grid; gap: var(--s3); align-content: center; }
.photo-card__side .button-row { margin: 0; }
.photo-card .profile-placeholder { min-height: 180px; }
.photo-card .profile-placeholder img { height: 260px; }
.card-panel__head h2 small { font-size: var(--t-label); font-weight: 600; color: var(--muted); }
.more { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.more > summary { cursor: pointer; list-style: none; min-height: var(--hit); padding: var(--s3) var(--s4); display: flex; align-items: center; justify-content: space-between; gap: var(--s3); font-weight: 700; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::after { content: '▾'; color: var(--muted); }
.more[open] > summary::after { content: '▴'; }
.more > summary small { margin-right: auto; font-size: var(--t-caption); font-weight: 500; color: var(--muted); }
.more__body { display: grid; gap: var(--s4); padding: 0 var(--s3) var(--s3); }
@media (max-width: 760px) { .photo-card__row { grid-template-columns: 1fr; } .photo-card .profile-placeholder img { height: min(40dvh, 300px); } }

/* ---------- quick registration: details fold ---------- */
.form-more { margin-top: var(--s4); border-top: 1px solid var(--line); padding-top: var(--s2); }
.form-more > summary { cursor: pointer; list-style: none; min-height: var(--hit); display: flex; align-items: center; gap: var(--s2); font-weight: 650; }
.form-more > summary::-webkit-details-marker { display: none; }
.form-more > summary::after { content: '▾'; margin-left: auto; color: var(--muted); }
.form-more[open] > summary::after { content: '▴'; }
.form-more > summary small { font-size: var(--t-caption); font-weight: 500; color: var(--muted); }

.upload-zone.is-dragover { border-color: var(--accent); background: var(--accent-soft); }
.upload-zone small { color: var(--muted); font-size: var(--t-caption); }

.style-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); font-size: var(--t-label); color: var(--muted); }
.style-row .segmented { margin-top: 0; }
.style-row .segmented button { min-height: 36px; }

/* ---------- illustrations ---------- */
.badge--ai { left: 10px; top: auto; bottom: 10px; background: var(--accent); color: var(--on-accent); }
.photo-thumb.is-illustration { background: #ece8e0; }
.illus-state { display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s3); font-size: var(--t-caption); font-weight: 650; color: var(--accent); }
.illus-state .icon { width: 16px; height: 16px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.photo-card__art { margin: 0; text-align: center; font-size: var(--t-caption); color: var(--muted); }
.photo-card__art img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: contain; border-radius: var(--r-md); background: var(--surface-2); }
.photo-card__art figcaption { margin-top: var(--s2); }
.photo-card__row { align-items: start; }
.photo-card__row .photo-card__side { align-self: center; }
.photo-card__row[data-images="2"] { grid-template-columns: minmax(100px, 1fr) minmax(100px, 1fr) minmax(0, 1.2fr); }
.photo-card__row[data-images="3"] { grid-template-columns: repeat(3, minmax(90px, 1fr)); }
.photo-card__row[data-images="3"] .photo-card__side { grid-column: 1 / -1; }
.portrait-redo { margin-top: var(--s4); border-top: 1px solid var(--line); padding-top: var(--s3); }
.portrait-redo > summary { cursor: pointer; font-weight: 600; }
.portrait-redo > summary small { color: var(--muted); font-weight: 400; }
.portrait-redo[open] > summary { margin-bottom: var(--s3); }
@media (max-width: 760px) { .photo-card__row[data-images="2"] { grid-template-columns: 1fr 1fr; } .photo-card__row[data-images="2"] .photo-card__side { grid-column: 1 / -1; } .photo-card__row[data-images="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); } .photo-card__row[data-images="3"] .profile-placeholder img { height: 160px; } }

/* ---------- home: recently worn looks ---------- */
.recent-list { display: grid; gap: var(--s2); margin: 0; padding: 0; list-style: none; }
.recent-card { width: 100%; display: grid; gap: var(--s2); padding: var(--s2); border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-align: left; transition: border-color var(--d-fast); }
.recent-card:hover { border-color: var(--line-strong); }
.recent-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.recent-card__art { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.recent-card__art .tile { border-radius: var(--r-sm); background: var(--surface-2); }
.recent-card__meta { display: flex; align-items: center; gap: var(--s2); min-width: 0; font-size: var(--t-caption); color: var(--muted); }
.recent-card__meta em { font-style: normal; font-weight: 750; color: var(--accent); flex: none; }
.recent-card__meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-empty { margin: 0; font-size: var(--t-caption); line-height: 1.6; color: var(--muted); }
.home__recent .section-head { margin-bottom: var(--s2); }
.home__recent .section-head h2 { font-size: 18px; }
.link-btn { min-height: 36px; padding: 0 var(--s2); font-size: var(--t-caption); font-weight: 650; color: var(--accent); }

/* ---------- registration: which kind is this? ---------- */
.kind-guide { margin-top: var(--s3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.kind-guide > summary { cursor: pointer; list-style: none; min-height: var(--hit); padding: var(--s2) var(--s3); display: flex; align-items: center; gap: var(--s2); font-weight: 650; }
.kind-guide > summary::-webkit-details-marker { display: none; }
.kind-guide > summary .icon { width: 18px; height: 18px; color: var(--accent); }
.kind-guide > summary small { margin-left: auto; font-size: var(--t-caption); font-weight: 500; color: var(--muted); }
.kind-guide__body { padding: 0 var(--s3) var(--s3); display: grid; gap: var(--s3); }
.kind-guide__lead { margin: 0; font-size: var(--t-label); line-height: 1.55; color: var(--ink); }
.kind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s2); max-height: 46dvh; overflow: auto; }
.kind-tile { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 2px var(--s2); align-items: center; padding: var(--s2); border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-align: left; }
.kind-tile:hover { border-color: var(--line-strong); }
.kind-tile.is-picked { border-color: var(--accent); background: var(--accent-soft); }
.kind-tile__art { grid-row: 1 / 3; width: 52px; height: 52px; border-radius: var(--r-sm); background: #ece8e0; display: grid; place-items: center; }
.kind-tile__art .garment-art { width: 100%; height: 100%; padding: 4px; }
.kind-tile strong { font-size: var(--t-label); font-weight: 700; line-height: 1.3; }
.kind-tile small { font-size: var(--t-caption); line-height: 1.4; color: var(--muted); }
@media (max-width: 760px) { .kind-grid { grid-template-columns: 1fr 1fr; } .kind-tile { grid-template-columns: 1fr; } .kind-tile__art { grid-row: auto; margin: 0 auto; } }

/* ---------- home: the left column (recent looks + suggestions) ---------- */
.home__side .section-head { flex-wrap: wrap; gap: var(--s2); }
.home__side .filters { width: 100%; }
.home__side .filters select { flex: 1; min-width: 0; }
@media (min-width: 1181px) {
  .home__side .look-list { grid-template-columns: 1fr; }
  .home__side .look-card, .home__side .look-card:has(.has-outer) { grid-template-columns: 1fr; }
  .home__side .look-card__art { grid-template-columns: repeat(3, 1fr); }
  .home__side .look-card__art:not(.has-outer) { grid-template-columns: repeat(2, 1fr); }
  .home__side .look-card__copy { padding: var(--s2) var(--s3) var(--s3); }
}
.home__side .section-head h2 { font-size: 18px; }

/* ---------- account ---------- */
.account-chip { display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; max-width: 180px; padding: 0 var(--s3) 0 var(--s2); border: 1.5px solid var(--line-strong); border-radius: var(--r-full); font-size: var(--t-caption); font-weight: 650; }
.account-chip img, .account-chip .icon { width: 28px; height: 28px; border-radius: 50%; flex: none; }
.account-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-login { white-space: nowrap; }
.quota-list { list-style: none; margin: var(--s2) 0 var(--s3); padding: 0; display: grid; gap: var(--s2); }
.quota-list li { display: flex; justify-content: space-between; gap: var(--s3); padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); font-size: var(--t-label); }
.quota-list strong { font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .account-chip span { display: none; } .account-chip { padding: 0 var(--s2); } .account-login { padding: 0 var(--s3); font-size: var(--t-caption); } }

/* ---------- progress: what is happening to my picture ---------- */
.progress { height: 10px; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; position: relative; margin: var(--s3) 0 var(--s2); }
.progress__bar { position: absolute; inset: 0 auto 0 0; width: 38%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, white)); animation: indeterminate 1.5s ease-in-out -.6s infinite; }
@keyframes indeterminate { 0% { left: -40%; } 100% { left: 102%; } }
.progress-time { margin: 0 0 var(--s3); font-size: var(--t-label); color: var(--muted); font-variant-numeric: tabular-nums; }
.progress-time b { color: var(--ink); }
.steps { list-style: none; margin: 0 0 var(--s3); padding: 0; display: grid; gap: var(--s2); }
.steps li { display: flex; align-items: center; gap: var(--s3); font-size: var(--t-label); color: var(--muted); }
.steps li small { color: var(--muted); font-weight: 500; }
.step-mark { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; }
.step-mark .icon { width: 14px; height: 14px; }
.steps li.is-done { color: var(--ink); }
.steps li.is-done .step-mark { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.steps li.is-now { color: var(--ink); font-weight: 700; }
.steps li.is-now .step-mark { border-color: var(--accent); border-top-color: transparent; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-done { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-label); color: var(--accent); margin-bottom: var(--s3); }
.progress-done .icon { width: 22px; height: 22px; }
.progress-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--s3); margin-bottom: var(--s2); }
.progress-pair figure { margin: 0; text-align: center; font-size: var(--t-caption); color: var(--muted); }
.progress-pair { align-items: start; }
.progress-pair img { display: block; width: 100%; height: auto; max-height: 38dvh; aspect-ratio: 3 / 4; object-fit: contain; border-radius: var(--r-md); background: var(--surface-2); margin-bottom: var(--s2); }
.progress-pair figure[style*="grid-column"] img { aspect-ratio: 2 / 1; }
.progress-error { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s3); border-radius: var(--r-sm); background: var(--warn-bg); color: var(--warn-ink); font-size: var(--t-label); line-height: 1.5; margin-bottom: var(--s2); }
.progress-error .icon { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.photo-busy, .portrait-busy { display: flex; align-items: center; gap: var(--s3); margin: var(--s3) 0 0; font-size: var(--t-label); color: var(--muted); }
.spinner { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 2.5px solid var(--line-strong); border-top-color: var(--accent); animation: spin .9s linear infinite; }
.job-slot { position: sticky; top: var(--top); z-index: 12; }
.job-banner { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s4); background: color-mix(in srgb, var(--accent-soft) 85%, var(--surface)); border-bottom: 1px solid var(--line); font-size: var(--t-label); }
.job-banner__bar { position: relative; width: 56px; height: 6px; flex: none; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; }
.job-banner__bar span { position: absolute; inset: 0 auto 0 0; width: 40%; border-radius: inherit; background: var(--accent); animation: indeterminate 1.4s ease-in-out infinite; }
.job-banner__time { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .progress__bar, .job-banner__bar span, .spinner, .steps li.is-now .step-mark, .illus-state .icon { animation: none; } .progress__bar { width: 60%; } }
@media (max-width: 760px) { .job-slot { top: 56px; } .job-banner { padding: var(--s2) var(--s3); } }

/* home: full-screen four-view viewer (dist/rotation-ui.js openRotationViewer) */
.rotation-full { border: 0; padding: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: var(--bg); color: var(--ink); }
.rotation-full__bar { position: absolute; top: 0; left: 0; right: 0; z-index: 5; display: flex; justify-content: space-between; padding: var(--s3); }
.rotation-full__bar .stage__pill { position: static; }
.rotation-full__stage { position: absolute; top: 64px; left: 50%; aspect-ratio: 1 / 2; height: calc(100dvh - 64px - 150px); max-width: 100vw; transform: translateX(-50%); overflow: hidden; touch-action: pan-y; cursor: grab; outline: none; user-select: none; }
.rotation-full__stage:active { cursor: grabbing; }
.rotation-full__strip { display: block; width: 400%; height: 100%; max-width: none; object-fit: fill; pointer-events: none; transition: transform .18s ease-out; }
.rotation-full__controls { position: absolute; left: 0; right: 0; bottom: calc(var(--s3) + 36px); display: flex; flex-wrap: wrap; max-width: 520px; margin: 0 auto; justify-content: center; gap: var(--s2); padding: 0 var(--s3); }
.rotation-full__controls .btn { font-size: var(--t-caption); }
.rotation-full .stage-full__hint { bottom: var(--s3); }
