@font-face {
  font-family: "Bricolage";
  src: url("/fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  --paper: #F2F3F7;
  --card: #FFFFFF;
  --sunken: #E9EAF1;
  --ink: #1C1A33;
  --ink-2: #45435E;
  --muted: #706E88;
  --line: #DFDFE8;
  --cobalt: #2F5BEA;
  --cobalt-press: #2147C9;
  --on-cobalt: #FFFFFF;
  --cobalt-soft: #E2E8FD;
  --good: #0B7F57;
  --bad: #B8470F;
  --danger: #BE2639;
  --shade: rgba(20, 18, 40, 0.42);
  --display: "Bricolage", "Avenir Next Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-sheet: 26px;
  --r-panel: 18px;
  --r-field: 12px;
  --r-thumb: 10px;
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #11111A;
    --card: #1A1A26;
    --sunken: #232333;
    --ink: #ECEBF6;
    --ink-2: #C5C3D8;
    --muted: #9A98B2;
    --line: #2C2C3E;
    --cobalt: #7B98FF;
    --cobalt-press: #9BB0FF;
    --on-cobalt: #0E1230;
    --cobalt-soft: #222B52;
    --good: #46C995;
    --bad: #F08A55;
    --danger: #FF6B7D;
    --shade: rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--cobalt); }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--cobalt); outline-offset: 2px; border-radius: 6px; }

.num { font-variant-numeric: tabular-nums; }

/* ---------- boot ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--paper); z-index: 50; }
.boot-mark { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--cobalt-soft); border-top-color: var(--cobalt); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.view {
  max-width: 1080px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 12px) 16px calc(var(--tabbar-h) + var(--safe-b) + 32px);
  outline: none;
}
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; margin-bottom: 8px; }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.wordmark svg { width: 26px; height: 26px; }
h1.page-title { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1.1; letter-spacing: -0.015em; margin: 0; }
h2.section-title { font-family: var(--display); font-weight: 650; font-size: 20px; line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.offline-banner { background: var(--sunken); color: var(--ink-2); border-radius: var(--r-field); padding: 10px 14px; font-size: 14px; margin-bottom: 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 600; font-size: 15.5px; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--cobalt); color: var(--on-cobalt); }
.btn-primary:hover { background: var(--cobalt-press); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-quiet { background: var(--sunken); color: var(--ink); }
.btn-outline { border-color: var(--line); background: var(--card); color: var(--ink); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.link-btn { background: none; border: 0; padding: 6px 0; color: var(--cobalt); font-weight: 600; font-size: 15px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--ink);
  display: inline-grid; place-items: center;
}
.icon-btn:hover { background: var(--sunken); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- segmented control ---------- */
.seg { display: inline-flex; background: var(--sunken); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; border-radius: 999px; padding: 6px 13px; min-height: 34px;
  font-size: 14px; font-weight: 600; color: var(--muted);
}
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(20,18,40,.12); }

/* ---------- hero ---------- */
.hero { padding: 6px 2px 2px; }
.hero-weight { display: flex; align-items: baseline; gap: 8px; }
.hero-num {
  font-family: var(--display); font-weight: 700; font-stretch: 75%;
  font-size: clamp(76px, 24vw, 128px); line-height: 0.88; letter-spacing: -0.012em;
  font-variant-numeric: tabular-nums;
}
.hero-unit { font-family: var(--display); font-size: 24px; font-weight: 600; color: var(--muted); }
.hero-sub { margin: 10px 0 0; font-size: 17px; color: var(--ink-2); }
.hero-sub strong { color: var(--ink); font-weight: 650; }
.hero-sub strong.delta-good { color: var(--good); }
.hero-sub strong.delta-bad { color: var(--bad); }
.delta-good { color: var(--good); }
.delta-bad { color: var(--bad); }

/* ---------- the tape (signature) ---------- */
.tape-wrap { margin: 22px 0 6px; }
.tape {
  position: relative; height: 66px; border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  overflow: hidden;
}
.tape-minor { position: absolute; top: 0; width: 1px; height: 12px; background: var(--muted); opacity: .55; }
.tape-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: var(--pct);
  background: var(--cobalt-soft);
  border-right: 2.5px solid var(--cobalt);
  transition: width .8s cubic-bezier(.2,.8,.2,1);
}
.tape-majors { position: absolute; inset: 0; }
.tape-major { position: absolute; top: 0; width: 1.5px; height: 24px; background: var(--ink-2); }
.tape-major span {
  position: absolute; top: 27px; left: 50%; transform: translateX(-50%);
  font-family: var(--display); font-stretch: 85%; font-size: 13px; font-weight: 600; color: var(--ink-2);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.tape-marker {
  position: absolute; bottom: 7px; left: var(--pct); transform: translateX(-50%);
  background: var(--cobalt); color: var(--on-cobalt); font-weight: 700; font-size: 12.5px;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums;
  transition: left .8s cubic-bezier(.2,.8,.2,1);
}
.tape-ends { display: flex; justify-content: space-between; margin-top: 8px; font-size: 14px; color: var(--muted); }
.tape-ends b { color: var(--ink); font-weight: 650; }
.goal-cta {
  margin: 22px 0 6px; padding: 16px; border: 1.5px dashed var(--line); border-radius: var(--r-panel);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ink-2);
}

/* ---------- panels ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-panel); }
.chart-panel { padding: 14px 10px 6px 6px; margin-top: 26px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 4px 6px 12px; flex-wrap: wrap; }
.chart-head .range-change { font-size: 15px; color: var(--ink-2); }
.chart-head .range-change b { color: var(--ink); }
.chart { position: relative; height: 250px; touch-action: pan-y; }
.chart:focus-visible { outline-offset: -2px; }
.chart-svg { display: block; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11.5px; font-family: var(--body); font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--cobalt); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area-stop-top { stop-color: var(--cobalt); stop-opacity: .18; }
.chart .area-stop-bottom { stop-color: var(--cobalt); stop-opacity: 0; }
.chart .dot { fill: var(--card); stroke: var(--cobalt); stroke-width: 2; }
.chart .dot-photo { fill: var(--cobalt); stroke: var(--card); stroke-width: 2; }
.chart .goal-line { stroke: var(--ink-2); stroke-width: 1.5; stroke-dasharray: 5 5; opacity: .6; }
.chart .goal-label { fill: var(--ink-2); font-size: 11.5px; font-weight: 600; }
.chart .guide { stroke: var(--ink); stroke-width: 1; opacity: .25; }
.chart .dot-active { fill: var(--cobalt); stroke: var(--card); stroke-width: 3; }
.chart-tip {
  position: absolute; z-index: 2; pointer-events: auto;
  background: var(--ink); color: var(--paper); border-radius: 12px; padding: 8px 10px;
  font-size: 13px; line-height: 1.35; display: flex; gap: 10px; align-items: center;
  box-shadow: 0 6px 20px rgba(10, 8, 30, .22); max-width: 240px;
}
.chart-tip b { font-size: 16px; font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-tip button { padding: 0; border: 0; background: none; border-radius: 6px; flex: none; }
.chart-tip img { width: 40px; height: 52px; object-fit: cover; border-radius: 6px; }
.chart-empty { height: 210px; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 20px; }
.chart-legend { display: flex; gap: 16px; padding: 4px 12px 8px; font-size: 13px; color: var(--muted); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.chart-legend .lg-photo { background: var(--cobalt); }
.chart-legend .lg-goal { width: 16px; height: 0; border-top: 2px dashed var(--ink-2); border-radius: 0; opacity: .6; vertical-align: 3px; }

/* ---------- stats ---------- */
.stats {
  display: grid; grid-template-columns: 1fr 1fr; margin-top: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden;
}
.stat { padding: 14px 16px; border-top: 1px solid var(--line); }
.stat:nth-child(-n+2) { border-top: 0; }
.stat:nth-child(odd) { border-right: 1px solid var(--line); }
.stat dt { font-size: 13.5px; color: var(--muted); }
.stat dd { margin: 2px 0 0; font-family: var(--display); font-weight: 650; font-size: 22px; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat dd small { font-family: var(--body); font-size: 13px; font-weight: 500; color: var(--muted); display: block; letter-spacing: 0; }

/* ---------- photo strip / grid ---------- */
.strip { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; padding: 0 16px 4px; margin: 0 -16px; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip .tile { flex: 0 0 34%; max-width: 150px; scroll-snap-align: start; }
.tile { border: 0; padding: 0; background: none; text-align: left; color: inherit; }
.tile-img { aspect-ratio: 3 / 4; border-radius: var(--r-thumb); overflow: hidden; background: var(--sunken); position: relative; }
.tile-img img { width: 100%; height: 100%; object-fit: cover; }
.tile-cap { margin-top: 6px; font-size: 13px; line-height: 1.3; }
.tile-cap b { font-weight: 650; font-variant-numeric: tabular-nums; }
.tile-cap span { color: var(--muted); display: block; }
.pose-tag { position: absolute; left: 6px; bottom: 6px; background: rgba(15, 14, 30, .62); color: #fff; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; backdrop-filter: blur(4px); }
.grid-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 10px; }
.month-label { font-family: var(--display); font-weight: 650; font-size: 17px; margin: 24px 0 10px; }
.photo-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 4px; }
.photo-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.empty { text-align: center; padding: 40px 20px; border: 1.5px dashed var(--line); border-radius: var(--r-panel); color: var(--ink-2); margin-top: 16px; }
.empty h3 { font-family: var(--display); font-size: 21px; margin: 0 0 6px; color: var(--ink); }
.empty p { margin: 0 auto 18px; max-width: 36ch; }

/* ---------- history ---------- */
.hist-month { margin-top: 22px; }
.hist-month h3 { font-family: var(--display); font-weight: 650; font-size: 17px; margin: 0 0 8px; display: flex; justify-content: space-between; align-items: baseline; }
.hist-month h3 > span { font-family: var(--body); font-size: 13.5px; font-weight: 500; color: var(--muted); }
.hist-list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; }
.hist-row { width: 100%; display: grid; grid-template-columns: 1fr auto 64px; gap: 4px 12px; align-items: center; padding: 12px 16px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; }
.hist-list li:first-child .hist-row { border-top: 0; }
.hist-row:hover { background: var(--sunken); }
.hist-date { font-size: 15px; }
.hist-date .cam { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 13px; margin-left: 6px; vertical-align: 1px; }
.hist-date .cam svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.hist-w { font-family: var(--display); font-weight: 650; font-size: 18px; font-variant-numeric: tabular-nums; }
.hist-d { text-align: right; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--muted); }
.hist-note { grid-column: 1 / -1; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- settings ---------- */
.set-group { margin-top: 26px; }
.set-group > h2 { margin-bottom: 10px; }
.set-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 16px; display: grid; gap: 16px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.set-row > div:first-child { min-width: 0; }
.set-row p { margin: 2px 0 0; }
.set-card hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
.inline-fields { display: flex; gap: 8px; align-items: center; }
.inline-fields .field { width: 110px; }

/* ---------- forms ---------- */
.field-label { display: block; font-size: 14px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--r-field);
  border: 1.5px solid var(--line); background: var(--card); font-size: 16px; color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
.field:focus { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-soft); }
textarea.field { min-height: 72px; resize: vertical; }
.field-unit { position: relative; }
.field-unit .field { padding-right: 46px; }
.field-unit > span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.weight-field .field { font-family: var(--display); font-size: 30px; font-weight: 700; min-height: 64px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.weight-field > span { font-size: 17px; }
.form-grid { display: grid; gap: 16px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 13.5px; color: var(--muted); margin: 6px 0 0; }
.error { color: var(--danger); font-size: 14px; margin: 6px 0 0; }
input[type="date"].field { min-height: 48px; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }

/* ---------- sheets (dialog) ---------- */
dialog.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px;
  max-height: calc(100dvh - 24px); background: var(--card); color: var(--ink);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: 0 -10px 40px rgba(10, 8, 30, .18);
  overflow: hidden;
}
dialog.sheet[open] { display: flex; flex-direction: column; animation: sheet-in .28s cubic-bezier(.2,.8,.2,1); }
dialog.sheet::backdrop { background: var(--shade); animation: fade-in .2s; }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 12px 6px 20px; gap: 12px; }
.sheet-head h2 { font-family: var(--display); font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.sheet-body { padding: 8px 20px 20px; overflow-y: auto; }
.sheet-foot { padding: 12px 20px calc(16px + var(--safe-b)); border-top: 1px solid var(--line); display: grid; gap: 10px; background: var(--card); }
.sheet-grip { width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; }

@media (min-width: 720px) {
  dialog.sheet { margin: auto; border-radius: var(--r-sheet); max-height: min(86dvh, 860px); }
  dialog.sheet .sheet-grip { display: none; }
}

.choice-list { display: grid; gap: 10px; padding-bottom: 6px; }
.choice {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; width: 100%;
  border: 1.5px solid var(--line); border-radius: 16px; background: var(--card); text-align: left;
}
.choice:hover { border-color: var(--cobalt); }
.choice-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--cobalt-soft); color: var(--cobalt); flex: none; }
.choice-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.choice b { display: block; font-size: 16.5px; }
.choice span { font-size: 14px; color: var(--muted); }

/* upload previews */
.previews { display: flex; gap: 12px; overflow-x: auto; padding: 4px 0 8px; margin-bottom: 8px; }
.preview { flex: 0 0 auto; width: calc((100% - 24px) / 3); min-width: 98px; }
.preview .tile-img { border-radius: 12px; }
.preview .remove { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(15,14,30,.6); color: #fff; display: grid; place-items: center; }
.preview .remove svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2.4; fill: none; }
.pose-pick { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.pose-pick button { border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 3px 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pose-pick button[aria-pressed="true"] { border-color: var(--cobalt); background: var(--cobalt-soft); color: var(--cobalt); }
.existing-note { background: var(--cobalt-soft); color: var(--ink); border-radius: var(--r-field); padding: 10px 12px; font-size: 14px; margin-top: 8px; }

/* ---------- full-screen viewers ---------- */
dialog.full {
  border: 0; padding: 0; margin: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none;
  background: #0B0B12; color: #F1F0F8;
}
dialog.full[open] { display: flex; flex-direction: column; }
dialog.full::backdrop { background: #000; }
.full-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(var(--safe-t) + 8px) 8px 8px 16px; }
.full-head .icon-btn { color: #F1F0F8; }
.full-head .icon-btn:hover { background: rgba(255,255,255,.1); }
.full-title b { font-family: var(--display); font-size: 22px; font-variant-numeric: tabular-nums; }
.full-title span { display: block; font-size: 14px; color: #A9A7BF; }
.viewer-stage { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; touch-action: pan-y pinch-zoom; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; }
.viewer-nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.viewer-nav.prev { left: 12px; }
.viewer-nav.next { right: 12px; }
.full-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px calc(14px + var(--safe-b)); }
.full-foot .pose-pick button { background: transparent; border-color: rgba(255,255,255,.22); color: #C9C7DC; font-size: 13.5px; padding: 5px 12px; }
.full-foot .pose-pick button[aria-pressed="true"] { background: #F1F0F8; color: #14132A; border-color: #F1F0F8; }
.dark-btn { background: rgba(255,255,255,.1); color: #F1F0F8; border: 0; }
.dark-btn.danger { color: #FF8C9A; }

.compare-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 0 16px 10px; }
.compare-tools .seg { background: rgba(255,255,255,.1); }
.compare-tools .seg button { color: #B9B7CD; }
.compare-tools .seg button[aria-pressed="true"] { background: #F1F0F8; color: #14132A; }
.compare-stage { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 8px; }
.cmp-pane { display: flex; flex-direction: column; min-height: 0; }
.cmp-img { flex: 1; min-height: 0; border-radius: 12px; overflow: hidden; background: #1B1B28; border: 0; padding: 0; position: relative; }
.cmp-img img { width: 100%; height: 100%; object-fit: cover; }
.cmp-img .swap { position: absolute; right: 8px; bottom: 8px; background: rgba(10,10,20,.66); color: #fff; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.cmp-cap { padding: 8px 4px 0; font-size: 14px; color: #A9A7BF; }
.cmp-cap b { color: #F1F0F8; font-family: var(--display); font-size: 19px; font-variant-numeric: tabular-nums; display: block; }
.cmp-summary { text-align: center; padding: 12px 16px calc(16px + var(--safe-b)); font-size: 16px; color: #C9C7DC; }
.cmp-summary b { color: #F1F0F8; font-family: var(--display); font-size: 20px; }
.slider-stage { flex: 1; min-height: 0; position: relative; margin: 0 8px; border-radius: 12px; overflow: hidden; background: #1B1B28; touch-action: none; }
.slider-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.slider-stage .after { clip-path: inset(0 0 0 var(--split, 50%)); }
.slider-handle { position: absolute; top: 0; bottom: 0; left: var(--split, 50%); width: 3px; background: #fff; transform: translateX(-50%); pointer-events: none; }
.slider-handle::after { content: ""; position: absolute; top: 50%; left: 50%; width: 38px; height: 38px; transform: translate(-50%, -50%); border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
.slider-labels { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; pointer-events: none; }
.slider-labels span { background: rgba(10,10,20,.66); color: #fff; font-size: 12.5px; padding: 3px 9px; border-radius: 999px; font-weight: 600; }

.picker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.picker-grid .tile[aria-pressed="true"] .tile-img { outline: 3px solid var(--cobalt); outline-offset: 2px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px); display: grid; justify-items: center; gap: 8px; pointer-events: none; z-index: 60; padding: 0 16px; }
.toast { background: var(--ink); color: var(--paper); padding: 11px 16px; border-radius: 14px; font-size: 15px; max-width: 440px; box-shadow: 0 8px 26px rgba(10,8,30,.25); animation: toast-in .25s ease-out; pointer-events: auto; }
.toast.milestone { background: var(--cobalt); color: var(--on-cobalt); font-weight: 600; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr 1fr 72px 1fr 1fr; align-items: center;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding: 0 6px var(--safe-b);
  background: var(--card);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--line);
}
.tab { display: grid; justify-items: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 11.5px; font-weight: 600; padding: 8px 0; -webkit-tap-highlight-color: transparent; }
.tab svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--cobalt); }
.tab-add {
  justify-self: center; width: 58px; height: 58px; border-radius: 20px; border: 0;
  background: var(--cobalt); color: var(--on-cobalt); display: grid; place-items: center;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--cobalt) 40%, transparent);
  transform: translateY(-10px);
  -webkit-tap-highlight-color: transparent;
}
.tab-add:active { transform: translateY(-10px) scale(.95); }
.tab-add svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }

@media (min-width: 720px) {
  .tabbar { left: 50%; right: auto; transform: translateX(-50%); width: 480px; bottom: 16px; border-radius: 24px; border: 1px solid var(--line); height: var(--tabbar-h); padding: 0 6px; box-shadow: 0 8px 30px rgba(10,8,30,.12); }
  .toasts { bottom: calc(var(--tabbar-h) + 34px); }
}

/* ---------- drop zone ---------- */
.dropzone { position: fixed; inset: 12px; z-index: 70; border: 3px dashed var(--cobalt); border-radius: 24px; background: color-mix(in srgb, var(--cobalt-soft) 85%, transparent); display: grid; place-items: center; pointer-events: none; }
.dropzone p { font-family: var(--display); font-size: 26px; font-weight: 700; color: var(--cobalt); }

/* ---------- login ---------- */
.login { min-height: calc(100dvh - 60px); display: grid; place-items: center; }
.login-card { width: 100%; max-width: 380px; }
.login-card .wordmark { font-size: 24px; margin-bottom: 26px; }
.login-card .wordmark svg { width: 34px; height: 34px; }
.login-card h1 { font-family: var(--display); font-size: 40px; font-weight: 700; font-stretch: 85%; line-height: 1; letter-spacing: -0.02em; margin: 0 0 10px; }
.login-card p { color: var(--ink-2); margin: 0 0 22px; }
.setup-steps { padding-left: 20px; color: var(--ink-2); }
.setup-steps li { margin-bottom: 8px; }
.setup-steps code { background: var(--sunken); padding: 1px 6px; border-radius: 6px; font-size: 14px; }

/* ---------- desktop dashboard ---------- */
@media (min-width: 960px) {
  .view { padding-top: 28px; }
  .dash { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr); gap: 0 36px; align-items: start; }
  .dash-left { position: sticky; top: 24px; }
  .chart-panel { margin-top: 0; }
  .chart { height: 320px; }
  .grid-photos { grid-template-columns: repeat(5, 1fr); }
  .strip { margin: 0; padding-inline: 0; scroll-padding-inline: 0; }
  .strip .tile { flex-basis: 22%; }
  .picker-grid { grid-template-columns: repeat(4, 1fr); }
  .compare-stage { max-width: 960px; margin: 0 auto; width: 100%; }
  .slider-stage { max-width: 720px; margin: 0 auto; width: 100%; }
}
@media (min-width: 600px) and (max-width: 959px) {
  .grid-photos { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
