/* fonts/fonts.css */
/* Self-hosted Google Fonts (SIL OFL 1.1): Inter, Instrument Serif. latin + latin-ext only. */
/* latin-ext */
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/InstrumentSerif-italic-latin-ext-4bed00.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/InstrumentSerif-italic-latin-99cc6e.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/InstrumentSerif-normal-latin-ext-fa1a1a.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/InstrumentSerif-normal-latin-a20ac7.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/Inter-normal-latin-ext-749a30.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/Inter-normal-latin-1ab1ad.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/Inter-normal-latin-ext-749a30.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/Inter-normal-latin-1ab1ad.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/Inter-normal-latin-ext-749a30.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/Inter-normal-latin-1ab1ad.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* styles.css */
/* =========================================================
   Index — minimal editorial personal record
   Mobile-first. Light + dark. Serif display / sans body.
   ========================================================= */

:root,
[data-theme='light'] {
  --color-bg: #faf9f6;
  --color-surface: #ffffff;
  --color-surface-2: #f4f2ec;
  --color-surface-offset: #efece4;
  --color-divider: #e6e2d8;
  --color-border: #d9d4c7;

  --color-text: #1a1a17;
  --color-text-muted: #6b6962;
  /* Darkened from #a8a59b (2.3:1) to meet WCAG AA 4.5:1 on bg/surface-2/offset. */
  --color-text-faint: #6f6c64;
  --color-text-inverse: #faf9f6;

  --color-primary: #1a1a17;
  --color-primary-hover: #000000;
  --color-accent: #8a5a2b;
  --color-accent-soft: #efe5d4;

  --shadow-sm: 0 1px 2px rgba(30, 25, 15, 0.04);
  --shadow-md: 0 6px 24px rgba(30, 25, 15, 0.06);
  --shadow-lg: 0 20px 60px rgba(30, 25, 15, 0.12);
}

[data-theme='dark'] {
  --color-bg: #141311;
  --color-surface: #1a1917;
  --color-surface-2: #222120;
  --color-surface-offset: #2a2927;
  --color-divider: #2a2826;
  --color-border: #38352f;

  --color-text: #ececea;
  --color-text-muted: #8d8b85;
  /* Lightened from #5f5d57 (2.7:1) to meet WCAG AA 4.5:1 on dark surfaces. */
  --color-text-faint: #918e87;
  --color-text-inverse: #141311;

  --color-primary: #ececea;
  --color-primary-hover: #ffffff;
  --color-accent: #d8a365;
  --color-accent-soft: #3a2e1f;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
}

:root {
  --font-display: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;

  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);
  --text-sm: clamp(0.8125rem, 0.78rem + 0.2vw, 0.9375rem);
  --text-base: clamp(0.9375rem, 0.9rem + 0.25vw, 1rem);
  --text-lg: clamp(1.0625rem, 1rem + 0.45vw, 1.25rem);
  --text-xl: clamp(1.375rem, 1.2rem + 0.9vw, 1.75rem);
  --text-2xl: clamp(1.875rem, 1.4rem + 2vw, 2.75rem);
  --text-3xl: clamp(2.5rem, 1.5rem + 4vw, 4.25rem);

  --space-1: 0.25rem;  --space-2: 0.5rem;   --space-3: 0.75rem;
  --space-4: 1rem;     --space-5: 1.25rem;  --space-6: 1.5rem;
  --space-8: 2rem;     --space-10: 2.5rem;  --space-12: 3rem;
  --space-16: 4rem;    --space-20: 5rem;

  --radius-sm: 6px;  --radius-md: 10px;  --radius-lg: 14px;
  --radius-xl: 20px; --radius-full: 9999px;

  --transition: 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --content-max: 720px;
}

/* ========== Reset ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  text-size-adjust: none;
}
body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);
  padding-bottom: calc(140px + env(safe-area-inset-bottom));
  transition: background var(--transition), color var(--transition);
}
img, svg { display: block; max-width: 100%; height: auto; }
button { cursor: pointer; background: none; border: none; color: inherit; font: inherit; }
[hidden] { display: none !important; }
input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.1; text-wrap: balance; font-weight: 400; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--color-accent-soft); color: var(--color-text); }

/* ========== AUTH GATE ==========
   With the landing hero added above the sign-in card, the gate now scrolls
   normally instead of pinning to viewport center. The sign-in card stays
   centered by its own layout below the landing. */
.auth-gate {
  position: fixed; inset: 0;
  background: var(--color-bg);
  padding: 0;
  z-index: 100;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.auth-inner {
  max-width: 360px; width: 100%;
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
  gap: var(--space-4);
  padding: var(--space-8) var(--space-6) var(--space-10);
  margin: 0 auto;
  scroll-margin-top: var(--space-6);
}

/* ========== LANDING HERO (logged-out visitors) ==========
   Sits above the sign-in card. On mobile it stacks vertically; on desktop it
   splits into a two-column pitch + product mockup. The mockup is a static HTML
   rendering — no real data — so it can’t drift out of sync with production. */
.landing {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-6);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
  align-items: center;
}
.landing-brand { margin-bottom: var(--space-4); }
.landing-h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3.5rem);
  line-height: 1.05;
  color: var(--color-text);
  margin: 0 0 var(--space-3);
  font-weight: 400;
  letter-spacing: -0.01em;
}
.landing-h1 em {
  font-style: italic;
  color: var(--color-primary, #1a1a1a);
}
.landing-lede {
  font-size: var(--text-lg, 1.125rem);
  line-height: 1.5;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-5);
  max-width: 44ch;
}
.landing-points {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-6);
  display: flex; flex-direction: column;
  gap: var(--space-2);
}
.landing-points li {
  display: flex; align-items: flex-start; gap: var(--space-3);
  font-size: var(--text-base);
  color: var(--color-text);
  line-height: 1.4;
}
.landing-dot {
  flex-shrink: 0;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-top: 0.55em;
  opacity: 0.5;
}
.landing-cta {
  align-self: flex-start;
  text-decoration: none;
  margin-bottom: var(--space-3);
}
.landing-fineprint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0;
}
.landing-footer-links {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: var(--space-3) 0 0;
  display: flex;
  gap: var(--space-2);
  align-items: center;
}
.landing-footer-links a {
  color: var(--color-text-muted);
  text-decoration: none;
}
.landing-footer-links a:hover {
  color: var(--color-text);
  text-decoration: underline;
}

/* Product mockup panel */
.landing-visual {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}
.lv-frame {
  background: #ffffff;
  border: 1px solid var(--color-border, #e5e5e0);
  border-radius: 20px;
  padding: var(--space-5);
  box-shadow: 0 20px 60px -20px rgba(0,0,0,0.15), 0 4px 12px -4px rgba(0,0,0,0.08);
  overflow: hidden;
}
.lv-topbar {
  display: flex; align-items: center; gap: 8px;
  color: var(--color-text);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border, #eee);
  margin-bottom: var(--space-4);
}
.lv-mark { color: var(--color-text); line-height: 0; }
.lv-brand {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1rem;
}
.lv-profile {
  text-align: center;
  margin-bottom: var(--space-4);
}
.lv-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--color-surface, #f2f0eb);
  color: var(--color-text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 500;
  margin: 0 auto var(--space-2);
}
.lv-handle {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--color-text);
}
.lv-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: var(--space-4);
  justify-content: center;
}
.lv-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--color-border, #e5e5e0);
  font-size: 0.75rem;
  color: var(--color-text);
  background: #fff;
}
.lv-chip b { color: var(--color-text-muted); font-weight: 500; font-size: 0.7rem; }
.lv-section-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}
.lv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.lv-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.lv-tile.lv-feature {
  grid-column: span 2;
  grid-row: span 2;
  aspect-ratio: auto;
  min-height: 160px;
}
.lv-rank {
  position: absolute;
  top: 6px; left: 6px;
  min-width: 22px; height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0,0,0,0.85);
  color: #fff;
  font-size: 0.7rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.lv-score {
  position: absolute;
  top: 6px; right: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0,0,0,0.85);
  color: #fff;
  font-size: 0.65rem; font-weight: 500;
}
.lv-tile-body {
  position: absolute;
  left: 10px; bottom: 8px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Desktop: two-column landing */
@media (min-width: 820px) {
  .landing {
    grid-template-columns: 1fr 1fr;
    padding: var(--space-10) var(--space-8) var(--space-8);
    gap: var(--space-10);
  }
  .landing-visual { max-width: 460px; }
}
.auth-mark {
  color: var(--color-text);
  margin-bottom: var(--space-2);
}
/* Brand lockup on the sign-in gate: numbered circle mark echoes the rank-badge visual language used throughout the app. */
.brand-lockup {
  color: var(--color-text);
  margin-bottom: var(--space-3);
  line-height: 0;
}
.brand-lockup .brand-mark { display: block; }
.auth-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-2xl);
  letter-spacing: -0.02em;
  color: var(--color-text);
}
.auth-sub {
  color: var(--color-text-muted);
  font-size: var(--text-base);
  max-width: 28ch;
  margin-bottom: var(--space-4);
}
.auth-note {
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  margin-top: var(--space-2);
}

/* Divider between Google sign-in and email form */
.auth-divider {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%;
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: var(--space-2) 0;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}
.auth-divider span { padding: 0 var(--space-1); }

/* Email/password form */
.auth-email-form {
  width: 100%;
  display: flex; flex-direction: column;
  gap: var(--space-3);
  text-align: left;
}
.auth-form-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-lg);
  color: var(--color-text);
  text-align: center;
  margin: 0 0 var(--space-1);
}
.auth-field {
  display: flex; flex-direction: column;
  gap: 4px;
}
.auth-field-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}
.auth-field input {
  width: 100%;
  font: inherit;
  font-size: var(--text-base);
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.auth-field input:focus {
  border-color: var(--color-text);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}
.auth-error {
  font-size: var(--text-sm);
  color: #b3261e;
  margin: 0;
}
.auth-success {
  font-size: var(--text-sm);
  color: #1b6e3b;
  margin: 0;
}
.auth-links {
  display: flex; align-items: center; justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.auth-links-sep { color: var(--color-text-faint); }
.linklike {
  background: none;
  border: none;
  padding: 4px 2px;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.linklike:hover { color: var(--color-text); }
.linklike:disabled { opacity: 0.5; cursor: default; }
.auth-iframe-notice {
  display: flex; flex-direction: column; align-items: center;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  max-width: 340px;
  width: 100%;
}
.auth-iframe-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-lg);
  color: var(--color-text);
  text-align: center;
}
.auth-iframe-body {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  text-align: center;
  max-width: 28ch;
}

/* ========== Auth loading: no gate/app flash for returning users ========== */
/* While Firebase restores the session, show neither the sign-in gate nor the
   app; a quiet brand mark instead. If auth never resolves (offline, blocked
   CDN), the gate is revealed after 4 s by a pure-CSS fallback. */
body[data-auth="loading"] #appShell { display: none; }
body[data-auth="loading"] #authGate { visibility: hidden; animation: tt-auth-reveal 0s linear 4s forwards; }
@keyframes tt-auth-reveal { to { visibility: visible; } }
/* Never signed in on this device (auth-hint.js): show the landing immediately. */
html[data-auth-hint="out"] body[data-auth="loading"] #authGate { visibility: visible; animation: none; }
html[data-auth-hint="out"] body[data-auth="loading"]::after { display: none; }
body[data-auth="loading"]::after {
  content: ""; position: fixed; inset: 0; margin: auto; width: 28px; height: 28px;
  border-radius: 50%; border: 2px solid var(--color-border); border-top-color: var(--color-text-muted);
  animation: tt-spin 0.9s linear infinite, tt-auth-hide 0s linear 4s forwards;
}
@keyframes tt-spin { to { transform: rotate(360deg); } }
@keyframes tt-auth-hide { to { opacity: 0; visibility: hidden; } }

/* ========== App shell & header ========== */
/* Mobile-first: hold the single-column feel at 720px. On progressively wider
   screens, step the container up so the list view stops feeling like a
   phone app rendered in the middle of a monitor. The list-row layout has
   plenty of horizontal room to breathe. */
.app {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-4) var(--space-5);
  transition: max-width var(--transition);
}
@media (min-width: 768px) {
  .app { padding: var(--space-8) var(--space-8) var(--space-16); }
}
@media (min-width: 1024px) {
  .app { max-width: 880px; }
}
@media (min-width: 1280px) {
  .app { max-width: 1040px; }
}
@media (min-width: 1600px) {
  .app { max-width: 1200px; }
}
/* Recipe view breaks out to wider container regardless of viewport */
body[data-view="recipe"] .app {
  max-width: 1040px;
}
@media (min-width: 1600px) {
  body[data-view="recipe"] .app { max-width: 1200px; }
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-2);
  padding-bottom: var(--space-6);
}
.brand {
  display: inline-flex; align-items: center;
  gap: var(--space-3);
  color: var(--color-text);
}
.brand .mark { color: var(--color-text); }
.wordmark {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  line-height: 1;
}
.header-actions {
  display: inline-flex; align-items: center; gap: var(--space-2);
}
.icon-btn {
  width: 38px; height: 38px;
  display: inline-grid; place-items: center;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover { background: var(--color-surface-2); color: var(--color-text); }

/* ========== Library bar (contextual controls above the list) ========== */
.library-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
  position: relative;
  flex-wrap: wrap;
}
@media (min-width: 780px) {
  .library-bar { margin-top: var(--space-8); padding-top: var(--space-5); }
}
.library-bar-left {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  min-width: 0;
  flex: 1 1 auto;
}
.library-bar-right {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  position: relative;
  flex: 0 0 auto;
  margin-left: auto;
}

/* Filter trigger pill (compact, ghost) */
.filter-pill-wrap { position: relative; flex: 0 0 auto; }
.filter-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem 0.35rem 0.55rem;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}
.filter-trigger:hover { border-color: var(--color-text-muted); background: var(--color-surface-2); }
.filter-trigger[aria-expanded="true"] {
  background: var(--color-surface-2);
  border-color: var(--color-text-muted);
}
.filter-trigger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  color: var(--color-text-muted);
}
.filter-trigger-label { letter-spacing: -0.005em; }
.filter-trigger-caret { color: var(--color-text-muted); transition: transform var(--transition); }
.filter-trigger[aria-expanded="true"] .filter-trigger-caret { transform: rotate(180deg); }

/* Popover */
.filter-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  width: min(22rem, calc(100vw - var(--space-5) * 2));
  padding: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg, 14px);
  box-shadow: 0 20px 48px -16px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.04);
  animation: popover-in 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes popover-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  margin-top: 2px;
}
.cat-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.7rem 0.75rem 0.65rem;
  min-height: 72px;
  border-radius: 10px;
  background: transparent;
  color: var(--color-text);
  text-align: left;
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.cat-tile:hover { background: var(--color-surface-2); }
.cat-tile.is-selected {
  background: var(--color-surface-2);
  box-shadow: inset 0 0 0 1px var(--color-border);
}
.cat-tile.is-selected .cat-tile-name { font-weight: 600; }
.cat-tile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--color-surface-2);
  color: var(--color-text);
}
.cat-tile:hover .cat-tile-icon { background: var(--color-surface); }
.cat-tile.is-selected .cat-tile-icon {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.cat-tile-name {
  font-size: var(--text-sm);
  line-height: 1.2;
  letter-spacing: -0.005em;
}
.cat-tile-count {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  font-size: 0.68rem;
  color: var(--color-text-faint);
  font-variant-numeric: tabular-nums;
}
.cat-tile.is-selected .cat-tile-count { color: var(--color-text-muted); }

/* "All / Everything" tile stretches full width on top */
.cat-tile--all {
  flex-direction: row;
  align-items: center;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  gap: 0.6rem;
  margin-bottom: 2px;
}
.cat-tile--all .cat-tile-count { position: static; margin-left: auto; }
.cat-tile--all .cat-tile-icon { width: 24px; height: 24px; }

/* Sort select (ghost, text-only trigger) */
.sort-select {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem 0.35rem 0.55rem;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.sort-select:hover { color: var(--color-text); background: var(--color-surface-2); }
.sort-select[aria-expanded="true"] {
  color: var(--color-text);
  background: var(--color-surface-2);
  border-color: var(--color-border);
}
.sort-caret { color: var(--color-text-faint); transition: transform var(--transition); }
.sort-select[aria-expanded="true"] .sort-caret { transform: rotate(180deg); }
.sort-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 11rem;
  padding: 0.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 20px 48px -16px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.04);
  animation: popover-in 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sort-item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.7rem;
  font-size: var(--text-sm);
  color: var(--color-text);
  background: transparent;
  border-radius: 8px;
  text-align: left;
  transition: background var(--transition);
}
.sort-item:hover { background: var(--color-surface-2); }
.sort-item.is-selected { background: var(--color-surface-2); font-weight: 600; }

/* Mobile tightening */
@media (max-width: 520px) {
  .filter-trigger-label { max-width: 7.5rem; overflow: hidden; text-overflow: ellipsis; }
  .filter-popover { width: calc(100vw - var(--space-5) * 2); }
  .cat-tile { min-height: 68px; padding: 0.6rem 0.65rem 0.55rem; }
}
.menu-search-icon {
  position: absolute;
  left: 0.85rem;
  color: var(--color-text-faint);
  pointer-events: none;
}
.menu-search-clear {
  position: absolute;
  right: 0.5rem;
  width: 26px; height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--color-text-muted);
  background: transparent;
  transition: background var(--transition), color var(--transition);
}
.menu-search-clear:hover { background: var(--color-surface-2); color: var(--color-text); }

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 var(--space-3);
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  width: 100%;
  text-align: left;
  color: var(--color-text);
  background: transparent;
  border-radius: 10px;
  transition: background var(--transition);
}
.menu-item:hover { background: var(--color-surface-2); }
.menu-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  color: var(--color-text-muted);
}
.menu-item-label { font-size: var(--text-sm); letter-spacing: -0.005em; }
.menu-item-value {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-transform: capitalize;
}

/* User footer in menu */
.menu-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}
.menu-user-meta { flex: 1 1 auto; min-width: 0; }
.menu-user .sheet-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-user .sheet-email {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: var(--text-xs);
}


/* ========== Capture hero ========== */
.eyebrow {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-text-faint);
  margin-bottom: var(--space-2);
}
.display {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  letter-spacing: -0.025em;
  color: var(--color-text);
  margin-bottom: var(--space-4);
}
.display em { font-style: italic; color: var(--color-accent); }
.lede {
  color: var(--color-text-muted);
  font-size: var(--text-lg);
  max-width: 48ch;
  margin-bottom: var(--space-8);
}
.page-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-5);
}

/* ========== Capture input ========== */
.capture-panel { margin-bottom: var(--space-12); }
.input-shell {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-shell:focus-within,
.input-shell.is-dragging {
  border-color: var(--color-text);
  box-shadow: var(--shadow-md);
}
.input-row {
  display: flex; align-items: flex-end; gap: var(--space-2);
}
.input-icon-btn {
  width: 34px; height: 34px;
  display: inline-grid; place-items: center;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--transition), background var(--transition);
}
.input-icon-btn:hover { background: var(--color-surface-2); color: var(--color-text); }
#captureInput {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-size: var(--text-lg);
  line-height: 1.4;
  padding: 0.4rem 0;
  max-height: 180px;
  min-height: 2rem;
  color: var(--color-text);
}
#captureInput::placeholder { color: var(--color-text-faint); }
.mic-btn {
  width: 34px; height: 34px;
  display: inline-grid; place-items: center;
  border-radius: var(--radius-full);
  color: var(--color-text-inverse);
  background: var(--color-primary);
  flex-shrink: 0;
  transition: background var(--transition), transform var(--transition);
}
.mic-btn:hover { background: var(--color-primary-hover); }
.mic-btn:active { transform: scale(0.96); }
.mic-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.input-hint {
  display: flex; align-items: center; gap: var(--space-2);
  padding-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  flex-wrap: wrap;
}
.input-hint kbd {
  font-family: inherit;
  font-size: 0.75em;
  padding: 0.1em 0.4em;
  border-radius: 4px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  color: var(--color-text-muted);
}
.hint-sep { color: var(--color-text-faint); }

.image-preview {
  margin-top: var(--space-3);
  position: relative;
  display: inline-block;
  max-width: 200px;
}
.image-preview img {
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  max-height: 160px;
  object-fit: cover;
}
.image-remove {
  position: absolute;
  top: -8px; right: -8px;
  width: 24px; height: 24px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  display: inline-grid; place-items: center;
  box-shadow: var(--shadow-md);
}

/* ========== Parse preview ========== */
.parse-preview {
  margin-top: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: slideIn 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.parse-stream {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-5) var(--space-5);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.parse-label { font-style: italic; }
.parse-dots { display: inline-flex; gap: 4px; }
.parse-dots span {
  width: 5px; height: 5px;
  background: var(--color-text-faint);
  border-radius: 50%;
  animation: dot 1.2s infinite ease-in-out;
}
.parse-dots span:nth-child(2) { animation-delay: 0.15s; }
.parse-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

.parse-card {
  padding: var(--space-5);
}
.parse-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.parse-identity { flex: 1; min-width: 0; }
.parse-category {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-accent);
  margin-bottom: var(--space-1);
  display: inline-block;
}

/* Clickable category chip (button that triggers the picker) */
.cat-picker-trigger {
  background: transparent;
  border: 1px dashed color-mix(in srgb, var(--color-accent) 40%, transparent);
  border-radius: var(--radius-sm);
  padding: 3px 8px 3px 9px;
  margin: 0 0 var(--space-2) -6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  font: inherit;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: var(--text-xs);
  color: var(--color-accent);
}
.cat-picker-trigger:hover {
  background: color-mix(in srgb, var(--color-accent) 8%, transparent);
  border-color: color-mix(in srgb, var(--color-accent) 70%, transparent);
}
.cat-picker-trigger[aria-expanded="true"] {
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
  border-style: solid;
  border-color: color-mix(in srgb, var(--color-accent) 60%, transparent);
}
.cat-picker-trigger[aria-expanded="true"] .cat-picker-caret {
  transform: rotate(180deg);
}
.cat-picker-caret {
  opacity: 0.65;
  transition: transform var(--transition);
}

/* The inline picker panel */
.cat-picker {
  margin: var(--space-2) 0 var(--space-1);
  padding: var(--space-3) 0 var(--space-1);
  border-top: 1px dashed var(--color-divider);
  animation: catFadeIn 180ms ease-out;
}
@keyframes catFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cat-picker-hint {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
}
.cat-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--color-divider);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.cat-chip:hover {
  background: var(--color-surface-2);
  border-color: color-mix(in srgb, var(--color-text) 25%, transparent);
}
.cat-chip.is-selected {
  background: var(--color-text);
  border-color: var(--color-text);
  color: var(--color-surface);
}
.cat-chip svg {
  width: 14px;
  height: 14px;
  opacity: 0.85;
}
.cat-chip.is-selected svg { opacity: 1; }

.parse-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  letter-spacing: -0.015em;
  color: var(--color-text);
  margin-bottom: var(--space-1);
  word-wrap: break-word;
}
.parse-sub {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.parse-close {
  width: 28px; height: 28px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  display: inline-grid; place-items: center;
  flex-shrink: 0;
}
.parse-close:hover { background: var(--color-surface-2); color: var(--color-text); }

.parse-meta {
  display: flex; flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
}
.meta-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: var(--space-3);
  align-items: center;
  min-height: 32px;
}
.meta-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-faint);
}
.meta-value { color: var(--color-text); font-size: var(--text-sm); }

/* Status toggle (chips) */
.status-toggle {
  display: inline-flex; flex-wrap: wrap; gap: var(--space-1);
}
.chip {
  padding: 0.35rem 0.75rem;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  transition: all var(--transition);
}
.chip:hover { color: var(--color-text); border-color: var(--color-text-muted); }
.chip.is-selected {
  color: var(--color-text-inverse);
  background: var(--color-primary);
  border-color: var(--color-primary);
}

/* Score slider */
.score-input {
  display: flex; align-items: center; gap: var(--space-3); width: 100%;
}
.score-input input[type='range'] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: var(--color-divider);
  border-radius: 2px;
  outline: none;
}
.score-input input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  transition: transform var(--transition);
}
.score-input input[type='range']::-webkit-slider-thumb:hover { transform: scale(1.12); }
.score-input input[type='range']::-moz-range-thumb {
  width: 18px; height: 18px;
  border: none;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
}
.score-value {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-lg);
  color: var(--color-text);
  min-width: 42px;
  text-align: right;
}

/* Tags */
.tags { display: inline-flex; flex-wrap: wrap; gap: var(--space-1); }
.tag {
  padding: 0.2rem 0.6rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  border-radius: var(--radius-full);
}

.parse-actions {
  display: flex; gap: var(--space-2);
  justify-content: flex-end;
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem 1.1rem;
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}
.btn-ghost:hover { color: var(--color-text); border-color: var(--color-text-muted); }
.btn-block { width: 100%; }
.btn-lg { padding: 0.8rem 1.4rem; font-size: var(--text-base); }

/* ========== Sections ========== */
.recent, .library-body { margin-top: var(--space-4); }
.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: var(--space-4);
}
.section-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-xl);
  color: var(--color-text);
}

/* ========== Status filter (pills inside library bar) ========== */
.status-filter {
  display: inline-flex; gap: 2px; align-items: center;
  padding: 2px;
  background: var(--color-surface-2);
  border-radius: var(--radius-full);
}
.filter-pill {
  padding: 0.3rem 0.7rem;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  transition: all var(--transition);
  white-space: nowrap;
}
.filter-pill:hover { color: var(--color-text); }
.filter-pill.is-selected {
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* ========== City filter dropdown (Restaurants only) ========== */
.city-select-wrap { position: relative; flex: 0 0 auto; }
.city-select-trigger {
  /* inherits .filter-trigger styling */
  gap: 4px;
}
.city-select-trigger.is-active {
  color: var(--color-text);
  background: var(--color-surface-2);
  border-color: var(--color-border, rgba(0,0,0,0.12));
}
.city-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  min-width: 240px;
  max-width: 300px;
  max-height: 380px;
  display: flex; flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border, rgba(0,0,0,0.08));
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.08);
  overflow: hidden;
}
@media (max-width: 480px) {
  /* Anchor to right edge on tight screens so it doesn't clip */
  .city-popover { left: auto; right: 0; min-width: min(260px, 90vw); }
}
.city-popover-search {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border, rgba(0,0,0,0.08));
  color: var(--color-text-muted);
}
.city-popover-search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--color-text);
  padding: 2px 0;
}
.city-popover-list {
  overflow-y: auto;
  padding: 4px 0;
  min-height: 0;
}
.city-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: var(--color-text);
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
}
.city-row:hover { background: var(--color-surface-2); }
.city-row.is-selected { background: var(--color-surface-2); font-weight: 500; }
.city-row-check { display: inline-flex; justify-content: center; color: var(--color-text); }
.city-row-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.city-row-count {
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-muted);
  line-height: 1.4;
}
.city-row-empty {
  padding: 12px;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  text-align: center;
}
.city-row-labels { min-width: 0; display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.city-row-labels .city-row-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.city-row-sublabel {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  line-height: 1.2;
}

/* Include-nearby toggle footer inside the city popover */
.city-popover-footer {
  border-top: 1px solid var(--color-border, rgba(0,0,0,0.08));
  background: var(--color-surface);
}
.city-nearby-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
}
.city-nearby-toggle:hover { background: var(--color-surface-2); }
.city-nearby-label { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.city-nearby-title {
  font-size: var(--text-sm);
  color: var(--color-text);
  font-weight: 500;
}
.city-nearby-hint {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  line-height: 1.2;
}
.city-nearby-switch {
  flex: 0 0 auto;
  position: relative;
  width: 32px; height: 18px;
  border-radius: 999px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border, rgba(0,0,0,0.15));
  transition: background var(--transition), border-color var(--transition);
}
.city-nearby-switch .city-nearby-knob {
  position: absolute;
  top: 1px; left: 1px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--color-surface);
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
  transition: transform var(--transition);
}
.city-nearby-switch.is-on {
  background: var(--color-text);
  border-color: var(--color-text);
}
.city-nearby-switch.is-on .city-nearby-knob {
  transform: translateX(14px);
  background: var(--color-surface);
}

/* ========== City picker (inside edit sheet, restaurants only) ========== */
.city-picker {
  display: flex; flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}
.city-picker-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.city-pick-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.32rem 0.7rem;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  white-space: nowrap;
  transition: all var(--transition);
  cursor: pointer;
}
.city-pick-chip:hover { color: var(--color-text); }
.city-pick-chip.is-selected {
  color: var(--color-surface);
  background: var(--color-text);
}
.city-pick-chip--add {
  color: var(--color-text);
  background: transparent;
  border-color: var(--color-border, rgba(0,0,0,0.12));
  border-style: dashed;
}
.city-pick-chip--add:hover {
  background: var(--color-surface-2);
  border-style: solid;
}
.city-picker-add {
  display: flex; align-items: center; gap: var(--space-2);
}
.city-picker-add .edit-input { flex: 1; }
.city-picker-add-cancel { flex: 0 0 auto; }

/* ========== Entry list ========== */
.entry-list {
  list-style: none;
  display: flex; flex-direction: column;
  gap: var(--space-1);
}
.entry-list.entry-list--ranked { gap: var(--space-1); }

/* Base row: icon | body | right-cluster. Ranked list adds drag-handle + rank-badge to the front. */
.entry {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  transition: background var(--transition), border-color var(--transition), transform 140ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.entry:hover {
  background: var(--color-surface);
  border-color: var(--color-divider);
}
/* Ranked list: drag handle (20px) + rank badge (28px) added in front */
.entry-list.is-sortable .entry {
  grid-template-columns: 20px 28px 40px minmax(0, 1fr) auto;
}
@media (min-width: 640px) {
  .entry { column-gap: var(--space-4); }
}

/* (Narrow-screen overrides moved below base styles — see bottom of entry block) */

.drag-handle {
  width: 20px; height: 36px;
  display: inline-grid; place-items: center;
  color: var(--color-text-faint);
  cursor: grab;
  opacity: 0.35;
  transition: opacity var(--transition), color var(--transition);
  touch-action: none;
  /* Kill iOS/Android long-press selection, callout menu, and tap highlight */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.entry:hover .drag-handle,
.drag-handle:active { opacity: 1; color: var(--color-text-muted); }
.drag-handle:active { cursor: grabbing; }
.entry-list.is-sortable .drag-handle { opacity: 0.35; } /* always visible hint in rank mode */
.entry-list.is-sortable .entry:hover .drag-handle { opacity: 1; }

/* Mobile: give the handle a finger-sized tap target (44px min) via an invisible extension */
@media (pointer: coarse), (max-width: 640px) {
  .drag-handle {
    width: 32px;
    height: 44px;
    opacity: 0.55; /* more discoverable on touch */
    position: relative;
  }
  .entry-list.is-sortable .drag-handle { opacity: 0.55; }
  /* Invisible hit-target extension so a thumb hits the handle reliably */
  .drag-handle::before {
    content: '';
    position: absolute;
    inset: -6px -8px;
  }
}

/* While reordering: lock body scroll and suppress text selection everywhere */
body.is-reordering {
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
body.is-reordering .entry {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Subtle "picked up" feedback on the chosen row */
.dragging-chosen {
  transform: scale(1.01);
  transition: transform 140ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.rank-badge {
  min-width: 28px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.375rem;
  color: var(--color-text-muted);
  text-align: center;
  line-height: 1;
  font-feature-settings: 'lnum';
}
/* Top 3: accent color */
.entry-list.is-sortable .entry:nth-child(-n+3) .rank-badge { color: var(--color-accent); }

/* Thumb slot — small icon tile by default, image fills when provided */
.entry-thumb {
  width: 40px; height: 40px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  color: var(--color-text-muted);
  overflow: hidden;
  flex-shrink: 0;
}
.entry-thumb[data-has-image="true"] { border-color: transparent; background: transparent; }
.entry-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.entry-thumb svg { width: 18px; height: 18px; }

/* Body column — title first, subtitle, then muted meta line */
.entry-body {
  min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.entry-title {
  font-size: var(--text-base);
  color: var(--color-text);
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Pinned-to-profile badge — gold pin next to title. Small enough to be a
   quiet signal, but the gold color makes it findable at a glance. */
.entry-pin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: -1px;
  margin-left: 6px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #d69e2e;
  color: #fff;
  flex-shrink: 0;
}
.entry-pin-badge svg { display: block; }

/* Fix-locations banner — shown above the library when restaurants/places
   are missing cities. Amber to signal 'action needed' without alarm. */
.fix-locations-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-3);
  border: 1px solid rgba(217, 119, 6, 0.25);
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.06), rgba(217, 119, 6, 0.02));
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
  font-family: inherit;
}
.fix-locations-banner:hover {
  background: rgba(217, 119, 6, 0.1);
  border-color: rgba(217, 119, 6, 0.4);
}
.fix-locations-banner__icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(217, 119, 6, 0.15);
  color: #a06710;
  display: flex;
  align-items: center;
  justify-content: center;
}
:root[data-theme="dark"] .fix-locations-banner__icon,
[data-theme="dark"] .fix-locations-banner__icon {
  color: #e2b568;
  background: rgba(217, 119, 6, 0.22);
}
.fix-locations-banner__body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fix-locations-banner__title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}
.fix-locations-banner__sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.fix-locations-banner__cta {
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: 600;
  color: #a06710;
  white-space: nowrap;
}
:root[data-theme="dark"] .fix-locations-banner__cta,
[data-theme="dark"] .fix-locations-banner__cta {
  color: #e2b568;
}

/* Fix-locations sheet body */
.fixlocs-card {
  max-width: 520px;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.fixlocs-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}
.fixlocs-title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--color-text);
}
.fixlocs-sub {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.fixlocs-progress {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.fixlocs-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.fixlocs-current {
  padding: var(--space-3);
  background: var(--color-surface-2, rgba(0,0,0,0.03));
  border-radius: var(--radius);
}
.fixlocs-entry-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 2px;
}
.fixlocs-entry-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.fixlocs-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fixlocs-status {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  min-height: 1.2em;
}
.fixlocs-foot {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
}
.fixlocs-foot .btn-primary { flex: 1 1 auto; }

/* Fix-locations "Other" input — make sure typed text and placeholder are
   both readable on dark backgrounds. The generic .input inheritance was
   giving us dim gray on dim gray. */
#fixLocationsAddWrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
#fixLocationsAddWrap .input,
#fixLocationsCityInput {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 14px;
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border, rgba(255,255,255,0.15));
  border-radius: var(--radius);
  outline: none;
}
#fixLocationsCityInput::placeholder {
  color: var(--color-text-muted);
  opacity: 0.75;
}
#fixLocationsCityInput:focus {
  border-color: var(--color-accent, #d69e2e);
  box-shadow: 0 0 0 3px rgba(214, 158, 46, 0.15);
}
:root[data-theme="dark"] #fixLocationsCityInput,
[data-theme="dark"] #fixLocationsCityInput {
  background: rgba(255,255,255,0.06);
  color: #f2f2f2;
  border-color: rgba(255,255,255,0.18);
}
:root[data-theme="dark"] #fixLocationsCityInput::placeholder,
[data-theme="dark"] #fixLocationsCityInput::placeholder {
  color: rgba(255,255,255,0.55);
  opacity: 1;
}

/* Missing-location chip — amber warning shown on restaurant/place rows
   that have no city. Clickable via the row itself; hint the user to tap. */
.entry-warn-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(214, 158, 46, 0.14);
  color: #a06710;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
.entry-warn-chip svg { display: block; flex-shrink: 0; }
:root[data-theme="dark"] .entry-warn-chip,
[data-theme="dark"] .entry-warn-chip {
  background: rgba(214, 158, 46, 0.22);
  color: #e2b568;
}

/* Error state on the city picker — flashes briefly when the user tries
   to save a restaurant/place without picking a city. */
.city-pick-error {
  animation: cityPickShake 0.4s ease-in-out;
  outline: 2px solid #d97706;
  outline-offset: 4px;
  border-radius: 6px;
}
@keyframes cityPickShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.entry-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.entry-meta-top {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 0 var(--space-2);
  font-size: 0.6875rem;
  color: var(--color-text-faint);
  margin-top: 2px;
}
.entry-meta-top .dot-sep { color: var(--color-text-faint); opacity: 0.6; }
.entry-category {
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  font-size: 0.625rem;
}

/* Right cluster — always one row, compact */
.entry-right {
  display: inline-flex; align-items: center; gap: var(--space-2);
  flex-shrink: 0;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.score-badge {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-accent);
  min-width: 28px; height: 22px;
  padding: 0 8px;
  display: inline-grid; place-items: center;
  border-radius: var(--radius-full);
  background: var(--color-accent-soft);
  line-height: 1;
}
.entry-status {
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  line-height: 1.1;
  white-space: nowrap;
}
.entry-status.is-loved { color: var(--color-accent); background: var(--color-accent-soft); }
.entry-status.is-want  { color: var(--color-text-muted); border: 1px solid var(--color-divider); background: transparent; padding: 2px 8px; }
.entry-status.is-tried { color: var(--color-text); background: var(--color-surface-2); }

/* Narrow-screen tightening — keep below base rules so overrides win */
@media (max-width: 520px) {
  .entry { padding: var(--space-2) var(--space-1); column-gap: var(--space-2); grid-template-columns: 32px minmax(0, 1fr) auto; }
  .entry-list.is-sortable .entry {
    grid-template-columns: 32px 22px 32px minmax(0, 1fr) auto;
  }
  .entry-thumb { width: 32px; height: 32px; }
  .entry-thumb svg { width: 16px; height: 16px; }
  .rank-badge { min-width: 22px; font-size: 1.125rem; }
  /* Keep finger-sized handle on narrow screens (was 16px — too small for touch) */
  .drag-handle { width: 32px; height: 44px; }
  .entry-meta-top { font-size: 0.625rem; }
  .entry-right { gap: 4px; }
  .score-badge { min-width: 24px; height: 20px; padding: 0 6px; }
  .entry-status { padding: 2px 6px; }
}

.empty-state {
  color: var(--color-text-muted);
  font-style: italic;
  padding: var(--space-6) 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: var(--text-lg);
}

/* Sortable drag states */
.dragging-ghost { opacity: 0.3; }
.dragging-chosen { background: var(--color-surface); }
.dragging-drag {
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-border);
}

/* Expand button */
.expand-btn {
  width: 100%;
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  margin-top: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: color var(--transition), background var(--transition);
}
.expand-btn:hover { color: var(--color-text); background: var(--color-surface-2); }

/* ========== Toast ========== */
.toast {
  position: fixed;
  left: 50%; bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 0.6rem 1rem;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-size: var(--text-sm);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  animation: toastIn 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 60;
}
@media (min-width: 768px) {
  .toast { bottom: auto; top: var(--space-6); left: auto; right: var(--space-6); transform: none; }
}
.toast { z-index: 95; max-width: calc(100vw - 2 * var(--space-4)); }
.toast #toastText { min-width: 0; }
.toast.is-error { background: #8f2d2d; color: #fff; }
.toast.is-error svg { display: none; }
.toast-action {
  margin-left: var(--space-2); padding: 4px 12px; border-radius: 999px;
  border: 1px solid currentColor; background: transparent; color: inherit;
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.toast-action:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.parse-cancel-inflight { margin-top: var(--space-3); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ========== Accessibility helpers ========== */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
:where(button, a, input, select, textarea, [tabindex], .entry):focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========== Account sheet ========== */
.sheet {
  position: fixed; inset: 0;
  z-index: 80;
  display: grid;
  align-items: end;
  justify-items: center;
}
.sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(20, 19, 17, 0.35);
  backdrop-filter: blur(2px);
  animation: fadeIn 200ms ease-out;
}
.sheet-card {
  position: relative;
  width: calc(100% - var(--space-4) * 2);
  max-width: 400px;
  margin-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-lg);
  animation: sheetUp 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@media (min-width: 640px) {
  .sheet { align-items: center; }
  .sheet-card { margin-bottom: 0; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.sheet-head {
  display: flex; align-items: center; gap: var(--space-3);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}
.sheet-name { font-weight: 500; color: var(--color-text); }
.sheet-email { color: var(--color-text-muted); font-size: var(--text-sm); }

/* ========== Read-only item view (item-view.js) ========== */
.item-view { z-index: 85; }
.item-view-card { max-width: 440px; padding: 0; overflow: hidden; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; }
.item-view-close { position: absolute; top: 10px; right: 10px; z-index: 2; background: var(--color-surface); }
.item-view-media {
  position: relative; aspect-ratio: 16 / 10; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-surface-2, #f1efe9); color: var(--color-text-muted);
}
.item-view-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.item-view-glyph svg { width: 40px; height: 40px; opacity: 0.45; }
.item-view-body { padding: var(--space-4) var(--space-5) 0; overflow-y: auto; }
.item-view-category { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-accent, #9a6a3a); font-weight: 600; }
.item-view-title { font-family: var(--font-display); font-size: 1.6rem; line-height: 1.15; margin-top: 4px; color: var(--color-text); }
.item-view-sub { color: var(--color-text-muted); font-size: var(--text-sm); margin-top: 4px; }
.item-view-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-3); }
.item-view-pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--color-border); color: var(--color-text-muted); }
.item-view-desc { margin-top: var(--space-3); line-height: 1.55; color: var(--color-text); font-size: var(--text-sm); }
.item-view-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-3); }
.item-view-tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--color-surface-2, #f1efe9); color: var(--color-text-muted); }
.item-view-source { display: inline-block; margin-top: var(--space-3); font-size: var(--text-sm); color: var(--color-text); text-decoration: underline; text-underline-offset: 3px; }
.item-view-actions { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-4) var(--space-5); border-top: 1px solid var(--color-divider); margin-top: var(--space-4); flex: none; }
.item-view [data-close-view]:focus-visible, #itemViewEdit:focus-visible, .item-view-source:focus-visible { outline: 2px solid var(--color-text); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .item-view .sheet-card, .item-view .sheet-backdrop { animation: none; } }

/* ========== Edit sheet ========== */
.edit-card { max-width: 480px; padding: var(--space-5) var(--space-5) var(--space-4); }
.edit-head {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}
.edit-identity { flex: 1; min-width: 0; }
.edit-title-display {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 400;
  line-height: 1.15;
  color: var(--color-text);
  word-break: break-word;
}
.edit-body {
  display: flex; flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.edit-field { align-items: flex-start; flex-direction: column; gap: 6px; }
.edit-field .meta-label { margin-bottom: 0; }
.edit-input {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}
.edit-input:focus { border-color: var(--color-text-muted); background: var(--color-surface); }
.edit-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
}
.edit-actions-right { display: inline-flex; gap: var(--space-2); }
.btn-danger {
  color: #b54444;
}
.btn-danger:hover { color: #8f2a2a; background: rgba(181, 68, 68, 0.08); }
[data-theme='dark'] .btn-danger { color: #e27272; }
[data-theme='dark'] .btn-danger:hover { color: #f19a9a; background: rgba(226, 114, 114, 0.10); }

/* Entry row is clickable — subtle affordance */
.entry { cursor: pointer; }
.entry:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.drag-handle { cursor: grab; }
.drag-handle:active { cursor: grabbing; }
.entry .entry-right { cursor: pointer; }

/* ========== Account: privacy & data ========== */
.account-data { margin-top: var(--space-6); padding-top: var(--space-5); border-top: 1px solid var(--color-divider); }
.account-toggle { display: flex; gap: var(--space-3); align-items: center; font-size: var(--text-sm); margin: var(--space-3) 0; cursor: pointer; }
.account-toggle input { width: 18px; height: 18px; accent-color: var(--color-accent); }
.account-toggle input:disabled + span { color: var(--color-text-muted); }
.account-data-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.account-delete-confirm { margin-top: var(--space-4); padding: var(--space-4); border-radius: 12px; border: 1px solid #c9a3a3; background: color-mix(in oklab, #8f2d2d 6%, var(--color-surface)); font-size: var(--text-sm); }
.account-delete-confirm p { margin: 0 0 var(--space-3); }
.account-delete-confirm label { display: block; margin-bottom: var(--space-2); }
.btn-danger-solid { background: #8f2d2d; border-color: #8f2d2d; color: #fff; }
.btn-danger-solid:disabled { opacity: 0.5; }
.account-data-status { min-height: 1.2em; font-size: var(--text-sm); color: var(--color-text-muted); margin: var(--space-3) 0 0; }

/* ========== Edit sheet: textarea for recipe fields ========== */
.edit-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
  font-family: var(--font-body);
}

/* ========== Merge banner (inside parse-card) ========== */
.merge-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: 10px 12px;
  margin: calc(var(--space-5) * -1) calc(var(--space-5) * -1) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--color-accent) 8%, transparent),
    color-mix(in srgb, var(--color-accent) 3%, transparent)
  );
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
  font-size: var(--text-sm);
  color: var(--color-text);
}
.merge-banner-body {
  display: inline-flex; align-items: center; gap: 8px;
  min-width: 0;
}
.merge-banner-icon { color: var(--color-accent); flex-shrink: 0; }
.merge-banner-text strong {
  font-weight: 600;
  color: var(--color-text);
}
.merge-banner-actions { display: inline-flex; gap: 6px; flex-shrink: 0; }
.merge-banner .chip {
  font-size: 12px;
  padding: 4px 10px;
}
@media (max-width: 520px) {
  .merge-banner { padding: 10px 12px; }
  .merge-banner-text { font-size: 13px; }
}

/* ========== Recipe view ========== */
.view-recipe {
  max-width: 1040px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-5) var(--space-10);
}
.recipe-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px 6px 6px;
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}
.recipe-back:hover { color: var(--color-text); background: var(--color-surface-2); }

.recipe-page {
  display: grid;
  gap: var(--space-6);
}
.recipe-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.recipe-hero img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.recipe-hero img[src=""], .recipe-hero img:not([src]) { display: none; }
.recipe-hero-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-muted);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--color-accent) 10%, var(--color-surface-2)) 0%,
    var(--color-surface-2) 60%
  );
}
.recipe-hero-fallback svg { width: 48px; height: 48px; opacity: 0.5; }

.recipe-head { display: grid; gap: var(--space-2); }
.recipe-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin: 0;
}
.recipe-sub {
  color: var(--color-text-muted);
  font-size: var(--text-base);
  margin: 0;
}
.recipe-meta {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.recipe-meta li {
  display: inline-flex; align-items: center; gap: 6px;
}
.recipe-meta li svg { opacity: 0.75; }
.recipe-meta li strong {
  font-weight: 500;
  color: var(--color-text);
}

/* Serves stepper (inside a recipe-meta pill) */
.meta-stepper-item {
  gap: 8px !important;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
}
.serves-stepper-label { color: var(--color-text-muted); }
.serves-step-btn {
  appearance: none; -webkit-appearance: none;
  background: none; border: 1px solid var(--color-border);
  color: var(--color-text);
  width: 26px; height: 26px;
  border-radius: 999px;
  display: inline-grid; place-items: center;
  font-size: 15px; line-height: 1;
  font-family: var(--font-body);
  cursor: pointer;
  padding: 0;
  transition: background var(--transition), border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.serves-step-btn:hover {
  background: color-mix(in srgb, var(--color-text) 6%, transparent);
  border-color: var(--color-text-muted);
}
.serves-step-btn:active {
  background: color-mix(in srgb, var(--color-text) 12%, transparent);
}
.serves-value {
  min-width: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600 !important;
  cursor: pointer;
  padding: 0 2px;
  transition: color var(--transition);
}
.serves-value.is-scaled {
  color: var(--color-accent, var(--color-text));
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

/* Mobile: slightly larger tap targets */
@media (pointer: coarse) {
  .serves-step-btn { width: 30px; height: 30px; font-size: 16px; }
}
.recipe-head-actions {
  display: inline-flex; gap: var(--space-2); flex-wrap: wrap;
  margin-top: var(--space-2);
}
.recipe-head-actions .btn { padding: 6px 12px; font-size: var(--text-sm); }
.recipe-head-actions .btn svg { margin-right: 4px; }

.recipe-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6);
}
@media (min-width: 780px) {
  .recipe-columns {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: var(--space-8);
  }
}
.recipe-ingredients, .recipe-steps { min-width: 0; }
.recipe-section-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  letter-spacing: -0.01em;
  color: var(--color-text);
  margin: 0;
}
.recipe-section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3);
  margin: 0 0 var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-divider);
}
.shop-controls { display: flex; align-items: center; gap: 6px; }
.shop-toggle-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--text-xs);
  padding: 5px 10px;
  border-radius: var(--radius-md);
}
.shop-toggle-btn svg { display: block; }
.shop-toggle-btn.is-active {
  background: var(--color-text);
  color: var(--color-bg);
  border-color: var(--color-text);
}
.shop-toggle-btn.is-active:hover {
  background: var(--color-text);
  color: var(--color-bg);
}
.shop-reset-btn {
  font-size: var(--text-xs);
  padding: 5px 10px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
}

/* Shopping mode: checkbox column appears, rows are tap targets */
.ingredient-list.is-shopping li {
  grid-template-columns: 28px auto 1fr;
  align-items: center;
  padding: 12px 0;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition), opacity var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.ingredient-list.is-shopping li:hover {
  background: color-mix(in srgb, var(--color-text) 4%, transparent);
}
.ingredient-list.is-shopping li.is-checked .ing-qty,
.ingredient-list.is-shopping li.is-checked .ing-item {
  text-decoration: line-through;
  color: var(--color-text-faint);
}
.ingredient-list.is-shopping li.is-checked .ing-note {
  text-decoration: line-through;
  opacity: 0.6;
}
.ing-check {
  display: inline-grid; place-items: center;
  background: none; border: 0; padding: 0; margin: 0;
  width: 24px; height: 24px;
  color: var(--color-text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.ing-check:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 2px;
  border-radius: 4px;
}
.ingredient-list {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 10px;
}
.ingredient-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
  font-size: var(--text-sm);
  color: var(--color-text);
  border-bottom: 1px dashed color-mix(in srgb, var(--color-divider) 70%, transparent);
}
.ingredient-list li:last-child { border-bottom: 0; }
.ing-qty {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
}
.ing-item { color: var(--color-text); }
.ing-note {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
  font-style: italic;
  margin-top: 2px;
}
.ing-none { color: var(--color-text-muted); }

.step-list {
  list-style: none; padding: 0; margin: 0;
  counter-reset: step;
  display: grid; gap: var(--space-4);
}
.step-list li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: var(--space-3);
  align-items: baseline;
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text);
}
.step-list li::before {
  content: counter(step);
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface-2));
  color: var(--color-accent);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 520px) {
  .view-recipe { padding: var(--space-2) var(--space-4) var(--space-10); }
  .recipe-title { font-size: 1.75rem; }
  .recipe-hero { aspect-ratio: 4 / 3; }
}

/* ========== Responsive ========== */
@media (min-width: 768px) {
  .capture-hero { margin-bottom: var(--space-8); }
}

/* ========== Dishes & Drinks ========== */

/* Section inside the edit sheet */
.dishes-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}

/* Dish mini-card */
.dish-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  min-height: 64px;
}
.dish-card:hover {
  background: var(--color-surface-offset);
  border-color: var(--color-text-muted);
}
.dish-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Thumbnail column */
.dish-thumb {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-surface-offset);
  display: flex;
  align-items: center;
  justify-content: center;
}
.dish-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dish-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-faint);
}

/* Dish body */
.dish-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.dish-name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dish-note-preview {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Rating pill on mini-card — reuses entry-status color language */
.dish-rating-pill {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  line-height: 1.3;
  white-space: nowrap;
  width: fit-content;
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
}
.dish-rating-pill.is-loved {
  color: var(--color-accent);
  background: var(--color-accent-soft);
  border-color: transparent;
}
.dish-rating-pill.is-liked {
  color: var(--color-text);
  background: var(--color-surface-offset);
  border-color: var(--color-divider);
}
.dish-rating-pill.is-disliked {
  color: var(--color-text-faint);
  background: transparent;
  border-color: var(--color-border);
  text-decoration: line-through;
}

/* "+ Add dish or drink" tile */
.dish-add-tile {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  background: transparent;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
  text-align: left;
  margin-top: var(--space-1);
}
.dish-add-tile:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
  background: var(--color-surface-2);
}
.dish-add-tile svg {
  flex-shrink: 0;
}

/* ========== Dish edit sheet ========== */

/* Stack the dish sheet higher than the parent edit sheet */
.dish-sheet {
  z-index: 100;
}
.dish-sheet-card {
  max-width: 440px;
  padding: var(--space-5) var(--space-5) var(--space-4);
}

/* Form layout */
.dish-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

/* Photo picker */
.dish-photo-picker {
  width: 100%;
}
.dish-photo-empty {
  display: flex;
  justify-content: center;
}
.dish-photo-trigger {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 120px;
  background: var(--color-surface-2);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}
.dish-photo-trigger:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
  background: var(--color-surface-offset);
}

/* Photo preview */
.dish-photo-preview {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: center;
}
.dish-photo-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  display: block;
}
.dish-photo-actions {
  display: flex;
  gap: var(--space-2);
}
.dish-photo-replace-label {
  cursor: pointer;
}

/* ========== Entry image picker (edit sheet) ========== */
.entry-image-picker {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}
.entry-image-empty {
  display: flex;
  justify-content: center;
}
.entry-image-trigger {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 100px;
  background: var(--color-surface-2);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}
.entry-image-trigger:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
  background: var(--color-surface-offset);
}
.entry-image-preview {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: center;
}
.entry-image-preview img {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  display: block;
  background: var(--color-surface-2);
}
.entry-image-actions {
  display: flex;
  gap: var(--space-2);
}
.entry-image-alt-controls {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
  flex-wrap: wrap;
}
.entry-image-alt-controls .entry-image-url-input {
  flex: 1 1 200px;
  min-width: 0;
}
.entry-image-alt-controls .btn {
  flex: 0 0 auto;
}
.entry-image-status {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-style: italic;
}
.entry-image-status.is-error { color: #b54444; font-style: normal; }
.entry-image-status.is-success { color: var(--color-text); font-style: normal; }
.edit-description-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-1);
  /* The parent .meta-row is a 2-column grid (label | value). Without an
     explicit column, this row lands in column 1 under the label, which
     visually orphans it in the bottom-left of the sheet. Force it into
     the value column so it sits directly under the textarea. */
  grid-column: 2;
}

/* Rating chip group in dish form */
.dish-rating-toggle {
  flex-wrap: wrap;
}

/* Note textarea — slightly shorter than recipe textarea */
.dish-note-textarea {
  min-height: 72px;
  resize: vertical;
}

/* Input error flash */
.edit-input.is-error {
  border-color: #b54444;
  animation: inputShake 0.25s ease;
}
@keyframes inputShake {
  0%  { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
  100%{ transform: translateX(0); }
}

/* ========== Dishes & Drinks global view ========== */

.view-dishes {
  max-width: 1140px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-4) var(--space-16);
}

/* Header */
.dishes-view-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.dishes-view-title-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.dishes-view-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--color-text);
  line-height: 1.2;
}
.dishes-view-subtitle {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-variant-numeric: tabular-nums;
}

/* Toolbar: pills + sort + search */
.dishes-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}
.dishes-toolbar-top {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.dishes-rating-pills {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}
.dishes-sort-wrap {
  position: relative;
  margin-left: auto;
}
.dishes-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0 var(--space-2) 0 var(--space-3);
  gap: var(--space-2);
  transition: border-color var(--transition);
}
.dishes-search-wrap:focus-within {
  border-color: var(--color-text-muted);
}
.dishes-search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 0;
  font-size: var(--text-sm);
  color: var(--color-text);
  min-width: 0;
}
.dishes-search-input:focus { outline: none; }
.dishes-search-input::placeholder { color: var(--color-text-faint); }

/* Grid */
.dishes-grid-view {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

/* Dish grid card */
.dish-grid-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  text-align: left;
  width: 100%;
}
.dish-grid-card:hover {
  border-color: var(--color-text-muted);
  background: var(--color-surface-2);
  box-shadow: var(--shadow-sm);
}
.dish-grid-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}

/* Thumbnail */
.dish-grid-thumb {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-faint);
}
.dish-grid-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Card body */
.dish-grid-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.dish-grid-name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.dish-grid-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.dish-grid-restaurant {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.dish-grid-note {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

/* Rating pill reuse */
.dish-grid-card .dish-rating-pill {
  font-size: 0.6rem;
  padding: 2px 7px;
}

/* Empty state */
.dishes-empty {
  grid-column: 1 / -1;
  color: var(--color-text-muted);
  font-style: italic;
  padding: var(--space-12) 0 var(--space-6);
  text-align: center;
  font-family: var(--font-display);
  font-size: var(--text-lg);
}

/* Responsive grid */
@media (min-width: 720px) {
  .dishes-grid-view {
    grid-template-columns: repeat(2, 1fr);
  }
  .view-dishes {
    padding: var(--space-4) var(--space-8) var(--space-16);
  }
  .dishes-view-title {
    font-size: var(--text-2xl);
  }
}

@media (min-width: 1100px) {
  .dishes-grid-view {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .dish-grid-thumb {
    width: 64px;
    height: 64px;
  }
  .dishes-toolbar-top {
    gap: var(--space-2);
  }
}

/* ========== Library search (always visible) ========== */
.library-search {
  position: relative; display: flex; align-items: center;
  margin: 0 0 var(--space-4);
}
.library-search-icon { position: absolute; left: 12px; color: var(--color-text-muted); pointer-events: none; }
.library-search-input {
  width: 100%; min-height: 40px; padding: 0 36px 0 34px;
  border: 1px solid var(--color-border); border-radius: var(--radius-full);
  background: var(--color-surface); color: var(--color-text); font: inherit; font-size: var(--text-sm);
  -webkit-appearance: none; appearance: none;
}
.library-search-input::placeholder { color: var(--color-text-muted); }
.library-search-input::-webkit-search-cancel-button { display: none; }
.library-search-clear {
  position: absolute; right: 6px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; border: 0; background: var(--color-surface-2); color: var(--color-text-muted); cursor: pointer;
}

/* ========== First-run onboarding ========== */
.onboarding-card {
  margin: 0 0 var(--space-5); padding: var(--space-5);
  border: 1px solid var(--color-border); border-radius: 16px;
  background: var(--color-surface);
}
.onboarding-title { font-size: 1.125rem; margin: 0 0 var(--space-2); }
.onboarding-sub, .onboarding-foot { color: var(--color-text-muted); font-size: var(--text-sm); margin: 0 0 var(--space-4); }
.onboarding-foot { margin: var(--space-4) 0 0; }
.onboarding-examples { display: grid; gap: var(--space-2); }
@media (min-width: 640px) { .onboarding-examples { grid-template-columns: repeat(3, 1fr); } }
.onboarding-example {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  min-height: 56px; padding: 0.7rem 0.9rem; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--color-border); background: var(--color-surface-2); color: var(--color-text); font: inherit;
  transition: border-color 150ms ease, transform 150ms ease;
}
.onboarding-example:hover { border-color: var(--color-text-muted); }
.onboarding-example:active { transform: scale(0.98); }
.onboarding-example-label { font-size: 0.75rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.onboarding-example-text { font-weight: 500; }

/* ========== Parse card: editable title/sub ========== */
.parse-title.is-editable, .parse-sub.is-editable {
  border-radius: 6px; outline: none; cursor: text;
  box-shadow: inset 0 -1px 0 transparent; transition: box-shadow 150ms ease, background 150ms ease;
}
.parse-title.is-editable:hover, .parse-sub.is-editable:hover { box-shadow: inset 0 -1px 0 var(--color-border); }
.parse-title.is-editable:focus, .parse-sub.is-editable:focus { background: var(--color-surface-2); box-shadow: inset 0 -2px 0 var(--color-accent); }

/* ========== Publish progress (account → categories) ========== */
.publish-progress-head { font-size: var(--text-sm); color: var(--color-text-muted); margin: var(--space-4) 0 var(--space-2); }
.publish-progress { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.publish-progress-item { display: grid; grid-template-columns: 7rem 1fr auto; gap: var(--space-3); align-items: center; font-size: var(--text-sm); }
.publish-progress-bar { height: 6px; border-radius: 999px; background: var(--color-surface-offset); overflow: hidden; }
.publish-progress-bar > span { display: block; height: 100%; background: var(--color-accent); border-radius: inherit; }
.publish-progress-count { color: var(--color-text-muted); font-variant-numeric: tabular-nums; }

/* ========== Want to try global view ========== */

.view-wants {
  max-width: 1140px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-4) var(--space-16);
}

/* Want card — variant of .entry */
.want-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  transition: background var(--transition), border-color var(--transition);
  cursor: pointer;
}
.want-card:hover {
  background: var(--color-surface);
  border-color: var(--color-divider);
}
.want-card-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
  align-items: center;
}
.want-card-action {
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
}
.want-card-action:hover {
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

@media (min-width: 640px) {
  .want-card { column-gap: var(--space-4); }
}

@media (min-width: 720px) {
  .view-wants {
    padding: var(--space-4) var(--space-8) var(--space-16);
  }
}

/* ========== isNew indicator ========== */
/* Subtle left accent stripe — editorial, not a banner */

.entry.is-new,
.want-card.is-new {
  border-left: 2px solid var(--color-accent);
  padding-left: calc(var(--space-3) - 2px);
}
.dish-grid-card.is-new,
.dish-card.is-new {
  border-left: 2px solid var(--color-accent);
}

@media (max-width: 520px) {
  .entry.is-new,
  .want-card.is-new {
    padding-left: calc(var(--space-1) - 2px);
  }
}

/* ============================================================
   Grid/List view toggle + Category grid landing
   ============================================================ */

/* Two-state segmented toggle in the library bar */
.view-toggle {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 2px;
  background: var(--color-surface);
  gap: 2px;
}
.view-toggle-btn {
  appearance: none; -webkit-appearance: none;
  background: transparent;
  border: 0;
  color: var(--color-text-muted);
  padding: 5px 9px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.view-toggle-btn:hover { color: var(--color-text); }
.view-toggle-btn.is-selected {
  background: var(--color-text);
  color: var(--color-surface);
}
@media (pointer: coarse) {
  .view-toggle-btn { padding: 7px 11px; }
}

/* ---------- Category grid (landing view) ---------- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}
@media (min-width: 560px) {
  .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 860px) {
  .category-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }
}
@media (min-width: 1200px) {
  .category-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.cg-tile {
  appearance: none; -webkit-appearance: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg, 14px);
  padding: 18px 14px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  color: var(--color-text);
  text-align: left;
  position: relative;
  overflow: hidden;
  transition:
    transform var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
  min-height: 108px;
  -webkit-tap-highlight-color: transparent;
}
.cg-tile:hover {
  border-color: var(--color-text-muted);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px -6px color-mix(in srgb, var(--color-text) 20%, transparent);
}
.cg-tile:active { transform: translateY(0); }
.cg-tile:focus-visible {
  outline: 2px solid var(--color-accent, var(--color-text));
  outline-offset: 2px;
}
.cg-tile.is-empty {
  opacity: 0.55;
}
.cg-tile.is-empty .cg-tile-count { opacity: 0.6; }

/* "Everything" tile spans full row */
.cg-tile--all {
  grid-column: 1 / -1;
  background: var(--color-text);
  color: var(--color-surface);
  border-color: var(--color-text);
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  min-height: 68px;
}
.cg-tile--all:hover {
  background: color-mix(in srgb, var(--color-text) 92%, var(--color-surface));
  border-color: var(--color-text);
  box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--color-text) 40%, transparent);
}
.cg-tile--all .cg-tile-icon { color: var(--color-surface); }
.cg-tile--all .cg-tile-label {
  font-size: var(--text-lg, 18px);
  font-weight: 600;
  flex: 1;
}
.cg-tile--all .cg-tile-count {
  background: color-mix(in srgb, var(--color-surface) 20%, transparent);
  color: var(--color-surface);
  border-color: transparent;
}

.cg-tile-icon {
  color: var(--color-text-muted);
  display: inline-grid;
  place-items: center;
  transition: color var(--transition);
}
.cg-tile:hover .cg-tile-icon { color: var(--color-text); }
.cg-tile-icon svg { width: 26px; height: 26px; }

.cg-tile-label {
  font-size: var(--text-base, 15px);
  font-weight: 600;
  line-height: 1.2;
}
.cg-tile-count {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  background: color-mix(in srgb, var(--color-text) 6%, transparent);
  border: 1px solid transparent;
  padding: 2px 8px;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Sort button appears in both modes but is inert in grid mode
   (sort doesn't apply to a grid of category tiles). Kept in the DOM
   so the library-bar layout is identical across grid and list. */
.sort-select.is-inert {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ========== UI polish: edit-sheet labels, Everything tile, sort hint, rank hint ========== */
/* Edit sheet labels were in an 88px column with 0.1em tracking, so
   "DESCRIPTION" overflowed into the field and "DISHES & DRINKS" wrapped. */
.edit-card .meta-row { grid-template-columns: 112px minmax(0, 1fr); }
.edit-card .meta-label { letter-spacing: 0.06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Dish cards need the full width anyway: put the label above them. */
.edit-card #editDishesRow { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 420px) {
  .edit-card .meta-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .edit-card .edit-description-actions { grid-column: 1; }
}

/* Everything tile: make it read as a button, not a heading. */
.cg-tile--all { cursor: pointer; }
.cg-tile--all .cg-tile-cta {
  font-size: var(--text-sm); font-weight: 500; opacity: 0.75;
}
.cg-tile--all .cg-tile-chevron { flex: none; opacity: 0.8; transition: transform 180ms ease; }
.cg-tile--all:hover .cg-tile-chevron, .cg-tile--all:focus-visible .cg-tile-chevron { transform: translateX(3px); }
.cg-tile--all:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* Sort control in grid mode: explain instead of going dead. */
.sort-select.is-inert { pointer-events: auto; cursor: help; }

@media (prefers-reduced-motion: reduce) { .cg-tile--all .cg-tile-chevron { transition: none; } }

/* ---------- Account detail sheet ---------- */

/* Give the Account entry a subtle divider so it reads as "utility",
   distinct from the content menu items above it. */
#menuAccountBtn {
  margin-top: 6px;
  padding-top: calc(var(--space-3) + 2px);
  border-top: 1px solid var(--color-divider);
}

.account-detail-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding-top: var(--space-4);
}

.account-identity {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  background: var(--color-surface-2);
  border-radius: 12px;
}
.account-identity-meta { min-width: 0; }
.account-identity-name {
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-identity-email {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-identity-provider {
  display: inline-block;
  margin-top: 6px;
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
  color: var(--color-text-muted);
  padding: 2px 8px;
  border: 1px solid var(--color-divider);
  border-radius: 999px;
  background: transparent;
}

.account-password-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.account-section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--color-text);
  margin: var(--space-1) 0 var(--space-1);
}
.account-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.account-field-label {
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
  color: var(--color-text-muted);
}
.account-form-msg {
  font-size: var(--text-sm);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--color-divider);
  background: var(--color-surface-2);
  color: var(--color-text);
}
.account-form-msg.is-success {
  color: var(--color-text);
  border-color: color-mix(in oklab, var(--color-primary) 40%, var(--color-divider));
  background: color-mix(in oklab, var(--color-primary) 8%, var(--color-surface-2));
}
.account-form-msg.is-error {
  color: var(--color-text);
  border-color: color-mix(in oklab, #b3261e 45%, var(--color-divider));
  background: color-mix(in oklab, #b3261e 8%, var(--color-surface-2));
}
.account-form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}

.account-google-note {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  padding: var(--space-3);
  border: 1px dashed var(--color-divider);
  border-radius: 10px;
  background: transparent;
}

.account-signout {
  display: flex;
  justify-content: center;
  padding-top: var(--space-3);
  margin-top: var(--space-2);
  border-top: 1px solid var(--color-divider);
}
.account-signout .btn {
  min-width: 140px;
}

/* Back arrow in the Account detail sheet header. */
.account-detail-back {
  margin-right: var(--space-2);
}

/* ---------- Public profile section (Account panel) ---------- */

.account-profile {
  padding-top: var(--space-4);
  margin-top: var(--space-2);
  border-top: 1px solid var(--color-divider);
}

.account-profile-intro-copy {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: var(--space-2) 0 var(--space-3);
}

.account-profile-example {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: 0.92em;
  color: var(--color-text);
  background: var(--color-surface-2);
  padding: 1px 6px;
  border-radius: 6px;
}
.account-profile-example em {
  font-style: italic;
  color: var(--color-text-muted);
}

.account-profile-settings {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Public toggle row */
.account-toggle-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-surface-2);
  border-radius: 12px;
  cursor: pointer;
  position: relative;
}
.account-toggle-copy { flex: 1; min-width: 0; }
.account-toggle-label {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.01em;
}
.account-toggle-help {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}
.account-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.account-toggle-visual {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--color-divider);
  position: relative;
  transition: background 160ms ease;
  flex-shrink: 0;
}
.account-toggle-visual::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-surface);
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  transition: transform 160ms ease;
}
.account-toggle-input:checked + .account-toggle-visual {
  background: var(--color-primary);
}
.account-toggle-input:checked + .account-toggle-visual::after {
  transform: translateX(18px);
}
.account-toggle-input:focus-visible + .account-toggle-visual {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Username row */
.account-username-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-2);
  border-radius: 10px;
}
.account-username-current {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: var(--text-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-username-domain { color: var(--color-text-muted); }
.account-username-value  { color: var(--color-text); font-weight: 600; }

.account-field-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-left: 4px;
}

/* Categories checklist */
.account-categories-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}
@media (max-width: 400px) {
  .account-categories-list { grid-template-columns: 1fr; }
}
.account-category-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--color-divider);
  border-radius: 10px;
  cursor: pointer;
  background: transparent;
  transition: background 120ms ease, border-color 120ms ease;
  min-width: 0;
}
.account-category-item:hover {
  background: var(--color-surface-2);
}
.account-category-item:has(.account-category-check:checked) {
  border-color: color-mix(in oklab, var(--color-primary) 55%, var(--color-divider));
  background: color-mix(in oklab, var(--color-primary) 6%, transparent);
}
.account-category-check {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--color-divider);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}
.account-category-check:checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.account-category-check:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid var(--color-surface);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.account-category-visual {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.account-category-visual svg { width: 100%; height: 100%; }
.account-category-label {
  font-size: var(--text-sm);
  color: var(--color-text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-category-count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.account-categories-empty {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  padding: var(--space-3);
  border: 1px dashed var(--color-divider);
  border-radius: 10px;
  margin: 0;
}

/* Split actions row: link on left, primary button on right */
.account-form-actions-split {
  justify-content: space-between;
  align-items: center;
}

/* ---------- Username claim modal ---------- */

.account-username-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  backdrop-filter: blur(4px);
}
.account-username-modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  border-radius: 16px;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.account-username-modal-copy {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0;
}
.account-username-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--color-divider);
  border-radius: 10px;
  padding: 4px 4px 4px 12px;
  background: var(--color-surface-2);
}
.account-username-input-prefix {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.account-username-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  padding: 8px 4px;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: var(--text-sm);
  color: var(--color-text);
}
.account-username-input:focus {
  outline: none;
}
.account-username-status {
  font-size: var(--text-xs);
  min-height: 1.2em;
  color: var(--color-text-muted);
}
.account-username-status.is-error   { color: color-mix(in oklab, #b3261e 80%, var(--color-text)); }
.account-username-status.is-success { color: color-mix(in oklab, var(--color-primary) 80%, var(--color-text)); }
.account-username-status.is-checking { color: var(--color-text-muted); font-style: italic; }

/* ---------- Edit sheet: Pin to profile row ---------- */

/* Pin row has no label — override the meta-row grid so the label spans
   the full width instead of getting squeezed into the 1fr value column. */
.edit-pin-row {
  padding: 0;
  display: block;
  min-height: 0;
}
.edit-pin-label {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-surface-2);
  border-radius: 12px;
  cursor: pointer;
  transition: background 120ms ease;
  width: 100%;
}
.edit-pin-label:hover {
  background: color-mix(in oklab, var(--color-surface-2) 92%, var(--color-text));
}
.edit-pin-check {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--color-divider);
  border-radius: 5px;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  margin: 2px 0 0;
  background: var(--color-surface);
}
.edit-pin-check:checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.edit-pin-check:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid var(--color-surface);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.edit-pin-check:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.edit-pin-visual {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: color-mix(in oklab, var(--color-primary) 12%, transparent);
  color: var(--color-primary);
  flex-shrink: 0;
  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.edit-pin-label:has(.edit-pin-check:checked) .edit-pin-visual {
  transform: rotate(-20deg) scale(1.1);
}
.edit-pin-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.edit-pin-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.01em;
}
.edit-pin-help {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* ============================================================
   Claim-username nudge
   Appears at the top of the library for signed-in users with
   entries but no claimed username. Dismissible; persists in
   localStorage. Mobile-first, subtle gold accent to signal
   the shareable/public angle without shouting.
   ============================================================ */
.claim-nudge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 var(--space-4) var(--space-4);
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    color-mix(in oklab, var(--color-accent) 8%, var(--color-surface)) 0%,
    var(--color-surface) 65%
  );
  border: 1px solid color-mix(in oklab, var(--color-accent) 22%, var(--color-border));
  box-shadow: 0 1px 0 rgba(0,0,0,0.02), 0 6px 16px -12px rgba(0,0,0,0.18);
  animation: claim-nudge-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes claim-nudge-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.claim-nudge-body {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.claim-nudge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  background: color-mix(in oklab, var(--color-accent) 14%, transparent);
  color: var(--color-accent);
}
.claim-nudge-text {
  min-width: 0;
}
.claim-nudge-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.005em;
}
.claim-nudge-sub {
  font-size: 12.5px;
  color: var(--color-text-muted);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.claim-nudge-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.claim-nudge-primary {
  appearance: none;
  border: 0;
  background: var(--color-text);
  color: var(--color-surface);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}
.claim-nudge-primary:hover { transform: translateY(-1px); }
.claim-nudge-primary:active { transform: translateY(0); }
.claim-nudge-dismiss {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, color 120ms ease;
}
.claim-nudge-dismiss:hover {
  background: color-mix(in oklab, var(--color-text) 8%, transparent);
  color: var(--color-text);
}

/* Small screens: keep it compact but readable. */
@media (max-width: 480px) {
  .claim-nudge {
    padding: 10px 12px;
    gap: 8px;
  }
  .claim-nudge-sub { display: none; }
  .claim-nudge-primary { padding: 7px 12px; font-size: 12.5px; }
  .claim-nudge-icon { width: 30px; height: 30px; }
}

/* Private-beta notice (non-allowlisted users; see app.js showBetaNotice) */
.beta-notice {
  margin-top: var(--space-5);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text);
}
/* Inline parse error in the add sheet (see app.js showParseError). Sits below
   the input in normal flow, so it never overlaps the text being edited. */
.parse-error {
  margin-top: var(--space-4);
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: #fbeceb;
  border: 1px solid #e8c4c1;
  border-radius: var(--radius-lg);
  color: #7a2424;
  animation: slideIn 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.parse-error[hidden] { display: none; }
.parse-error-text { flex: 1 1 auto; min-width: 0; margin: 0; font-size: var(--text-sm); line-height: 1.4; overflow-wrap: anywhere; }
.parse-error-retry {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 999px;
  border: 1px solid currentColor; background: transparent; color: inherit;
  font: inherit; font-size: var(--text-sm); font-weight: 600; cursor: pointer; white-space: nowrap;
}
.parse-error-retry:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
[data-theme='dark'] .parse-error { background: #3a1d1b; border-color: #6b302c; color: #f4c7c2; }
/* Multi-line toasts read as a rounded card, not a stretched pill. */
.toast.is-error { border-radius: var(--radius-lg); text-align: left; }
.beta-notice-title { font-weight: 600; margin: 0 0 4px; }
.beta-notice-body { color: var(--color-text-muted); font-size: var(--text-sm); margin: 0 0 var(--space-3); }

a.menu-item { text-decoration: none; color: inherit; }
.item-view-media { position: relative; }
.item-view-media .img-credit { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 14px 10px 6px;
  font: 400 11px/1.3 var(--font-sans, sans-serif); color: #fff; text-align: right;
  background: linear-gradient(transparent, rgba(0,0,0,.5)); }
.img-credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* Per-item share (share.js) */
.entry-share { display:inline-grid; place-items:center; width:32px; height:32px; border:0; border-radius:999px; background:transparent; color:var(--muted, #8a7f73); cursor:pointer; opacity:.7; }
.entry-share:hover, .entry-share:focus-visible { opacity:1; background:color-mix(in srgb, currentColor 10%, transparent); }
.share-add-notice { margin:0 0 16px; padding:12px 14px; border-radius:14px; background:color-mix(in srgb, #b0442a 12%, transparent); color:inherit; font-size:14px; text-align:center; }
.account-shared { margin-top:20px; }
.shared-links-list { list-style:none; margin:12px 0 0; padding:0; display:grid; gap:8px; }
.shared-links-list li { display:flex; align-items:center; gap:12px; padding:10px 12px; border-radius:12px; background:color-mix(in srgb, currentColor 5%, transparent); }
.shared-link-title { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; }
.shared-link-title small { display:block; opacity:.6; font-size:12px; }
.shared-links-empty { opacity:.7; font-size:14px; margin:10px 0 0; }
.linklike.is-danger { color:#b3261e; }
.account-legal { font-size: var(--text-sm); color: var(--color-text-muted); margin: var(--space-4) 0 0; }
.account-legal a { color: inherit; display: inline-flex; align-items: center; min-height: 44px; }
.auth-terms a { color: inherit; }

/* redesign.css */
/* =========================================================
   Top Tried — redesign layer (2026-10)
   Loaded after styles.css. Tokens first, then components.
   Principles: one loop (add → rank → flex), one way to navigate,
   depth over borders, warm ember accent, motion that explains.
   ========================================================= */

:root, [data-theme='light'] {
  --color-bg: #f8f5ef;
  --color-surface: #ffffff;
  --color-surface-2: #f1ece3;
  --color-divider: #e7e0d3;
  --color-border: #ddd5c6;
  --color-text: #17140f;
  --color-text-muted: #5f5a50;     /* 6.4:1 on bg */
  --color-text-faint: #6b665c;     /* 5.3:1 on bg */
  --color-accent: #b9400f;         /* ember — 5.2:1 on bg, 5.6:1 on white */
  --color-accent-soft: #fbe6d8;
  --ember-grad: linear-gradient(135deg, #ff8a3d 0%, #f0544f 55%, #d63a7a 100%);
  --glass: rgba(248, 245, 239, 0.78);
  --shadow-sm: 0 1px 2px rgba(40, 28, 10, 0.05), 0 1px 1px rgba(40, 28, 10, 0.03);
  --shadow-md: 0 2px 4px rgba(40, 28, 10, 0.04), 0 10px 28px rgba(40, 28, 10, 0.08);
  --shadow-lg: 0 6px 12px rgba(40, 28, 10, 0.06), 0 28px 64px rgba(40, 28, 10, 0.16);
}
[data-theme='dark'] {
  --color-bg: #12100d;
  --color-surface: #1c1915;
  --color-surface-2: #25211c;
  --color-divider: #2d2822;
  --color-border: #3a342c;
  --color-text: #f3eee6;
  --color-text-muted: #b3aa9c;
  --color-text-faint: #a39a8b;
  --color-accent: #ff9a5c;         /* 8.6:1 on bg */
  --color-accent-soft: #3b2417;
  --glass: rgba(18, 16, 13, 0.72);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.6);
}
:root {
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.5, 1);
  --radius-card: 22px;
}

/* ---------- Header: brand left, actions right, frosted ---------- */
body.rd .app-header {
  position: sticky; top: 0; z-index: 40;
  margin: 0 calc(-1 * var(--space-5));
  padding: calc(var(--space-3) + env(safe-area-inset-top)) var(--space-5) var(--space-3);
  background: var(--glass);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
  gap: var(--space-3);
}
.app-brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--color-text); text-decoration: none;
  font-family: var(--font-display); font-size: 1.4rem; letter-spacing: -0.01em; line-height: 1;
}
.app-brand svg { width: 26px; height: 26px; }
.app-header-nav { display: none; margin-left: auto; gap: var(--space-1); }
.header-link {
  padding: 8px 14px; border-radius: 999px; font-size: var(--text-sm); font-weight: 500;
  color: var(--color-text-muted); transition: background var(--transition), color var(--transition);
}
.header-link:hover { background: var(--color-surface-2); color: var(--color-text); }
@media (min-width: 768px) { .app-header-nav { display: inline-flex; } }

/* ---------- Capture: the hero of the app ---------- */
body.rd .capture-hero { margin-top: var(--space-6); }
body.rd .display { font-size: clamp(2.6rem, 1.6rem + 4.4vw, 4.4rem); margin-bottom: var(--space-2); }
body.rd .capture-panel { margin-bottom: var(--space-8); }
body.rd .input-shell {
  border: 0; border-radius: 20px; padding: 10px 10px 10px 14px;
  box-shadow: var(--shadow-md), 0 0 0 1px var(--color-divider);
  transition: box-shadow 260ms var(--ease-out), transform 260ms var(--ease-out);
}
body.rd .input-shell:focus-within {
  box-shadow: var(--shadow-lg), 0 0 0 2px var(--color-accent);
  transform: translateY(-1px);
}
body.rd #captureInput { font-size: 1.0625rem; }
body.rd .mic-btn {
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--color-text); color: var(--color-bg);
  transition: transform 180ms var(--ease-spring), background var(--transition);
}
body.rd .mic-btn:active { transform: scale(0.92); }

/* The taste card replaces the claim banner. */
body.rd .claim-nudge { display: none !important; }
@keyframes tcGlow { from { transform: translate(0, 0) rotate(0deg); } to { transform: translate(-12%, 8%) rotate(12deg); } }

/* ---------- Chip rail: the one way to move between lists ---------- */
.chip-rail {
  position: sticky; top: calc(60px + env(safe-area-inset-top)); z-index: 30;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  /* Chips stay inside the content column (no bleed past the page edge); the
     sticky glass still spans the gutters via a side-only shadow. */
  --rail-gutter: var(--space-5);
  margin: 0; padding: var(--space-2) 0;
  background: var(--glass);
  box-shadow: 0 0 0 var(--rail-gutter) var(--glass);
  clip-path: inset(0 calc(-1 * var(--rail-gutter)));
  -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
}
.chip-rail::-webkit-scrollbar { display: none; }
.tt-chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  font-size: var(--text-sm); font-weight: 500; color: var(--color-text);
  background: var(--color-surface); box-shadow: 0 0 0 1px var(--color-divider);
  transition: background 200ms var(--ease-out), color 200ms var(--ease-out), transform 180ms var(--ease-spring);
}
.tt-chip:active { transform: scale(0.95); }
.tt-chip-icon svg { width: 15px; height: 15px; }
.tt-chip-n { font-variant-numeric: tabular-nums; color: var(--color-text-muted); font-size: 0.8125rem; }
.tt-chip.is-on { background: var(--color-text); color: var(--color-bg); box-shadow: none; }
.tt-chip.is-on .tt-chip-n { color: inherit; opacity: 0.75; }

/* Cut: grid/list toggle, category popover, All/Tried filter. Sort + search stay. */
body.rd .view-toggle,
body.rd .filter-pill-wrap,
body.rd .status-filter { display: none !important; }
body.rd .library-bar { border-top: 0; margin-top: var(--space-2); padding-top: 0; }
body.rd .category-grid { display: none !important; }

.profile-caption {
  display: flex; align-items: center; gap: 8px;
  margin: var(--space-2) 0 var(--space-3); font-size: var(--text-sm); color: var(--color-text-muted);
}
.profile-caption::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ember-grad); flex: none; }

/* ---------- Rows: calmer, bigger art, rank as typography ---------- */
body.rd .entry {
  padding: 10px var(--space-3); border-radius: 16px;
  transition: background 200ms var(--ease-out), box-shadow 200ms var(--ease-out), transform 200ms var(--ease-spring);
}
body.rd .entry:hover { background: var(--color-surface); border-color: transparent; box-shadow: var(--shadow-sm); }
body.rd .entry-list .entry { grid-template-columns: 52px minmax(0, 1fr) auto; }
body.rd .entry-list.is-sortable .entry { grid-template-columns: 22px 30px 52px minmax(0, 1fr) auto; }
body.rd .entry-thumb { width: 52px; height: 52px; border-radius: 12px; border: 0; box-shadow: inset 0 0 0 1px var(--color-divider); }
body.rd .entry-thumb[data-has-image="true"] { box-shadow: var(--shadow-sm); }
body.rd .entry-thumb svg { width: 20px; height: 20px; }
body.rd .entry-title { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
body.rd .entry-sub { font-size: 0.875rem; }
body.rd .rank-badge { font-size: 1.6rem; color: var(--color-text-faint); }
/* Hide noise: category is redundant inside a category, "Tried" is the default, and timestamps aren't taste. */
body.rd .entry-meta-top > :not(.entry-category):not(.entry-warn-chip) { display: none; }
body.rd:not([data-cat="all"]) .entry-meta-top > .entry-category { display: none; }
body.rd:not([data-cat="all"]) .entry-meta-top:not(:has(.entry-warn-chip)) { display: none; }
body.rd .entry-status.is-tried { display: none; }
body.rd .score-badge {
  min-width: 34px; height: 28px; padding: 0 8px; border-radius: 10px;
  font-variant-numeric: tabular-nums; font-weight: 600;
  background: var(--color-surface-2); color: var(--color-text);
}

/* Ranks 1–5 in a category are your public profile: make it felt. */
.entry-list.is-profile-ranked > .entry:nth-child(-n+5) .rank-badge {
  color: var(--color-accent);
}
.entry-list.is-profile-ranked > .entry:nth-child(-n+5) {
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}
.entry-list.is-profile-ranked > .entry:nth-child(5) { margin-bottom: var(--space-4); position: relative; }
.entry-list.is-profile-ranked > .entry:nth-child(5)::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: calc(-1 * var(--space-3));
  border-bottom: 1.5px dashed var(--color-border);
}
.entry-list.is-profile-ranked.is-sortable .entry:nth-child(-n+3) .rank-badge { color: var(--color-accent); }

/* New item lands with a little lift + ember glow. */
body.rd .entry.is-new { animation: rdLand 900ms var(--ease-spring); box-shadow: 0 0 0 2px var(--color-accent), var(--shadow-md); }
@keyframes rdLand {
  0% { transform: translateY(14px) scale(0.97); opacity: 0; }
  60% { transform: translateY(-2px) scale(1.01); opacity: 1; }
  100% { transform: none; }
}
/* Drag: lift, not just move. */
body.rd .dragging-chosen { transform: scale(1.025); box-shadow: var(--shadow-lg); background: var(--color-surface); }

/* ---------- Toast: above the tab bar, springy ---------- */
body.rd .toast {
  bottom: calc(84px + env(safe-area-inset-bottom));
  padding: 0.75rem 1.1rem; font-weight: 500;
  animation: rdToast 420ms var(--ease-spring);
}
@keyframes rdToast { from { transform: translate(-50%, 16px) scale(0.96); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@media (min-width: 768px) {
  body.rd .toast { bottom: auto; animation: rdToastD 380ms var(--ease-spring); }
  @keyframes rdToastD { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* ---------- Tab bar (mobile) ---------- */
.tabbar { display: none; }
body.rd[data-auth="in"] .tabbar {
  position: fixed; z-index: 50; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px;
  width: min(360px, calc(100vw - 32px)); padding: 6px;
  border-radius: 26px; background: var(--glass);
  -webkit-backdrop-filter: saturate(1.8) blur(24px); backdrop-filter: saturate(1.8) blur(24px);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--color-divider);
}
.tabbar-btn {
  display: grid; justify-items: center; gap: 2px; padding: 6px 0; border-radius: 20px;
  font-size: 0.6875rem; font-weight: 600; color: var(--color-text-muted);
}
.tabbar-btn:active { background: var(--color-surface-2); }
.tabbar-add {
  width: 56px; height: 48px; border-radius: 18px; display: grid; place-items: center;
  color: #fff; background: var(--ember-grad); box-shadow: 0 8px 20px rgba(214, 58, 122, 0.35);
  transition: transform 200ms var(--ease-spring);
}
.tabbar-add:active { transform: scale(0.9) rotate(90deg); }
.tabbar-add:focus-visible, .tabbar-btn:focus-visible { outline: 2px solid var(--color-text); outline-offset: 2px; }
@media (min-width: 768px) { body.rd[data-auth="in"] .tabbar { display: none; } }
body.rd[data-view="recipe"] .tabbar, body.rd .sheet:not([hidden]) ~ .tabbar { display: none; }

/* ---------- Landing ---------- */
.landing-eyebrow {
  display: inline-block; margin-bottom: var(--space-4);
  padding: 6px 12px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--color-accent); background: var(--color-accent-soft);
}
body .landing-h1 { font-size: clamp(3rem, 1.8rem + 5vw, 5.4rem); line-height: 0.98; letter-spacing: -0.03em; }
body .landing-h1 em {
  background: var(--ember-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-right: 0.06em;
}
.landing-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-6) 0 var(--space-3); }
.landing-actions .btn { min-height: 52px; }
.landing-example { color: var(--color-text); box-shadow: inset 0 0 0 1px var(--color-border); }
.lv-stage { position: relative; height: 440px; max-width: 420px; margin: 0 auto; }
.lv-stage::before {
  content: ''; position: absolute; inset: 15% 5% 5%; background: var(--ember-grad); filter: blur(70px); opacity: 0.35; border-radius: 50%;
}
.lv-id { position: absolute; top: 0; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; z-index: 4; }
.lv-id .lv-avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 0.8rem; font-weight: 700;
  color: #fff; background: var(--ember-grad); box-shadow: 0 0 0 3px var(--color-bg);
}
.lv-id .lv-handle { font-family: var(--font-display); font-size: 1.6rem; }
.lv-pill { font-size: 0.7rem; font-weight: 600; padding: 4px 8px; border-radius: 999px; background: var(--color-text); color: var(--color-bg); }
.lv-card {
  position: absolute; left: 50%; width: 270px; padding: 18px 18px 14px; border-radius: 22px;
  background: var(--color-surface); box-shadow: var(--shadow-lg), 0 0 0 1px var(--color-divider);
  transition: transform 500ms var(--ease-spring);
}
.lv-card--back { top: 70px; transform: translateX(-38%) rotate(7deg); }
.lv-card--mid { top: 82px; transform: translateX(-62%) rotate(-6deg); }
.lv-card--front { top: 104px; transform: translateX(-50%); z-index: 3; }
.landing-visual:hover .lv-card--back { transform: translateX(-26%) rotate(10deg); }
.landing-visual:hover .lv-card--mid { transform: translateX(-74%) rotate(-9deg); }
/* Scroll-driven fan + shuffle (redesign.js sets data-slot and --fan, 0..1).
   Slot 0 is the front card; the deck fans wider as the hero scrolls. */
.lv-stage.is-live .lv-card { transition: transform 600ms var(--ease-spring), top 600ms var(--ease-spring), box-shadow 300ms ease; }
.lv-stage.is-live .lv-card[data-slot="0"] { top: 104px; z-index: 3; transform: translateX(-50%) rotate(calc(var(--fan, 0) * -1.5deg)); }
.lv-stage.is-live .lv-card[data-slot="1"] { top: calc(82px - var(--fan, 0) * 10px); z-index: 2; transform: translateX(calc(-62% - var(--fan, 0) * 8%)) rotate(calc(-6deg - var(--fan, 0) * 3deg)); }
.lv-stage.is-live .lv-card[data-slot="2"] { top: calc(70px - var(--fan, 0) * 14px); z-index: 1; transform: translateX(calc(-38% + var(--fan, 0) * 8%)) rotate(calc(7deg + var(--fan, 0) * 3deg)); }
.lv-card-cat { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-accent); margin-bottom: 10px; }
.lv-card-list { list-style: none; display: grid; gap: 9px; }
.lv-card-list li { display: grid; grid-template-columns: 18px 34px 1fr; align-items: center; gap: 10px; font-weight: 500; font-size: 0.95rem; }
.lv-n { font-family: var(--font-display); font-style: italic; font-size: 1.35rem; text-align: center; color: var(--color-text-faint); }
.lv-card-list li:nth-child(-n+3) .lv-n { color: var(--color-accent); }
.lv-swatch { width: 34px; height: 34px; border-radius: 10px; }
.lv-card[data-hue="r"] li:nth-child(1) .lv-swatch { background: linear-gradient(135deg, #f6b26b, #c2571e); }
.lv-card[data-hue="r"] li:nth-child(2) .lv-swatch { background: linear-gradient(135deg, #f2d29b, #b07a2a); }
.lv-card[data-hue="r"] li:nth-child(3) .lv-swatch { background: linear-gradient(135deg, #f7a29a, #c2413a); }
.lv-card[data-hue="r"] li:nth-child(4) .lv-swatch { background: linear-gradient(135deg, #b9d7a8, #5b8c4a); }
.lv-card[data-hue="r"] li:nth-child(5) .lv-swatch { background: linear-gradient(135deg, #c9c1e8, #6c5fb0); }
.lv-card[data-hue="m"] .lv-swatch { background: linear-gradient(160deg, #3a3f5c, #11131c); }
.lv-card[data-hue="b"] .lv-swatch { background: linear-gradient(160deg, #e9dcc3, #a48b62); }
.lv-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .lv-stage { height: 400px; transform: scale(0.92); transform-origin: top center; } }

@media (prefers-reduced-motion: reduce) {
  body.rd .entry.is-new { animation: none; }
  body.rd .toast { animation: none; }
  .lv-card, .tt-chip, .tabbar-add, body.rd .input-shell { transition: none; }
}

/* Sticky chrome spans the column on wider screens too. */
body.rd .app { padding-top: 0; }
@media (min-width: 768px) {
  body.rd .app-header { margin-left: calc(-1 * var(--space-8)); margin-right: calc(-1 * var(--space-8)); padding-left: var(--space-8); padding-right: var(--space-8); }
  body.rd .chip-rail { --rail-gutter: var(--space-8); }
}
.landing-example { text-decoration: none; }
.lv-pill { white-space: nowrap; }

/* ---------- Tab bar: three equal destinations (Add lives in the page) ---------- */
body.rd[data-auth="in"] .tabbar { grid-template-columns: repeat(3, 1fr); }
.tabbar-btn[aria-current="page"] { color: var(--color-text); background: var(--color-surface); box-shadow: var(--shadow-sm); }
.tabbar-btn[data-tab="foryou"][aria-current="page"] svg { color: var(--color-accent); }
.header-link[aria-current="page"] { color: var(--color-text); background: var(--color-surface-2); }

/* ---------- For you ---------- */
.fy-teaser { margin: 0 0 var(--space-6); }
.fy-teaser-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--space-3); }
.fy-teaser-title { font-family: var(--font-display); font-size: 1.9rem; letter-spacing: -0.01em; }
.fy-see-all { font-size: var(--text-sm); font-weight: 600; color: var(--color-accent); padding: 8px 4px; }
.fy-rail { display: flex; gap: var(--space-3); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 calc(-1 * var(--space-5)); padding: 4px var(--space-5) var(--space-3); }
.fy-rail::-webkit-scrollbar { display: none; }
.fy-rail .fy-card { flex: 0 0 168px; scroll-snap-align: start; cursor: pointer; }
.fy-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin: var(--space-6) 0 var(--space-5); }
.fy-eyebrow { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-accent); }
.fy-h1 { font-family: var(--font-display); font-size: clamp(2.6rem, 1.6rem + 4.4vw, 4rem); letter-spacing: -0.02em; outline: none; }
.fy-h1 em { background: var(--ember-grad); -webkit-background-clip: text; background-clip: text; color: transparent; padding-right: 0.06em; }
.fy-meta { color: var(--color-text-muted); font-size: var(--text-sm); margin-top: 4px; }
.fy-refresh { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--color-surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--color-divider); color: var(--color-text); transition: transform 300ms var(--ease-spring); }
.fy-refresh:active { transform: rotate(-120deg) scale(0.92); }
.fy-refresh:disabled { opacity: 0.45; }
.fy-status { color: var(--color-text-muted); font-size: var(--text-sm); margin-bottom: var(--space-4); }
.fy-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-4); }
@media (min-width: 640px) { .fy-grid { grid-template-columns: 1fr 1fr; } }
.fy-card { position: relative; display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius-card);
  background: var(--color-surface); box-shadow: var(--shadow-md), 0 0 0 1px var(--color-divider);
  transition: transform 260ms var(--ease-spring), opacity 260ms var(--ease-out); }
.fy-card.is-leaving { transform: translateX(-24px) scale(0.96); opacity: 0; }
.fy-art { position: relative; aspect-ratio: 16 / 10; background: var(--color-surface-2); overflow: hidden; }
.fy-card[data-media="poster"] .fy-art { aspect-ratio: 16 / 11; }
.fy-art img { width: 100%; height: 100%; object-fit: cover; }
.fy-card[data-media="poster"] .fy-art img { object-position: center 25%; }
.fy-glyph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--color-text-faint); }
.fy-glyph svg { width: 36px; height: 36px; }
.fy-cat, .fy-crowd { position: absolute; top: 10px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; background: rgba(255, 255, 255, 0.94); color: #17140f; box-shadow: var(--shadow-sm); }
.fy-cat { left: 10px; } .fy-cat svg { width: 13px; height: 13px; }
.fy-crowd { right: 10px; background: #17140f; color: #fff; }
.fy-body { display: flex; flex-direction: column; gap: 6px; padding: var(--space-4); flex: 1; }
.fy-title { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; }
.fy-sub { font-size: var(--text-sm); color: var(--color-text-muted); }
.fy-because { font-size: var(--text-sm); color: var(--color-text); line-height: 1.4; }
.fy-because strong { color: var(--color-accent); font-weight: 600; }
.fy-reason { font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.45; }
.fy-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: var(--space-3); }
.fy-btn { min-height: 40px; padding: 0 14px; border-radius: 999px; font-size: var(--text-sm); font-weight: 600;
  background: var(--color-surface-2); color: var(--color-text); transition: transform 180ms var(--ease-spring), background var(--transition); }
.fy-btn:active { transform: scale(0.94); }
.fy-btn--primary { background: var(--color-text); color: var(--color-bg); }
.fy-btn--quiet { background: transparent; color: var(--color-text-muted); }
.fy-btn:disabled { opacity: 0.5; }
.fy-link { align-self: flex-start; font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); text-decoration: none; padding: 6px 0 0; }
.fy-card--compact .fy-art { aspect-ratio: 4 / 5; }
.fy-card--compact .fy-body { padding: 10px 12px 12px; gap: 3px; }
.fy-card--compact .fy-title { font-size: 0.9375rem; }
.fy-card--compact .fy-because { font-size: 0.8125rem; color: var(--color-text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fy-card--compact .fy-sub, .fy-card--compact .fy-cat span { display: none; }
.fy-empty { text-align: center; padding: var(--space-10) var(--space-5); border-radius: var(--radius-card); background: var(--color-surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--color-divider); }
.fy-empty-title { font-family: var(--font-display); font-size: 1.8rem; margin-bottom: var(--space-2); }
.fy-empty p { color: var(--color-text-muted); max-width: 36ch; margin: 0 auto var(--space-4); }
.fy-skel .fy-art, .fy-skel .fy-body span { background: linear-gradient(90deg, var(--color-surface-2) 0%, var(--color-divider) 50%, var(--color-surface-2) 100%); background-size: 200% 100%; animation: fyShimmer 1.4s linear infinite; }
.fy-skel .fy-body span { display: block; height: 12px; border-radius: 6px; }
.fy-skel .fy-body span:first-child { width: 70%; height: 16px; } .fy-skel .fy-body span:last-child { width: 45%; }
@keyframes fyShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.account-toggle-note { display: block; color: var(--color-text-muted); font-size: var(--text-xs); line-height: 1.45; margin-top: 4px; }
@media (prefers-reduced-motion: reduce) {
  .fy-skel .fy-art, .fy-skel .fy-body span { animation: none; }
  .fy-card, .fy-btn, .fy-refresh { transition: none; }
}

/* ---------- Sheets scroll (all .sheet modals) ----------
   The card is the scroll container; the page behind is locked by
   sheet-lock.js. Wheel / trackpad / touch scroll stays inside the sheet. */
.sheet { overscroll-behavior: contain; }
.sheet-card {
  max-height: calc(100vh - var(--space-4) * 2 - env(safe-area-inset-bottom) - env(safe-area-inset-top));
  max-height: calc(100dvh - var(--space-4) * 2 - env(safe-area-inset-bottom) - env(safe-area-inset-top));
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
/* The read-only item view keeps its fixed media header; its body scrolls. */
.item-view-card { overflow: hidden; }
.item-view-body { min-height: 0; flex: 1 1 auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
html.sheet-locked, html.sheet-locked body { overflow: hidden; overscroll-behavior: none; }

/* ---------- Quick rate sheet ("Tried it" on For you) ---------- */
.qr-card { max-width: 420px; display: flex; flex-direction: column; gap: var(--space-3); }
.qr-head { display: flex; gap: var(--space-3); align-items: center; }
.qr-thumb { flex: none; width: 56px; height: 56px; border-radius: 14px; overflow: hidden; background: var(--color-surface-2); display: grid; place-items: center; color: var(--color-text-faint); }
.qr-thumb img { width: 100%; height: 100%; object-fit: cover; }
.qr-thumb svg { width: 24px; height: 24px; }
.qr-id { min-width: 0; }
.qr-kicker { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-accent); }
.qr-title { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-sub { font-size: var(--text-sm); color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-label { display: flex; align-items: baseline; gap: 6px; font-weight: 600; font-size: var(--text-sm); margin-top: var(--space-2); }
.qr-score-val { margin-left: auto; font-family: var(--font-display); font-size: 2rem; line-height: 1; color: var(--color-text); }
.qr-of { color: var(--color-text-muted); font-weight: 500; }
.qr-optional { color: var(--color-text-muted); font-weight: 400; }
.qr-range { width: 100%; height: 44px; accent-color: var(--color-accent); touch-action: pan-x; }
.qr-note { min-height: 64px; resize: vertical; }
.qr-actions { display: flex; align-items: center; justify-content: space-between; margin-top: var(--space-2); }
.qr-save { min-width: 120px; min-height: 44px; }
.item-view-note { margin-top: var(--space-3); padding: 10px 12px; border-radius: 12px; background: var(--color-surface-2); font-size: var(--text-sm); line-height: 1.5; }
.item-view-note::before { content: 'Your note'; display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); margin-bottom: 2px; }

/* ---------- For you: refresh feedback ---------- */
.fy-refresh { width: auto; padding: 0 16px 0 14px; border-radius: 999px; display: inline-flex; gap: 8px; align-items: center; font-size: var(--text-sm); font-weight: 600; }
.fy-refresh:disabled { opacity: 0.8; cursor: progress; }
.fy-refresh.is-spinning svg { animation: fySpin 0.9s linear infinite; }
@keyframes fySpin { to { transform: rotate(360deg); } }
.fy-progress { position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; margin-bottom: var(--space-4);
  padding: 10px 14px; border-radius: 12px; background: var(--color-surface-2); color: var(--color-text-muted); font-size: var(--text-sm); }
.fy-progress-bar { position: absolute; left: 0; top: 0; height: 3px; width: 40%; background: var(--ember-grad, var(--color-accent)); border-radius: 3px; animation: fyBar 1.2s var(--ease-out, ease) infinite; }
@keyframes fyBar { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.fy-list.is-refreshing .fy-card { opacity: 0.55; filter: saturate(0.7); transition: opacity 200ms ease; }
.fy-list.is-refreshing .fy-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%); background-size: 200% 100%; animation: fyShimmer 1.4s linear infinite; }
.fy-inline-error { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--space-4); padding: 10px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--color-error, #b3261e) 10%, var(--color-surface)); color: var(--color-text); font-size: var(--text-sm); }
.fy-card.is-fresh { animation: fyIn 420ms var(--ease-spring) both; }
.fy-grid .fy-card.is-fresh:nth-child(2) { animation-delay: 50ms; } .fy-grid .fy-card.is-fresh:nth-child(3) { animation-delay: 100ms; }
.fy-grid .fy-card.is-fresh:nth-child(4) { animation-delay: 150ms; } .fy-grid .fy-card.is-fresh:nth-child(n+5) { animation-delay: 200ms; }
@keyframes fyIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .fy-refresh.is-spinning svg, .fy-progress-bar, .fy-list.is-refreshing .fy-art::after, .fy-card.is-fresh { animation: none; }
  .fy-progress-bar { width: 100%; opacity: 0.6; }
}
@media (prefers-reduced-motion: reduce) {
  .fy-card.is-fresh{ animation: none; }
  .fy-card.is-leaving{ transition: none; }
}

/* warm.css */
/* =========================================================
   Top Tried — warm editorial layer (2026-10, preview)
   Food-magazine feel: cream paper, terracotta ink, deep green.
   Light by default; a re-toned warm dark variant. All text
   pairs >= 4.5:1 (see PR for the contrast table).
   ========================================================= */
:root, [data-theme='light'] {
  --color-bg: #faf4ea;
  --color-surface: #fffcf6;
  --color-surface-2: #f3eadc;
  --color-surface-offset: #efe4d3;
  --color-divider: #e8dccb;
  --color-border: #dccdb8;
  --color-text: #2b2118;           /* 14.4:1 on bg */
  --color-text-muted: #67594b;     /* 6.2:1 */
  --color-text-faint: #6f6152;     /* 5.5:1 */
  --color-accent: #b0442a;         /* terracotta 5.2:1 on bg, white on it 5.7:1 */
  --color-accent-soft: #f6dfd3;
  --color-green: #2f5d46;          /* deep green 6.9:1 */
  --color-green-soft: #dfeae2;
  --row-top-tint: #f9ebe1;
  --ember-grad: linear-gradient(135deg, #d9673f 0%, #b0442a 60%, #8c3a2a 100%);
  --glass: rgba(250, 244, 234, 0.82);
  --shadow-sm: 0 1px 2px rgba(74, 44, 20, 0.06), 0 1px 1px rgba(74, 44, 20, 0.04);
  --shadow-md: 0 2px 6px rgba(74, 44, 20, 0.05), 0 12px 30px rgba(74, 44, 20, 0.09);
  --shadow-lg: 0 8px 16px rgba(74, 44, 20, 0.07), 0 30px 70px rgba(74, 44, 20, 0.16);
}
[data-theme='dark'] {
  --color-bg: #1d1713;
  --color-surface: #271f1a;
  --color-surface-2: #312720;
  --color-surface-offset: #392e26;
  --color-divider: #3b3029;
  --color-border: #4a3d33;
  --color-text: #f4ebdd;
  --color-text-muted: #c4b5a3;
  --color-text-faint: #b3a491;
  --color-accent: #ef916d;
  --color-accent-soft: #432a20;
  --color-green: #8fc7a6;
  --color-green-soft: #23332a;
  --row-top-tint: #33241d;
  --ember-grad: linear-gradient(135deg, #f2a27f 0%, #ef916d 60%, #d9673f 100%);
  --glass: rgba(29, 23, 19, 0.8);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 26px 64px rgba(0, 0, 0, 0.55);
}
body.rd { background: var(--color-bg); }

/* ---------- Wider, two-zone desktop ---------- */
@media (min-width: 1024px) { body.rd .app { max-width: 1120px; } }
@media (min-width: 1440px) { body.rd .app { max-width: 1240px; } }
@media (min-width: 1024px) {
  body.rd .capture-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-6); margin-top: var(--space-8); }
  body.rd .capture-panel { max-width: 760px; }
}
body.rd .display em, body.rd .display i { color: var(--color-accent); }

/* Primary actions: terracotta. Selected states: deep green. */
body.rd .mic-btn, .fy-btn--primary, body.rd .btn-primary { background: var(--color-accent); color: #fff; }
[data-theme='dark'] body.rd .mic-btn, [data-theme='dark'] .fy-btn--primary, [data-theme='dark'] body.rd .btn-primary { color: #1d1713; }
.tt-chip.is-on { background: var(--color-green); color: var(--color-bg); }
body.rd .input-shell:focus-within { box-shadow: var(--shadow-lg), 0 0 0 2px var(--color-accent); }

/* ---------- Try next (For you on home) ---------- */
.fy-teaser { margin-bottom: var(--space-8); }
.fy-teaser-eyebrow { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-green); }
.fy-teaser-title { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem); }
.fy-rail .fy-card { flex-basis: 180px; }
.fy-rail { scroll-padding-inline: var(--space-5); }
@media (min-width: 900px) { .fy-rail { margin: 0; padding: 4px 0 var(--space-3); } .fy-rail .fy-card { flex-basis: 220px; } }
.fy-because strong { color: var(--color-accent); }
.fy-crowd { background: var(--color-green); }

/* ---------- Lists: bigger art; two columns on desktop ---------- */
body.rd .entry-list .entry { grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; }
body.rd .entry-list.is-sortable .entry { grid-template-columns: 22px 30px 64px minmax(0, 1fr) auto; }
body.rd .entry-thumb { width: 64px; height: 64px; border-radius: 14px; }
body.rd .entry { background: var(--color-surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--color-divider); margin-bottom: 8px; }
body.rd .entry:hover { box-shadow: var(--shadow-md), 0 0 0 1px var(--color-divider); transform: translateY(-1px); }
body.rd .entry-title { font-size: 1.0625rem; }
.rank-badge { color: var(--color-accent); }
@media (min-width: 1024px) {
  body.rd #libraryList.entry-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--space-4); row-gap: 0; align-items: start; }
  body.rd .entry-list .entry { grid-template-columns: 76px minmax(0, 1fr) auto; }
  body.rd .entry-list.is-sortable .entry { grid-template-columns: 22px 30px 76px minmax(0, 1fr) auto; }
  body.rd .entry-thumb { width: 76px; height: 76px; }
  /* The "top 5 on your profile" divider spans both columns. */
  .entry-list.is-profile-ranked > .entry:nth-child(5)::after { display: none; }
}
.entry-list.is-profile-ranked > .entry:nth-child(-n+5) { background: var(--row-top-tint); }
.profile-caption::before { background: var(--color-green); }

/* Tighter rhythm */
body.rd .capture-panel { margin-bottom: var(--space-6); }
body.rd .chip-rail { margin-top: 0; }

@media (prefers-reduced-motion: reduce) {
   body.rd .entry { transition: none; }
   body.rd .entry:hover { transform: none; }
}

/* ---------- Designed tiles for items with no image ----------
   Same box as a photo: the initial on a warm gradient (cream text >= 4.9:1
   on every stop). Used by the top-picks hero, its mini rows and list thumbs. */
.type-tile {
  position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden;
  color: #faf4ea; background: linear-gradient(145deg, var(--tt-a), var(--tt-b));
}
.type-tile[data-tone="0"] { --tt-a: #b0442a; --tt-b: #8c3a2a; }
.type-tile[data-tone="1"] { --tt-a: #2f5d46; --tt-b: #244a37; }
.type-tile[data-tone="2"] { --tt-a: #8f6119; --tt-b: #74500f; }
.type-tile[data-tone="3"] { --tt-a: #7a3b4f; --tt-b: #5f2d3e; }
.type-tile[data-tone="4"] { --tt-a: #56622a; --tt-b: #434d1f; }
.type-tile-initial { font-family: var(--font-display); font-style: italic; line-height: 1; font-size: 1.4em; }
.type-tile::after { /* soft paper grain ring for depth */
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(120% 90% at 20% 10%, rgba(255, 255, 255, 0.16), transparent 55%);
}
.type-tile-glyph { position: absolute; right: 14px; top: 14px; opacity: 0.55; }
.type-tile-glyph svg { width: 22px; height: 22px; }
.type-tile--hero .type-tile-initial { font-size: clamp(5rem, 3rem + 6vw, 8rem); transform: translateY(-12%); }
.type-tile--hero .type-tile-glyph { display: none; }

/* Thumbs host tiles at their own size. */
/* Guard: whatever holds a tile is its box. .type-tile is absolute/inset 0, so a
   host without a positioning context made it fill the viewport (2026-10 bug). */
:where(:has(> .type-tile)) { position: relative; }
 body.rd .entry-thumb { position: relative; }
body.rd .entry-thumb .type-tile { border-radius: inherit; }
body.rd .entry-thumb .type-tile-initial { font-size: 1.9rem; }
body.rd .entry-thumb[data-has-image="false"] { box-shadow: var(--shadow-sm); background: none; }
.fy-art { position: relative; }
.fy-art .type-tile-initial { font-size: 4rem; }
@keyframes stShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---- Try next row (home) ------------------------------------------------ */
.entry-list > li.tn-slot { list-style: none; padding: 0; margin: var(--space-5) 0 var(--space-6); background: none; border: 0; box-shadow: none; display: block; }
.entry-list > li.tn-slot::before, .entry-list > li.tn-slot::after { content: none; }
.tn { margin: var(--space-6) 0; min-width: 0; }
.tn[hidden] { display: none; }
.tn-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.tn-title-h { font-family: var(--font-display); font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); letter-spacing: -0.01em; color: var(--color-text); }
.tn-rail {
  --tn-w: 150px;
  display: flex; gap: var(--space-3); overflow-x: auto; overflow-y: visible;
  scroll-snap-type: x mandatory; scroll-padding-inline: 2px; scrollbar-width: none;
  padding: 6px 2px 10px; margin: 0 -2px;
  overscroll-behavior-x: contain;
}
.tn-rail::-webkit-scrollbar { display: none; }
.tn-rail:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 4px; border-radius: 12px; }
/* 390px: two full cards and a peek of the third. */
@media (min-width: 640px) { .tn-rail { --tn-w: 176px; } }
@media (min-width: 1024px) { .tn-rail { --tn-w: 196px; } }
.tn-item { flex: 0 0 var(--tn-w); scroll-snap-align: start; display: flex; }
@keyframes tnShimmer { 50% { opacity: 0.55; } }
.fy-filter { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); color: var(--color-text-muted); font-size: var(--text-sm); }
.fy-filter strong { color: var(--color-text); }
@media (prefers-reduced-motion: reduce) {
  .tn-rail { scroll-behavior: auto; }
}
.entry-list > li.tn-slot { grid-column: 1 / -1; width: 100%; background: none !important; box-shadow: none !important; border: 0 !important; }
/* Same caption height for every category so switching pills never moves the list. */
.profile-caption { min-height: calc(2 * 1.4em); line-height: 1.4; align-items: center; }
@media (min-width: 640px) { .profile-caption { min-height: 1.4em; } }
/* Uniform For you cards so a refilled slot never changes the grid. */
.fy-grid .fy-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fy-grid .fy-because, .fy-grid .fy-reason { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* poster.css */
/* Poster tiles for movies & TV without a licensed image (tiles.js posterTile).
   Self-contained: also used by the public profile, which has no warm.css. */
.poster-tile, .poster-stage {
  --pt-a: #b5573b; --pt-b: #7e3423; --pt-ink: #fbf3e6; --pt-acc: #f2c9a0;
  position: absolute; inset: 0; overflow: hidden; display: grid; place-items: center;
  color: var(--pt-ink);
  background:
    radial-gradient(130% 80% at 15% 0%, rgba(255, 255, 255, 0.14), transparent 55%),
    radial-gradient(120% 90% at 100% 110%, rgba(0, 0, 0, 0.28), transparent 60%),
    linear-gradient(160deg, var(--pt-a), var(--pt-b));
}
.poster-tile { container-type: size; }
[data-pal="clay"]    { --pt-a: #b9593d; --pt-b: #7c3221; --pt-ink: #fbf3e6; --pt-acc: #f3c79c; }
[data-pal="forest"]  { --pt-a: #2f5a46; --pt-b: #13281f; --pt-ink: #f6efe2; --pt-acc: #e0916a; }
[data-pal="night"]   { --pt-a: #352f4d; --pt-b: #14111d; --pt-ink: #f1e8d8; --pt-acc: #d2b073; }
[data-pal="ink"]     { --pt-a: #2d2724; --pt-b: #0e0b0a; --pt-ink: #f0e4d1; --pt-acc: #c8573a; }
[data-pal="oxblood"] { --pt-a: #7d3127; --pt-b: #37110c; --pt-ink: #f8eadb; --pt-acc: #e6b47e; }
[data-pal="rose"]    { --pt-a: #c88674; --pt-b: #91493b; --pt-ink: #fff6ee; --pt-acc: #fde3cf; }
[data-pal="ochre"]   { --pt-a: #d8a44c; --pt-b: #a46b1d; --pt-ink: #2a1a0c; --pt-acc: #7a2e1a; }
[data-pal="paper"]   { --pt-a: #f4ead8; --pt-b: #e0cfb0; --pt-ink: #3a2418; --pt-acc: #b0442a; }
[data-pal="sage"]    { --pt-a: #6d8966; --pt-b: #3e573c; --pt-ink: #f8f2e4; --pt-acc: #f1c99f; }

/* Paper grain + a fine inset frame, like a printed one-sheet. */
.poster-tile::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.22; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.poster-tile::after {
  content: ''; position: absolute; inset: 5.5cqmin; pointer-events: none; border-radius: 1.5cqmin;
  border: 1px solid color-mix(in srgb, var(--pt-ink) 22%, transparent);
  display: none;
}
.poster-tile .type-tile-initial {
  position: relative; font-family: var(--font-display, 'Instrument Serif', Georgia, serif); font-style: italic;
  font-weight: 400; line-height: 1; font-size: 58cqmin; letter-spacing: -0.02em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}
/* Thumbnail size (list rows): kicker on top, the title set small at the
   bottom left, so even a 64px tile says what it is. */
@container (max-width: 99.98px) or (max-height: 109.98px) {
.poster-tile .pt-body {
  position: relative; display: flex; flex-direction: column; justify-content: space-between;
  width: 100%; height: 100%; box-sizing: border-box; padding: 9cqmin 9cqmin 10cqmin; text-align: left;
}
.poster-tile .pt-kicker {
  font: 700 max(6px, 10.5cqmin)/1 var(--font-sans, Inter, system-ui, sans-serif);
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--pt-acc);
}
.poster-tile .pt-title {
  font-family: var(--font-display, 'Instrument Serif', Georgia, serif); font-weight: 400;
  font-size: max(9px, 19cqmin); line-height: 0.98; letter-spacing: -0.005em; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.poster-tile[data-len="s"] .pt-title, .poster-tile[data-len="xs"] .pt-title { font-size: max(8.5px, 16cqmin); -webkit-line-clamp: 4; }
.poster-tile .pt-rule, .poster-tile .pt-meta { display: none; }
}

/* Poster layout once there is room for type (>= ~100px wide). */
@container (min-width: 100px) and (min-height: 110px) {
  .poster-tile::after { display: block; }
  .poster-tile .pt-body {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
    width: 100%; height: 100%; box-sizing: border-box; padding: 13cqh 11cqw 12cqh; text-align: center; gap: 0;
  }
  .pt-kicker {
    position: absolute; top: 11cqh; left: 0; right: 0;
    font: 600 clamp(8px, 4.4cqw, 13px)/1 var(--font-sans, Inter, system-ui, sans-serif);
    letter-spacing: 0.28em; text-transform: uppercase; color: var(--pt-acc); opacity: 0.95;
  }
  .pt-title {
    font-family: var(--font-display, 'Instrument Serif', Georgia, serif); font-weight: 400;
    line-height: 0.98; letter-spacing: -0.01em; text-wrap: balance; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden;
    font-size: 17cqw;
  }
  [data-len="m"] .pt-title { font-size: 14cqw; }
  [data-len="s"] .pt-title { font-size: 11.5cqw; }
  [data-len="xs"] .pt-title { font-size: 9.5cqw; }
  .pt-rule { width: 14cqw; height: 1px; margin: 6cqh 0 4.5cqh; background: var(--pt-acc); opacity: 0.9; }
  .pt-meta {
    font: 500 clamp(9px, 4.8cqw, 15px)/1.2 var(--font-sans, Inter, system-ui, sans-serif);
    letter-spacing: 0.06em; opacity: 0.86; font-variant-numeric: lining-nums;
  }
}
/* Very wide boxes (Discover cards): keep the poster proportions readable. */
@container (min-aspect-ratio: 5/4) and (min-height: 110px) {
  .poster-tile .pt-body { padding: 10cqh 18cqw 11cqh; }
  .pt-title { font-size: min(17cqw, 22cqh); }
  [data-len="m"] .pt-title { font-size: min(14cqw, 18cqh); }
  [data-len="s"] .pt-title { font-size: min(11.5cqw, 15cqh); }
  [data-len="xs"] .pt-title { font-size: min(9.5cqw, 12cqh); }
  .pt-kicker { top: 9cqh; font-size: clamp(8px, 4cqh, 12px); }
  .pt-meta { font-size: clamp(9px, 4.6cqh, 14px); }
  .pt-rule { width: 9cqh; margin: 4.5cqh 0 3.5cqh; }
}

/* Detail-sheet hero: centred 2:3 card on a deeper stage of the same palette. */
.poster-stage { background: linear-gradient(160deg, color-mix(in srgb, var(--pt-a) 70%, #000), color-mix(in srgb, var(--pt-b) 75%, #000)); }
.poster-stage .poster-card {
  position: relative; height: 84%; aspect-ratio: 2 / 3; border-radius: 6px; overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25);
}
.poster-stage .poster-card .poster-tile { border-radius: inherit; }

/* Light paper palette needs an edge on cream pages; dims a touch in dark mode. */
.poster-tile[data-pal="paper"] { box-shadow: inset 0 0 0 1px rgba(58, 36, 24, 0.08); }
:root[data-theme="dark"] .poster-tile[data-pal="paper"] { filter: brightness(0.9) saturate(0.95); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .poster-tile[data-pal="paper"] { filter: brightness(0.9) saturate(0.95); } }

/* Official Apple "Listen on" badges (unaltered SVG from Apple Services
   Marketing Tools). Clear space: >= 1/10 of the badge height on every side. */
.apple-badge { display: inline-block; padding: 6px; margin: 2px 0 0 -6px; line-height: 0; border-radius: 10px; }
.apple-badge img { display: block; height: 40px; width: auto; }
.apple-badge:focus-visible { outline: 2px solid var(--accent, #b0442a); outline-offset: 2px; }
.thumb-apple { display: block; position: absolute; inset: 0; border-radius: inherit; }
.thumb-apple img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.rs-badge { padding: 12px 20px 0; }
.iv-badge { padding: 12px 0 0; }
.rs-badge:empty, .iv-badge:empty { display: none; }

/* mylist.css */
/* My List (Phase 2, design doc §5, §8). Tokens from warm.css. */

/* Cut from home: hero, "Your top picks" grid, teaser, grid/list toggle, the
   category dropdown and the All/Tried pills (chip bar + Tried/Want own these). */
.capture-hero, #forYouTeaser, .view-toggle, .filter-pill-wrap,
.status-filter, #categoryGrid { display: none !important; }

.ml-head {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px;
  margin: 8px 0 14px;
}
.ml-h1 {
  font-family: var(--font-display, Georgia, serif); font-weight: 400;
  font-size: clamp(2rem, 1.4rem + 2vw, 2.75rem); letter-spacing: -0.02em; line-height: 1.05;
  margin: 0; flex: 1 1 auto; color: var(--color-text);
}
.ml-seg {
  display: inline-flex; padding: 3px; border-radius: 999px;
  background: var(--color-surface-offset); box-shadow: inset 0 0 0 1px var(--color-divider);
}
.ml-seg-btn {
  min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: none;
  font: inherit; font-size: var(--text-sm, .875rem); font-weight: 500; color: var(--color-text-muted); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.ml-seg-btn[aria-pressed="true"] { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }
.ml-count {
  min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: .75rem; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--color-accent-soft); color: var(--color-text);
}
.ml-add-btn {
  display: none; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px;
  background: var(--color-accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
@media (min-width: 761px) { .ml-add-btn { display: inline-flex; } }
@media (max-width: 760px) { .ml-h1 { flex-basis: 100%; } }

/* Chip "+ more" and its popover */
.tt-chip.tt-chip--more { color: var(--color-accent); background: transparent; box-shadow: none; border: 1px dashed var(--color-border); }
.chip-more {
  margin: -4px 0 14px; padding: 12px; border-radius: 16px; background: var(--color-surface);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--color-divider);
}
.chip-more-h { margin: 0 0 8px; font-size: .8125rem; color: var(--color-text-muted); }
.chip-more-list { display: flex; flex-wrap: wrap; gap: 8px; }

/* Body owned by My List: the ranked <ul> is hidden */
.ml-body[hidden] { display: none; }
body.ml-own #expandBtn, body.ml-own #profileCaption, body.ml-own #filterBar { display: none !important; }

/* All: overview, one card per category, compact top 3 */
.ml-overview { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 761px) { .ml-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .ml-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ml-ov {
  background: var(--color-surface); border-radius: 18px; padding: 14px 14px 8px;
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--color-divider);
}
.ml-ov-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.ml-ov-head h2 { margin: 0; font-size: 1.0625rem; font-weight: 600; display: flex; align-items: center; gap: 8px; color: var(--color-text); }
.ml-ov-icon svg { width: 16px; height: 16px; color: var(--color-accent); }
.ml-ov-all { font-size: .8125rem; color: var(--color-text-muted); text-decoration: none; padding: 8px 4px; white-space: nowrap; }
.ml-ov-all:hover { color: var(--color-accent); }
.ml-ov-list { list-style: none; margin: 0; padding: 0; }

/* One row grid for every compact row: rank? · thumb · text · trailing.
   Text truncates; the thumb never overlaps it (audit 3c). */
.ml-ov-row, .ml-row, .ml-st {
  display: grid; align-items: center; gap: 12px; min-height: 56px; padding: 6px 4px;
  border-radius: 12px; cursor: pointer;
}
.ml-ov-row { grid-template-columns: 22px 44px minmax(0, 1fr) auto auto; }
.ml-ov-row + .ml-ov-row { box-shadow: inset 0 1px 0 var(--color-divider); border-radius: 0; }
.ml-ov-row:hover, .ml-ov-row:focus-visible { background: var(--color-surface-offset); }
.ml-rank { font-family: var(--font-display, Georgia, serif); font-style: italic; font-size: 1.125rem; color: var(--color-text-muted); text-align: center; }
.ml-rank.is-one { color: var(--color-accent); }
.ml-thumb {
  position: relative; /* contains .type-tile (absolute, inset 0) */
  width: 44px; height: 44px; border-radius: 10px; overflow: hidden; flex: none;
  background: linear-gradient(135deg, var(--color-green-soft), var(--color-accent-soft)); display: grid; place-items: center;
}
.ml-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ml-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left; }
.ml-title, .ml-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-title { font-weight: 600; color: var(--color-text); line-height: 1.3; }
.ml-sub { font-size: .8125rem; line-height: 1.3; color: var(--color-text-muted); }
.ml-score {
  min-width: 30px; height: 26px; padding: 0 8px; border-radius: 8px; display: grid; place-items: center;
  font-size: .8125rem; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--color-surface-offset); color: var(--color-text);
}

/* Want to try rows: same grid, primary action on the right */
.ml-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
@media (min-width: 900px) { .ml-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ml-row {
  grid-template-columns: 56px minmax(0, 1fr) auto auto; cursor: default; padding: 10px 12px;
  background: var(--color-surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--color-divider); border-radius: 16px;
}
.ml-row .ml-thumb { width: 56px; height: 56px; border-radius: 12px; }
.ml-open { background: none; border: 0; padding: 4px 0; font: inherit; cursor: pointer; color: inherit; }
.ml-rate { white-space: nowrap; }
@media (max-width: 420px) {
  .ml-row { grid-template-columns: 48px minmax(0, 1fr) auto; }
  .ml-row .ml-thumb { width: 48px; height: 48px; }
  .ml-rate { grid-column: 1 / -1; justify-self: stretch; grid-row: 2; }
}

/* Category view: top 5 = "On your profile" */
#libraryList.ml-ranked > li.entry.ml-p-last:not(:last-child) { margin-bottom: 22px; position: relative; }
#libraryList.ml-ranked > li.entry.ml-p-last:not(:last-child)::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: -12px; border-bottom: 1px dashed var(--color-border);
}
#libraryList.ml-ranked > li.entry.ml-onprofile { box-shadow: inset 3px 0 0 var(--color-accent), var(--shadow-sm); }

/* Empty states + inline starter picks */
.ml-empty {
  text-align: center; padding: 28px 18px; border-radius: 18px; background: var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-divider); display: grid; gap: 10px; justify-items: center;
}
.ml-empty p { margin: 0; color: var(--color-text-muted); }
.ml-empty .ml-empty-title { font-family: var(--font-display, Georgia, serif); font-size: 1.5rem; color: var(--color-text); }
.ml-starters { width: 100%; max-width: 640px; display: grid; gap: 8px; margin: 6px 0; text-align: left; }
.ml-st {
  grid-template-columns: 44px minmax(0, 1fr) auto; cursor: default; padding: 8px 10px;
  background: var(--color-bg); border-radius: 14px; box-shadow: 0 0 0 1px var(--color-divider);
}
.ml-st-actions { display: flex; gap: 6px; }
@media (max-width: 480px) { .ml-st { grid-template-columns: 44px minmax(0, 1fr); } .ml-st-actions { grid-column: 1 / -1; } .ml-st-actions .fy-btn { flex: 1; } }
.ml-st--skel .ml-thumb, .ml-st--skel .ml-text span { background: var(--color-surface-offset); border-radius: 6px; }
.ml-st--skel .ml-text span { height: 12px; width: 70%; display: block; }
.ml-st--skel .ml-text span + span { width: 45%; }
@media (prefers-reduced-motion: no-preference) {
  .ml-st--skel .ml-thumb, .ml-st--skel .ml-text span { animation: tnShimmer 1.2s ease-in-out infinite; }
}

/* Next for you: the Discover card, inline variant (discover.css) */
.tn .tn-rail--one { display: block; overflow: visible; }
.tn .tn-rail--one .tn-item { width: 100%; max-width: 620px; }

/* Add sheet */
.add-card { width: min(640px, 100%); }
.add-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.add-title { margin: 0; font-family: var(--font-display, Georgia, serif); font-weight: 400; font-size: 1.5rem; }
.add-sheet .capture-panel { margin: 0; }

/* Tab bar + */
.tabbar-add { color: #fff; }
.tabbar-add-dot {
  width: 46px; height: 46px; border-radius: 999px; display: grid; place-items: center;
  background: var(--color-accent); box-shadow: var(--shadow-md); color: #fff;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.rd[data-auth="in"] .tabbar { grid-template-columns: repeat(3, 1fr); }
/* One clean circle: the button is just the slot (no gradient square / pink glow
   from redesign.css underneath); the dot is the visible control. */
.tabbar-add {
  display: grid; place-items: center; align-self: center; justify-self: center;
  width: 100%; height: auto; padding: 4px 0; border-radius: 20px;
  background: none; box-shadow: none; transform: none;
}
.tabbar-add:active { background: none; transform: none; }
.tabbar-add-dot {
  width: 44px; height: 44px; border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16), 0 1px 2px rgba(0, 0, 0, 0.08);
  transition: transform 160ms ease;
}
.tabbar-add:active .tabbar-add-dot { transform: scale(0.92); }
.tabbar-add:focus-visible { outline: none; }
.tabbar-add:focus-visible .tabbar-add-dot { outline: 2px solid var(--color-text); outline-offset: 2px; }
/* The top-5 divider only reads in the single-column list; on the two-column grid the tint marks them. */
@media (min-width: 761px) {
  #libraryList.ml-ranked > li.entry.ml-p-last:not(:last-child) { margin-bottom: 0; }
  #libraryList.ml-ranked > li.entry.ml-p-last:not(:last-child)::after { content: none; }
}
.ml-thumb .type-tile { width: 100%; height: 100%; border-radius: inherit; font-size: 1.1rem; }

/* Phase 6: reserve the floating tab bar's real footprint (set by app.js),
   never less than the original 140px + safe area. */
body.rd { padding-bottom: max(calc(140px + env(safe-area-inset-bottom)), var(--tabbar-clear, 0px)); }

/* Want to try: which share of the list this category is */
.ml-want-scope { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin: 0 0 var(--space-3); color: var(--color-text-muted); font-size: var(--text-sm); }
.ml-empty .ml-want-scope { justify-content: center; margin: 0; }

/* Add lives in a floating action button above the tab bar, not in it (iOS HIG: tab bars navigate). */
.fab-add { display: none; }
@media (max-width: 767px) {
  body.rd[data-auth="in"] .fab-add {
    position: fixed; z-index: 51; right: 16px;
    bottom: calc(12px + env(safe-area-inset-bottom) + 64px + 14px);
    display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
    background: var(--color-accent); color: #fff; border: 0;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22), 0 1px 3px rgba(0, 0, 0, 0.12);
    transition: transform 160ms ease;
  }
  body.rd[data-auth="in"] .fab-add:active { transform: scale(0.92); }
  body.rd[data-auth="in"] .fab-add:focus-visible { outline: 2px solid var(--color-text); outline-offset: 3px; }
  body.rd[data-view="recipe"] .fab-add, body.rd .sheet:not([hidden]) ~ .fab-add { display: none; }
}
@media (prefers-reduced-motion: reduce) { .fab-add { transition: none; } }

/* discover.css */
/* Discover (Phase 3): the one recommendation card + its details sheet. */

/* Art and title are buttons (open details); reset them to look like content. */
.rec-art { display: block; width: 100%; padding: 0; border: 0; margin: 0; cursor: pointer; font: inherit; color: inherit; text-align: left; }
.rec-title { all: unset; cursor: pointer; display: inline; border-radius: 4px; }
.rec-title:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.rec-title:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.fy-actions [data-act="not_for_me"] { margin-left: auto; }

/* Inline variant: same markup and actions, art on the left (Next for you). */
.rec-card--inline { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: stretch; }
.rec-card--inline .fy-art { aspect-ratio: 4 / 5; height: 100%; }
.rec-card--inline .fy-card .fy-art, .rec-card--inline[data-media] .fy-art { aspect-ratio: 4 / 5; }
.rec-card--inline .fy-cat span { display: none; }
.rec-card--inline .fy-body { padding: 14px 16px; gap: 4px; }
.rec-card--inline .fy-title { font-size: 1.0625rem; }
.rec-card--inline .fy-because { font-size: .875rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rec-card--inline .fy-actions { padding-top: 10px; }
@media (max-width: 480px) {
  .rec-card--inline { grid-template-columns: 96px minmax(0, 1fr); }
  .rec-card--inline .fy-actions [data-act="not_for_me"] { margin-left: 0; }
}

/* Details sheet */
.rs-card { width: min(560px, 100%); position: relative; }
.rs-close { position: absolute; top: 12px; right: 12px; z-index: 1; background: var(--color-surface); }
.rs-art { position: relative; flex: none; width: 132px; aspect-ratio: 4 / 5; border-radius: 14px; overflow: hidden; background: var(--color-surface-2); box-shadow: var(--shadow-md); }
.rs-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rs-art .type-tile { width: 100%; height: 100%; }
.rs-cat { display: flex; align-items: center; gap: 6px; margin: 14px 0 4px; font-size: .8125rem; color: var(--color-text-muted); }
.rs-cat svg { width: 14px; height: 14px; }
.rs-title { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 1.75rem; line-height: 1.1; letter-spacing: -0.01em; }
.rs-sub { margin: 4px 0 0; color: var(--color-text-muted); }
.rs-because { margin: 12px 0 0; }
.rs-reason { margin: 8px 0 0; line-height: 1.5; }
.rs-link { display: inline-flex; gap: 4px; margin-top: 12px; color: var(--color-accent); font-weight: 600; text-decoration: none; }
.rs-link:hover { text-decoration: underline; }
.rs-actions { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--color-divider); }

/* Actions always one row. "Not for me" is a labelled × where space is tight
   (inline card on phones); its accessible name stays "Not for me: <title>". */
.rc-x { display: none; }
.rec-card--inline .fy-actions { flex-wrap: nowrap; gap: 6px; }
@media (max-width: 520px) {
  .rec-card--inline { grid-template-columns: 84px minmax(0, 1fr); }
  .rec-card--inline .fy-body { padding: 12px 12px 12px 14px; }
  .rec-card--inline .fy-btn { padding-inline: 12px; white-space: nowrap; }
  .rec-card--inline [data-act="not_for_me"] { margin-left: auto; width: 40px; min-width: 40px; padding: 0; justify-content: center; }
  .rec-card--inline [data-act="not_for_me"] .rc-lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .rec-card--inline [data-act="not_for_me"] .rc-x { display: block; }
}

/* Phase 6 (c): the tile sits under the photo; the photo fades in when loaded. */
.fy-art > .rec-img { position: absolute; inset: 0; z-index: 1; opacity: 0; transition: opacity 220ms ease; }
.fy-art > .rec-img.is-loaded { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .fy-art > .rec-img { transition: none; } }

/* Phase 6 (d): "Next for you" waiting state — a static tile card, no shimmer. */
.tn-wait .fy-body { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.tn-wait-text { margin: 0; color: var(--color-text-muted); font-size: 0.95rem; }

/* ---------- Recommendation detail sheet (v2) ---------- */
.rec-sheet .rs-card { padding: 0; overflow-x: hidden; display: flex; flex-direction: column; }
.rec-sheet .rs-body { padding: 0 20px 8px; }
.rec-sheet .rs-art {
  width: auto; aspect-ratio: auto; height: 228px; margin: 0 -20px; border-radius: 0;
  box-shadow: none; background: var(--color-surface-2);
}
.rec-sheet .rs-art--poster { display: grid; place-items: center; overflow: hidden; }
.rec-sheet .rs-art--poster::before {
  content: ''; position: absolute; inset: -20px; background: var(--rs-bg, none) center / cover;
  filter: blur(22px) saturate(1.1); opacity: .55; transform: scale(1.1);
}
.rec-sheet .rs-art--poster img {
  position: relative; width: auto; height: 196px; max-width: 70%; object-fit: contain;
  border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.28);
}
.rec-sheet .rs-art .type-tile--hero { border-radius: 0; }
.rec-sheet .rs-close { top: 12px; right: 12px; background: rgba(255,255,255,.88); backdrop-filter: blur(8px); }
.rs-credit-wrap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 12px 7px; pointer-events: none;
  background: linear-gradient(transparent, rgba(0,0,0,.45)); }
.rs-credit-wrap:empty { display: none; }
.rs-credit { margin: 0; font: 400 11px/1.3 Roboto, var(--font-sans, sans-serif); color: #fff; text-align: right; pointer-events: auto; }
.rs-credit a { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.rs-facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.rs-facts div { padding: 6px 10px; border-radius: 10px; background: var(--color-surface-2); }
.rs-facts dt { font-size: .6875rem; letter-spacing: .04em; text-transform: uppercase; color: var(--color-text-muted); }
.rs-facts dd { margin: 1px 0 0; font-size: .875rem; font-weight: 600; color: var(--color-text); }
.rs-summary { margin: 14px 0 0; line-height: 1.55; color: var(--color-text); }
.rs-skel { display: grid; gap: 8px; }
.rs-skel span { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--color-surface-2) 0, var(--color-divider) 50%, var(--color-surface-2) 100%) 0 0 / 200% 100%; animation: rsShimmer 1.2s linear infinite; }
.rs-skel span:nth-child(2) { width: 92%; } .rs-skel span:nth-child(3) { width: 64%; }
@keyframes rsShimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .rs-skel span { animation: none; } }
.rs-why { margin: 18px 0 0; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--color-accent) 7%, var(--color-surface)); }
.rs-why h3 { margin: 0 0 2px; font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; color: var(--color-accent); }
.rs-why .rs-because { margin: 4px 0 0; }
.rs-why .rs-reason { margin: 6px 0 0; }
.rs-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.rs-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text);
  font-weight: 600; font-size: .875rem; text-decoration: none; }
.rs-chip svg { color: var(--color-accent); }
@media (hover: hover) { .rs-chip:hover { border-color: var(--color-accent); } }
.rs-sources { margin: 16px 0 4px; font-size: .75rem; line-height: 1.45; color: var(--color-text-muted); }
.rs-sources a { color: inherit; }
.rec-sheet .rs-actions {
  position: sticky; bottom: 0; z-index: 2; margin: 8px 0 0; padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: var(--color-surface); border-top: 1px solid var(--color-divider);
}
.is-native .rec-sheet .rs-card { padding-bottom: 0; }
.is-native .rec-sheet .rs-card::before { position: absolute; left: 50%; top: 6px; margin: 0 0 0 -18px; z-index: 3; background: rgba(255,255,255,.8); }
.rec-sheet .rs-art:has(.type-tile) .rs-credit-wrap { display: none; }
.rec-sheet .rs-card:focus { outline: none; }

/* ---------- Discover gallery: hero picks + category shelves ---------- */
.fy-gallery { display: block; }
.fy-hero { margin: 0 0 28px; }
.fy-hero-rail, .fy-shelf-rail {
  display: flex; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.fy-hero-rail::-webkit-scrollbar, .fy-shelf-rail::-webkit-scrollbar { display: none; }
.fy-hero-rail { gap: 0; border-radius: var(--radius-card, 22px); }
.rec-card--hero { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; border-radius: var(--radius-card, 22px); }
.rec-card--hero .fy-art { aspect-ratio: 4 / 3; }
.rec-card--hero[data-media="poster"] .fy-art { aspect-ratio: 4 / 3; background: #1d1714; }
.rec-card--hero[data-media="poster"] .fy-art > .rec-img {
  inset: 8% auto 8% 50%; width: auto; height: 84%; aspect-ratio: 2 / 3; transform: translateX(-50%);
  object-fit: cover; border-radius: 10px; box-shadow: 0 18px 40px rgba(0,0,0,.45);
}
.rec-hero-bg { position: absolute; inset: -24px; width: calc(100% + 48px); height: calc(100% + 48px); object-fit: cover;
  filter: blur(26px) saturate(1.2) brightness(.7); z-index: 0; }
.rec-card--hero .fy-art::after { content: ''; position: absolute; inset: auto 0 0 0; height: 40%; z-index: 1; pointer-events: none;
  background: linear-gradient(transparent, rgba(0,0,0,.28)); }
.rec-card--hero .fy-body { padding: 16px 18px 18px; gap: 6px; }
.rec-card--hero .fy-title { font-family: var(--font-display, Georgia, serif); font-weight: 400; font-size: 1.75rem; line-height: 1.08; letter-spacing: -0.015em; }
.rec-card--hero .fy-because { font-size: .9375rem; }
.fy-hero-dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.fy-hero-dots span { width: 6px; height: 6px; border-radius: 3px; background: var(--color-border); transition: width 200ms ease, background 200ms ease; }
.fy-hero-dots span.is-on { width: 18px; background: var(--color-accent); }

.fy-shelf { margin: 0 0 26px; }
.fy-shelf-head { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 1.1875rem; font-weight: 600; letter-spacing: -0.01em; color: var(--color-text); }
.fy-shelf-icon svg { width: 16px; height: 16px; color: var(--color-accent); display: block; }
.fy-shelf-n { margin-left: auto; font-size: .8125rem; font-weight: 500; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
/* Exactly two whole cards per view on phones, four on wide screens. */
.rec-card--shelf { flex: 0 0 calc((100% - 12px) / 2); scroll-snap-align: start; min-width: 0; }
.fy-shelf-rail.is-single .rec-card--shelf { flex-basis: calc((100% - 12px) / 2); }
@media (min-width: 900px) { .rec-card--shelf { flex-basis: calc((100% - 36px) / 4); } }
.rec-card--shelf .fy-art, .rec-card--shelf[data-media] .fy-art { aspect-ratio: 4 / 5; }
.rec-card--shelf[data-media="poster"] .fy-art { aspect-ratio: 2 / 3; }
.rec-card--shelf .fy-cat span, .rec-card--shelf .fy-sub { display: none; }
.rec-card--shelf .fy-body { padding: 10px 12px 12px; gap: 4px; }
.rec-card--shelf .fy-title { font-size: .9375rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rec-card--shelf .fy-because { font-size: .8125rem; color: var(--color-text-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rec-card--shelf .fy-actions { margin-top: auto; padding-top: 8px; display: grid; grid-template-columns: 1fr 44px; grid-template-areas: "t x" "w w"; gap: 6px; }
.rec-card--shelf [data-act="tried"] { grid-area: t; }
.rec-card--shelf [data-act="want"] { grid-area: w; }
.rec-card--shelf [data-act="not_for_me"] { grid-area: x; }
.rec-card--shelf .fy-btn { justify-content: center; padding-inline: 8px; min-height: 44px; font-size: .8125rem; white-space: nowrap; }
.rec-card--shelf [data-act="not_for_me"] { margin-left: auto; width: 44px; min-width: 44px; padding: 0; justify-content: center; }
.rec-card--shelf [data-act="not_for_me"] .rc-lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rec-card--shelf [data-act="not_for_me"] .rc-x { display: block; }
.rec-card--shelf .fy-body { flex: 1; display: flex; flex-direction: column; }
@media (min-width: 900px) {
  .rec-card--hero .fy-art, .rec-card--hero[data-media="poster"] .fy-art { aspect-ratio: 21 / 8; }
  .fy-shelf-rail.is-single .rec-card--shelf { flex-basis: calc((100% - 36px) / 4); }
}

/* shell.css */
/* Phase 6: settings behind the avatar, item edit sheet footer + … menu,
   confirm dialog (design doc §4, §6). Tokens from warm.css. */

/* Avatar → Settings (replaces ☰) */
.avatar-btn {
  position: relative; flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  display: inline-grid; place-items: center; overflow: hidden; cursor: pointer;
  background: var(--color-surface-offset, var(--color-surface-2)); color: var(--color-text);
  box-shadow: inset 0 0 0 1px var(--color-divider);
  font: 600 0.8rem/1 var(--font-body); letter-spacing: 0.02em;
}
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-btn:hover { box-shadow: inset 0 0 0 1px var(--color-text-muted); }
.avatar-btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.app-header .avatar-btn { margin-left: auto; }
@media (min-width: 900px) { .app-header .app-header-nav + .avatar-btn { margin-left: var(--space-4); } }

/* Settings sheet */
.settings-card { max-width: 420px; display: flex; flex-direction: column; gap: var(--space-4); }
.settings-head { display: flex; align-items: center; gap: var(--space-3); padding-bottom: var(--space-4); border-bottom: 1px solid var(--color-divider); }
.settings-head img { border-radius: 50%; flex: none; background: var(--color-surface-2); }
.settings-head img:not([src]), .settings-head img[src=""] { display: none; }
.settings-head .menu-user-meta { flex: 1; min-width: 0; }
.settings-head .sheet-name { margin: 0; font: 600 1rem/1.25 var(--font-body); }
.settings-theme { border: 0; padding: 0; margin: 0; min-width: 0; }
.settings-label { padding: 0; margin-bottom: var(--space-2); font-size: var(--text-xs, 0.75rem); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border-radius: 999px; background: var(--color-surface-offset, var(--color-surface-2)); box-shadow: inset 0 0 0 1px var(--color-divider); }
.seg-opt { position: relative; }
.seg-opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg-opt span { display: block; padding: 8px 10px; border-radius: 999px; text-align: center; font-size: var(--text-sm); color: var(--color-text-muted); transition: background 160ms ease, color 160ms ease; }
.seg-opt input:checked + span { background: var(--color-surface); color: var(--color-text); box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 1px var(--color-divider); font-weight: 600; }
.seg-opt input:focus-visible + span { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.settings-card .menu-list { margin: 0; }

/* Item edit sheet: … menu (Delete) and a footer pinned to the bottom of the card */
.edit-more-wrap { position: relative; flex: none; }
.edit-more { width: 36px; height: 36px; }
.edit-more-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; min-width: 180px; padding: 6px;
  background: var(--color-surface); border-radius: 12px; box-shadow: var(--shadow-lg), 0 0 0 1px var(--color-border);
}
.edit-more-item { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px; background: none; text-align: left; font: inherit; font-size: var(--text-sm); color: var(--color-text); cursor: pointer; }
.edit-more-item:hover, .edit-more-item:focus-visible { background: var(--color-surface-2); outline: none; }
.edit-more-item.is-danger { color: #b54444; }
[data-theme='dark'] .edit-more-item.is-danger { color: #e27272; }
.edit-card .edit-actions {
  position: sticky; bottom: calc(-1 * var(--space-4)); z-index: 2;
  justify-content: flex-end;
  margin: 0 calc(-1 * var(--space-5)) calc(-1 * var(--space-4));
  padding: var(--space-3) var(--space-5) calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  background: var(--color-surface);
}
.edit-card .edit-body { margin-bottom: var(--space-4); }

/* Confirm dialog */
.confirm-sheet { z-index: 92; }
.confirm-card { max-width: 360px; display: flex; flex-direction: column; gap: var(--space-2); }
.confirm-title { margin: 0; font: 600 1.05rem/1.3 var(--font-body); color: var(--color-text); word-break: break-word; }
.confirm-body { margin: 0; color: var(--color-text-muted); font-size: var(--text-sm); }
.confirm-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-3); }
.btn-danger-solid { background: #b54444; color: #fff; border: 0; }
.btn-danger-solid:hover { background: #9c3535; }
[data-theme='dark'] .btn-danger-solid { background: #e27272; color: #1d1713; }
.edit-share { flex: none; }

/* flat.css */
/* Flat My List (visual pass): full-width rows, thin dividers, bigger art,
   about twice as many items on screen. Loaded last so it wins over the
   card styles in redesign.css / warm.css / mylist.css. */

/* ---- Category list ---- */
body.rd #libraryList.entry-list { display: block; }
body.rd #libraryList .entry,
body.rd #libraryList .entry:hover,
body.rd .entry-list.is-profile-ranked > .entry:nth-child(-n+5),
body.rd #libraryList.ml-ranked > li.entry.ml-onprofile {
  background: transparent; box-shadow: none; border: 0; border-radius: 0; transform: none;
  margin: 0; padding: 6px 2px; min-height: 0;
  border-bottom: 1px solid var(--color-divider);
}
body.rd #libraryList .entry:active { background: var(--color-surface-offset); }
body.rd #libraryList .entry { grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; }
body.rd #libraryList.is-sortable .entry { grid-template-columns: 12px 24px 52px minmax(0, 1fr) auto; gap: 10px; }
body.rd #libraryList .entry-thumb { width: 52px; height: 52px; border-radius: 10px; box-shadow: 0 0 0 1px var(--color-divider); }
body.rd #libraryList .entry-thumb[data-cat="movie"], body.rd #libraryList .entry-thumb[data-cat="tv"],
body.rd #libraryList .entry-thumb[data-cat="book"], body.rd #libraryList .entry-thumb[data-cat="game"] { width: 39px; height: 52px; border-radius: 6px; justify-self: center; }
body.rd #libraryList .entry-title { font-size: 1rem; line-height: 1.25; }
body.rd #libraryList .entry-sub { font-size: .8125rem; line-height: 1.3; margin-top: 2px; }
body.rd #libraryList .entry-body { gap: 0; }
body.rd #libraryList .rank-badge { font-size: 1.25rem; }
body.rd #libraryList .drag-handle { opacity: .45; }
body.rd #libraryList .score-badge { min-width: 40px; height: 26px; border-radius: 8px; font-size: .8125rem; }

/* Top 5 = public profile: an accent rank and a labelled rule, no card. */
body.rd #libraryList.ml-ranked > li.entry.ml-onprofile .rank-badge { color: var(--color-accent); }
body.rd #libraryList.ml-ranked > li.entry.ml-p-last:not(:last-child) { margin-bottom: 0; border-bottom: 0; }
body.rd #libraryList.ml-ranked > li.entry.ml-p-last:not(:last-child)::after {
  content: "Not on your profile"; position: absolute; left: 0; right: 0; bottom: -10px; height: 20px; border: 0;
  display: flex; align-items: center; gap: 10px; font-size: .6875rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--color-text-faint);
  background: linear-gradient(var(--color-border), var(--color-border)) right center / calc(100% - 150px) 1px no-repeat;
}
body.rd #libraryList.ml-ranked > li.entry.ml-p-last:not(:last-child) + li.entry { margin-top: 22px; border-top: 0; }
body.rd .entry-list.is-profile-ranked > .entry:nth-child(5) { margin-bottom: 0; }
body.rd .entry-list.is-profile-ranked > .entry:nth-child(5)::after { content: none; }

@media (min-width: 761px) {
  body.rd #libraryList.entry-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; }
  body.rd #libraryList.ml-ranked > li.entry.ml-p-last:not(:last-child)::after { content: none; }
  body.rd #libraryList.ml-ranked > li.entry.ml-p-last:not(:last-child) { border-bottom: 1px solid var(--color-divider); }
  body.rd #libraryList.ml-ranked > li.entry.ml-p-last:not(:last-child) + li.entry { margin-top: 0; }
}

/* ---- Overview: sections, not cards ---- */
.ml-overview { gap: 26px; }
.ml-ov { background: none; box-shadow: none; border-radius: 0; padding: 0; }
.ml-ov-head { margin-bottom: 2px; padding-bottom: 6px; border-bottom: 1px solid var(--color-border); }
.ml-ov-head h2 { font-size: 1.1875rem; letter-spacing: -0.01em; }
.ml-ov-row { grid-template-columns: 20px 56px minmax(0, 1fr) auto; gap: 12px; padding: 8px 0; min-height: 0; border-radius: 0; }
.ml-ov-row + .ml-ov-row { box-shadow: inset 0 1px 0 var(--color-divider); }
.ml-ov-row:hover, .ml-ov-row:focus-visible { background: transparent; }
.ml-ov-row:active { background: var(--color-surface-offset); }
.ml-ov-row .ml-thumb { width: 56px; height: 56px; border-radius: 10px; }
.ml-ov .ml-title { font-size: 1rem; }

/* Want to try rows: flat too */
.ml-rows { gap: 0; }
.ml-row { background: none; box-shadow: none; border-radius: 0; padding: 8px 0; border-bottom: 1px solid var(--color-divider); }
.ml-row .ml-thumb { width: 56px; height: 56px; border-radius: 10px; }
.ml-row { grid-template-columns: 56px minmax(0, 1fr) auto; }
@media (max-width: 420px) { .ml-row { grid-template-columns: 56px minmax(0, 1fr); } }

/* waitlist.css */
/* Waitlist screen (waitlist.js). Used in the Add sheet when adding isn't open to
   the account yet, and on /waitlist. Tokens only; works in light and dark. */
.wl { --wl-gap: var(--space-5); display: grid; gap: var(--wl-gap); color: var(--color-text); max-width: 30rem; margin: 0 auto; }
.wl[hidden], .wl [hidden] { display: none !important; }
.wl-intro { display: grid; gap: var(--space-2); }
.wl-title { font-family: var(--font-display); font-weight: 400; font-size: var(--text-2xl); line-height: 1.05; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
.wl-body { margin: 0; font-size: var(--text-base); line-height: 1.5; color: var(--color-text-muted); max-width: 38ch; text-wrap: pretty; }

/* Demo card: a real slice of the demo profile. The whole card is the link. */
.wl-demo { display: grid; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-xl);
  background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow-sm);
  color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform 160ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 160ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.wl-demo:hover { box-shadow: var(--shadow-md); }
.wl-demo:active { transform: scale(0.985); }
.wl-demo:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }
.wl-demo-head { display: flex; align-items: center; gap: var(--space-3); }
.wl-demo-avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--color-accent-soft); color: var(--color-accent); font-weight: 600; font-size: 0.875rem; letter-spacing: 0.02em; }
.wl-demo-who { display: grid; line-height: 1.25; min-width: 0; }
.wl-demo-kicker { font-size: var(--text-xs); color: var(--color-text-muted); }
.wl-demo-name { font-weight: 600; }
.wl-demo-meta { font-size: var(--text-xs); color: var(--color-text-muted); }
.wl-demo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.wl-demo-row { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.wl-demo-rank { flex: none; width: 1.25rem; text-align: center; font-family: var(--font-display); font-size: 1.375rem; line-height: 1; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.wl-demo-row:first-child .wl-demo-rank { color: var(--color-accent); }
.wl-demo-row img { flex: none; width: 40px; height: 40px; border-radius: var(--radius-md); object-fit: cover; background: var(--color-surface-2); }
.wl-demo-text { display: grid; min-width: 0; line-height: 1.25; }
.wl-demo-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-demo-sub { font-size: var(--text-xs); color: var(--color-text-muted); }
.wl-demo-link { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin: 0 calc(-1 * var(--space-1)) calc(-1 * var(--space-2));
  padding: 0 var(--space-1); border-top: 1px solid var(--color-divider); font-weight: 600; color: var(--color-accent); }

/* Form */
.wl-form { display: grid; gap: var(--space-2); }
.wl-label { font-size: var(--text-sm); font-weight: 600; }
.wl-input { width: 100%; box-sizing: border-box; min-height: 50px; padding: 0 var(--space-4); border-radius: var(--radius-lg);
  border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text);
  font: inherit; font-size: 17px; /* 16px+ keeps iOS from zooming */ -webkit-appearance: none; appearance: none; }
.wl-input::placeholder { color: var(--color-text-faint); }
.wl-input:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-soft); }
.wl-input[aria-invalid="true"] { border-color: #b3261e; }
.wl-error { margin: 0; min-height: 0; font-size: var(--text-sm); line-height: 1.4; color: #a1261d; }
.wl-error:empty { display: none; }
:root[data-theme="dark"] .wl-error { color: #f2a49c; }
:root[data-theme="dark"] .wl-input[aria-invalid="true"] { border-color: #f2a49c; }
.wl-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.wl-submit { appearance: none; border: 0; width: 100%; min-height: 50px; margin-top: var(--space-1); border-radius: var(--radius-lg);
  background: var(--color-accent); color: #fff; font: inherit; font-size: 17px; font-weight: 600; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: transform 120ms ease-out, opacity 120ms ease-out; }
:root[data-theme="dark"] .wl-submit { color: #1d1713; }
.wl-submit:active { transform: scale(0.98); }
.wl-submit:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }
.wl-submit[aria-busy="true"] { opacity: 0.7; cursor: progress; }
.wl-fine { margin: 0; font-size: var(--text-xs); color: var(--color-text-muted); text-align: center; }

/* Done */
.wl-done { display: grid; justify-items: center; text-align: center; gap: var(--space-3); padding: var(--space-6) 0 var(--space-2); outline: none; }
.wl-done-mark { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--color-green-soft, var(--color-accent-soft)); color: var(--color-green, var(--color-accent)); }
.wl-done-title { font-family: var(--font-display); font-weight: 400; font-size: var(--text-2xl); line-height: 1.05; margin: 0; }
.wl-done-body { margin: 0; max-width: 34ch; color: var(--color-text-muted); line-height: 1.5; overflow-wrap: anywhere; }
.wl-done-actions { display: grid; gap: var(--space-2); width: 100%; margin-top: var(--space-2); }
.wl-done-demo { display: flex; align-items: center; justify-content: center; min-height: 44px; font-weight: 600; color: var(--color-accent); text-decoration: none; }
@media (prefers-reduced-motion: no-preference) {
  .wl-done:not([hidden]) .wl-done-mark { animation: wl-pop 360ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }
  .wl-done:not([hidden]) { animation: wl-in 220ms ease-out both; }
}
@keyframes wl-pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes wl-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Inside the Add sheet: the waitlist replaces the input. */
.add-sheet.is-gated .capture-panel > :not(.wl-host) { display: none !important; }
.wl-host { padding: var(--space-2) 0 calc(var(--space-4) + env(safe-area-inset-bottom, 0px)); }
.wl-host[hidden] { display: none; }

/* Standalone /waitlist page */
body.wl-page { margin: 0; min-height: 100dvh; background: var(--color-bg); color: var(--color-text); font-family: var(--font-body);
  display: grid; grid-template-rows: auto 1fr auto; -webkit-text-size-adjust: 100%; }
.wl-page-top { padding: calc(env(safe-area-inset-top, 0px) + var(--space-4)) var(--space-5) 0; }
.wl-page-brand { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; color: inherit; text-decoration: none; font-weight: 600; }
.wl-page-main { padding: var(--space-5) var(--space-5) var(--space-8, 3rem); width: 100%; box-sizing: border-box; }
.wl-page-main .wl-title { font-size: clamp(2rem, 8vw, 2.75rem); }
.wl-page-foot { padding: var(--space-4) var(--space-5) calc(env(safe-area-inset-bottom, 0px) + var(--space-5)); text-align: center; font-size: var(--text-xs); color: var(--color-text-muted); }
.wl-page-foot a { color: inherit; }
@media (min-width: 720px) { .wl-page-main { align-self: center; } }

/* a11y.css */
/* Shared accessibility layer: skip link, focus rings, 44px tap targets. */
.skip-link { position: absolute; left: 12px; top: -100px; z-index: 10000; padding: 12px 16px; border-radius: 10px; background: #1d1713; color: #fff; font: 600 15px/1.2 Inter, system-ui, sans-serif; text-decoration: none; }
.skip-link:focus, .skip-link:focus-visible { top: calc(env(safe-area-inset-top, 0px) + 12px); outline: 3px solid #e8a33d; outline-offset: 2px; }
:where(a, button, input, select, textarea, summary, [role="button"], [tabindex]):focus-visible { outline: 2px solid #b0442a; outline-offset: 2px; }
:where(main, [role="main"]):focus { outline: none; }
.linklike, a.brand, .topbar-cta, .signup-btn, .landing-footer-links a, .container footer a { display: inline-flex; align-items: center; min-height: 44px; }
.topbar-cta[hidden] { display: none; }
.sp-seg label { min-height: 44px; display: inline-flex; align-items: center; }
.landing-eyebrow { color: #8c3a2a; }
