@font-face {
  font-family: "Inter Tight";
  src: url("/assets/fonts/inter-tight.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ground: #f3f1ec;
  --ink: #141414;
  --muted: #5f5b55;
  --strike: #6b665f;
  --line: #d6d2ca;
  --chip: #e6e2da;
  --card: #ffffff;
  --accent: #c8361b;
  --ok: #2f6b3a;
  --on-ink: #ffffff; /* text on ink-coloured buttons and pills */
  --radius: 24px;
  --font: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
}
/* Light unless chosen otherwise. Settings can pick dark, or "automatic" to follow the phone
   (data-theme on <html>, set in app.js). */
:root { color-scheme: light; }
:root[data-theme="system"] { color-scheme: light dark; }
:root[data-theme="dark"] { color-scheme: dark;
  --ground: #121110; --ink: #f3f1ec; --on-ink: #141414; --muted: #a8a29a; --strike: #8f8a83;
  --line: #36332f; --chip: #2a2724; --card: #1e1c1a; --accent: #e2583c; --ok: #6cbf75;
}
/* Black would vanish into the background: colour dots and bars get a light outline; the chosen
   option of a switch is lighter than its track, not darker. */
:root[data-theme="dark"] .legend .dot, :root[data-theme="dark"] .match-chip .dot, :root[data-theme="dark"] .swatch .dot { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.35); }
:root[data-theme="dark"] .palette { border: 1.5px solid rgba(255, 255, 255, 0.28); box-shadow: none; }
:root[data-theme="dark"] .segmented button[aria-pressed="true"] { background: #3a3632; box-shadow: none; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
  --ground: #121110; --ink: #f3f1ec; --on-ink: #141414; --muted: #a8a29a; --strike: #8f8a83;
  --line: #36332f; --chip: #2a2724; --card: #1e1c1a; --accent: #e2583c; --ok: #6cbf75;
  }
  :root[data-theme="system"] .legend .dot, :root[data-theme="system"] .match-chip .dot, :root[data-theme="system"] .swatch .dot { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.35); }
  :root[data-theme="system"] .palette { border: 1.5px solid rgba(255, 255, 255, 0.28); box-shadow: none; }
  :root[data-theme="system"] .segmented button[aria-pressed="true"] { background: #3a3632; box-shadow: none; }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

#app {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  gap: 16px;
}
.boot { margin: auto; color: var(--muted); }

/* ---------- type ---------- */
.wordmark { font-size: 28px; font-weight: 800; letter-spacing: -1px; line-height: 1; margin: 0; }
h1 { margin: 0; font-size: 34px; font-weight: 700; line-height: 1.08; letter-spacing: -1px; }
.lede { margin: 6px 0 0; font-size: 15px; line-height: 1.45; color: var(--muted); }
.small { font-size: 12px; color: var(--muted); text-align: center; margin: 0; }
.label { font-size: 14px; font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 56px; padding: 0 24px; border-radius: 28px; border: none;
  background: var(--ink); color: var(--on-ink); font-size: 16px; font-weight: 600; text-decoration: none;
}
.btn[aria-disabled="true"], .btn:disabled { opacity: 0.4; pointer-events: none; }
.btn.small-btn { height: 44px; font-size: 14px; padding: 0 18px; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.round {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none; padding: 0;
}
.round.ink { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.chip {
  height: 44px; padding: 0 14px; white-space: nowrap; border-radius: 22px; border: 1px solid var(--line);
  background: var(--card); display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600;
}
.topbar .chip { min-width: 0; }
.chip span { overflow: hidden; text-overflow: ellipsis; }
.badge-count {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--ground);
}
.icon { width: 20px; height: 20px; flex-shrink: 0; }

/* ---------- setup ---------- */
.progress { display: flex; flex-direction: column; gap: 10px; }
.progress-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; color: var(--muted); min-height: 24px; }
.progress-top a { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; color: var(--muted); }
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--chip); border-radius: 14px; }
.segmented button { height: 40px; border: none; border-radius: 10px; background: transparent; font-size: 14px; font-weight: 600; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(20, 20, 20, 0.12); }
.segmented.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.search {
  display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
}
.search:focus-within { border-color: var(--ink); color: var(--ink); }
.search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 16px; color: var(--ink); }
.picked { display: flex; flex-wrap: wrap; gap: 6px; }
.picked:empty { display: none; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 8px 0 12px; border-radius: 18px;
  border: none; background: var(--ink); color: var(--on-ink); font-size: 13px; font-weight: 600;
}
.tag .icon { width: 14px; height: 14px; }
.store-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.store {
  min-height: 56px; padding: 8px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left;
}
.store b { font-size: 15px; font-weight: 600; }
.store small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.store[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.store[aria-pressed="true"] small { color: #c9c5bd; }
.store .check { visibility: hidden; }
.store[aria-pressed="true"] .check { visibility: visible; }
.size-group { display: flex; flex-direction: column; gap: 8px; }
.size-head { display: flex; justify-content: space-between; align-items: baseline; }
.size-head span:last-child { font-size: 12px; color: var(--muted); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; } /* wraps, so the chosen one is always in view */
.pills::-webkit-scrollbar { display: none; }
.pill {
  flex: 1 0 auto; min-width: 48px; height: 44px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); font-size: 14px; font-weight: 600;
}
.pill[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.pill:disabled { border-style: dashed; color: var(--strike); text-decoration: line-through; cursor: default; }

/* Colour filter: a wrapping grid of swatches with a label under each. */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 10px 6px; }
.swatch {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  border: 0; background: none; padding: 2px 0; font-size: 12px; font-weight: 600; color: var(--muted);
}
.swatch .dot {
  width: 38px; height: 38px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  outline: 2px solid transparent; outline-offset: 3px;
  transition: outline-color 0.15s, transform 0.15s;
}
.swatch[aria-pressed="true"] { color: var(--ink); }
.swatch[aria-pressed="true"] .dot { outline-color: var(--ink); transform: scale(0.92); }
.taste-line { text-align: left; margin: 0; }
.bottom { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }

/* ---------- swipe ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
/* Filter chip and picks together on the right, so nothing floats in the middle. */
.topbar-end { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar .wordmark { flex: none; }
.topbar .picks-link, .topbar .filter-link { position: relative; }
.topbar .filter-link .icon { width: 20px; height: 20px; }
/* Red is for picks; the filter count is ink. */
.badge-count.ink { background: var(--ink); color: var(--on-ink); }
/* Every filter in force, in full, under the greeting; tap to change them. */
.filter-line {
  margin-top: -12px; font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.greeting { margin: -4px 0 0; font-size: 20px; font-weight: 700; letter-spacing: -0.4px; }
.greet-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 0; min-height: 40px; }
.greet-row .greeting { margin: 0; }
.settings-link { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); }
.settings-link:active { background: var(--chip); }
.optional { font-weight: 500; color: var(--muted); font-size: 12px; margin-left: 4px; }
.demo-note {
  font-size: 12px; color: var(--muted); background: var(--chip); border-radius: 12px; padding: 8px 12px; margin: 0;
}
/* Bottom margin leaves room for the card peeking out behind the top one. */
.deck { position: relative; flex-grow: 1; min-height: 440px; margin-bottom: 18px; }
.card {
  position: absolute; inset: 0; border-radius: var(--radius); overflow: hidden; background: var(--card);
  display: flex; flex-direction: column; box-shadow: 0 10px 30px rgba(20, 20, 20, 0.12);
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab;
  transition: transform 0.25s ease;
}
.card.dragging { transition: none; cursor: grabbing; }
.card.back { transform: translateY(18px) scale(0.94); transform-origin: 50% 100%; box-shadow: 0 1px 2px rgba(20, 20, 20, 0.06); pointer-events: none; }
.card.back .card-info { opacity: 0; }
/* While the top card flies off, the one behind grows into its place (see act() in app.js). */
.card.back.rising { transform: none; box-shadow: 0 10px 30px rgba(20, 20, 20, 0.12); transition: transform 0.24s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.24s; }
.card.back.rising .card-info { opacity: 1; transition: opacity 0.2s 0.05s; }
/* …and the new card behind it fades in where it rests. */
.card.back.arriving { animation: fade-in 0.3s ease both; }
.media { position: relative; flex-grow: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.placeholder { display: flex; flex-direction: column; align-items: center; gap: 10px; color: #3e3a35; font-size: 12px; font-weight: 500; text-transform: capitalize; }
.placeholder svg { width: 64px; height: 64px; }
.tags { position: absolute; top: 16px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center; gap: 8px; z-index: 1; }
.store-pill { background: #fff; color: #141414; font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; padding: 7px 12px; border-radius: 999px; }
.off-pill { background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; padding: 7px 12px; border-radius: 999px; }
.stamp {
  position: absolute; top: 72px; z-index: 1; border: 3px solid; background: rgba(255, 255, 255, 0.88);
  font-size: 26px; font-weight: 800; letter-spacing: 2px; padding: 4px 12px; border-radius: 8px; opacity: 0;
}
.stamp.save { left: 20px; transform: rotate(-12deg); color: var(--ink); }
.stamp.nope { right: 20px; transform: rotate(12deg); color: var(--strike); }
.card-info { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.card-name { font-size: 18px; font-weight: 600; line-height: 1.25; margin: 0; }
.prices { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.price { font-size: 22px; font-weight: 700; color: var(--accent); }
.price.full { color: var(--ink); }
.was { font-size: 15px; color: var(--strike); text-decoration: line-through; }
.fits { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ok); }
.fits svg { width: 16px; height: 16px; }
.actions { display: flex; align-items: center; justify-content: center; gap: 14px; }
.actions .skip { width: 60px; height: 60px; color: var(--muted); }
.actions .save { width: 72px; height: 72px; }
.actions .save .icon { width: 28px; height: 28px; }
.actions .round { width: 48px; height: 48px; }
.actions .skip, .actions .save { width: 60px; height: 60px; }
.actions .save { width: 72px; height: 72px; }
.empty {
  position: absolute; inset: 0; border-radius: var(--radius); border: 2px dashed var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 32px;
}
.empty h2 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.1; }
.empty p { margin: 0; font-size: 15px; color: var(--muted); max-width: 280px; line-height: 1.45; }
.error { color: var(--accent); }

/* ---------- detail sheet ---------- */
.sheet {
  width: 100%; max-width: 460px; max-height: 92dvh; margin: auto auto 0; padding: 0; border: none;
  border-radius: 24px 24px 0 0; background: var(--card); color: var(--ink); overflow: auto;
}
.sheet::backdrop { background: rgba(20, 20, 20, 0.45); }
.sheet .media { height: 360px; flex-grow: 0; }
.sheet-close { position: absolute; top: 16px; right: 16px; z-index: 2; border: none; }
.sheet-body { padding: 20px 22px max(24px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.sheet-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.sheet-meta b { color: var(--ink); letter-spacing: 1.2px; text-transform: uppercase; }
.sheet h2 { margin: 0; font-size: 22px; font-weight: 600; line-height: 1.2; }
.sheet .price { font-size: 26px; }
.size-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.size-grid .pill { min-width: 0; }
.sheet-actions { display: flex; gap: 10px; }
.sheet-actions .btn { flex-grow: 1; }
.sheet-actions .round { width: 56px; height: 56px; }
.saved-on { color: var(--accent); }
.saved-on svg { fill: currentColor; }

/* ---------- picks ---------- */
.picks-head { display: flex; align-items: center; justify-content: space-between; }
.picks-head h1 { font-size: 24px; letter-spacing: -0.5px; }
.groups { display: flex; flex-direction: column; gap: 14px; }
.group { background: var(--card); border-radius: 20px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.group-head b { font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase; }
.group-head span { font-size: 12px; color: var(--muted); }
.row { display: flex; gap: 12px; align-items: flex-start; }
.row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.thumb { width: 84px; height: 112px; border-radius: 10px; flex-shrink: 0; overflow: hidden; position: relative; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.row-main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; background: none; border: none; padding: 0; text-align: left; }
.row-name { font-size: 15px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-sub { font-size: 12px; color: var(--muted); }
.row .price { font-size: 14px; }
.row .was { font-size: 12px; }
.flag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; align-self: flex-start; }
.flag.drop { background: var(--accent); color: #fff; }
.flag.gone { background: var(--chip); color: var(--muted); }
.row-actions { display: flex; gap: 6px; }
.row-actions .round { width: 44px; height: 44px; }
.empty-picks { text-align: center; color: var(--muted); padding: 48px 16px; display: flex; flex-direction: column; gap: 16px; align-items: center; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--on-ink); font-size: 14px; font-weight: 600; padding: 12px 18px; border-radius: 999px;
  white-space: nowrap; box-shadow: 0 8px 24px rgba(20, 20, 20, 0.25); z-index: 10;
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}

/* ---------- native feel ---------- */
html, body { overscroll-behavior: none; }
body { -webkit-touch-callout: none; }
button, .btn, .round, .chip, .pill, .store, .option, .card { -webkit-user-select: none; user-select: none; }
.btn, .round, .chip, .pill, .store, .option, .tag, .segmented button {
  transition: transform 0.16s cubic-bezier(0.3, 0.7, 0.4, 1.5), background-color 0.2s, color 0.2s, border-color 0.2s;
}
.btn:active, .round:active, .chip:active, .pill:active, .store:active, .option:active, .tag:active, .segmented button:active { transform: scale(0.95); }
.btn[aria-busy="true"] { opacity: 0.6; pointer-events: none; }
.btn[aria-busy="true"]::after {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Screens slide like a native navigation stack (View Transitions; browsers without them just switch). */
::view-transition-old(root) { animation: 0.24s cubic-bezier(0.4, 0, 0.2, 1) both slide-out; }
::view-transition-new(root) { animation: 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both slide-in; }
[data-nav="back"]::view-transition-old(root) { animation-name: slide-out-back; }
[data-nav="back"]::view-transition-new(root) { animation-name: slide-in-back; }
@keyframes slide-in { from { transform: translateX(28%); opacity: 0; } }
@keyframes slide-out { to { transform: translateX(-12%); opacity: 0; } }
@keyframes slide-in-back { from { transform: translateX(-28%); opacity: 0; } }
@keyframes slide-out-back { to { transform: translateX(12%); opacity: 0; } }

/* The next card springs into place. */
/* backwards only: once it has played, dragging moves the card freely. */
.card.front.enter { animation: card-in 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.2) backwards; }
@keyframes card-in { from { transform: translateY(16px) scale(0.95); } }
.badge-count.bump { animation: bump 0.4s cubic-bezier(0.3, 0.7, 0.4, 1.6); }
@keyframes bump { 40% { transform: scale(1.45); } }

/* Bottom sheet slides up with a little spring; the backdrop fades. */
.sheet[open] { animation: sheet-up 0.42s cubic-bezier(0.2, 0.9, 0.25, 1.05); }
.sheet[open]::backdrop { animation: fade-in 0.3s ease both; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }
.toast { animation: toast-in 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.3); }
@keyframes toast-in { from { transform: translate(-50%, 16px); opacity: 0; } }
.row { transition: transform 0.22s ease, opacity 0.22s ease; }
.row.leaving { transform: translateX(-40px); opacity: 0; }

/* ---------- welcome ---------- */
.welcome { flex: 1; display: flex; flex-direction: column; gap: 14px; position: relative; padding-top: 28px; }
.welcome-mark {
  font-size: clamp(56px, 17vw, 76px); font-weight: 800; letter-spacing: -0.06em; line-height: 1; margin: 0;
  display: flex; position: relative; z-index: 1;
}
.drop { display: inline-block; animation: drop-in 0.7s cubic-bezier(0.25, 1.4, 0.45, 1) both; animation-delay: calc(0.15s + var(--i) * 0.07s); }
.drop.dot { color: var(--accent); animation-name: dot-in; animation-duration: 0.6s; animation-delay: 0.9s; }
@keyframes drop-in {
  0% { transform: translateY(-120px) rotate(calc((var(--i) - 4) * 6deg)); opacity: 0; }
  60% { opacity: 1; }
}
@keyframes dot-in {
  0% { transform: translateY(-160px) scale(0.4); opacity: 0; }
  55% { transform: translateY(0) scale(1.5, 0.6); opacity: 1; }
  75% { transform: translateY(-14px) scale(0.9, 1.1); }
}
.slogan {
  margin: 0; font-size: 22px; font-weight: 600; line-height: 1.3; letter-spacing: -0.3px; max-width: 320px;
  position: relative; z-index: 1; animation: rise 0.6s ease both 1.25s;
}
.welcome-actions { display: flex; flex-direction: column; gap: 10px; position: relative; z-index: 1; animation: rise 0.6s ease both 1.45s; }
@keyframes rise { from { transform: translateY(18px); opacity: 0; } }
/* Three cards drift between the slogan and the buttons, showing real pieces once they load. */
.welcome-cards { position: relative; flex: 1; min-height: 260px; margin: 8px 0; pointer-events: none; }
.welcome-cards span {
  position: absolute; left: 50%; top: 50%; width: 52%; max-width: 210px; aspect-ratio: 3 / 4; overflow: hidden;
  border-radius: 22px; box-shadow: 0 14px 34px rgba(20, 20, 20, 0.12);
  animation: deal 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.15) both, float 6s ease-in-out infinite;
}
.welcome-cards span:nth-child(1) { background: #d9cfc1; --r: -14deg; --x: -86%; animation-delay: 1.05s, 0s; }
.welcome-cards span:nth-child(2) { background: #cbd5db; --r: 12deg; --x: -14%; animation-delay: 1.15s, -2s; }
.welcome-cards span:nth-child(3) { background: #fff; --r: -2deg; --x: -50%; animation-delay: 1.25s, -4s; }
.welcome-cards span { transform: translate(var(--x), -50%) rotate(var(--r)); }
.welcome-cards img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.5s ease; }
.welcome-cards img.in { opacity: 1; }
@keyframes deal { from { transform: translate(-50%, 40%) rotate(0deg) scale(0.6); opacity: 0; } }
@keyframes float { 50% { translate: 0 -10px; } }
[data-screen="welcome"] #app { padding-bottom: max(32px, env(safe-area-inset-bottom)); }
/* The same kind of cards on the name step, calmer: they fade in and drift, and fan out further
   with every letter of your name (--s goes from 0 to 1); then a tag on the front one says who they're for. */
.welcome-cards.calm { min-height: 210px; margin: 0; --s: 0; }
.welcome-cards.calm span {
  width: 40%; max-width: 160px;
  animation: fade-in 0.8s ease both, float 6s ease-in-out infinite;
  transition: transform 0.6s cubic-bezier(0.3, 1.3, 0.4, 1);
}
.welcome-cards.calm span:nth-child(1) { --x: calc(-82% - 34% * var(--s)); --r: calc(-8deg - 8deg * var(--s)); animation-delay: 0.3s, 0s; }
.welcome-cards.calm span:nth-child(2) { --x: calc(-18% + 34% * var(--s)); --r: calc(8deg + 8deg * var(--s)); animation-delay: 0.4s, -2s; }
.welcome-cards.calm span:nth-child(3) { --x: -50%; --r: calc(-2deg + 4deg * var(--s)); animation-delay: 0.5s, -4s; }
.gift-tag {
  position: absolute; left: 50%; top: calc(50% + 100px); z-index: 2;
  padding: 7px 12px; border-radius: 999px; background: var(--ink); color: var(--on-ink);
  font-size: 13px; font-weight: 700; white-space: nowrap; max-width: 90%; overflow: hidden; text-overflow: ellipsis;
  transform: translate(-50%, 10px) rotate(-3deg) scale(0.8); opacity: 0;
  transition: opacity 0.3s, transform 0.5s cubic-bezier(0.3, 1.5, 0.4, 1);
}
.welcome-cards.tagged .gift-tag { opacity: 1; transform: translate(-50%, 0) rotate(-3deg); }

/* ---------- sign-up steps and settings: a calm fade-in, block by block ---------- */
#app.flow > * { animation: settle 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
#app.flow > :nth-child(2) { animation-delay: 0.04s; }
#app.flow > :nth-child(3) { animation-delay: 0.1s; }
#app.flow > :nth-child(4) { animation-delay: 0.16s; }
#app.flow > :nth-child(n + 5) { animation-delay: 0.22s; }
@keyframes settle { from { transform: translateY(8px); opacity: 0; } }
#app.flow.still > *, #app.flow.still .steps i.now::after { animation: none; }

/* Three bars, the current step filling from the left. */
.steps { display: flex; gap: 5px; }
.steps i { width: 24px; height: 5px; border-radius: 3px; background: var(--line); position: relative; overflow: hidden; }
.steps i.done { background: var(--ink); }
.steps i.now::after {
  content: ""; position: absolute; inset: 0; background: var(--ink); border-radius: inherit;
  transform-origin: left; animation: bar-fill 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both 0.3s;
}
@keyframes bar-fill { from { transform: scaleX(0); } }

/* Create account: a Face ID style scan, corners breathing and a beam sweeping over the face. */
.scan { flex: 1; display: grid; place-items: center; min-height: 180px; color: var(--ink); }
.scan svg { width: 132px; height: 132px; overflow: visible; }
.scan .corner { animation: corner 2.4s ease-in-out infinite; transform-box: view-box; transform-origin: 60px 60px; }
.scan .face { opacity: 0.85; }
.scan .beam { stroke: var(--accent); stroke-width: 4; animation: beam 2.4s ease-in-out infinite; }
@keyframes corner { 50% { transform: scale(0.9); } }
@keyframes beam {
  0%, 100% { transform: translateY(-34px); opacity: 0; }
  15%, 85% { opacity: 1; }
  50% { transform: translateY(34px); }
}

/* Name step: "Hi, Seb." builds up as you type, every new letter dropping in. */
.hello {
  margin: 8px 0 0; font-size: clamp(40px, 12vw, 54px); font-weight: 800; letter-spacing: -0.05em; line-height: 1.05;
  opacity: 0; transform: translateY(10px); transition: opacity 0.3s, transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow-wrap: anywhere;
}
#app.flow > .hello { animation: none; }
.hello.on { opacity: 1; transform: none; }
.hello-name { white-space: pre-wrap; }
.hello-name span { display: inline-block; }
.hello-name .pop { animation: letter-in 0.5s cubic-bezier(0.25, 1.4, 0.45, 1) both; }
@keyframes letter-in { from { transform: translateY(-38px) rotate(-10deg); opacity: 0; } }
.hello-dot { color: var(--accent); display: inline-block; }
.hello.on .hello-dot { animation: dot-in 0.6s both 0.1s; }

/* After the setup the first two cards are dealt onto the deck. */
.deck.dealt .card { animation: deal-card 0.75s cubic-bezier(0.2, 0.9, 0.3, 1.15) both; }
.deck.dealt .card.back { animation-delay: 0.15s; }
.deck.dealt .card.front { animation-delay: 0.35s; }
@keyframes deal-card { from { transform: translateY(70%) rotate(-14deg) scale(0.7); opacity: 0; } }

/* ---------- brands dropdown, account line ---------- */
.dropdown { border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow: hidden; }
.dropdown summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 52px; padding: 0 14px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown .chevron { transition: transform 0.25s ease; color: var(--muted); }
.dropdown[open] .chevron { transform: rotate(180deg); }
.dropdown-panel { border-top: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 8px; animation: rise 0.25s ease both; }
.dropdown-list { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; overscroll-behavior: contain; }
.option {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 6px 10px;
  border: none; border-radius: 10px; background: transparent; text-align: left; font-size: 15px; font-weight: 600;
}
.option small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.option .check { visibility: hidden; color: var(--accent); }
.option[aria-pressed="true"] { background: var(--chip); }
.option[aria-pressed="true"] .check { visibility: visible; }
.account-line { margin-top: 4px; }
.linkish { border: none; background: none; padding: 6px 2px; font: inherit; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; min-height: 32px; }
.pill-count { font-weight: 500; opacity: 0.7; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; transition: none !important; }
}

/* ---------- basket run ---------- */
.run-head { display: flex; align-items: center; justify-content: space-between; }
.run-head h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.4px; }
.run-progress { height: 6px; border-radius: 3px; background: var(--chip); overflow: hidden; }
.run-progress span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
.run-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 42dvh; overflow-y: auto; }
.run-list li { display: flex; align-items: center; gap: 12px; transition: opacity 0.3s ease; }
.run-list .thumb { width: 48px; height: 64px; }
.run-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.run-name b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-name small { font-size: 12px; color: var(--muted); }
.run-state { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); flex-shrink: 0; }
.run-list li.done { opacity: 0.55; }
.run-list li.done .run-state { background: var(--ok); border-color: var(--ok); color: #fff; animation: bump 0.4s cubic-bezier(0.3, 0.7, 0.4, 1.6); }
.run-list li.next .run-state { border-color: var(--ink); }
.sheet-body .linkish { align-self: center; }

/* Only on Netlify preview links (see app.js): a strip of its own above the page, covering nothing. */
html.is-preview #app { padding-top: calc(max(20px, env(safe-area-inset-top)) + 20px); }
.preview-tag {
  position: fixed; top: max(4px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 50;
  padding: 3px 9px; border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 800; letter-spacing: 0.08em; pointer-events: none;
}

/* A pick that's no longer in the shop. */
.thumb.faded img { opacity: 0.45; filter: grayscale(1); }

/* Undo: small, and the card it brings back flies in from the side it left on. */
.actions .undo { width: 44px; height: 44px; color: var(--muted); }
.actions .undo .icon { width: 20px; height: 20px; }
.actions .undo:disabled { opacity: 0.35; }
.card.front.back-left { animation: back-left 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.1) both; }
.card.front.back-right { animation: back-right 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.1) both; }
@keyframes back-left { from { transform: translateX(-120%) rotate(-18deg); } }
@keyframes back-right { from { transform: translateX(120%) rotate(18deg); } }

/* ---------- your style ---------- */
.style-words { display: flex; flex-wrap: wrap; gap: 8px; }
.style-words span {
  padding: 8px 14px; border-radius: 999px; background: var(--ink); color: var(--on-ink); font-size: 14px; font-weight: 700;
  animation: settle 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.style-words span:nth-child(2) { animation-delay: 0.06s; }
.style-words span:nth-child(3) { animation-delay: 0.12s; }
.style-card { background: var(--card); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.style-card p { margin: 0; font-size: 15px; line-height: 1.45; }
.palette { display: flex; height: 34px; border-radius: 12px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); }
.palette i { flex-basis: 0; min-width: 6px; transform-origin: left; animation: grow 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(var(--i) * 0.05s); }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }
.legend b, .style-bars b { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.style-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.style-bars li { display: grid; grid-template-columns: minmax(0, 9em) 1fr 3em; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.style-bars li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.style-bars .bar { height: 8px; border-radius: 4px; background: var(--chip); overflow: hidden; }
.style-bars .bar i { display: block; height: 100%; width: var(--w); background: var(--ink); border-radius: inherit; transform-origin: left; animation: grow 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(0.1s + var(--i) * 0.05s); }
.style-bars b { text-align: right; }
@keyframes grow { from { transform: scaleX(0); } }
.price-big { font-size: 38px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; display: flex; align-items: baseline; gap: 10px; }
.price-big small { font-size: 14px; font-weight: 600; letter-spacing: 0; color: var(--muted); }

/* Style card preview, match teaser and the match screen. */
.card-preview { margin: 0; display: flex; justify-content: center; }
.card-preview img { width: 62%; max-width: 260px; border-radius: 18px; box-shadow: 0 14px 34px rgba(20, 20, 20, 0.16); animation: settle 0.45s ease both; }
.match-teaser { flex-direction: row; align-items: center; justify-content: space-between; text-decoration: none; color: var(--ink); }
.match-invite { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--card); font-size: 15px; font-weight: 600; position: relative; z-index: 1; animation: rise 0.6s ease both 1.3s; }
.match-score { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0; }
.match-score b { font-size: 84px; font-weight: 800; letter-spacing: -0.05em; line-height: 1; animation: settle 0.5s ease both; }
.match-score span { font-size: 17px; font-weight: 700; color: var(--accent); }
.match-row { display: grid; grid-template-columns: 4.5em 1fr; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.match-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-row .palette { height: 26px; }
.match-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.match-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--chip); font-size: 14px; font-weight: 600; }
.match-chip .dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }

/* Home screen tip: numbered steps with an icon each. */
.home-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; counter-reset: step; }
.home-steps li { display: flex; align-items: center; gap: 12px; font-size: 15px; line-height: 1.35; }
.home-steps .step-icon { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--chip); display: grid; place-items: center; overflow: hidden; }
.home-steps .step-icon img { width: 100%; height: 100%; }

/* Loading: a card-shaped placeholder with a soft shimmer instead of a line of text. */
.card.skeleton { cursor: default; box-shadow: none; }
.card.skeleton .media, .card.skeleton .card-info span {
  background: linear-gradient(100deg, var(--chip) 30%, var(--card) 50%, var(--chip) 70%) 0 0 / 300% 100%;
  animation: shimmer 1.4s linear infinite;
}
.card.skeleton .card-info span { display: block; height: 14px; border-radius: 7px; }
.card.skeleton .card-info span:first-child { width: 70%; height: 18px; }
.card.skeleton .card-info span:last-child { width: 35%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* A toast you can tap. */
.toast.action { cursor: pointer; pointer-events: auto; }

/* Picks: sort and clean up. */
.picks-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; }
.picks-tools .sort { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; }
.picks-tools select {
  font: inherit; font-weight: 700; color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 14px; -webkit-appearance: none; appearance: none;
}

/* Your swipes: one big number, four small ones, a line about days. */
.stats-big { display: flex; align-items: baseline; gap: 10px; }
.stats-big b { font-size: 52px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.stats-big span { font-size: 16px; font-weight: 700; color: var(--muted); }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stats-grid div { background: var(--chip); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.stats-grid b { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stats-grid span { font-size: 13px; font-weight: 600; color: var(--muted); }
.stats-line { text-align: left; margin: 0; }
