/* ==========================================================================
   FlavorWeave — Visual System v2.0
   Source of truth: FlavorWeave Brand + Product Design Guide v2.0 + exemplar board.

   1. Scales (type, space, radii, motion) — theme-independent
   2. Themes — semantic color tokens only; components never reference hex
   3. Base
   4. App shell (header, top nav, tab bar)
   5. Primitives (buttons, fields, chips, badges, cards, tabs, avatars, …)
   6. Views
   7. Motion + accessibility
   ========================================================================== */

/* 1. Scales ---------------------------------------------------------------- */
:root {
  --font-sans: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-md: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: clamp(1.75rem, 1.35rem + 1.6vw, 2.5rem);
  --text-display: clamp(2.125rem, 1.45rem + 2.8vw, 3.5rem);
  /* Primary button labels are WCAG "large text" (≥ 18.66px bold) so coral fills keep the exact brand hue. */
  --text-button: 1.1875rem;
  --text-button-sm: 0.9375rem;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-heavy: 800;

  --leading-tight: 1.1;
  --leading-snug: 1.3;
  --leading-normal: 1.55;
  --tracking-tight: -0.022em;
  --tracking-eyebrow: 0.12em;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 56px;
  --space-10: 72px;

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  --icon-sm: 16px;
  --icon-md: 20px;
  --icon-lg: 24px;

  --target-min: 44px;
  --control-h: 52px;
  --control-h-sm: 40px;

  --duration-fast: 120ms;
  --duration-base: 200ms;
  --duration-slow: 360ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-emphasized: cubic-bezier(0.2, 0.9, 0.25, 1.15);

  --header-h: 68px;
  --tabbar-h: 66px;
  --page-max: 1240px;
  --page-pad: clamp(16px, 4vw, 48px);
}

/* 2. Themes ------------------------------------------------------------------
   Every theme defines the same semantic tokens. Blocks use attribute selectors
   (not :root) so a nested [data-theme] — e.g. a theme preview swatch — re-scopes. */
:root,
[data-theme="signature"] {
  --color-bg: #FFFDF8;
  --color-surface: #FFFFFF;
  --color-surface-quiet: #F7F2EC;
  --color-surface-sunken: #F1EBE3;
  --surface-hero: linear-gradient(120deg, #FFFDF8 0%, #FBF6F0 100%);
  --color-header-bg: rgba(255, 253, 248, 0.92);

  --color-text: #17393A;
  --color-text-secondary: #4A6263;
  --color-text-tertiary: #5F7273;
  --color-border: #E5DED7;
  --color-border-strong: #CBC2B8;

  --color-primary: #F15D3C;
  --color-primary-hover: #E5512F;
  --color-primary-pressed: #D9472D;
  --color-on-primary: #FFFFFF;
  --color-primary-soft: #FBE6DB;
  --color-primary-text: #B53A24;

  --color-structure: #0F5D5B;
  --color-structure-hover: #0B4A48;
  --color-structure-soft: #E2EEEC;
  --color-on-structure: #FFFFFF;

  --color-accent: #D6A13A;
  --color-accent-soft: #FAF0DA;
  --color-accent-text: #7E5812;
  --color-natural: #A9BA9B;
  --color-natural-soft: #EDF2E8;
  --color-natural-text: #47603B;

  --color-selected-bg: #FBE6DB;
  --color-selected-border: #F15D3C;

  --badge-fit-bg: #FBE6DB;
  --badge-fit-text: #B53A24;
  --badge-match-bg: #E3F1E4;
  --badge-match-text: #23603A;
  --badge-neutral-bg: #F7F2EC;
  --badge-neutral-text: #4A6263;

  --color-success: #2E7D4F;
  --color-success-soft: #E3F1E4;
  --color-success-text: #23603A;
  --color-warning: #D6A13A;
  --color-warning-soft: #FAF0DA;
  --color-warning-text: #7E5812;
  --color-error: #C2362B;
  --color-error-soft: #FBE3E0;
  --color-error-text: #9E2A21;

  --color-focus: #0F5D5B;
  --color-inverse-bg: #17393A;
  --color-inverse-text: #FFFDF8;
  --color-overlay: rgba(23, 57, 58, 0.45);
  --weave-1: #F15D3C;
  --weave-2: #0F5D5B;
  --weave-3: #A9BA9B;
  --shadow-rgb: 23 57 58;
  --check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}

[data-theme="citrus-berry"] {
  --color-bg: #FFF9F4;
  --color-surface: #FFFFFF;
  --color-surface-quiet: #FFF0E7;
  --color-surface-sunken: #FCE6DA;
  --surface-hero: linear-gradient(120deg, #FFF3EA 0%, #FFE9F0 100%);
  --color-header-bg: rgba(255, 249, 244, 0.92);

  --color-text: #2A1631;
  --color-text-secondary: #5C4660;
  --color-text-tertiary: #6E5871;
  --color-border: #F1DDD3;
  --color-border-strong: #DCC1B8;

  --color-primary: #D51F63;
  --color-primary-hover: #C21A59;
  --color-primary-pressed: #A8164D;
  --color-on-primary: #FFFFFF;
  --color-primary-soft: #FCE2EB;
  --color-primary-text: #A8164D;

  --color-structure: #7B45D8;
  --color-structure-hover: #6735C0;
  --color-structure-soft: #EFE7FB;
  --color-on-structure: #FFFFFF;

  --color-accent: #FF6A2A;
  --color-accent-soft: #FFE6D8;
  --color-accent-text: #A9420E;
  --color-natural: #FFB27D;
  --color-natural-soft: #FFEFE3;
  --color-natural-text: #8E3D10;

  --color-selected-bg: #FFE6D8;
  --color-selected-border: #D51F63;

  --badge-fit-bg: #FFE6D8;
  --badge-fit-text: #A9420E;
  --badge-match-bg: #EFE7FB;
  --badge-match-text: #5B2DB0;
  --badge-neutral-bg: #FFF0E7;
  --badge-neutral-text: #5C4660;

  --color-success: #2E7D4F;
  --color-success-soft: #E3F1E4;
  --color-success-text: #23603A;
  --color-warning: #E39A1F;
  --color-warning-soft: #FDF0D8;
  --color-warning-text: #7A4F05;
  --color-error: #C2263B;
  --color-error-soft: #FBE1E4;
  --color-error-text: #9A1C2D;

  --color-focus: #7B45D8;
  --color-inverse-bg: #2A1631;
  --color-inverse-text: #FFF9F4;
  --color-overlay: rgba(42, 22, 49, 0.45);
  --weave-1: #FF6A2A;
  --weave-2: #D51F63;
  --weave-3: #7B45D8;
  --shadow-rgb: 82 24 60;
  --check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}

[data-theme="fresh-herb"] {
  --color-bg: #FFFDF6;
  --color-surface: #FFFFFF;
  --color-surface-quiet: #F4F2E7;
  --color-surface-sunken: #ECE9DA;
  --surface-hero: linear-gradient(120deg, #FBFCF1 0%, #EFF5E8 100%);
  --color-header-bg: rgba(255, 253, 246, 0.92);

  --color-text: #1D3324;
  --color-text-secondary: #4A5E4E;
  --color-text-tertiary: #5B6E5F;
  --color-border: #E3E0D1;
  --color-border-strong: #C9C6B3;

  --color-primary: #2F6F3E;
  --color-primary-hover: #286135;
  --color-primary-pressed: #21522C;
  --color-on-primary: #FFFFFF;
  --color-primary-soft: #E2EFE2;
  --color-primary-text: #2A6438;

  --color-structure: #245437;
  --color-structure-hover: #1B432B;
  --color-structure-soft: #E5EEE5;
  --color-on-structure: #FFFFFF;

  --color-accent: #E98B5D;
  --color-accent-soft: #FBE8DD;
  --color-accent-text: #9A4A22;
  --color-natural: #D3A633;
  --color-natural-soft: #F8EFD5;
  --color-natural-text: #74570B;

  --color-selected-bg: #E2EFE2;
  --color-selected-border: #2F6F3E;

  --badge-fit-bg: #FBE8DD;
  --badge-fit-text: #9A4A22;
  --badge-match-bg: #E2EFE2;
  --badge-match-text: #2A6438;
  --badge-neutral-bg: #F4F2E7;
  --badge-neutral-text: #4A5E4E;

  --color-success: #2F6F3E;
  --color-success-soft: #E2EFE2;
  --color-success-text: #2A6438;
  --color-warning: #D3A633;
  --color-warning-soft: #F8EFD5;
  --color-warning-text: #74570B;
  --color-error: #B8392C;
  --color-error-soft: #F9E2DE;
  --color-error-text: #962C21;

  --color-focus: #245437;
  --color-inverse-bg: #1D3324;
  --color-inverse-text: #FFFDF6;
  --color-overlay: rgba(29, 51, 36, 0.45);
  --weave-1: #2F6F3E;
  --weave-2: #E98B5D;
  --weave-3: #D3A633;
  --shadow-rgb: 29 51 36;
  --check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}

[data-theme="cobalt-coral"] {
  --color-bg: #FBFCFF;
  --color-surface: #FFFFFF;
  --color-surface-quiet: #F1F4FD;
  --color-surface-sunken: #E7ECFA;
  --surface-hero: linear-gradient(120deg, #F1F4FF 0%, #F6F0FF 100%);
  --color-header-bg: rgba(251, 252, 255, 0.92);

  --color-text: #141B3A;
  --color-text-secondary: #474F70;
  --color-text-tertiary: #575F80;
  --color-border: #DEE3F1;
  --color-border-strong: #C2C9DF;

  --color-primary: #3D5AF1;
  --color-primary-hover: #3049D6;
  --color-primary-pressed: #263CB8;
  --color-on-primary: #FFFFFF;
  --color-primary-soft: #E6EAFE;
  --color-primary-text: #2A43C6;

  --color-structure: #2B3A99;
  --color-structure-hover: #222F7D;
  --color-structure-soft: #E6EAFE;
  --color-on-structure: #FFFFFF;

  --color-accent: #FF604D;
  --color-accent-soft: #FFE7E3;
  --color-accent-text: #B12E1D;
  --color-natural: #9A7CF7;
  --color-natural-soft: #F0EBFE;
  --color-natural-text: #5A3BC0;

  --color-selected-bg: #E6EAFE;
  --color-selected-border: #3D5AF1;

  --badge-fit-bg: #FFE7E3;
  --badge-fit-text: #B12E1D;
  --badge-match-bg: #F0EBFE;
  --badge-match-text: #5A3BC0;
  --badge-neutral-bg: #F1F4FD;
  --badge-neutral-text: #474F70;

  --color-success: #2E7D4F;
  --color-success-soft: #E3F1E4;
  --color-success-text: #23603A;
  --color-warning: #D6A13A;
  --color-warning-soft: #FAF0DA;
  --color-warning-text: #7E5812;
  --color-error: #C2362B;
  --color-error-soft: #FBE3E0;
  --color-error-text: #9E2A21;

  --color-focus: #3D5AF1;
  --color-inverse-bg: #141B3A;
  --color-inverse-text: #FBFCFF;
  --color-overlay: rgba(20, 27, 58, 0.45);
  --weave-1: #FF604D;
  --weave-2: #3D5AF1;
  --weave-3: #9A7CF7;
  --shadow-rgb: 20 27 58;
  --check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}

[data-theme="dark"] {
  --color-bg: #101819;
  --color-surface: #172223;
  --color-surface-quiet: #1C2A2B;
  --color-surface-sunken: #0C1314;
  --surface-hero: linear-gradient(120deg, #142021 0%, #182728 100%);
  --color-header-bg: rgba(16, 24, 25, 0.9);

  --color-text: #E9F2EF;
  --color-text-secondary: #B3C4C0;
  --color-text-tertiary: #9DB0AC;
  --color-border: #2A3B3C;
  --color-border-strong: #385E5C;

  --color-primary: #FF6A50;
  --color-primary-hover: #FF7F68;
  --color-primary-pressed: #F0583E;
  --color-on-primary: #101819;
  --color-primary-soft: #3A2521;
  --color-primary-text: #FF9580;

  --color-structure: #8FCBC4;
  --color-structure-hover: #A8D9D3;
  --color-structure-soft: #1F3A39;
  --color-on-structure: #101819;

  --color-accent: #E2B65A;
  --color-accent-soft: #33291A;
  --color-accent-text: #EBC77A;
  --color-natural: #385E5C;
  --color-natural-soft: #1F3332;
  --color-natural-text: #A9C9C5;

  --color-selected-bg: #2C2220;
  --color-selected-border: #FF6A50;

  --badge-fit-bg: #3A2521;
  --badge-fit-text: #FFB0A0;
  --badge-match-bg: #1F3A39;
  --badge-match-text: #A6DCD5;
  --badge-neutral-bg: #1C2A2B;
  --badge-neutral-text: #B3C4C0;

  --color-success: #6FCF97;
  --color-success-soft: #173126;
  --color-success-text: #8EDCAD;
  --color-warning: #E2B65A;
  --color-warning-soft: #33291A;
  --color-warning-text: #EBC77A;
  --color-error: #FF8A7A;
  --color-error-soft: #3A1E1C;
  --color-error-text: #FFA294;

  --color-focus: #8FCBC4;
  --color-inverse-bg: #E9F2EF;
  --color-inverse-text: #101819;
  --color-overlay: rgba(0, 0, 0, 0.6);
  --weave-1: #FF6A50;
  --weave-2: #8FCBC4;
  --weave-3: #385E5C;
  --shadow-rgb: 0 0 0;
  --check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23101819' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}

/* Elevation derives from the theme's shadow tint. */
:root,
[data-theme] {
  --shadow-sm: 0 1px 2px rgb(var(--shadow-rgb) / 0.06), 0 1px 1px rgb(var(--shadow-rgb) / 0.04);
  --shadow-md: 0 10px 28px -14px rgb(var(--shadow-rgb) / 0.22), 0 2px 6px rgb(var(--shadow-rgb) / 0.05);
  --shadow-lg: 0 24px 48px -20px rgb(var(--shadow-rgb) / 0.32), 0 4px 12px rgb(var(--shadow-rgb) / 0.06);
  --shadow-primary: 0 8px 20px -10px color-mix(in srgb, var(--color-primary) 70%, transparent);
}

/* 3. Base ---------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--color-bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

h1[tabindex="-1"]:focus,
h2[tabindex="-1"]:focus {
  outline: none;
}

[hidden],
.hidden {
  display: none !important;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: var(--icon-md);
  height: var(--icon-md);
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--color-inverse-bg);
  color: var(--color-inverse-text);
  font-weight: var(--weight-semibold);
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-3);
}

.eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.display {
  font-size: var(--text-display);
  font-weight: var(--weight-heavy);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

.title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-heavy);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

.section-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: -0.01em;
  margin: var(--space-8) 0 var(--space-4);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  letter-spacing: -0.01em;
}

.lede {
  margin-top: var(--space-3);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  color: var(--color-text-secondary);
  max-width: 60ch;
  text-wrap: pretty;
}

.meta {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

.hint {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

.hint--center {
  text-align: center;
}

.section-label {
  margin: var(--space-6) 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-text);
}

.card-kicker {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.card-kicker .icon {
  width: var(--icon-sm);
  height: var(--icon-sm);
}

/* 4. App shell ----------------------------------------------------------- */
.app-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--color-header-bg);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  padding-top: env(safe-area-inset-top);
}

.app-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  max-width: var(--page-max);
  height: var(--header-h);
  margin: 0 auto;
  padding: 0 var(--page-pad);
  min-width: 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  flex: none;
  min-height: var(--target-min);
  border-radius: var(--radius-sm);
}

.brand-lockup {
  height: 28px;
  width: auto;
}

.brand-lockup--dark,
.brand-wordmark--dark {
  display: none;
}

[data-theme="dark"] .brand-lockup--light,
[data-theme="dark"] .brand-wordmark--light {
  display: none;
}

[data-theme="dark"] .brand-lockup--dark,
[data-theme="dark"] .brand-wordmark--dark {
  display: block;
}

.top-nav {
  display: none;
  align-items: stretch;
  gap: var(--space-2);
  height: 100%;
  flex: 1 1 auto;
  min-width: 0;
}

.top-nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-4);
  border: 0;
  background: none;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  transition: color var(--duration-fast) var(--ease-standard);
}

.top-nav__link:hover {
  color: var(--color-text);
}

.top-nav__link[aria-current="page"] {
  color: var(--color-primary-text);
}

.top-nav__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: var(--space-4);
  right: var(--space-4);
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--color-primary);
}

.top-nav__link:focus-visible {
  outline-offset: -6px;
}

.header-end {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
}

.household-name {
  display: none;
  max-width: 18ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
}

.diners {
  display: flex;
}

.diners .avatar {
  width: 34px;
  height: 34px;
  font-size: var(--text-sm);
  border: 2px solid var(--color-bg);
}

.diners .avatar + .avatar {
  margin-left: -8px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: var(--target-min);
  height: var(--target-min);
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text-secondary);
  transition: background var(--duration-fast) var(--ease-standard), color var(--duration-fast);
}

.icon-btn:hover,
.icon-btn[aria-current="page"] {
  background: var(--color-surface-quiet);
  color: var(--color-text);
}

.app-main {
  flex: 1;
  outline: none;
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--color-header-bg);
  border-top: 1px solid var(--color-border);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  background: none;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-tertiary);
}

.tab .icon {
  width: var(--icon-lg);
  height: var(--icon-lg);
}

.tab.is-on {
  color: var(--color-primary-text);
}

.tab.is-on .icon {
  stroke: var(--color-primary);
  stroke-width: 2.1;
}

.tab:focus-visible {
  outline-offset: -4px;
}

/* Chrome modes: full (nav + tabs) · focus (nav, no tabs) · brand (wordmark only) · none (cook) */
.app-shell[data-chrome="full"] .app-main {
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}

.app-shell:not([data-chrome="full"]) .tabbar {
  display: none;
}

.app-shell[data-chrome="brand"] .top-nav,
.app-shell[data-chrome="brand"] .header-end {
  display: none;
}

.app-shell[data-chrome="none"] .app-header {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--space-4) + env(safe-area-inset-bottom));
  z-index: 60;
  max-width: min(92vw, 460px);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-pill);
  background: var(--color-inverse-bg);
  color: var(--color-inverse-text);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity var(--duration-base) var(--ease-standard), transform var(--duration-base) var(--ease-standard);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.debug {
  position: fixed;
  right: var(--space-2);
  top: calc(var(--header-h) + var(--space-2));
  z-index: 70;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-xs);
  background: var(--color-inverse-bg);
  color: var(--color-inverse-text);
  font: 600 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.screen-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  padding: var(--space-2) var(--page-pad);
  background: var(--color-surface-sunken);
}

.screen-nav button {
  padding: 2px var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs);
  background: var(--color-surface);
  font-size: var(--text-xs);
}

.screen-nav button.is-on {
  border-color: var(--color-primary);
}

/* 5. Primitives ------------------------------------------------------------ */

/* Page containers */
.view {
  display: none;
}

.view.is-active {
  display: block;
  animation: view-in var(--duration-slow) var(--ease-standard);
}

.page {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--space-6) var(--page-pad) var(--space-9);
}

.page--narrow {
  max-width: 600px;
}

.page--medium {
  max-width: 960px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-7);
}

.page-head--center {
  justify-content: center;
  text-align: center;
}

.page-head--center .lede {
  margin-left: auto;
  margin-right: auto;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-h);
  padding: 0 var(--space-6);
  border: 1.5px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--text-button);
  font-weight: var(--weight-bold);
  line-height: 1.2;
  letter-spacing: -0.005em;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-base) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn .icon {
  transition: transform var(--duration-base) var(--ease-standard);
}

.btn:hover:not(:disabled) .icon--forward {
  transform: translateX(3px);
}

.btn-lg {
  min-height: 56px;
  padding: 0 var(--space-7);
}

.btn-sm {
  min-height: var(--control-h-sm);
  padding: 0 var(--space-4);
  font-size: var(--text-button-sm);
  font-weight: var(--weight-semibold);
}

.btn.wide {
  width: 100%;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.btn-primary:active:not(:disabled) {
  background: var(--color-primary-pressed);
  box-shadow: none;
}

.btn-secondary {
  background: var(--color-surface);
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-surface-quiet);
  border-color: var(--color-text-tertiary);
}

.btn-quiet,
.btn-ghost {
  background: transparent;
  color: var(--color-structure);
}

.btn-quiet:hover:not(:disabled),
.btn-ghost:hover:not(:disabled) {
  background: var(--color-structure-soft);
}

.back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--target-min);
  margin: 0 0 var(--space-4) calc(var(--space-3) * -1);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
}

.back:hover {
  background: var(--color-surface-quiet);
  color: var(--color-text);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-7);
}

.actions--center {
  justify-content: center;
}

.sticky-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-7);
}

/* Fields */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

.field__label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: var(--control-h);
  padding: 0 var(--space-4);
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-base);
  transition: border-color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard);
}

.field textarea {
  min-height: 96px;
  padding: var(--space-3) var(--space-4);
  resize: vertical;
}

.field select {
  appearance: none;
  padding-right: var(--space-8);
  background-image: linear-gradient(45deg, transparent 50%, var(--color-text-secondary) 50%), linear-gradient(135deg, var(--color-text-secondary) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--color-text-tertiary);
  opacity: 0.85;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--color-text-tertiary);
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: none;
  border-color: var(--color-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-focus) 28%, transparent);
}

.field input[readonly] {
  background: var(--color-surface-quiet);
  font-size: var(--text-sm);
}

.field-row {
  display: grid;
  gap: 0 var(--space-4);
}

/* Selectable tiles (diet limits) */
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.check-tile {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: border-color var(--duration-fast), background-color var(--duration-fast);
}

.check-tile:hover {
  border-color: var(--color-border-strong);
}

.check-tile.is-on {
  border-color: var(--color-selected-border);
  background: var(--color-selected-bg);
}

.check-tile input {
  appearance: none;
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-xs);
  background: var(--color-surface);
  transition: background-color var(--duration-fast), border-color var(--duration-fast);
}

.check-tile input:checked {
  border-color: var(--color-primary);
  background: var(--color-primary) var(--check-mark) center / 16px no-repeat;
}

.check-tile:has(input:focus-visible) {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.check-tile input:focus-visible {
  outline: none;
}

.check-tile__text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.check-tile__hint {
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  color: var(--color-text-secondary);
  line-height: var(--leading-snug);
}

/* An allergy exception sits under its parent limit and only appears when that limit is on. */
.check-tile--exception {
  grid-column: 1 / -1;
  border-style: dashed;
}

.field__error {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-error-text);
}

.field input[aria-invalid="true"] {
  border-color: var(--color-error);
}

/* Chips + toggles */
.chip-grid,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip-grid {
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--badge-neutral-bg);
  color: var(--badge-neutral-text);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
}

.chip--soft {
  background: var(--color-natural-soft);
  color: var(--color-natural-text);
}

.chip-tog,
.channel-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--target-min);
  padding: 0 var(--space-5);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  transition: border-color var(--duration-fast), background-color var(--duration-fast), color var(--duration-fast);
}

.chip-tog:hover,
.channel-chip:hover {
  border-color: var(--color-border-strong);
}

.chip-tog.is-on,
.channel-chip.is-on {
  border-color: var(--color-selected-border);
  background: var(--color-selected-bg);
  color: var(--color-primary-text);
}

.chip-tog.is-on::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-primary) var(--check-mark) center / 10px no-repeat;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Badges */
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--badge-neutral-bg);
  color: var(--badge-neutral-text);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
}

.badge .icon {
  width: var(--icon-sm);
  height: var(--icon-sm);
}

.badge--fit {
  background: var(--badge-fit-bg);
  color: var(--badge-fit-text);
}

.badge--match {
  background: var(--badge-match-bg);
  color: var(--badge-match-text);
}

.badge--time {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: inset 0 0 0 1px var(--color-border);
}

.badge--accent {
  background: var(--color-accent-soft);
  color: var(--color-accent-text);
}

.badge--success {
  background: var(--color-success-soft);
  color: var(--color-success-text);
}

.badge--warning {
  background: var(--color-warning-soft);
  color: var(--color-warning-text);
}

.badge--sm {
  min-height: 24px;
  padding: 2px 10px;
  font-size: var(--text-xs);
}

/* Cards */
.card {
  padding: var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.card--quiet {
  border-color: transparent;
  background: var(--color-surface-quiet);
  box-shadow: none;
}

.card--accent {
  border-color: transparent;
  background: var(--color-primary-soft);
  box-shadow: none;
}

/* Avatars */
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
}

.avatar + .avatar,
.avatar--alt,
.diners .avatar:nth-child(2n) {
  background: var(--color-structure);
  color: var(--color-on-structure);
}

.avatar--lg {
  width: 52px;
  height: 52px;
  font-size: var(--text-lg);
}

.member-list {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-6);
}

.member-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.member-row .grow {
  flex: 1;
  min-width: 0;
}

.member-row .name {
  font-weight: var(--weight-bold);
}

.member-row:nth-child(2n) .avatar {
  background: var(--color-structure);
  color: var(--color-on-structure);
}

.inline-add {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: var(--space-3);
}

/* Tabs */
.tabs {
  margin-top: var(--space-6);
}

.tab-list {
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  border-bottom: 1px solid var(--color-border);
  scrollbar-width: none;
}

.tab-btn {
  position: relative;
  flex: none;
  min-height: var(--target-min);
  padding: 0 var(--space-4);
  border: 0;
  background: none;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
}

.tab-btn:hover {
  color: var(--color-text);
}

.tab-btn[aria-selected="true"] {
  color: var(--color-primary-text);
}

.tab-btn[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: var(--space-3);
  right: var(--space-3);
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--color-primary);
}

.tab-btn:focus-visible {
  outline-offset: -4px;
}

.tab-panel {
  padding-top: var(--space-6);
  animation: fade-in var(--duration-base) var(--ease-standard);
}

.tab-panel:focus-visible {
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

/* Meal imagery */
.meal-media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--color-surface-quiet);
}

.meal-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.meal-media--ready .meal-media__img {
  opacity: 1;
}

.meal-media--error .meal-media__img {
  display: none;
}

.meal-media__fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  background:
    radial-gradient(circle at 30% 30%, var(--color-primary-soft), transparent 60%),
    var(--color-surface-quiet);
}

.meal-media img + .meal-media__fallback {
  display: grid;
}

.meal-media--ready img + .meal-media__fallback {
  display: none;
}

.meal-media--error .meal-media__fallback {
  display: grid;
}

/* Dialog / sheet */
.sheet {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-lg);
}

.sheet::backdrop {
  background: var(--color-overlay);
}

.sheet[open] {
  animation: sheet-in var(--duration-slow) var(--ease-emphasized);
}

.sheet__inner {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-7) var(--space-6) var(--space-6);
}

.sheet__actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* Empty, loading */
.empty-state {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-9) var(--space-6);
  border: 1.5px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--color-text-secondary);
}

.empty-state__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary-text);
}

.empty-state strong {
  font-size: var(--text-lg);
  color: var(--color-text);
}

.skeleton {
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--color-surface-quiet) 0%, var(--color-surface-sunken) 50%, var(--color-surface-quiet) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.weave-loader {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--color-surface-quiet);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
}

.weave-loader__strands {
  position: relative;
  width: 44px;
  height: 28px;
}

.weave-loader__strands span,
.celebrate__mark--weave span,
.demo-result__weave span,
.weave-thread span {
  position: absolute;
  left: 0;
  right: 0;
  height: 5px;
  border-radius: var(--radius-pill);
}

.weave-loader__strands span:nth-child(1),
.celebrate__mark--weave span:nth-child(1),
.demo-result__weave span:nth-child(1),
.weave-thread span:nth-child(1) {
  background: var(--weave-1);
}

.weave-loader__strands span:nth-child(2),
.celebrate__mark--weave span:nth-child(2),
.demo-result__weave span:nth-child(2),
.weave-thread span:nth-child(2) {
  background: var(--weave-2);
}

.weave-loader__strands span:nth-child(3),
.celebrate__mark--weave span:nth-child(3),
.demo-result__weave span:nth-child(3),
.weave-thread span:nth-child(3) {
  background: var(--weave-3);
}

.weave-loader__strands span:nth-child(1) { top: 2px; animation: weave 1.2s var(--ease-standard) infinite; }
.weave-loader__strands span:nth-child(2) { top: 11px; animation: weave 1.2s var(--ease-standard) 0.15s infinite reverse; }
.weave-loader__strands span:nth-child(3) { top: 20px; animation: weave 1.2s var(--ease-standard) 0.3s infinite; }

/* Progress (onboarding) */
.flow__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.flow__top .back {
  margin-bottom: 0;
}

.progress-dots {
  display: flex;
  gap: 6px;
  width: min(180px, 40vw);
}

.progress-dots span {
  flex: 1;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  transition: background-color var(--duration-base);
}

.progress-dots span.is-done {
  background: var(--color-structure);
}

.progress-dots span.is-on {
  background: var(--color-primary);
}

/* 6. Views ----------------------------------------------------------------- */

/* Welcome */
.welcome {
  display: grid;
  gap: var(--space-7);
  padding-top: var(--space-5);
}

.welcome__media {
  position: relative;
  order: -1;
}

.welcome__photo {
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: var(--color-surface-quiet);
}

.welcome__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.welcome__photo--main {
  aspect-ratio: 4 / 3;
  box-shadow: var(--shadow-md);
}

.welcome__photo--a,
.welcome__photo--b {
  display: none;
}

.weave-thread {
  display: none;
}

.welcome__title {
  display: grid;
  gap: var(--space-2);
}

.welcome__lead {
  display: block;
}

.wordmark-inline img {
  height: 0.92em;
  width: auto;
  max-width: 100%;
}

.pillars {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-7);
}

.pillars li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.pillars strong {
  display: block;
  font-size: var(--text-base);
  color: var(--color-text);
}

.pillar-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary-text);
}

.welcome .actions .btn {
  flex: 1 1 220px;
}

/* Onboarding flow */
.flow {
  display: grid;
  gap: var(--space-8);
}

.flow__main {
  width: 100%;
  max-width: 600px;
}

.flow__actions {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-8);
}

.flow__aside {
  display: none;
}

.invite-code-card {
  margin-top: var(--space-6);
}

.code-block {
  margin-bottom: var(--space-4);
  font: var(--weight-bold) var(--text-xl) / 1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.06em;
  color: var(--color-text);
}

.invite-code-card .meta {
  margin-top: var(--space-3);
}

.join-hint {
  margin-top: var(--space-4);
}

/* Choice set */
.choice-grid {
  display: grid;
  gap: var(--space-4);
}

.option-card {
  position: relative;
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: var(--space-4);
  align-items: start;
  padding: var(--space-3);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition:
    border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-base) var(--ease-standard),
    transform var(--duration-base) var(--ease-standard);
}

.option-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.option-card.selected-mark {
  border-color: var(--color-selected-border);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-selected-border) 22%, transparent), var(--shadow-md);
}

.option-card__media {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
}

.option-card__letter {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-xs);
  font-weight: var(--weight-heavy);
  box-shadow: var(--shadow-sm);
}

.option-card__body {
  min-width: 0;
  padding: var(--space-1) var(--space-2) var(--space-2) 0;
}

.option-card h2 {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  letter-spacing: -0.01em;
}

.option-card .badges {
  margin-top: var(--space-2);
}

.option-card .why {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.option-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

.option-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.option-meta .icon {
  width: var(--icon-sm);
  height: var(--icon-sm);
}

.option-card__pick {
  display: none;
}

.option-card.selected-mark .option-card__pick {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  display: inline-flex;
}

.option-card__cta {
  display: none;
}

.option-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.option-card__actions .option-card__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-structure);
}

.share-card {
  display: grid;
  gap: var(--space-5);
  margin-top: var(--space-8);
  background: var(--color-surface-quiet);
  border-color: transparent;
  box-shadow: none;
}

.share-card__text {
  font-weight: var(--weight-semibold);
}

.share-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-end;
}

.share-card__actions .field {
  flex: 1 1 100%;
  margin-top: 0;
}

/* Home — Tonight's pick */
.tonight-hero {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--surface-hero);
  box-shadow: var(--shadow-sm);
}

.tonight-hero__media {
  order: -1;
  aspect-ratio: 4 / 3;
}

.tonight-hero__media .meal-media {
  height: 100%;
  aspect-ratio: auto;
}

.tonight-hero__media--stack {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.tonight-hero__media--stack .meal-media {
  aspect-ratio: auto;
  height: 100%;
}

.tonight-hero__copy {
  padding: var(--space-6);
}

.tonight-hero .eyebrow {
  color: var(--color-primary-text);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-7);
}

.hero-actions .btn {
  flex: 1 1 200px;
}

.insight-row {
  display: grid;
  gap: var(--space-5);
  margin-top: var(--space-5);
}

.insight {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.insight__icon,
.why-card__icon,
.link-card__icon,
.settings-section__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--color-primary-soft);
  color: var(--color-primary-text);
}

.insight__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.insight__text {
  margin-top: 2px;
  font-size: var(--text-sm);
  color: var(--color-text);
}

.home-grid {
  display: grid;
  gap: var(--space-3);
}

.link-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
  min-height: 80px;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--duration-fast), box-shadow var(--duration-base), transform var(--duration-base);
}

button.link-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.link-card .link-card__icon {
  background: var(--color-structure-soft);
  color: var(--color-structure);
}

.link-card__body {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 2px;
}

.link-card__body strong {
  font-weight: var(--weight-bold);
}

.link-card__body span {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

.install-hint {
  margin-top: var(--space-6);
}

/* Recipe detail */
.recipe {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6);
}

.recipe > * {
  min-width: 0;
}

.recipe__media {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.why-card {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--color-surface-quiet);
}

.why-card__text {
  line-height: var(--leading-normal);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.stat {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: var(--space-4) var(--space-2);
  text-align: center;
}

.stat + .stat {
  border-left: 1px solid var(--color-border);
}

.stat .icon {
  color: var(--color-structure);
}

.stat dt {
  order: 2;
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.stat dd {
  font-weight: var(--weight-bold);
}

.ing {
  display: grid;
  margin-top: var(--space-3);
}

.ing li {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}

.ing li::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-natural);
  transform: translateY(-1px);
}

.ing .qty {
  min-width: 7.5em;
  font-weight: var(--weight-bold);
}

.ing .ing-note {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

.recipe-steps {
  display: grid;
  gap: var(--space-4);
  counter-reset: step;
}

.recipe-steps li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: var(--space-3);
  counter-increment: step;
}

.recipe-steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-structure-soft);
  color: var(--color-structure);
  font-weight: var(--weight-heavy);
}

.recipe-steps strong {
  display: block;
  margin-top: 6px;
}

.recipe-steps p {
  margin-top: 2px;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.notes-list {
  display: grid;
  gap: var(--space-4);
}

.notes-list div {
  display: grid;
  gap: 2px;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.notes-list dt {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.recipe__actions .btn {
  flex: 1 1 auto;
}

/* Cook */
.view-cook.is-active {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--color-bg);
}

.cook {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.cook__bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--space-3) var(--page-pad);
}

.cook__meal {
  overflow: hidden;
  font-weight: var(--weight-bold);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cook__count {
  min-width: 3.5em;
  font-weight: var(--weight-bold);
  color: var(--color-text-secondary);
  text-align: right;
}

.cook-progress {
  display: flex;
  gap: 6px;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--page-pad);
}

.cook-progress .dot {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  transition: background-color var(--duration-base);
}

.cook-progress .dot.is-done {
  background: var(--color-structure);
}

.cook-progress .dot.is-on {
  background: var(--color-primary);
}

.cook__scroll {
  flex: 1;
  overflow-y: auto;
}

.cook-layout {
  display: grid;
  gap: var(--space-7);
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--space-8) var(--page-pad);
}

.cook-step-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-primary-text);
}

.cook-step-title {
  margin-top: var(--space-2);
  font-size: clamp(1.9rem, 1.4rem + 2.4vw, 3rem);
  font-weight: var(--weight-heavy);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.cook-step-body {
  margin-top: var(--space-5);
  max-width: 46ch;
  font-size: clamp(1.15rem, 1rem + 0.6vw, 1.45rem);
  line-height: 1.6;
}

.cook-ings {
  align-self: start;
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--color-surface-quiet);
}

.cook-ings h3 {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.cook-ings ul {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.cook-ings li {
  display: flex;
  gap: var(--space-2);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}

.cook-ings li::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 0.6em;
  border-radius: 50%;
  background: var(--color-natural);
}

.cook-ings ul:empty::after {
  content: "Nothing new to grab — just keep going.";
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

.cook-nav {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: var(--space-3);
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--space-4) var(--page-pad);
  border-top: 1px solid var(--color-border);
}

.cook-nav .btn {
  min-height: 64px;
}

/* Celebrate (finished, loop) */
.celebrate {
  display: grid;
  justify-items: center;
  padding-top: var(--space-10);
  text-align: center;
}

.celebrate .lede {
  margin-left: auto;
  margin-right: auto;
}

.celebrate__mark {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin-bottom: var(--space-6);
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary-text);
}

.celebrate__mark .icon {
  width: 44px;
  height: 44px;
  stroke-width: 2.4;
}

.celebrate__mark--weave {
  position: relative;
}

.celebrate__mark--weave span {
  left: 24px;
  right: 24px;
  height: 7px;
}

.celebrate__mark--weave span:nth-child(1) { top: 32px; transform: rotate(-14deg); }
.celebrate__mark--weave span:nth-child(2) { top: 45px; }
.celebrate__mark--weave span:nth-child(3) { top: 58px; transform: rotate(14deg); }

.loop-check {
  display: grid;
  gap: var(--space-2);
  width: 100%;
  max-width: 420px;
  margin-top: var(--space-7);
  text-align: left;
}

.loop-check li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface-quiet);
  font-weight: var(--weight-semibold);
}

.loop-check .ok {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--color-success-soft);
  color: var(--color-success-text);
  font-size: var(--text-sm);
}

/* Ratings */
.rater-grid {
  display: grid;
  gap: var(--space-4);
}

.rater-card {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.rater-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.rater-head .grow {
  flex: 1;
  min-width: 0;
}

.rater-name {
  font-weight: var(--weight-bold);
}

.rater-status {
  display: inline-flex;
  margin-top: 2px;
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

.rater-status.done {
  color: var(--color-success-text);
  font-weight: var(--weight-bold);
}

.rater-face {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-surface-quiet);
  font-size: 30px;
  line-height: 1;
  transition: transform var(--duration-base) var(--ease-emphasized), background-color var(--duration-base);
}

.rater-face.is-set {
  background: var(--color-primary-soft);
  transform: scale(1.06);
}

.score-rows {
  display: grid;
  gap: var(--space-2);
}

.score-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-2);
}

.score {
  min-height: 52px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  transition: background-color var(--duration-fast), border-color var(--duration-fast), color var(--duration-fast), transform var(--duration-fast);
}

.score:hover {
  border-color: var(--color-primary);
}

.score.is-picked {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-on-primary);
  transform: scale(1.04);
}

.anchors {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-tertiary);
}

.rater-card .field {
  margin-top: 0;
}

/* Settings */
.settings-layout {
  display: grid;
  gap: var(--space-5);
  min-width: 0;
}

.settings-stack {
  display: grid;
  gap: var(--space-5);
  align-content: start;
}

.settings-section .field:first-of-type {
  margin-top: var(--space-4);
}

.settings-section__head {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}

.settings-section__head .meta {
  margin-top: 2px;
}

.settings-section__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.settings-section .member-list {
  margin-top: var(--space-4);
}

.settings-section .check-grid {
  margin-top: var(--space-4);
}

.settings-actions .btn {
  width: 100%;
}

.theme-options {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.theme-option {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3);
  padding-right: var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  cursor: pointer;
  transition: border-color var(--duration-fast), background-color var(--duration-fast), box-shadow var(--duration-base);
}

.theme-option:hover {
  border-color: var(--color-border-strong);
}

.theme-option:has(input:checked) {
  border-color: var(--color-selected-border);
  background: var(--color-selected-bg);
}

.theme-option:has(input:focus-visible) {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.theme-option input {
  appearance: none;
  width: 24px;
  height: 24px;
  margin: 0;
  border: 2px solid var(--color-border-strong);
  border-radius: 50%;
  background: var(--color-surface);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.theme-option input:checked {
  border-color: var(--color-primary);
  box-shadow: inset 0 0 0 5px var(--color-surface), inset 0 0 0 12px var(--color-primary);
}

.theme-option input:focus-visible {
  outline: none;
}

.theme-option > span:not(.theme-swatch):not(.sr-only) {
  min-width: 0;
}

.theme-option__name {
  display: block;
  font-weight: var(--weight-bold);
}

.theme-option__note {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

/* The swatch re-scopes tokens via its own data-theme, so it always previews that theme. */
.theme-swatch {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--surface-hero);
}

.theme-swatch__bar {
  position: absolute;
  inset: 0 0 auto;
  height: 22%;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.theme-swatch__dot {
  position: absolute;
  top: 6%;
  left: 9%;
  width: 10%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--color-primary);
}

.theme-swatch__title {
  position: absolute;
  left: 12%;
  top: 36%;
  width: 54%;
  height: 9%;
  border-radius: var(--radius-pill);
  background: var(--color-text);
}

.theme-swatch__line {
  position: absolute;
  left: 12%;
  top: 52%;
  width: 40%;
  height: 6%;
  border-radius: var(--radius-pill);
  background: var(--color-structure);
  opacity: 0.6;
}

.theme-swatch__cta {
  position: absolute;
  left: 12%;
  bottom: 12%;
  width: 46%;
  height: 14%;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
}

.theme-swatch__accent {
  position: absolute;
  right: 10%;
  bottom: 12%;
  width: 20%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--color-accent);
}

/* History */
.history-list {
  display: grid;
  gap: var(--space-3);
}

.history-item {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.history-item .meal-media {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
}

.history-item__body {
  min-width: 0;
}

.history-item__title {
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
}

.history-item .badges {
  margin-top: var(--space-2);
}

.history-skeleton {
  height: 112px;
}

/* Taste profile */
.profile-layout {
  display: grid;
  gap: var(--space-5);
  align-items: start;
}

.taste-lines {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.taste-lines li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface-quiet);
  line-height: var(--leading-snug);
}

.taste-line__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary-text);
}

.taste-line--avoid .taste-line__icon {
  background: var(--color-warning-soft);
  color: var(--color-warning-text);
}

.taste-line--history .taste-line__icon {
  background: var(--color-structure-soft);
  color: var(--color-structure);
}

.taste-line--starter .taste-line__icon {
  background: var(--color-natural-soft);
  color: var(--color-natural-text);
}

.taste-lines li > span:last-child {
  padding-top: 9px;
}

.weave-accent {
  position: relative;
  overflow: hidden;
}

.weave-accent::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--weave-1) 0 33.3%, var(--weave-2) 33.3% 66.6%, var(--weave-3) 66.6% 100%);
}

.profile-card .chip-grid {
  margin: var(--space-4) 0 var(--space-6);
}

/* Demo */
.demo-layout {
  display: grid;
  gap: var(--space-4);
}

.demo-diner {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}

.demo-diner strong {
  display: block;
  margin-bottom: var(--space-2);
}

.demo-diner .meta {
  margin-top: var(--space-2);
}

.demo-diner__kind {
  margin: var(--space-3) 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
}

.demo-diner strong + .demo-diner__kind {
  margin-top: 0;
}

.demo-result {
  display: flex;
  gap: var(--space-4);
  align-items: center;
}

.demo-result .card-kicker {
  color: var(--color-primary-text);
}

.demo-result__weave {
  position: relative;
  flex: none;
  width: 52px;
  height: 36px;
}

.demo-result__weave span:nth-child(1) { top: 4px; transform: rotate(-12deg); }
.demo-result__weave span:nth-child(2) { top: 15px; }
.demo-result__weave span:nth-child(3) { top: 26px; transform: rotate(12deg); }

/* Responsive composition ------------------------------------------------- */

/* Mobile: one primary action, pinned within thumb reach. */
@media (max-width: 767.98px) {
  .sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin-left: calc(var(--page-pad) * -1);
    margin-right: calc(var(--page-pad) * -1);
    padding: var(--space-4) var(--page-pad) calc(var(--space-4) + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--color-bg) 70%, transparent);
  }

  .sticky-actions .btn {
    flex: 1 1 100%;
  }

  .app-shell[data-chrome="full"] .sticky-actions {
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  }

  .recipe {
    margin: 0 calc(var(--page-pad) * -1);
  }

  .recipe__media {
    border-radius: 0;
    box-shadow: none;
  }

  .recipe__body {
    padding: 0 var(--page-pad);
  }

  .tab-btn {
    padding: 0 var(--space-3);
  }

  .recipe-page-back {
    margin-bottom: var(--space-2);
  }

  .tonight-hero {
    border-radius: var(--radius-lg);
  }

  .page {
    padding-top: var(--space-5);
  }

  .cook-nav {
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  }
}

/* Tablet and up */
@media (min-width: 768px) {
  .top-nav {
    display: flex;
  }

  .app-shell[data-chrome="full"] .tabbar {
    display: none;
  }

  .app-shell[data-chrome="full"] .app-main {
    padding-bottom: 0;
  }

  .toast {
    bottom: var(--space-7);
  }

  .page {
    padding-top: var(--space-8);
  }

  .field-row {
    grid-template-columns: 1fr 1fr;
  }

  .choice-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
  }

  .option-card {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
    overflow: hidden;
  }

  .option-card__media {
    aspect-ratio: 4 / 3;
    border-radius: 0;
  }

  .option-card__letter {
    top: var(--space-3);
    left: var(--space-3);
    width: 32px;
    height: 32px;
    font-size: var(--text-sm);
  }

  .option-card__body {
    padding: var(--space-5);
  }

  .option-card h2 {
    font-size: var(--text-lg);
  }

  .option-card__cta {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    margin: 0 var(--space-5) var(--space-5);
    font-size: var(--text-sm);
    font-weight: var(--weight-bold);
    color: var(--color-structure);
  }

  .option-card__cta .icon {
    width: var(--icon-sm);
    height: var(--icon-sm);
  }

  .option-card {
    display: flex;
    flex-direction: column;
  }

  .option-card__body {
    flex: 1;
  }

  .share-card {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .share-card__actions {
    justify-content: flex-end;
    max-width: 520px;
  }

  .insight-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    padding: var(--space-5) var(--space-2);
  }

  .insight {
    padding: 0 var(--space-5);
  }

  .insight + .insight {
    border-left: 1px solid var(--color-border);
  }

  .home-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
  }

  .history-list {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
  }

  .history-item {
    grid-template-columns: 120px 1fr;
  }

  .rater-grid:has(.rater-card:nth-child(2)) {
    grid-template-columns: repeat(2, 1fr);
  }

  .theme-options {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr));
  }

  .top-nav__link {
    padding: 0 var(--space-2);
  }

  .theme-option {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    padding: var(--space-3);
  }

  .theme-option .theme-swatch {
    grid-column: 1 / -1;
    aspect-ratio: 16 / 10;
    margin-bottom: var(--space-1);
  }

  .sticky-actions .btn,
  .flow__actions .btn {
    flex: 0 1 auto;
  }

  .flow__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }

  .flow__actions .btn.wide {
    width: auto;
    min-width: 220px;
  }

  .demo-layout {
    grid-template-columns: 1fr 1fr;
  }

  .demo-result {
    grid-column: 1 / -1;
  }

  .settings-actions .btn {
    width: auto;
  }

  .welcome .actions .btn {
    flex: 0 1 auto;
  }

  .pillars {
    grid-template-columns: repeat(3, 1fr);
  }

  .cook-layout {
    grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
    gap: var(--space-9);
    padding-top: var(--space-9);
  }

  .cook-nav {
    grid-template-columns: auto auto;
    justify-content: end;
  }

  .cook-nav .btn {
    min-width: 200px;
  }
}

@media (min-width: 960px) {
  .household-name {
    display: block;
  }

  .top-nav__link {
    padding: 0 var(--space-4);
  }
}

/* Desktop / laptop: editorial, side-by-side compositions */
@media (min-width: 1024px) {
  .choice-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
  }

  .choice-grid:has(.option-card:nth-child(4)) {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }

  .welcome {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    align-items: center;
    gap: var(--space-10);
    min-height: calc(100dvh - var(--header-h) - var(--space-10));
    padding-top: var(--space-6);
  }

  .welcome__media {
    order: 0;
    padding: var(--space-8) var(--space-8) var(--space-8) var(--space-9);
  }

  .welcome__photo--main {
    aspect-ratio: 5 / 4;
  }

  .welcome__photo--a,
  .welcome__photo--b {
    position: absolute;
    display: block;
    width: 36%;
    aspect-ratio: 4 / 3;
    border: 6px solid var(--color-bg);
    box-shadow: var(--shadow-lg);
  }

  .welcome__photo--a {
    left: 0;
    bottom: 0;
  }

  .welcome__photo--b {
    right: 0;
    top: 0;
    width: 30%;
  }

  .weave-thread {
    position: absolute;
    right: 18%;
    bottom: 2%;
    display: block;
    width: 120px;
    height: 34px;
  }

  .weave-thread span:nth-child(1) { top: 2px; transform: rotate(-8deg); }
  .weave-thread span:nth-child(2) { top: 14px; }
  .weave-thread span:nth-child(3) { top: 26px; transform: rotate(8deg); }

  .pillars {
    grid-template-columns: 1fr;
    max-width: 420px;
  }

  .flow {
    grid-template-columns: minmax(0, 600px) minmax(0, 1fr);
    gap: var(--space-10);
    align-items: start;
  }

  .flow__aside {
    position: sticky;
    top: calc(var(--header-h) + var(--space-8));
    display: grid;
    gap: var(--space-4);
  }

  .flow__aside img {
    width: 100%;
    aspect-ratio: 5 / 4;
    object-fit: cover;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
  }

  .flow__note {
    padding-left: var(--space-4);
    border-left: 3px solid var(--color-primary);
    font-weight: var(--weight-semibold);
    color: var(--color-text-secondary);
  }

  .tonight-hero {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    min-height: 460px;
  }

  .tonight-hero__copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--space-9) var(--space-8) var(--space-9) var(--space-9);
  }

  .tonight-hero__media {
    order: 0;
    aspect-ratio: auto;
    min-height: 100%;
  }

  .tonight-hero__media .meal-media img {
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 16%);
    mask-image: linear-gradient(to right, transparent 0, #000 16%);
  }

  .hero-actions .btn {
    flex: 0 1 auto;
  }

  .home-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .link-card {
    flex-direction: column;
    align-items: flex-start;
    min-height: 168px;
    padding: var(--space-5);
  }

  .link-card--invite .btn {
    margin-top: auto;
  }

  .recipe {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: var(--space-9);
    align-items: start;
  }

  .recipe__media {
    position: sticky;
    top: calc(var(--header-h) + var(--space-6));
    aspect-ratio: 1 / 1;
  }

  .settings-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: var(--space-6);
  }

  .settings-section--appearance {
    position: sticky;
    top: calc(var(--header-h) + var(--space-6));
  }

  .theme-options {
    grid-template-columns: repeat(2, 1fr);
  }

  .profile-layout {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: var(--space-6);
  }

  .history-list {
    grid-template-columns: repeat(3, 1fr);
  }

  .history-item {
    grid-template-columns: 1fr;
    padding: 0;
    overflow: hidden;
  }

  .history-item .meal-media {
    aspect-ratio: 4 / 3;
    border-radius: 0;
  }

  .history-item__body {
    padding: var(--space-2) var(--space-5) var(--space-5);
  }

  .demo-layout {
    grid-template-columns: 1fr 1fr 1.2fr;
  }

  .demo-result {
    grid-column: auto;
  }
}

@media (min-width: 1440px) {
  :root {
    --page-max: 1320px;
  }

  .theme-options {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Installed PWA: respect the device chrome. */
@media (display-mode: standalone) {
  .app-header {
    padding-top: max(env(safe-area-inset-top), 0px);
  }
}

/* 7. Motion + accessibility ------------------------------------------------ */
@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes weave {
  0%, 100% { transform: translateX(0) scaleX(1); }
  50% { transform: translateX(6px) scaleX(0.7); }
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@keyframes pop {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); }
}

.weave-pop {
  animation: pop var(--duration-slow) var(--ease-emphasized) both;
}

.view-cook.is-active {
  animation: fade-in var(--duration-base) var(--ease-standard);
}

@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;
  }

  .option-card:hover,
  button.link-card:hover {
    transform: none;
  }
}

@media (forced-colors: active) {
  .btn,
  .option-card,
  .check-tile,
  .theme-option,
  .score {
    border: 1px solid CanvasText;
  }

  .score.is-picked,
  .option-card.selected-mark {
    outline: 3px solid Highlight;
  }
}

.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* Viewing vs choosing on recipe detail */
.pick-state {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.pick-state:empty {
  display: none;
}

.pick-state--chosen {
  font-weight: var(--weight-semibold);
  color: var(--color-success-text);
}

/* Round context on Tonight */
.round-note {
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface-quiet);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.round-note strong {
  color: var(--color-text);
}

#choicesActions {
  margin-top: var(--space-5);
}

.option-card.is-past-round {
  opacity: 0.86;
}

.history-item__actions {
  margin-top: var(--space-2);
}
