/* The Sophia Standard — "stepping into an exclusive, classy closet".
   Deep burgundy (Sophia's swatch #3A0412), warm cream, one champagne-gold accent. */
:root {
  --wine: #3A0412; --wine-2: #5a0f22; --wine-3: #7a2338;
  --cream: #f7f1ea; --paper: #fffdf9; --sand: #ece2d6; --line: #e3d6c8;
  --ink: #241318; --ink-2: #6e5a5f; --ink-3: #9a8a8d;
  --gold: #c9a26b; --gold-2: #e7d2ae; --blush: #ecc9c0;
  --ok: #3c6e4f; --warn: #a2532a;
  --r: 18px; --r-sm: 12px;
  --shadow: 0 1px 2px rgba(58,4,18,.06), 0 8px 24px rgba(58,4,18,.08);
  --serif: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  --sans: 'Jost', 'Avenir Next', 'Helvetica Neue', system-ui, sans-serif;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--cream); color: var(--ink); font: 16px/1.45 var(--sans); }
body { min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--wine-2); }
img { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: .01em; margin: 0; }
h1 { font-size: 34px; line-height: 1.05; }
h2 { font-size: 26px; line-height: 1.1; }
h3 { font-size: 20px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.eyebrow { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.hide { display: none !important; }

/* app frame */
#app { max-width: 760px; margin: 0 auto; padding-bottom: calc(var(--tab-h) + var(--safe-b) + 24px); min-height: 100dvh; }
.top { position: sticky; top: 0; z-index: 20; background: linear-gradient(var(--cream) 70%, rgba(247,241,234,0)); padding: calc(14px + env(safe-area-inset-top, 0px)) 20px 10px; display: flex; align-items: center; gap: 12px; }
.top .title { flex: 1; min-width: 0; }
.top .title h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); display: grid; place-items: center; cursor: pointer; position: relative; flex: none; }
.icon-btn svg { width: 20px; height: 20px; }
.dot { position: absolute; top: 8px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); border: 2px solid var(--paper); }
.page { padding: 4px 20px 20px; }
.section { margin: 22px 0 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.section h2 { font-size: 22px; }

/* brand bar */
.brand { display: flex; align-items: center; gap: 10px; }
.mono { width: 36px; height: 36px; border-radius: 50%; background: var(--wine); color: var(--gold-2); display: grid; place-items: center; font: 600 17px/1 var(--serif); letter-spacing: .02em; flex: none; }

/* tab bar */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--wine); padding-bottom: var(--safe-b); box-shadow: 0 -6px 24px rgba(58,4,18,.18); }
.tabs nav { max-width: 760px; margin: 0 auto; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; height: var(--tab-h); }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: rgba(247,241,234,.62); text-decoration: none; font-size: 11px; letter-spacing: .06em; }
.tabs a svg { width: 22px; height: 22px; }
.tabs a.on { color: var(--gold-2); }
.tabs a.on::after { content: ''; width: 18px; height: 2px; border-radius: 2px; background: var(--gold); margin-top: 1px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--wine); background: var(--wine); color: var(--cream); font-weight: 500; letter-spacing: .03em; cursor: pointer; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn.ghost { background: transparent; color: var(--wine); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--wine); }
.btn.soft { background: var(--paper); color: var(--wine); border-color: var(--line); }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* cards */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.card.wine { background: var(--wine); color: var(--cream); border-color: var(--wine); }
.card.wine .muted { color: rgba(247,241,234,.7); }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; cursor: pointer; }
.list-item:last-child { border-bottom: 0; }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--blush); color: var(--wine); display: grid; place-items: center; font: 600 20px/1 var(--serif); flex: none; overflow: hidden; }
.chev { color: var(--ink-3); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--sand); color: var(--ink-2); font-size: 12px; letter-spacing: .03em; }
.pill.gold { background: var(--gold-2); color: var(--wine); }
.pill.wine { background: var(--wine); color: var(--cream); }
.pill.ok { background: #dbe9df; color: var(--ok); }

/* hero actions */
.hero-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hero-actions button { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 8px 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--wine); box-shadow: var(--shadow); }
.hero-actions button svg { width: 26px; height: 26px; }
.hero-actions button.main { background: var(--wine); color: var(--gold-2); border-color: var(--wine); }

/* chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 20px 6px; margin: 0 -20px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--wine); color: var(--cream); border-color: var(--wine); }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }

/* grid of garments */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; cursor: pointer; text-align: left; padding: 0; position: relative; }
.tile .ph { aspect-ratio: 4/5; background: var(--sand); overflow: hidden; }
.tile .ph img { width: 100%; height: 100%; object-fit: cover; }
.tile .cap { padding: 8px 10px 10px; }
.tile .cap b { display: block; font-weight: 500; font-size: 14px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .cap span { font-size: 12px; color: var(--ink-3); }
.tile.sel { outline: 3px solid var(--gold); outline-offset: -3px; }
.tile .check { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; background: var(--gold); color: var(--wine); display: none; place-items: center; font-weight: 700; }
.tile.sel .check { display: grid; }
.swatch-ph { width: 100%; height: 100%; display: grid; place-items: center; font: 600 16px var(--serif); color: var(--wine); padding: 10px; text-align: center; }

/* outfit card (horizontal collage) */
.looks { display: grid; grid-auto-flow: column; grid-auto-columns: 82%; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 20px 10px; margin: 0 -20px; scrollbar-width: none; }
.looks::-webkit-scrollbar { display: none; }
.look { scroll-snap-align: start; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.collage { display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: 2px; background: var(--line); }
.collage .ph { aspect-ratio: 3/4; background: var(--sand); overflow: hidden; }
.collage img { width: 100%; height: 100%; object-fit: cover; }
.look .body { padding: 14px 16px 16px; }
.wore { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.wore .count { font-size: 13px; color: var(--ink-2); }

/* forms */
label.f { display: block; margin: 14px 0 6px; font-size: 13px; color: var(--ink-2); letter-spacing: .02em; }
.in, select.in, textarea.in { width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--paper); outline: none; }
textarea.in { min-height: 96px; resize: vertical; }
.in:focus { border-color: var(--wine-3); box-shadow: 0 0 0 3px rgba(122,35,56,.12); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* sheet (modal from bottom) */
.scrim { position: fixed; inset: 0; background: rgba(36,19,24,.45); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
.sheet { background: var(--cream); width: 100%; max-width: 760px; max-height: 92dvh; overflow-y: auto; border-radius: 24px 24px 0 0; padding: 10px 20px calc(24px + var(--safe-b)); animation: up .24s cubic-bezier(.2,.8,.2,1); }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 14px; }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sheet-head h2 { flex: 1; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 18px); transform: translateX(-50%); background: var(--ink); color: var(--cream); padding: 12px 18px; border-radius: 999px; z-index: 90; font-size: 14px; box-shadow: var(--shadow); animation: up .2s ease; max-width: 90vw; text-align: center; }

/* empty state */
.empty { text-align: center; padding: 36px 20px; color: var(--ink-2); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* chat */
.chat { display: flex; flex-direction: column; gap: 8px; padding-bottom: 90px; }
.bubble { max-width: 80%; padding: 10px 14px; border-radius: 18px; font-size: 15px; white-space: pre-wrap; }
.bubble.me { align-self: flex-end; background: var(--wine); color: var(--cream); border-bottom-right-radius: 6px; }
.bubble.them { align-self: flex-start; background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble.notes { align-self: flex-start; background: var(--gold-2); color: var(--wine); border-bottom-left-radius: 6px; }
.bubble .who { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; opacity: .7; margin-bottom: 2px; }
.composer { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b)); z-index: 25; background: var(--cream); border-top: 1px solid var(--line); padding: 10px 16px; }
.composer .inner { max-width: 728px; margin: 0 auto; display: flex; gap: 8px; }

/* questionnaire */
.q-wrap { min-height: 100dvh; display: flex; flex-direction: column; padding: calc(20px + env(safe-area-inset-top, 0px)) 22px calc(22px + var(--safe-b)); max-width: 640px; margin: 0 auto; }
.q-progress { height: 4px; background: var(--sand); border-radius: 2px; overflow: hidden; margin: 14px 0 28px; }
.q-progress i { display: block; height: 100%; background: var(--wine); transition: width .3s; }
.q-body { flex: 1; }
.q-body h1 { margin-bottom: 8px; }
.style-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 18px; }
.style-tile { border: 1px solid var(--line); background: var(--paper); border-radius: var(--r); padding: 16px 14px; text-align: left; cursor: pointer; min-height: 92px; }
.style-tile b { font: 600 20px var(--serif); display: block; }
.style-tile span { font-size: 13px; color: var(--ink-2); }
.style-tile.on { border-color: var(--wine); background: var(--wine); color: var(--cream); }
.style-tile.on span { color: rgba(247,241,234,.75); }
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.sw { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; background: none; border: 0; padding: 0; }
.sw i { width: 58px; height: 58px; border-radius: 50%; border: 1px solid rgba(0,0,0,.08); position: relative; }
.sw.on i { box-shadow: 0 0 0 3px var(--cream), 0 0 0 5px var(--wine); }

/* welcome / landing */
.welcome { min-height: 100dvh; background: radial-gradient(120% 80% at 50% 0%, #5a0f22 0%, var(--wine) 55%, #24020b 100%); color: var(--cream); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 28px; }
.welcome .mark { font: 500 15px var(--sans); letter-spacing: .4em; text-transform: uppercase; color: var(--gold-2); }
.welcome h1 { font-size: 54px; font-weight: 500; margin: 14px 0 6px; }
.welcome p { max-width: 420px; color: rgba(247,241,234,.78); }
.welcome .rule { width: 60px; height: 1px; background: var(--gold); margin: 22px auto; }

/* presentation mode */
.present { position: fixed; inset: 0; z-index: 80; background: var(--wine); color: var(--cream); display: flex; flex-direction: column; }
.present .bar { display: flex; align-items: center; padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 8px; gap: 10px; }
.present .stage { flex: 1; overflow-y: auto; padding: 8px 22px 22px; }
.present .stage h2 { font-size: 36px; color: var(--cream); margin: 8px 0; }
.present .stage .note { color: rgba(247,241,234,.82); font-size: 17px; margin-bottom: 18px; }
.present .pgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.present .pgrid .tile { border-color: rgba(255,255,255,.08); }
.present .nav { display: flex; gap: 10px; padding: 12px 16px calc(14px + var(--safe-b)); align-items: center; }
.present .dots { flex: 1; display: flex; gap: 6px; justify-content: center; }
.present .dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(247,241,234,.3); }
.present .dots i.on { background: var(--gold); }
.shop { display: inline-flex; margin-top: 6px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--wine); background: var(--gold-2); padding: 6px 10px; border-radius: 999px; text-decoration: none; }

/* slide editor */
.slide-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; }
.slide-card .thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.slide-card .thumbs .t { width: 64px; height: 80px; border-radius: 8px; overflow: hidden; background: var(--sand); position: relative; }
.slide-card .thumbs .t img { width: 100%; height: 100%; object-fit: cover; }
.slide-card .thumbs .t button { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(36,19,24,.7); color: #fff; font-size: 13px; line-height: 1; cursor: pointer; }
.slide-card .thumbs .add { width: 64px; height: 80px; border-radius: 8px; border: 1.5px dashed var(--ink-3); background: transparent; color: var(--ink-2); font-size: 26px; cursor: pointer; }

/* sorting animation */
.sorting { display: flex; align-items: center; gap: 10px; color: var(--wine); font-weight: 500; }
.spin { width: 18px; height: 18px; border: 2px solid var(--gold-2); border-top-color: var(--wine); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* feedback launcher (feedback.js) */
#fb-btn { position: fixed; right: 14px; bottom: calc(var(--tab-h) + var(--safe-b) + 14px); z-index: 40; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--gold); background: var(--paper); color: var(--wine); font: 500 13px var(--sans); letter-spacing: .04em; box-shadow: var(--shadow); cursor: pointer; }
body.no-tabs #fb-btn { bottom: calc(var(--safe-b) + 14px); }
body.has-composer #fb-btn { bottom: calc(var(--tab-h) + var(--safe-b) + 84px); }
#fb-btn svg { width: 16px; height: 16px; }
.fb-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 4px; }
.fb-types button { border: 1px solid var(--line); background: var(--paper); border-radius: var(--r-sm); padding: 12px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 14px; }
.fb-types button.on { background: var(--wine); color: var(--cream); border-color: var(--wine); }
.fb-types button span { font-size: 22px; }
.fb-where { font-size: 13px; color: var(--ink-2); background: var(--sand); padding: 8px 12px; border-radius: 10px; }
.present .tile { color: var(--ink); }
a.chip { text-decoration: none; color: inherit; }
a.chip.on { color: var(--cream); }
/* panel fixes: titles wrap instead of truncating; nothing hides under the feedback button; contrast */
.top .title h1 { white-space: normal; font-size: clamp(26px, 7.4vw, 34px); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.page { padding-bottom: 84px; }
:root { --ink-3: #74636a; }
.tabs a { color: rgba(247,241,234,.82); font-size: 12px; }
.small { font-size: 14px; }
.top { background: var(--cream); box-shadow: 0 1px 0 var(--line); }

/* guided camera */
.camera { position: fixed; inset: 0; z-index: 85; background: #000; color: #fff; }
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera .sil { position: absolute; left: 10%; right: 10%; top: 14%; bottom: 30%; width: 80%; height: 56%; pointer-events: none; }
.camera .sil path { fill: rgba(255,255,255,.06); stroke: #fff; stroke-width: .8; stroke-dasharray: 3 2; vector-effect: non-scaling-stroke; transition: stroke .2s; }
.camera[data-q="ok"] .sil path { stroke: var(--gold); stroke-width: 1.4; }
.camera[data-q="dark"] .sil path { stroke: #ff9b8a; }
.cam-top { position: absolute; top: 0; left: 0; right: 0; padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 10px; display: flex; align-items: center; gap: 10px; background: linear-gradient(rgba(0,0,0,.55), transparent); }
.cam-x { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0,0,0,.45); color: #fff; font-size: 18px; }
.cam-hint { flex: 1; text-align: center; font-size: 15px; font-weight: 500; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.camera[data-q="ok"] .cam-hint { color: var(--gold-2); }
.camera[data-q="dark"] .cam-hint { color: #ffc2b8; }
.cam-count { min-width: 40px; font-size: 12px; text-align: right; color: var(--gold-2); }
.cam-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 0 calc(18px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(transparent, rgba(0,0,0,.7) 30%); }
.cam-sil { display: flex; gap: 8px; overflow-x: auto; padding: 0 14px 14px; scrollbar-width: none; justify-content: safe center; }
.cam-sil::-webkit-scrollbar { display: none; }
.cam-sil button { flex: none; width: 62px; border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.35); color: #fff; border-radius: 12px; padding: 6px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; }
.cam-sil svg { width: 30px; height: 30px; } .cam-sil path { fill: none; stroke: currentColor; stroke-width: 5; }
.cam-sil button.on { border-color: var(--gold); color: var(--gold-2); background: rgba(58,4,18,.6); }
.cam-row { display: flex; align-items: center; justify-content: space-around; }
.cam-side { width: 72px; height: 44px; border-radius: 22px; border: 1px solid rgba(255,255,255,.35); background: rgba(0,0,0,.35); color: #fff; font-size: 14px; }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; background: transparent; padding: 4px; }
.shutter i { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; transition: background .2s; }
.camera[data-q="ok"] .shutter i { background: var(--gold); }
.camera.flash::after { content: ''; position: absolute; inset: 0; background: #fff; opacity: .7; }
body:has(.camera) #fb-btn { display: none; }
