/* FitCast: one phone-width column. People → weather → where/when/style → outfit. Sheets are <dialog>s. */
:root {
  --bg: #f4f6fb; --surface: #ffffff; --surface-2: #e9eef7; --ink: #121826; --muted: #5d6578; --line: #dde3ee;
  --accent: #1f55d6; --accent-ink: #ffffff; --accent-soft: #e3ebfc; --brand-2: #2b9bf0; --warn: #b4472f; --good: #2d6b52;
  --radius: 18px; --shadow: 0 1px 2px rgba(40, 30, 20, .05), 0 6px 20px rgba(40, 30, 20, .06);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --display: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141d; --surface: #182030; --surface-2: #212b3d; --ink: #eef2f9; --muted: #9aa5b9; --line: #2a3448;
    --accent: #5fa8ff; --accent-ink: #0b1430; --accent-soft: #1d2c4a; --brand-2: #4fb3ff; --warn: #f08a70; --good: #7fcfaa;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font);
  padding: env(safe-area-inset-top, 0px) 16px calc(24px + env(safe-area-inset-bottom, 0px));
}
.wrap { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; padding-block: 12px; }
h1, h2 { margin: 0; font-family: var(--display); line-height: 1.15; }
h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.word span { color: var(--brand-2); }
.brand { display: flex; align-items: center; gap: 8px; font-style: italic; }
.brand img { border-radius: 9px; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
svg { display: block; }
button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.place {
  display: inline-flex; align-items: center; gap: 6px; max-width: 60%; min-height: 40px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px 6px 10px;
}
.place span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .92rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.label { font: 700 .78rem/1 var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.field + .field { margin-top: 18px; }

/* People */
.people-list { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; }
.people-list::-webkit-scrollbar { display: none; }
.person {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 68px;
  background: none; border: 0; padding: 0; font-size: .8rem; font-weight: 600; color: var(--muted);
}
.person .face { width: 56px; height: 56px; border-radius: 50%; background: var(--surface-2); border: 2px solid transparent; overflow: hidden; }
.person .face svg { width: 100%; height: 100%; }
.person[aria-checked="true"] { color: var(--ink); }
.person[aria-checked="true"] .face { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.person .nm { max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person.add .face { display: grid; place-items: center; border: 2px dashed var(--line); background: none; color: var(--muted); font-size: 1.6rem; font-weight: 400; }

.share-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 2px; }
.link-btn { background: none; border: 0; padding: 6px 0; min-height: 32px; color: var(--accent); font-weight: 600; font-size: .85rem; }

/* Weather */
.wx-empty { color: var(--muted); }
.wx { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: center; }
.wx-icon { grid-row: span 2; width: 56px; height: 56px; color: var(--accent); }
.wx-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.wx-temp { font: 800 1.9rem/1 var(--display); letter-spacing: -.02em; }
.wx-temp small { font: 600 .95rem var(--font); color: var(--muted); letter-spacing: 0; }
.wx-desc { color: var(--muted); font-size: .95rem; }
.wx-chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip-s { font-size: .82rem; font-weight: 600; background: var(--surface-2); border-radius: 999px; padding: 4px 10px; }
.chip-s.alert { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.wx-err { color: var(--warn); display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* Tiles, segmented, chips */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tiles .tile:last-child:nth-child(odd) { grid-column: span 2; }
.warmth { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tile {
  display: flex; align-items: center; gap: 10px; min-height: 52px; text-align: left; padding: 10px 12px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: .92rem; line-height: 1.2;
}
.tile svg { flex: 0 0 22px; width: 22px; height: 22px; }
.tile[aria-checked="true"], .seg button[aria-checked="true"], .chips button[aria-checked="true"] {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { flex: 1; min-height: 38px; border: 1px solid transparent; background: none; border-radius: 9px; font-weight: 600; font-size: .9rem; padding: 4px 6px; }
.seg.small button { min-height: 32px; padding: 2px 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { min-height: 36px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: .88rem; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 36px; height: 36px; border-radius: 50%; padding: 0; border: 2px solid var(--line); background: none; overflow: hidden; }
.swatches button svg { width: 100%; height: 100%; }
.swatches button[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Style slider */
.style-name { font-size: .88rem; color: var(--muted); text-align: right; }
input[type=range] { width: 100%; -webkit-appearance: none; appearance: none; background: none; height: 32px; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--surface-2), var(--accent)); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--surface-2), var(--accent)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 2px 6px rgba(0,0,0,.18); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.ticks { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); font-weight: 600; }

/* Outfit */
.fit-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.fit-head h2 { font-size: 1.25rem; font-weight: 800; }
.eyebrow { margin: 0 0 2px; font-size: .82rem; color: var(--muted); font-weight: 600; }
.ghost { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: .85rem; min-height: 36px; }
.fit-body { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 14px; margin-top: 12px; align-items: start; }
.figure { background: radial-gradient(ellipse at 50% 40%, var(--surface-2), transparent 70%); border-radius: 14px; color: var(--ink); }
.stage { position: relative; width: 100%; aspect-ratio: 144 / 392; }
.stage .layer { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Image layers are full 200×400 figure canvases; the stage shows the 28,8 → 172,400 crop. */
.stage .art { inset: auto; left: -19.444%; top: -2.041%; width: 138.889%; height: 102.041%; transform-origin: 0 0; object-fit: fill; }
.figure > svg { width: 100%; height: auto; }
.fig-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.fig-col .figure { width: 100%; }
.coat-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; min-height: 34px; font-size: .82rem; font-weight: 600; }
.coat-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.pieces { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pieces li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; }
.pieces svg { width: 22px; height: 22px; margin-top: 1px; }
.pieces .nm { font-weight: 600; font-size: .95rem; line-height: 1.25; }
.pieces .tag { display: block; font-size: .76rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.feedback { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; font-size: .88rem; color: var(--muted); font-weight: 600; }
.feedback span { margin-right: auto; }
.thumb { width: 44px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; }
.thumb svg { width: 20px; height: 20px; }
.thumb:active { background: var(--accent-soft); }
.fb-msg { min-height: 1.2em; margin: 4px 0 0; font-size: .85rem; color: var(--good); text-align: right; }
.chips button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.row-links { display: flex; gap: 14px; flex-wrap: wrap; }
.notes { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.notes li { background: var(--accent-soft); border-radius: 12px; padding: 8px 12px; font-size: .9rem; }
.norm { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .9rem; color: var(--muted); }
.norm p { margin: 0 0 6px; }
.norm strong { color: var(--ink); }

.foot { text-align: center; font-size: .8rem; color: var(--muted); }
.foot a { color: inherit; }
.foot .ver { margin-top: 4px; font-size: .72rem; opacity: .7; }

/* Buttons */
.primary { border: 0; background: var(--accent); color: var(--accent-ink); border-radius: 12px; padding: 10px 16px; font-weight: 700; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.primary.wide { width: 100%; }
.primary:disabled { opacity: .55; }
.danger-link { background: none; border: 0; color: var(--warn); font-weight: 600; padding: 8px 0; text-decoration: underline; text-underline-offset: 3px; }

/* Dialogs as bottom sheets */
dialog {
  width: min(560px, 100%); max-width: 100%; max-height: 92dvh; margin: auto auto 0; padding: 0 0 env(safe-area-inset-bottom, 0px);
  border: 0; border-radius: 22px 22px 0 0; background: var(--surface); color: var(--ink); overflow: auto;
}
dialog::backdrop { background: rgba(10, 8, 5, .45); }
@media (min-width: 600px) { dialog { margin: auto; border-radius: 22px; } }
.sheet { padding: 0 16px 16px; }
form.sheet { padding-bottom: 0; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 0 10px; }
.sheet-head h2 { font-size: 1.2rem; }
.x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface-2); font-size: 1.3rem; line-height: 1; }
.or { text-align: center; color: var(--muted); font-size: .85rem; margin: 12px 0 8px; }
.search { display: flex; gap: 8px; }
.search input, .field-inline input {
  flex: 1; min-width: 0; min-height: 44px; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 8px 12px; font-size: 16px;
}
.msg { min-height: 1.2em; font-size: .88rem; color: var(--muted); margin: 8px 0; }
.msg.err { color: var(--warn); }
.results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.results button { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 12px; min-height: 48px; }
.results .rg { display: block; font-size: .82rem; color: var(--muted); }
.settings { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.settings .danger-link { align-self: flex-start; }

/* Welcome */
dialog.welcome { margin: auto; border-radius: 24px; width: min(440px, calc(100% - 24px)); }
.welcome-body { padding: 28px 22px 22px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.welcome-logo { border-radius: 20px; box-shadow: 0 8px 24px rgba(31, 85, 214, .35); }
.welcome-body h2 { font-size: 1.9rem; font-weight: 800; font-style: italic; }
.welcome-tag { margin: 0; color: var(--muted); font-size: .98rem; }
.steps { list-style: none; padding: 0; margin: 8px 0 4px; display: flex; flex-direction: column; gap: 12px; text-align: left; width: 100%; }
.steps li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; background: var(--surface-2); border-radius: 14px; padding: 12px; }
.steps .num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.steps strong { display: block; font-size: .98rem; }
.steps .how { display: block; color: var(--muted); font-size: .88rem; margin-top: 2px; }
.share-ic { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.welcome-privacy { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 4px 0 6px; font-size: .85rem; color: var(--muted); }
.welcome-privacy svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: var(--good); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.builder { display: flex; flex-direction: column; gap: 14px; }
.preview { width: 120px; height: 120px; margin: 0 auto; border-radius: 50%; background: var(--surface-2); overflow: hidden; }
.preview svg { width: 100%; height: 100%; }
.field-inline { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .9rem; }
.hint { color: var(--muted); font-weight: 400; }
.opt .label { display: block; margin-bottom: 8px; }
.row-end { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 4px; }

@media (max-width: 360px) {
  .fit-body { grid-template-columns: 1fr; }
  .figure { max-width: 200px; margin: 0 auto; width: 100%; }
}
/* Idle animation: a slow breath and a blink. Turned off when the phone asks for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .figure .stage { animation: pop .3s ease-out, breathe 4.2s ease-in-out .3s infinite; transform-origin: 50% 100%; }
  .eye { transform-box: fill-box; transform-origin: 50% 50%; animation: blink 5.5s infinite; }
  .person:nth-child(2n) .eye { animation-delay: 1.7s; }
  @keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
  @keyframes breathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.008) translateY(-1px); } }
  @keyframes tilt { 0%, 100% { transform: rotate(0deg); } 30% { transform: rotate(-2deg); } 60% { transform: rotate(1.2deg); } }
  @keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 95.5% { transform: scaleY(.08); } }
}
