/* Layout: a fitting-room workbench. Controls on the left, outfit "flat-lays" on the right, stacked on phones. */
:root {
  --bg: #ecede8;
  --surface: #f8f8f4;
  --ink: #16181b;
  --muted: #5d625e;
  --line: #d2d5ce;
  --accent: #2f43b8;
  --accent-ink: #ffffff;
  --ok: #1d7748;
  --warn: #a8690f;
  --bad: #c0362b;
  --garment-line: rgba(22, 24, 27, .38);
  --font-display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131514; --surface: #1c1f1d; --ink: #eceee9; --muted: #9ba29d; --line: #2f3330;
    --accent: #93a1ff; --accent-ink: #10132b; --ok: #4fc68b; --warn: #e5b14c; --bad: #ff6d60;
    --garment-line: rgba(236, 238, 233, .42); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131514; --surface: #1c1f1d; --ink: #eceee9; --muted: #9ba29d; --line: #2f3330;
  --accent: #93a1ff; --accent-ink: #10132b; --ok: #4fc68b; --warn: #e5b14c; --bad: #ff6d60;
  --garment-line: rgba(236, 238, 233, .42); color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5;
}
.wrap {
  max-width: 1120px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 28px 56px;
  display: grid; gap: 24px;
}
header { display: grid; gap: 6px; }
h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1; margin: 0; letter-spacing: -.02em; text-wrap: balance; }
h1 span { color: var(--accent); }
.lede { margin: 0; color: var(--muted); max-width: 60ch; font-size: 1.02rem; }
h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
h3 { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0; font-weight: 600; }

/* Context bar */
.context { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; }
.seg-wrap { display: grid; gap: 6px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: .9rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.chip:hover { border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  font: inherit; font-weight: 600; background: none; border: 0; color: var(--muted); cursor: pointer;
  padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab:hover { color: var(--ink); }

/* Workbench */
.bench { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 820px) { .bench { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px; display: grid; gap: 16px; min-width: 0; }
.field { display: grid; gap: 6px; }
label, .lbl { font-size: .82rem; font-weight: 600; }
select, input[type="text"] {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 10px; width: 100%;
}
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Swatches */
.sw-group { display: grid; gap: 5px; }
.sw-label { font-size: .74rem; color: var(--muted); }
.sw-row { display: flex; flex-wrap: wrap; gap: 6px; }
.sw {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--garment-line); background: var(--c);
  cursor: pointer; padding: 0; position: relative;
}
.sw.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.picked { font-family: var(--font-mono); font-size: .78rem; color: var(--muted); }

.btn {
  font: inherit; font-weight: 600; border-radius: 6px; padding: 9px 14px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
}
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--muted); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Results */
.results { display: grid; gap: 14px; min-width: 0; }
.results-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.outfits { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 14px; }
.outfit { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: grid; gap: 10px; align-content: start; }
.outfit.best { border-color: var(--ink); }
.fig { display: grid; place-items: center; background: var(--bg); border-radius: 8px; padding: 12px 0; }
.fig svg { width: 120px; height: auto; display: block; }
.verdict { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pill { font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px solid currentColor; }
.pill.ok { color: var(--ok); } .pill.fine { color: var(--ok); } .pill.risky { color: var(--warn); } .pill.bad { color: var(--bad); }
.score { font-family: var(--font-mono); font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pieces { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pieces li { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--garment-line); flex: none; }
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.notes li { font-size: .86rem; padding-left: 14px; position: relative; color: var(--ink); }
.notes li::before { content: ""; position: absolute; left: 0; top: .55em; width: 7px; height: 7px; border-radius: 50%; }
.notes li.good::before { background: var(--ok); }
.notes li.warn::before { background: var(--warn); }
.notes li.bad::before { background: var(--bad); }
.notice { font-size: .88rem; padding: 10px 12px; border-radius: 8px; border: 1px dashed var(--line); color: var(--muted); }
.notice.warn { border-color: var(--warn); color: var(--ink); }

/* Closet list */
.closet { display: grid; gap: 12px; }
.items { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.item { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 8px; border: 1px solid var(--line); border-radius: 999px; font-size: .84rem; background: var(--bg); }
.item button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 2px 6px; border-radius: 50%; }
.item button:hover { color: var(--bad); }
.tag { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--warn); font-weight: 600; }

/* Check tab */
.check-big { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 20px; align-items: start; }
.check-big .fig svg { width: 140px; }
@media (max-width: 520px) { .check-big { grid-template-columns: minmax(0, 1fr); } }
.big-verdict { font-family: var(--font-display); font-weight: 700; font-size: 2rem; line-height: 1.05; margin: 0; }
.big-verdict.ok, .big-verdict.fine { color: var(--ok); } .big-verdict.risky { color: var(--warn); } .big-verdict.bad { color: var(--bad); }
.fix { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.slot-row { display: grid; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.slot-row:last-child { border-bottom: 0; padding-bottom: 0; }

/* Rules */
.rules { border-top: 1px solid var(--line); padding-top: 22px; display: grid; gap: 12px; }
.rules ul { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px 24px; }
.rules li { font-size: .9rem; color: var(--muted); }
.rules li b { color: var(--ink); display: block; font-weight: 600; }

@media (prefers-reduced-motion: no-preference) {
  .outfit { animation: rise .25s ease-out both; }
  .outfit:nth-child(2) { animation-delay: .04s; } .outfit:nth-child(3) { animation-delay: .08s; }
  @keyframes rise { from { transform: translateY(4px); } to { transform: none; } }
}

/* ---- Lebsa additions ---- */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
[hidden] { display: none !important; }
img, canvas { max-width: 100%; }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.login { max-width: 380px; margin: 0 auto; padding-block: 12vh 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 14px; }
.login .lede { margin-bottom: 8px; }
.form-error { color: var(--bad); margin: 0; font-size: .9rem; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.big { padding: 14px 18px; font-size: 1rem; text-align: center; }
.btn.small { padding: 5px 10px; font-size: .85rem; }
.photo-box { display: grid; gap: 12px; }
.photo-box canvas { display: block; width: 100%; height: auto; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
.rate-canvas canvas { cursor: crosshair; touch-action: manipulation; }
.detected { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detected .dot { width: 22px; height: 22px; }
.privacy { font-size: .8rem; color: var(--muted); display: flex; gap: 6px; align-items: baseline; }
.progress { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.progress li { display: flex; gap: 10px; align-items: center; font-size: .95rem; }
.check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; font-size: .7rem; font-weight: 700; }
.check.done { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.item.pick { cursor: pointer; font: inherit; font-size: .84rem; color: var(--ink); padding: 5px 10px 5px 8px; }
.item.pick[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.step-prompt { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; margin: 0; }
.taps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.taps li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; align-items: center; font-size: .88rem; }
.taps select { grid-column: 2; }
.go { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; margin: 0; line-height: 1.1; }
.go.yes { color: var(--ok); } .go.no { color: var(--bad); } .go.maybe { color: var(--warn); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: .9rem; z-index: 20; max-width: calc(100% - 32px); }
.item.off { opacity: .55; }
.item .wash { font-size: .72rem; font-weight: 600; border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; color: var(--muted); }
.item .wash:hover { color: var(--ink); border-color: var(--muted); }
.item .wash[aria-pressed="true"] { color: var(--ok); border-color: var(--ok); }
/* weather, reminders, shopping */
.wx { margin: 0; font-size: .88rem; color: var(--muted); }
.wx b { color: var(--ink); font-weight: 600; }
.reminders { list-style: none; margin: 0; padding: 10px 12px; display: grid; gap: 6px; border: 1px solid var(--warn); border-radius: 8px; }
.reminders li { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.dot.ghost { background: transparent; border-style: dashed; }
.linkish { font: inherit; text-transform: none; letter-spacing: 0; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; }
.city-form { display: grid; gap: 8px; flex-basis: 100%; max-width: 560px; }
.city-form .btn-row input { flex: 1 1 160px; width: auto; }
.badge { display: inline-block; min-width: 1.4em; padding: 0 6px; border-radius: 999px; background: var(--bad); color: var(--surface); font-size: .72rem; font-weight: 700; line-height: 1.5; text-align: center; vertical-align: middle; }
.deals, .wishes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.deals li, .wishes li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: start; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.deals li:last-child, .wishes li:last-child { border-bottom: 0; padding-bottom: 0; }
.deals li > div, .wishes li > div { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.wishes li > div { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.wishes li .score { flex-basis: 100%; }
.deals li.new a { font-weight: 600; }
.wishes .links { grid-column: 1; }
a { color: var(--accent); }
.links { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .84rem; }
.estimate { display: grid; gap: 4px; border-top: 1px solid var(--line); padding-top: 12px; }
.bench.shop { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.bench.shop > .results { grid-column: 1 / -1; }
@media (max-width: 820px) { .bench.shop { grid-template-columns: minmax(0, 1fr); } }
.context { align-items: flex-start; }
