/* «Образ» — визуальная система «Ателье».
   Прохладный меловой фон, чернильный текст, кобальт для действий и жёлтая
   сантиметровая лента как единственная яркая деталь. Все значения — токены ниже. */

/* ============ 1. Токены ============ */
:root {
  /* цвет */
  --chalk: #F1F0F4;
  --surface: #FFFFFF;
  --surface-2: #E8E6EE;
  --ink: #1D1A2B;
  --ink-2: #4A4659;
  --ink-3: #656178;
  --line: #DCD9E4;
  --line-strong: #8F8AA3;
  --accent: #2B3AC4;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3E5FA;
  --tape: #F2C94C;
  --tape-ink: #1D1A2B;
  --tag-bg: #1D1A2B;
  --tag-ink: #F1F0F4;
  --tag-ink-2: #C9C6D6;
  --good: #1E6B43;
  --good-soft: #DCEFE3;
  --warn: #8A5A00;
  --warn-soft: #F7EACB;
  --bad: #A32B2B;
  --bad-soft: #F7DEDC;
  --scrim: rgba(20, 18, 32, .5);

  /* шрифты и шкала (1.2 от 15px) */
  --font-display: 'Tenor Sans', 'Onest', system-ui, sans-serif;
  --font-text: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 15px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: 27px;
  --fs-3xl: 32px;
  --fs-4xl: 44px;
  --lh-tight: 1.15;
  --lh-text: 1.5;

  /* отступы */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 48px;

  /* радиусы по иерархии */
  --r-sheet: 28px;
  --r-card: 20px;
  --r-item: 16px;
  --r-field: 14px;
  --r-pill: 999px;

  /* глубина: тень только у плавающего */
  --shadow-float: 0 12px 32px -12px rgba(29, 26, 43, .35), 0 2px 6px rgba(29, 26, 43, .08);
  --shadow-soft: 0 1px 2px rgba(29, 26, 43, .06);

  /* движение */
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* раскладка */
  --col: 640px;
  --gutter: 16px;
  --tap: 44px;
  --tabbar-h: 64px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-total: calc(var(--tabbar-h) + var(--safe-b));

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --chalk: #14131B; --surface: #1D1C26; --surface-2: #282734; --ink: #F0EEF6; --ink-2: #C2BED1; --ink-3: #9C97B0;
    --line: #302F3D; --line-strong: #6E6985; --accent: #9AA4FF; --accent-ink: #14131B; --accent-soft: #262A55;
    --tag-bg: #262436; --tag-ink: #F0EEF6; --tag-ink-2: #C2BED1;
    --good: #7FD3A2; --good-soft: #1B3026; --warn: #EBC170; --warn-soft: #352B14; --bad: #F29A92; --bad-soft: #3A1F1E;
    --scrim: rgba(0, 0, 0, .6);
    --shadow-float: 0 12px 32px -12px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .4);
    --shadow-soft: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --chalk: #14131B; --surface: #1D1C26; --surface-2: #282734; --ink: #F0EEF6; --ink-2: #C2BED1; --ink-3: #9C97B0;
  --line: #302F3D; --line-strong: #6E6985; --accent: #9AA4FF; --accent-ink: #14131B; --accent-soft: #262A55;
  --tag-bg: #262436; --tag-ink: #F0EEF6; --tag-ink-2: #C2BED1;
  --good: #7FD3A2; --good-soft: #1B3026; --warn: #EBC170; --warn-soft: #352B14; --bad: #F29A92; --bad-soft: #3A1F1E;
  --scrim: rgba(0, 0, 0, .6);
  --shadow-float: 0 12px 32px -12px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .4);
  --shadow-soft: none;
  color-scheme: dark;
}

/* ============ 2. Основа ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  background: var(--chalk); color: var(--ink);
  font: 400 var(--fs-md)/var(--lh-text) var(--font-text);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; }
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: var(--lh-tight); font-weight: 400; }
h1 { font: 400 var(--fs-3xl)/1.1 var(--font-display); letter-spacing: -.01em; }
h2 { font: 400 var(--fs-xl)/1.2 var(--font-display); }
h3 { font: 600 var(--fs-md)/1.3 var(--font-text); }
p { margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: var(--fs-sm); }
.tiny { font-size: var(--fs-xs); color: var(--ink-3); }
.hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.i.fill { fill: currentColor; stroke: none; }

/* фокус: заметное кольцо только с клавиатуры */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.btn:focus-visible, .chip:focus-visible, .icon-btn:focus-visible { border-radius: var(--r-pill); }
.witem:focus-visible { border-radius: var(--r-item); }
#view:focus-visible { outline: none; }

/* ============ 3. Каркас ============ */
#app { max-width: calc(var(--col) + 2 * var(--gutter)); margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  min-height: 56px; padding: calc(var(--sp-2) + var(--safe-t)) var(--gutter) var(--sp-2);
  background: color-mix(in srgb, var(--chalk) 90%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: var(--sp-2); font: 400 var(--fs-xl)/1 var(--font-display); letter-spacing: .02em; color: var(--ink); text-decoration: none; }
.logo { width: 30px; height: 30px; flex: none; }
#topbar-extra { display: flex; align-items: center; gap: var(--sp-2); }
main { flex: 1; padding: var(--sp-1) var(--gutter) calc(var(--nav-total) + var(--sp-7)); }

.screen-title { margin: var(--sp-2) 0 var(--sp-4); }
.screen-title p { margin-top: var(--sp-1); }

/* смена вкладок: короткий сдвиг и проявление */
.view-enter { animation: view-in var(--dur-2) var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }

/* ============ 4. Навигация ============ */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 0 var(--sp-1) var(--safe-b);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  transition: transform var(--dur-2) var(--ease);
}
.tabbar button {
  position: relative; min-height: var(--tabbar-h); border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 500; letter-spacing: .01em; color: var(--ink-3);
}
.tabbar button .i { width: 24px; height: 24px; transition: transform var(--dur-1) var(--ease); }
.tabbar button:active .i { transform: scale(.9); }
.tabbar button[aria-current="page"] { color: var(--ink); font-weight: 700; }
/* активная вкладка: кусочек сантиметровой ленты сверху */
.tabbar button[aria-current="page"]::before {
  content: ''; position: absolute; top: 0; left: 50%; width: 32px; height: 5px; margin-left: -16px;
  border-radius: 0 0 3px 3px;
  background: repeating-linear-gradient(90deg, var(--tape-ink) 0 1px, transparent 1px 4px) bottom / 100% 2px no-repeat, var(--tape);
}
.tabbar-inner { display: contents; }
body.kbd-open .tabbar { transform: translateY(100%); }
body.kbd-open { --nav-total: 0px; }

/* ============ 5. Базовые блоки ============ */
.section { margin: var(--sp-5) 0; }
.section:first-child { margin-top: var(--sp-2); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--sp-4); box-shadow: var(--shadow-soft); }
.card + .card { margin-top: var(--sp-3); }
.card.flat { background: var(--chalk); box-shadow: none; padding: var(--sp-3); }
.stack > * + * { margin-top: var(--sp-3); }
.stack.tight > * + * { margin-top: var(--sp-2); }
.row { display: flex; gap: var(--sp-2); align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
.mt-1 { margin-top: var(--sp-1); } .mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); } .mt-4 { margin-top: var(--sp-4); }
.actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }

/* кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 48px; padding: 0 var(--sp-5); border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap;
  font-weight: 600; font-size: var(--fs-md);
  transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.btn .i { width: 18px; height: 18px; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--ink); color: var(--chalk); border-color: var(--ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--ink) 88%, var(--accent)); }
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.accent:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn.ghost { border-color: transparent; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn.small { min-height: var(--tap); padding: 0 var(--sp-4); font-size: var(--fs-sm); }
.btn.block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: default; transform: none; }
.btn.loading { pointer-events: none; }
.link-btn { border: 0; background: none; padding: var(--sp-2) 0; min-height: var(--tap); color: var(--accent); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: var(--sp-1); }

.icon-btn {
  width: var(--tap); height: var(--tap); flex: none; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: var(--surface-2); color: var(--ink);
  transition: background-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.icon-btn:active { transform: scale(.92); }
.icon-btn.on { background: var(--accent); color: var(--accent-ink); }
.icon-btn.ink { background: var(--ink); color: var(--chalk); }
.icon-btn.plain { background: transparent; }
.icon-btn:disabled { opacity: .45; cursor: default; }

/* чипы */
.chips { display: flex; gap: var(--sp-2); overflow-x: auto; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) var(--sp-1); scrollbar-width: none; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; scroll-snap-align: start;
  min-height: 40px; padding: 0 var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface); color: var(--ink); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; white-space: nowrap;
  position: relative; transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
/* зона нажатия 44px при визуальной высоте 40 */
.chip::after { content: ''; position: absolute; inset: -2px 0; }
.chip:hover { border-color: var(--line-strong); }
.chip.on, .chip[aria-pressed="true"] { background: var(--ink); color: var(--chalk); border-color: var(--ink); }
.chip.on .sw { border-color: var(--chalk); }
.chips.wrap .chip { white-space: normal; text-align: left; min-height: var(--tap); }

/* поля */
label.field { display: block; }
label.field > span { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
input[type=text], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; min-height: 48px; padding: var(--sp-3) 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-field); background: var(--surface);
  font-size: 16px; line-height: 1.3;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
select { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23656178' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 16px; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); outline: none; }
input[aria-invalid="true"] { border-color: var(--bad); }
textarea { resize: none; min-height: 48px; }
input[type=color] { width: 48px; height: 48px; padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--r-field); background: var(--surface); cursor: pointer; }
label.field > .field-hint, label.field > .field-error { font-size: var(--fs-xs); font-weight: 400; color: var(--ink-3); margin: 6px 0 0; }
label.field > .field-error { color: var(--bad); font-weight: 600; }
label.field > .field-error:empty { display: none; }

/* сегменты */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--sp-1); padding: var(--sp-1); background: var(--surface-2); border-radius: var(--r-pill); }
.seg button { min-height: var(--tap); border: 0; background: transparent; border-radius: var(--r-pill); padding: 0 var(--sp-2); cursor: pointer; font-weight: 600; font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.2; transition: background-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-soft), 0 0 0 1px var(--line); }

/* теги и подсказки */
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 600; padding: 3px 10px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.notice { display: flex; gap: var(--sp-3); align-items: flex-start; border-radius: var(--r-item); padding: var(--sp-3) 14px; font-size: var(--fs-sm); background: var(--accent-soft); color: var(--ink); }
.notice > .i { margin-top: 1px; color: var(--accent); }
.notice.good { background: var(--good-soft); } .notice.good > .i { color: var(--good); }
.notice.warn { background: var(--warn-soft); } .notice.warn > .i { color: var(--warn); }
.notice.bad { background: var(--bad-soft); } .notice.bad > .i { color: var(--bad); }
.notice .btn { margin-top: var(--sp-2); }

/* ============ 6. Лента — фирменная деталь ============ */
.tape {
  --p: 0;
  position: relative; height: 14px; border-radius: 3px; overflow: hidden;
  background: color-mix(in srgb, var(--tape) 28%, var(--surface-2));
}
.tape::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: calc(var(--p) * 100%);
  background: var(--tape); transition: width var(--dur-3) var(--ease);
}
.tape::after {
  content: ''; position: absolute; inset: 0;
  background:
    repeating-linear-gradient(90deg, var(--tape-ink) 0 1px, transparent 1px 40px) top / 100% 9px no-repeat,
    repeating-linear-gradient(90deg, var(--tape-ink) 0 1px, transparent 1px 8px) top / 100% 5px no-repeat;
  opacity: .55;
}

/* ============ 7. Сегодня: бирка ============ */
.hero {
  position: relative; overflow: hidden; color: var(--tag-ink); background: var(--tag-bg);
  border-radius: var(--r-card) var(--r-card) var(--r-item) var(--r-item);
  padding: var(--sp-5) var(--sp-5) calc(var(--sp-5) + 18px);
}
/* лента по нижнему краю */
.hero::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 14px;
  background:
    repeating-linear-gradient(90deg, var(--tape-ink) 0 1px, transparent 1px 40px) top / 100% 9px no-repeat,
    repeating-linear-gradient(90deg, var(--tape-ink) 0 1px, transparent 1px 8px) top / 100% 5px no-repeat,
    var(--tape);
}
.hero h1 { color: var(--tag-ink); margin-top: var(--sp-1); }
.hero .muted, .hero .tiny { color: var(--tag-ink-2); }
.hero-date { font-size: var(--fs-sm); color: var(--tag-ink-2); }
.hero-date::first-letter { text-transform: uppercase; }
.wx { display: flex; align-items: flex-end; gap: var(--sp-4); margin-top: var(--sp-5); }
.wx-temp { font: 400 var(--fs-4xl)/.9 var(--font-display); letter-spacing: -.02em; }
.wx-meta { font-size: var(--fs-sm); color: var(--tag-ink-2); padding-bottom: 2px; }
.wx-meta b { color: var(--tag-ink); font-weight: 600; }
.tips { margin: var(--sp-4) 0 0; padding: 0; list-style: none; font-size: var(--fs-sm); }
.tips li { padding-left: 14px; position: relative; }
.tips li::before { content: ''; position: absolute; left: 0; top: .6em; width: 6px; height: 6px; border-radius: 50%; background: var(--tape); }
.tips li + li { margin-top: var(--sp-1); }
.hero .actions { margin-top: var(--sp-4); }
.hero .btn { color: var(--tag-ink); border-color: color-mix(in srgb, var(--tag-ink) 40%, transparent); }
.hero .btn:hover { background: color-mix(in srgb, var(--tag-ink) 12%, transparent); }
.hero .notice { background: color-mix(in srgb, var(--tag-ink) 10%, transparent); color: var(--tag-ink); margin-top: var(--sp-4); }
.hero .notice > .i { color: var(--tape); }

/* карточка настройки (прогресс по ленте) */
.setup .tape { margin: var(--sp-3) 0 var(--sp-2); }
.steps { list-style: none; margin: var(--sp-2) 0 0; padding: 0; }
.steps li { border-top: 1px solid var(--line); }
.steps button {
  width: 100%; min-height: 56px; display: flex; align-items: center; gap: var(--sp-3);
  border: 0; background: none; padding: var(--sp-2) 0; text-align: left; cursor: pointer; color: var(--ink);
}
.steps .mark { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line-strong); color: var(--ink-3); font-size: var(--fs-xs); font-weight: 700; }
.steps .done .mark { background: var(--ink); border-color: var(--ink); color: var(--chalk); }
.steps .done .title { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1px; }
.steps .title { font-weight: 600; }
.steps .chev { color: var(--ink-3); }

/* ============ 8. Образы ============ */
.outfit { padding: var(--sp-4); }
.outfit-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.outfit-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: var(--sp-2); margin: var(--sp-3) 0; }
.outfit-items .witem { border: 0; background: none; border-radius: var(--r-item); }
.thumb { aspect-ratio: 1; border-radius: var(--r-item); background: var(--surface-2); display: grid; place-items: center; overflow: hidden; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb svg { width: 68%; height: 68%; }
.thumb .cap {
  position: absolute; left: 6px; right: 6px; bottom: 6px; font-size: 11px; font-weight: 600; line-height: 1.2;
  padding: 3px 6px; border-radius: var(--r-pill); background: var(--surface); color: var(--ink);
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.score { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: var(--fs-sm); padding: 4px 10px; border-radius: var(--r-pill); background: var(--good-soft); color: var(--good); }
.score.mid { background: var(--warn-soft); color: var(--warn); }
.reasons { list-style: none; padding: 0; margin: 0; font-size: var(--fs-sm); color: var(--ink-2); }
.reasons li { padding-left: 22px; position: relative; }
.reasons li + li { margin-top: var(--sp-1); }
.reasons li::first-letter { text-transform: uppercase; }
.reasons li::before { content: ''; position: absolute; left: 3px; top: .45em; width: 9px; height: 5px; border-left: 2px solid var(--good); border-bottom: 2px solid var(--good); transform: rotate(-45deg); }
.reasons li.w::before { width: 6px; height: 6px; left: 5px; top: .55em; border: 0; border-radius: 50%; background: var(--warn); transform: none; }
.outfit .actions { margin-top: var(--sp-4); }
.outfit .actions .btn.primary { flex: 1 1 auto; }
.swatches { display: flex; gap: 0; }
.swatches .sw + .sw { margin-left: -5px; }
.sw { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); flex: none; display: inline-block; vertical-align: middle; }
.sw.lg { width: 34px; height: 34px; }
.saved-meta { font-size: var(--fs-sm); color: var(--ink-2); }

/* ============ 9. Гардероб ============ */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-item); padding: var(--sp-3); }
.stat b { display: block; font: 400 var(--fs-2xl)/1 var(--font-display); margin-bottom: var(--sp-1); }
.stat span { font-size: var(--fs-xs); color: var(--ink-2); line-height: 1.3; display: block; }
.colormap { display: flex; height: 28px; border-radius: 6px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.colormap > div { height: 100%; flex: 1; }
.wgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
.witem { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-item); overflow: hidden; cursor: pointer; padding: 0; text-align: left; color: var(--ink); transition: transform var(--dur-1) var(--ease); display: block; width: 100%; }
.witem:active { transform: scale(.97); }
.witem .thumb { border-radius: 0; }
.witem .meta { padding: var(--sp-2) 10px 10px; font-size: var(--fs-sm); }
.witem .meta b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.witem .meta span { display: block; font-size: var(--fs-xs); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fab {
  position: fixed; z-index: 9; right: max(var(--gutter), calc(50% - var(--col) / 2));
  bottom: calc(var(--nav-total) + var(--sp-4));
  height: 56px; padding: 0 var(--sp-5) 0 var(--sp-4); border: 0; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; gap: var(--sp-2);
  background: var(--ink); color: var(--chalk); font-weight: 600; font-size: var(--fs-md);
  box-shadow: var(--shadow-float); cursor: pointer; transition: transform var(--dur-1) var(--ease);
}
.fab .i { width: 22px; height: 22px; }
.fab:active { transform: scale(.95); }
.list-plain { margin: var(--sp-2) 0 0; padding-left: 18px; font-size: var(--fs-sm); }
.list-plain li + li { margin-top: var(--sp-1); }

/* ============ 10. Профиль ============ */
details.card, details.card.flat { padding: 0; }
details.card.flat > summary { min-height: 52px; padding: var(--sp-2) var(--sp-3); }
details.card.flat > .body { padding: 0 var(--sp-3) var(--sp-3); }
details.card + details.card { margin-top: var(--sp-3); }
details.card > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--sp-3);
  min-height: 60px; padding: var(--sp-3) var(--sp-4); font-weight: 600; border-radius: var(--r-card);
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary .sum-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); flex: none; }
details.card > summary .sum-t { flex: 1; min-width: 0; }
details.card > summary .sum-t small { display: block; font-weight: 400; font-size: var(--fs-xs); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
details.card > summary::after { content: ''; width: 10px; height: 10px; margin-right: 4px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg) translateY(-3px); transition: transform var(--dur-2) var(--ease); flex: none; }
details.card[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
details.card > .body { padding: 0 var(--sp-4) var(--sp-4); }
.palette { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.palette .sw { width: 100%; height: auto; aspect-ratio: 1; border-radius: 10px; border: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.selfie-wrap { position: relative; border-radius: var(--r-item); overflow: hidden; cursor: crosshair; background: var(--surface-2); }
.selfie-wrap canvas { width: 100%; display: block; }
.marker { position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.4); pointer-events: none; }
.metric { display: grid; grid-template-columns: 96px 1fr 96px; gap: var(--sp-2); align-items: center; font-size: var(--fs-xs); color: var(--ink-2); }
.metric .track { height: 6px; background: var(--surface-2); border-radius: var(--r-pill); position: relative; }
.metric .dot { position: absolute; top: -5px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.metric span:last-child { text-align: right; }
.size-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.size-table td, .size-table th { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.size-table th { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 600; }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); min-height: var(--tap); }
.shape-ic { font-size: 28px; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); flex: none; }

/* ============ 11. Чат ============ */
.chat-screen { display: flex; flex-direction: column; min-height: calc(100dvh - 56px - var(--safe-t) - var(--nav-total) - 100px); }
.chat { display: flex; flex-direction: column; gap: var(--sp-3); flex: 1; padding-bottom: var(--sp-3); }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 18px; font-size: var(--fs-md); overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--ink); color: var(--chalk); border-bottom-right-radius: 6px; }
.msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg img { border-radius: 12px; max-height: 200px; margin-bottom: var(--sp-2); }
.msg p + p, .msg ul, .msg ol, .msg h3, .msg h4 { margin-top: var(--sp-2); }
.msg ul, .msg ol { padding-left: 20px; margin-bottom: 0; }
.msg h3, .msg h4 { font-size: var(--fs-md); font-weight: 700; }
.msg-error { margin-top: var(--sp-2); padding-top: var(--sp-2); border-top: 1px solid var(--line); font-size: var(--fs-sm); color: var(--bad); }
.msg-error .btn { margin-top: var(--sp-2); }
.composer {
  position: sticky; bottom: var(--nav-total); z-index: 8;
  margin: 0 calc(-1 * var(--gutter)); padding: var(--sp-2) var(--gutter);
  background: var(--chalk); border-top: 1px solid var(--line);
}
.composer .row { align-items: flex-end; }
.composer textarea { min-height: var(--tap); max-height: 140px; border-radius: 22px; padding: 11px 16px; }
.composer-preview { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2); font-size: var(--fs-sm); }
.composer-preview img { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; }
.suggest { display: flex; flex-direction: column; gap: var(--sp-2); }
.suggest .chip { justify-content: flex-start; white-space: normal; text-align: left; min-height: var(--tap); padding: var(--sp-2) var(--sp-4); }
.typing::after { content: ''; display: inline-block; width: 8px; height: 1em; margin-left: 2px; vertical-align: text-bottom; background: currentColor; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* тренды */
.trend .stage { font-size: var(--fs-xs); font-weight: 700; }
.fitbar { height: 6px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; margin-top: var(--sp-1); }
.fitbar > div { height: 100%; background: var(--accent); }
.fitbar.low > div { background: var(--warn); }

/* поводы с иконками */
.chip .i { width: 16px; height: 16px; flex: none; }

/* «Как считалась оценка» в карточке образа */
.why { margin-top: var(--sp-3); font-size: var(--fs-sm); }
.why > summary { cursor: pointer; color: var(--ink-2); font-weight: 600; min-height: var(--tap); display: flex; align-items: center; list-style: none; }
.why > summary::-webkit-details-marker { display: none; }
.why > summary::after { content: ''; width: 8px; height: 8px; margin-left: var(--sp-2); border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform var(--dur-1) var(--ease); }
.why[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.why .part .fitbar { margin-top: 2px; }

/* поле, которое стоит проверить после распознавания ИИ */
.field.check select, .field.check input { border-color: var(--warn); box-shadow: 0 0 0 2px var(--warn-soft); }
.end { justify-content: flex-end; }

/* ============ 12. Состояния: пусто, загрузка, ошибка ============ */
.state { text-align: center; padding: var(--sp-7) var(--sp-5); }
.state .state-ic { width: 64px; height: 64px; margin: 0 auto var(--sp-4); border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink); }
.state .state-ic .i { width: 28px; height: 28px; }
.state.error .state-ic { background: var(--bad-soft); color: var(--bad); }
.state h2 { margin-bottom: var(--sp-2); }
.state p { color: var(--ink-2); max-width: 34ch; margin: 0 auto; }
.state .actions { justify-content: center; }
.spinner { width: 18px; height: 18px; border: 2px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { border-radius: var(--r-card); background: linear-gradient(90deg, var(--surface-2) 0, var(--surface) 50%, var(--surface-2) 100%) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.boot { padding-top: var(--sp-2); }
.boot .skeleton + .skeleton { margin-top: var(--sp-3); }
.loading-line { display: flex; align-items: center; gap: var(--sp-3); color: var(--ink-2); font-size: var(--fs-sm); }

/* ============ 13. Листы, диалоги, тосты ============ */
.modal-back { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: var(--scrim); animation: fade var(--dur-2) var(--ease); }
.modal {
  width: 100%; max-width: calc(var(--col) + 2 * var(--gutter)); max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--chalk); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  padding: var(--sp-2) var(--gutter) calc(var(--sp-6) + var(--safe-b));
  animation: sheet-up var(--dur-3) var(--ease); box-shadow: var(--shadow-float);
}
.modal::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 0 auto var(--sp-3); opacity: .6; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.modal-foot { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-5); }
.modal.dialog { max-width: 400px; }
.modal.dialog p { color: var(--ink-2); margin-top: var(--sp-2); }
.modal.dialog .modal-foot { flex-direction: column-reverse; align-items: stretch; }
.modal.dialog::before { display: none; }
.modal.dialog { padding-top: var(--sp-6); }
.modal.dialog .btn.danger { background: var(--bad); color: var(--surface); border-color: var(--bad); }
.desk-only { display: none !important; }
@keyframes fade { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: .3; } }
@media (min-width: 600px) {
  .modal-back { align-items: center; padding: var(--sp-6); }
  .modal { border-radius: var(--r-sheet); padding-bottom: var(--sp-6); }
  .modal::before { display: none; }
  .modal-head { margin-top: var(--sp-2); }
  .modal.dialog .modal-foot { flex-direction: row; justify-content: flex-end; }
}

#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-total) + var(--sp-4)); z-index: 60;
  display: flex; align-items: center; gap: var(--sp-3);
  width: max-content; max-width: min(440px, calc(100vw - 2 * var(--gutter))); min-height: 48px; padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4);
  background: var(--ink); color: var(--chalk); border-radius: var(--r-item); font-size: var(--fs-sm); font-weight: 500;
  box-shadow: var(--shadow-float);
  opacity: 0; pointer-events: none; transform: translate(-50%, 12px);
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
#toast:not(.has-action) { padding-right: var(--sp-4); }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast .toast-msg { flex: 1; }
#toast .toast-act { border: 0; background: none; color: var(--tape); font-weight: 700; min-height: var(--tap); padding: 0 var(--sp-3); cursor: pointer; border-radius: var(--r-field); }

/* ============ 14. Знакомство (первый запуск) ============ */
.ob { position: fixed; inset: 0; z-index: 40; background: var(--chalk); overflow-y: auto; overscroll-behavior: contain; animation: fade var(--dur-2) var(--ease); }
.ob-inner { max-width: calc(var(--col) + 2 * var(--gutter)); min-height: 100%; margin: 0 auto; display: flex; flex-direction: column; padding: calc(var(--sp-3) + var(--safe-t)) var(--gutter) calc(var(--sp-4) + var(--safe-b)); }
.ob-top { display: flex; align-items: center; gap: var(--sp-3); }
.ob-top .tape { flex: 1; }
.ob-step { font-size: var(--fs-xs); color: var(--ink-3); white-space: nowrap; }
.ob-body { flex: 1; padding: var(--sp-6) 0 var(--sp-4); animation: view-in var(--dur-3) var(--ease); }
.ob-body h1 { font-size: var(--fs-3xl); }
.ob-lead { font-size: var(--fs-lg); color: var(--ink-2); margin-top: var(--sp-3); line-height: 1.45; }
.ob-mark { width: 72px; height: 72px; margin-bottom: var(--sp-6); }
.ob-points { list-style: none; margin: var(--sp-6) 0 0; padding: 0; }
.ob-points li { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) 0; border-top: 1px solid var(--line); }
.ob-points li:last-child { border-bottom: 1px solid var(--line); }
.ob-points .i { width: 24px; height: 24px; margin-top: 1px; color: var(--accent); }
.ob-points b { display: block; font-weight: 600; }
.ob-points span { color: var(--ink-2); font-size: var(--fs-sm); }
.ob-foot { position: sticky; bottom: 0; display: flex; flex-direction: column; gap: var(--sp-2); padding-top: var(--sp-3); background: linear-gradient(to bottom, transparent, var(--chalk) 30%); }
.ob-choice { display: grid; gap: var(--sp-2); margin-top: var(--sp-5); }
.ob-choice .btn { justify-content: flex-start; min-height: 60px; padding: 0 var(--sp-4); border-radius: var(--r-item); background: var(--surface); border-color: var(--line); text-align: left; white-space: normal; }
.ob-choice .btn .i { color: var(--accent); }
.ob-choice .btn small { display: block; font-weight: 400; color: var(--ink-2); font-size: var(--fs-xs); }
.ob-done { color: var(--good); font-weight: 600; display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-4); }
.season-pick { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-2); margin-top: var(--sp-3); }
.season-pick .chip { white-space: normal; text-align: left; min-height: var(--tap); }

/* установка */
.install-card { display: flex; gap: var(--sp-3); align-items: center; }
.install-card .i { width: 28px; height: 28px; color: var(--accent); }

/* ============ 15. Адаптив ============ */
@media (max-width: 380px) {
  .wgrid { grid-template-columns: repeat(2, 1fr); }
  .grid3 { grid-template-columns: 1fr 1fr; }
  h1 { font-size: var(--fs-2xl); }
  .wx-temp { font-size: 38px; }
}

/* десктоп: навигация слева, контент — колонка */
@media (min-width: 900px) {
  :root { --nav-total: 0px; --gutter: 24px; }
  #app {
    max-width: 1040px; display: grid; column-gap: var(--sp-7);
    grid-template-columns: 208px minmax(0, var(--col));
    grid-template-rows: auto 1fr; grid-template-areas: "top top" "nav main";
    padding: 0 var(--gutter);
  }
  .topbar { grid-area: top; padding-left: 0; padding-right: 0; min-height: 72px; }
  main { grid-area: main; padding-left: 0; padding-right: 0; padding-bottom: var(--sp-8); }
  .tabbar {
    grid-area: nav; position: sticky; top: 72px; align-self: start; z-index: 1;
    display: flex; flex-direction: column; gap: var(--sp-1);
    padding: var(--sp-2) 0; background: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .tabbar button { flex-direction: row; justify-content: flex-start; gap: var(--sp-3); min-height: 48px; padding: 0 var(--sp-4); border-radius: var(--r-field); font-size: var(--fs-md); }
  .tabbar button:hover { background: var(--surface-2); }
  .tabbar button[aria-current="page"] { background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
  .tabbar button[aria-current="page"]::before { top: 50%; left: 0; width: 5px; height: 28px; margin: -14px 0 0; border-radius: 0 3px 3px 0;
    background: repeating-linear-gradient(180deg, var(--tape-ink) 0 1px, transparent 1px 4px) right / 2px 100% no-repeat, var(--tape); }
  .fab { display: none; }
  .desk-only { display: inline-flex !important; }
  .composer { margin: 0; padding-left: 0; padding-right: 0; bottom: 0; }
  .chips { margin: 0; padding-left: 0; padding-right: 0; }
  .modal { max-width: 560px; }
  .modal.dialog { max-width: 420px; }
}
@media (min-width: 900px) and (hover: hover) {
  .wgrid { grid-template-columns: repeat(4, 1fr); }
}

/* ============ 16. Меньше движения ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .spinner { animation: spin 1.6s linear infinite !important; }
}
