/* ═══════════════════════════════════════════════════════════
   PIZZA CALCULATOR — Design System & Styles
   pizzacalculator.pro
   ═══════════════════════════════════════════════════════════ */

/* ─── DESIGN TOKENS ─────────────────────────────────────── */
:root {
  /* Brand Colors */
  --c-primary:        #C4621A;
  --c-primary-dark:   #A34F12;
  --c-primary-light:  #F5E4D4;
  --c-secondary:      #1E3FAB;
  --c-secondary-dark: #162E82;
  --c-secondary-light:#E8EDFC;

  /* Neutrals */
  --c-bg:             #FDF8F3;
  --c-surface:        #FFFFFF;
  --c-surface-tint:   #FEF4EB;
  --c-border:         #E8DDD2;
  --c-border-strong:  #D4C4B0;
  --c-text:           #1A1208;
  --c-text-muted:     #6B5744;
  --c-text-faint:     #9C8674;
  --c-pill-idle:      #EDE8E3;

  /* Spacing (4px base) */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px;  --sp-6: 24px;  --sp-7: 28px;  --sp-8: 32px;
  --sp-10: 40px; --sp-12: 48px; --sp-16: 64px; --sp-20: 80px;

  /* Typography */
  --font: 'Inter', 'Inter-fallback', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semi:    600;
  --fw-bold:    700;
  --fw-extra:   800;

  /* Type Scale */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-md:   1.125rem;
  --text-lg:   1.25rem;
  --text-xl:   1.5rem;
  --text-2xl:  1.875rem;
  --text-3xl:  2.375rem;
  --text-hero: 4.5rem;

  /* Border Radius */
  --r-sm:   4px;
  --r-base: 6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   20px;
  --r-pill: 999px;

  /* Shadows (warm-tinted) */
  --shadow-xs: 0 1px 2px rgba(100,40,5,.06);
  --shadow-sm: 0 2px 6px rgba(100,40,5,.08);
  --shadow-md: 0 4px 16px rgba(100,40,5,.10);
  --shadow-card: 0 2px 12px rgba(100,40,5,.09), 0 1px 3px rgba(100,40,5,.06);
  --shadow-lg: 0 8px 32px rgba(100,40,5,.12);

  /* Transitions */
  --t-fast: 150ms ease;
  --t-base: 250ms ease;
  --t-slow: 380ms ease;

  /* Layout */
  --max-w: 1280px;
  --header-h: 64px;
  --toc-h:    36px;
}

/* ─── FONT FALLBACK (CWV: size-adjust minimises CLS during font swap) ── */
@font-face {
  font-family: 'Inter-fallback';
  src: local('Arial');
  size-adjust: 100.06%;
  ascent-override: 106%;
  descent-override: 30%;
  line-gap-override: 0%;
}

/* ─── RESET ──────────────────────────────────────────────── */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

/* [hidden] must always win — prevents display:flex/grid overriding it (CLS fix) */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; }

fieldset { border: none; }

button { font-family: inherit; cursor: pointer; }

input { font-family: inherit; }

table { border-collapse: collapse; width: 100%; }

/* ─── ACCESSIBILITY ──────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-4);
  padding: var(--sp-2) var(--sp-4);
  background: var(--c-secondary);
  color: white;
  font-weight: var(--fw-semi);
  border-radius: var(--r-base);
  text-decoration: none;
  z-index: 9999;
  transition: top var(--t-fast);
}
.skip-link:focus { top: var(--sp-2); }

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

:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ─── LAYOUT ─────────────────────────────────────────────── */
.container {
  width: 92%;
  max-width: var(--max-w);
  margin-inline: auto;
}

@media (max-width: 480px) {
  .container { width: 96%; }
}

/* ─── HEADER ─────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(253,248,243,0.92);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid rgba(232,221,210,0.7);
  box-shadow: 0 1px 12px rgba(100,40,5,.06);
}

.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.site-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  text-decoration: none;
  font-family: var(--font);
  font-size: var(--text-md);
  font-weight: var(--fw-bold);
  color: var(--c-text);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.site-logo span { white-space: nowrap; }
.site-logo svg { flex-shrink: 0; }

.site-nav {
  display: none;
  align-items: center;
  gap: var(--sp-1);
}

@media (min-width: 640px) {
  .site-nav { display: flex; }
}

.site-nav a {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--c-text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  transition: color var(--t-fast), background var(--t-fast);
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--c-primary);
  background: var(--c-primary-light);
}

/* Header actions group */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}

/* Header CTA button */
.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--c-primary);
  color: white;
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  text-decoration: none;
  border-radius: var(--r-pill);
  transition: background var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
  box-shadow: 0 2px 8px rgba(196,98,26,.25);
  white-space: nowrap;
}

.header-cta:hover {
  background: var(--c-primary-dark);
  box-shadow: 0 4px 14px rgba(196,98,26,.35);
  transform: translateY(-1px);
}

.header-cta svg { flex-shrink: 0; }

[data-theme="dark"] .header-cta {
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
[data-theme="dark"] .site-header {
  background: rgba(18,14,8,0.92);
  border-bottom-color: var(--c-border);
}

/* ─── CALCULATOR SECTION ─────────────────────────────────── */
.calc-section { padding-block: var(--sp-12) var(--sp-10); }

.calc-hero {
  text-align: center;
  margin-bottom: var(--sp-10);
}

.calc-hero h1 {
  font-family: var(--font);
  font-size: clamp(2.4rem, 5.5vw, 3.2rem);
  font-weight: var(--fw-extra);
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--c-text);
  margin-bottom: var(--sp-3);
}

.calc-subtitle {
  font-size: var(--text-base);
  color: var(--c-text-muted);
  max-width: 500px;
  margin-inline: auto;
  line-height: 1.7;
  font-weight: var(--fw-regular);
}

/* Trust badges */
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: center;
  margin-top: var(--sp-5);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-pill);
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  color: var(--c-text-muted);
  box-shadow: var(--shadow-xs);
}

.hero-badge svg { color: var(--c-primary); flex-shrink: 0; }

[data-theme="dark"] .hero-badge {
  background: #1D1710;
  border-color: var(--c-border);
}

/* ─── CALC CARD ──────────────────────────────────────────── */
.calc-card {
  background: #FEF3E8; /* exact match to calc-output gradient start — zero gap */
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Inputs section gets white explicitly */
.calc-inputs {
  display: flex;
  flex-direction: column;
  counter-reset: step-counter;
  background: var(--c-surface);
}

@media (min-width: 768px) {
  .calc-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    align-items: start; /* critical for sticky child to work */
  }
}

.input-group {
  padding: var(--sp-5) var(--sp-6) var(--sp-6);
  border-bottom: 1px solid var(--c-border);
  position: relative;
  transition: background var(--t-fast);
  background: var(--c-surface);
  counter-increment: step-counter;
}
.input-group:hover:not(:focus-within) { background: rgba(196,98,26,.008); }

/* Subtle left accent on active group */
.input-group::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: transparent;
  border-radius: 0;
  transition: background var(--t-base);
}

.input-group:focus-within { background: rgba(196,98,26,.018); }
.input-group:focus-within::before { background: var(--c-primary); }
.input-group:focus-within .label-icon {
  background: var(--c-primary);
  color: white;
  transform: scale(1.08);
}

.input-group--last { border-bottom: none; }

@media (min-width: 768px) {
  .input-group--last { border-bottom: 1px solid var(--c-border); }
  .calc-inputs { border-right: 1px solid var(--c-border); }
}

/* ─── INPUT LABEL ────────────────────────────────────────── */
.input-label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-base);
  font-weight: var(--fw-bold);
  color: var(--c-text);
  letter-spacing: -0.02em;
  text-transform: none;
  line-height: 1.3;
  /* Force space above and below — legend needs padding not margin */
  width: 100%;
  float: left;
  padding-top: 22px;
  padding-bottom: 14px;
  margin: 0;
}

/* Clear the float so content flows below */
.input-label + *,
.input-label ~ * {
  clear: left;
}

/* Step counter badge — rendered as first flex item inside each label */
.input-label::before {
  content: counter(step-counter);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  background: var(--c-primary);
  color: white;
  border-radius: 50%;
  font-size: 10px;
  font-weight: var(--fw-bold);
  flex-shrink: 0;
  line-height: 1;
  letter-spacing: 0;
}
[data-theme="dark"] .input-label::before { background: var(--c-primary-dark); }

/* Icon badge */
.label-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--c-primary-light);
  color: var(--c-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}

.input-hint {
  font-size: var(--text-xs);
  font-weight: var(--fw-regular);
  letter-spacing: 0;
  color: var(--c-text-faint);
  margin-left: 2px;
}

/* ─── STEP COUNTER ───────────────────────────────────────── */
.label-icon { position: relative; }

/* ─── FINE-TUNE DIVIDER ──────────────────────────────────── */
.input-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-7);
  background: linear-gradient(90deg, var(--c-bg) 0%, rgba(253,244,235,.6) 50%, var(--c-bg) 100%);
  border-bottom: 1px solid var(--c-border);
}

.input-divider::before,
.input-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--c-border-strong);
  opacity: 0.5;
}

.input-divider span {
  font-size: 10px;
  font-weight: var(--fw-bold);
  color: var(--c-primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: nowrap;
  opacity: 0.75;
}

/* ─── SLIDER ROW ─────────────────────────────────────────── */
.slider-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* ─── RANGE SLIDER ───────────────────────────────────────── */
.range-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 6px;
  border-radius: var(--r-pill);
  background: linear-gradient(
    to right,
    var(--c-primary) var(--fill-pct, 9.09%),
    var(--c-pill-idle) var(--fill-pct, 9.09%)
  );
  outline: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c-primary);
  border: 2.5px solid white;
  box-shadow: 0 1px 6px rgba(196,98,26,.4);
  cursor: grab;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.range-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c-primary);
  border: 2.5px solid white;
  box-shadow: 0 1px 6px rgba(196,98,26,.4);
  cursor: grab;
}

.range-slider::-webkit-slider-thumb:hover,
.range-slider:active::-webkit-slider-thumb {
  transform: scale(1.2);
  box-shadow: 0 2px 10px rgba(196,98,26,.5);
  cursor: grabbing;
}

.range-slider:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 3px;
}

/* ─── NUMBER INPUT ───────────────────────────────────────── */
.number-input {
  width: 76px;
  flex-shrink: 0;
  padding: var(--sp-2) var(--sp-2);
  font-family: var(--font);
  font-size: var(--text-xl);
  font-weight: var(--fw-extra);
  color: var(--c-primary);
  text-align: center;
  background: var(--c-surface);
  border: 2px solid var(--c-border);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  -moz-appearance: textfield;
  box-shadow: 0 1px 3px rgba(100,40,5,.06);
}

.number-input::-webkit-inner-spin-button,
.number-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.number-input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(196,98,26,.15);
  color: var(--c-primary);
}

.number-input--sm {
  width: 64px;
  font-size: var(--text-md);
}

/* ─── KIDS TOGGLE ROW ────────────────────────────────────── */
.kids-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--sp-3);
}

.kids-toggle-label {
  font-size: var(--text-sm);
  color: var(--c-text-muted);
  font-weight: var(--fw-medium);
}

/* ─── TOGGLE SWITCH ──────────────────────────────────────── */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: var(--r-pill);
  background: var(--c-pill-idle);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background var(--t-base);
  flex-shrink: 0;
}

.toggle-switch[aria-checked="true"] { background: var(--c-primary); }

.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform var(--t-base);
}

.toggle-switch[aria-checked="true"] .toggle-knob {
  transform: translateX(20px);
}

/* ─── KIDS SPLIT PANEL ───────────────────────────────────── */
.kids-split-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--t-base);
  overflow: hidden;
}

.kids-split-panel--open { grid-template-rows: 1fr; }

.kids-split-inner { min-height: 0; padding-top: var(--sp-3); }

.split-fields {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-4);
}

.split-label {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  font-size: 11px;
  font-weight: var(--fw-bold);
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Stepper wrapper */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--c-surface);
  border: 2px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.stepper__btn {
  width: 34px;
  height: 44px;
  background: transparent;
  border: none;
  color: var(--c-primary);
  font-size: 1.25rem;
  font-weight: var(--fw-bold);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast), color var(--t-fast);
  line-height: 1;
  padding: 0;
}

.stepper__btn:hover {
  background: var(--c-primary-light);
  color: var(--c-primary-dark);
}

.stepper__btn:active {
  background: var(--c-primary);
  color: white;
}

.stepper .number-input--sm {
  width: 52px;
  border: none;
  border-left: 1px solid var(--c-border);
  border-right: 1px solid var(--c-border);
  border-radius: 0;
  box-shadow: none;
  padding: var(--sp-1) 4px;
  font-size: var(--text-md);
  font-weight: var(--fw-bold);
}

.split-plus {
  font-size: var(--text-xl);
  color: var(--c-border-strong);
  font-weight: var(--fw-bold);
  line-height: 1;
  padding-bottom: 10px;
}

.split-hint {
  margin-top: var(--sp-3);
  font-size: var(--text-xs);
  color: var(--c-text-faint);
  display: flex;
  align-items: center;
  gap: 5px;
}

.split-hint svg { flex-shrink: 0; opacity: 0.6; }

/* Dark mode stepper */
[data-theme="dark"] .stepper {
  background: #2A2218;
  border-color: var(--c-border);
}
[data-theme="dark"] .stepper .number-input--sm {
  background: #2A2218;
  border-color: var(--c-border);
  color: var(--c-primary);
}
[data-theme="dark"] .stepper__btn:hover {
  background: rgba(196,98,26,.18);
}

/* ─── PILL GROUPS ────────────────────────────────────────── */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding-top: var(--sp-1);
}

.pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 16px;
  min-height: 44px;
  background: var(--c-surface);
  color: var(--c-text-muted);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
  white-space: nowrap;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(100,40,5,.05);
}

.pill:hover {
  background: var(--c-primary-light);
  color: var(--c-primary-dark);
  border-color: rgba(196,98,26,.3);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(196,98,26,.15);
}

.pill--active {
  background: var(--c-primary);
  color: white;
  border-color: var(--c-primary);
  box-shadow: 0 3px 10px rgba(196,98,26,.3), 0 1px 2px rgba(196,98,26,.2);
  transform: translateY(-1px);
}

.pill--active:hover {
  background: var(--c-primary-dark);
  border-color: var(--c-primary-dark);
  color: white;
}

.pill__label {
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  line-height: 1.2;
}

.pill__note {
  font-size: 11px;
  font-weight: var(--fw-medium);
  opacity: 0.75;
  line-height: 1;
}

.pill--active .pill__note { opacity: 0.85; }

/* ─── OUTPUT PANEL ───────────────────────────────────────── */
.calc-output {
  background: linear-gradient(170deg, #FEF3E8 0%, #FDEBD6 55%, #FBE4C8 100%);
  padding: 0 var(--sp-6) var(--sp-7);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  position: relative;
  border-top: 1px solid var(--c-border);
}

@media (min-width: 768px) {
  .calc-output {
    min-height: 100%;
    border-top: none;
    border-left: 1px solid rgba(196,98,26,.12);
    padding-top: 0;
    /* Sticky output panel — stays visible while user scrolls inputs */
    position: sticky;
    top: calc(var(--header-h) + 16px);
    max-height: calc(100vh - var(--header-h) - 32px);
    overflow-y: auto;
    overflow-x: hidden;
    /* Smooth scrolling inside panel */
    scroll-behavior: smooth;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .calc-output::-webkit-scrollbar { display: none; }
}

/* ── Output hero: icon → label → number → size ── */
.output-hero {
  text-align: center;
  padding: 32px 16px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* Pizza icon — circle container with warm halo */
.output-pizza-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 38%, #FFE0A8, #F8B56A);
  color: #8B3A0A;
  margin-bottom: 16px;
  box-shadow:
    0 0 0 8px rgba(196,98,26,.09),
    0 4px 18px rgba(196,98,26,.2);
  flex-shrink: 0;
}

/* Label */
.output-label {
  display: block;
  font-size: 9.5px;
  font-weight: 800;
  color: var(--c-primary);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  margin-bottom: 8px;
  opacity: 0.75;
}

/* The number */
.output-number {
  display: block;
  font-family: var(--font);
  font-size: clamp(5.5rem, 12vw, 7.5rem);
  font-weight: 900;
  color: var(--c-primary);
  line-height: 0.85;
  letter-spacing: -0.05em;
  transition: color var(--t-fast);
  text-shadow: 0 3px 0 rgba(163,79,18,.12);
}

/* Divider between number and size label */
.output-size-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--c-text-muted);
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(196,98,26,.14);
  width: 100%;
  text-align: center;
  letter-spacing: -0.01em;
}

/* ─── STAT ICONS ─────────────────────────────────────────── */
.stat-icon {
  display: block;
  margin: 0 auto var(--sp-1);
  color: var(--c-text-faint);
  opacity: 0.7;
}

/* Stats row */
.output-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-2);
}

.stat-item {
  background: rgba(255,255,255,0.8);
  border: 1px solid rgba(196,98,26,.1);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  text-align: center;
  box-shadow: 0 1px 3px rgba(100,40,5,.06), 0 0 0 1px rgba(255,255,255,.5) inset;
  backdrop-filter: blur(4px);
  min-width: 0;
}

.stat-value {
  display: block;
  font-family: var(--font);
  font-size: var(--text-md);
  font-weight: var(--fw-bold);
  color: var(--c-text);
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-label {
  display: block;
  font-size: 10px;
  font-weight: var(--fw-semi);
  color: var(--c-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 3px;
  white-space: nowrap;
}

/* Recommendation sentence */
.output-recommendation {
  font-size: var(--text-sm);
  color: var(--c-text-muted);
  line-height: 1.7;
  min-height: 3.6em;
  padding: var(--sp-4) var(--sp-4);
  background: rgba(255,255,255,0.9);
  border-radius: var(--r-md);
  border: 1px solid rgba(196,98,26,.12);
  border-left: 3px solid var(--c-primary);
  box-shadow: 0 1px 3px rgba(100,40,5,.05);
}

.output-recommendation strong { color: var(--c-text); font-weight: var(--fw-bold); }

/* Varieties breakdown */
/* ─── VARIETY CARDS ──────────────────────────────────────── */
.variety-cards {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding-top: var(--sp-1);
}

.variety-card {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
  width: 100%;
}

.variety-card:hover {
  border-color: rgba(196,98,26,.35);
  background: var(--c-surface-tint);
}

.variety-card.pill--active {
  border-color: var(--c-primary);
  background: var(--c-primary-light);
  box-shadow: 0 2px 8px rgba(196,98,26,.15);
}

.variety-card__pizzas {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

/* Mini pizza circle slices */
.vpizza {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(196,98,26,.3);
}

.vpizza--full    { background: var(--c-primary); border-color: var(--c-primary-dark); }
.vpizza--half-a  { background: var(--c-primary); border-color: var(--c-primary-dark); }
.vpizza--half-b  { background: var(--c-primary-light); border-color: rgba(196,98,26,.4); }
.vpizza--third-a { background: var(--c-primary); border-color: var(--c-primary-dark); }
.vpizza--third-b { background: var(--c-primary-light); border-color: rgba(196,98,26,.4); }
.vpizza--third-c { background: #FDEEDE; border-color: rgba(196,98,26,.25); }
.vpizza--quarter-a { background: var(--c-primary); border-color: var(--c-primary-dark); width:18px; height:18px; }
.vpizza--quarter-b { background: var(--c-primary-light); border-color: rgba(196,98,26,.4); width:18px; height:18px; }
.vpizza--quarter-c { background: #FDEEDE; border-color: rgba(196,98,26,.25); width:18px; height:18px; }
.vpizza--quarter-d { background: #FBE6CE; border-color: rgba(196,98,26,.2); width:18px; height:18px; }

.variety-card__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.variety-card__info strong {
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  color: var(--c-text);
  line-height: 1.3;
}

.variety-card__info span {
  font-size: var(--text-xs);
  color: var(--c-text-faint);
  line-height: 1.4;
}

.variety-card.pill--active .variety-card__info strong { color: var(--c-primary-dark); }
.variety-card.pill--active .variety-card__info span   { color: var(--c-text-muted); }

/* Dark mode */
[data-theme="dark"] .variety-card {
  background: #1D1710;
  border-color: var(--c-border);
}
[data-theme="dark"] .variety-card:hover { background: #231C13; border-color: rgba(196,98,26,.3); }
[data-theme="dark"] .variety-card.pill--active {
  background: rgba(196,98,26,.12);
  border-color: var(--c-primary);
}
[data-theme="dark"] .variety-card__info strong { color: var(--c-text); }
[data-theme="dark"] .variety-card__info span   { color: var(--c-text-faint); }
[data-theme="dark"] .variety-card.pill--active .variety-card__info strong { color: #F4AC70; }
[data-theme="dark"] .vpizza--half-b, [data-theme="dark"] .vpizza--third-b,
[data-theme="dark"] .vpizza--third-c, [data-theme="dark"] .vpizza--quarter-b,
[data-theme="dark"] .vpizza--quarter-c, [data-theme="dark"] .vpizza--quarter-d {
  background: rgba(196,98,26,.2);
  border-color: rgba(196,98,26,.3);
}

/* Varieties breakdown */
.varieties-breakdown {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.variety-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  background: rgba(255,255,255,.7);
  border: 1px solid rgba(30,63,171,.12);
  border-left: 3px solid var(--c-secondary);
  border-radius: var(--r-md);
}

.variety-chip__count {
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  color: var(--c-secondary-dark);
  white-space: nowrap;
}

.variety-chip__label {
  font-size: var(--text-xs);
  color: var(--c-text-faint);
  text-align: right;
}

[data-theme="dark"] .variety-chip {
  background: rgba(30,63,171,.12);
  border-color: rgba(30,63,171,.25);
  border-left-color: #7B96D9;
}
[data-theme="dark"] .variety-chip__count { color: #9EB3F0; }
[data-theme="dark"] .variety-chip__label { color: var(--c-text-faint); }

/* Color-coded variety chips: Cheese=amber, Veggie=green, Meat=red, BBQ=orange */
.variety-chip--0 { border-left-color: #D97706; background: rgba(217,119,6,.05); }
.variety-chip--0 .variety-chip__count { color: #92400E; }
.variety-chip--1 { border-left-color: #16A34A; background: rgba(22,163,74,.05); }
.variety-chip--1 .variety-chip__count { color: #14532D; }
.variety-chip--2 { border-left-color: #DC2626; background: rgba(220,38,38,.05); }
.variety-chip--2 .variety-chip__count { color: #7F1D1D; }
.variety-chip--3 { border-left-color: #EA580C; background: rgba(234,88,12,.05); }
.variety-chip--3 .variety-chip__count { color: #7C2D12; }

[data-theme="dark"] .variety-chip--0 { border-left-color: #F59E0B; background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.2); }
[data-theme="dark"] .variety-chip--0 .variety-chip__count { color: #FCD34D; }
[data-theme="dark"] .variety-chip--1 { border-left-color: #22C55E; background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.2); }
[data-theme="dark"] .variety-chip--1 .variety-chip__count { color: #86EFAC; }
[data-theme="dark"] .variety-chip--2 { border-left-color: #F87171; background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.2); }
[data-theme="dark"] .variety-chip--2 .variety-chip__count { color: #FCA5A5; }
[data-theme="dark"] .variety-chip--3 { border-left-color: #FB923C; background: rgba(251,146,60,.1); border-color: rgba(251,146,60,.2); }
[data-theme="dark"] .variety-chip--3 .variety-chip__count { color: #FDBA74; }

/* ─── OUTPUT ACTIONS ─────────────────────────────────────── */
/*
  Layout:
  Row 1: [Share Link — full width, primary CTA]
  Row 2: [Copy Order] [Copy]
  Row 3: [Print — full width, subtle ghost]
  Row 4: [Reset — full width, ultra-muted]
*/
.output-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.output-actions__row {
  display: flex;
  gap: 8px;
}

.output-actions__row .btn {
  flex: 1;
}

/* ─── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 18px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: var(--r-pill);
  border: 1.5px solid transparent;
  text-decoration: none;
  cursor: pointer;
  min-height: 42px;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  transition:
    background 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease,
    border-color 140ms ease,
    transform 120ms ease;
  -webkit-tap-highlight-color: transparent;
}

/* Ripple base */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  background: rgba(255,255,255,.18);
  transition: opacity 200ms ease;
}
.btn:active::after { opacity: 1; }

/* ── Share — primary orange, prominent ── */
#share-btn {
  background: linear-gradient(135deg, #D4711F 0%, #B8560F 100%);
  color: white;
  border-color: transparent;
  min-height: 48px;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.015em;
  box-shadow:
    0 1px 0 rgba(255,255,255,.15) inset,
    0 3px 12px rgba(196,98,26,.30),
    0 1px 3px rgba(196,98,26,.20);
  width: 100%;
}
#share-btn:hover {
  background: linear-gradient(135deg, #C4621A 0%, #A34F12 100%);
  box-shadow:
    0 1px 0 rgba(255,255,255,.15) inset,
    0 5px 20px rgba(196,98,26,.40),
    0 2px 6px rgba(196,98,26,.25);
  transform: translateY(-1px);
}
#share-btn:active { transform: translateY(0); }

/* ── Copy Order — navy/secondary ── */
#copy-order-btn {
  background: linear-gradient(135deg, #2547C8 0%, #1A38A0 100%);
  color: white;
  border-color: transparent;
  box-shadow:
    0 1px 0 rgba(255,255,255,.12) inset,
    0 2px 8px rgba(30,63,171,.28);
}
#copy-order-btn:hover {
  background: linear-gradient(135deg, #1E3FAB 0%, #162E82 100%);
  box-shadow:
    0 1px 0 rgba(255,255,255,.12) inset,
    0 4px 14px rgba(30,63,171,.36);
  transform: translateY(-1px);
}
#copy-order-btn:active { transform: translateY(0); }

/* ── Copy ── */
#copy-btn {
  background: linear-gradient(135deg, #2547C8 0%, #1A38A0 100%);
  color: white;
  border-color: transparent;
  box-shadow:
    0 1px 0 rgba(255,255,255,.12) inset,
    0 2px 8px rgba(30,63,171,.28);
}
#copy-btn:hover {
  background: linear-gradient(135deg, #1E3FAB 0%, #162E82 100%);
  box-shadow:
    0 1px 0 rgba(255,255,255,.12) inset,
    0 4px 14px rgba(30,63,171,.36);
  transform: translateY(-1px);
}
#copy-btn:active { transform: translateY(0); }

/* ── Print — ghost/outline ── */
#print-btn {
  background: rgba(255,255,255,.7);
  color: var(--c-text-muted);
  border-color: var(--c-border-strong);
  width: 100%;
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 3px rgba(100,40,5,.06);
}
#print-btn:hover {
  background: white;
  color: var(--c-text);
  border-color: var(--c-border-strong);
  box-shadow: 0 2px 8px rgba(100,40,5,.10);
  transform: translateY(-1px);
}
#print-btn:active { transform: translateY(0); }

/* ── Reset — ultra-subtle, destructive hint on hover ── */
#reset-btn {
  background: transparent;
  color: var(--c-text-faint);
  border-color: transparent;
  font-size: 0.75rem;
  font-weight: 500;
  min-height: 34px;
  width: 100%;
  letter-spacing: 0.02em;
  opacity: 0.7;
}
#reset-btn:hover {
  color: #b91c1c;
  background: rgba(185,28,28,.06);
  border-color: rgba(185,28,28,.15);
  opacity: 1;
  transform: none;
}

/* ── Generic variants (used elsewhere) ── */
.btn--secondary {
  background: linear-gradient(135deg, #2547C8 0%, #1A38A0 100%);
  color: white;
  border-color: transparent;
  box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 2px 8px rgba(30,63,171,.28);
}
.btn--secondary:hover {
  background: linear-gradient(135deg, #1E3FAB 0%, #162E82 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 4px 14px rgba(30,63,171,.36);
}

.btn--ghost {
  background: transparent;
  color: var(--c-text-muted);
  border-color: var(--c-border-strong);
}
.btn--ghost:hover {
  background: var(--c-pill-idle);
  color: var(--c-text);
}

/* ── Share button alias ── */
.btn--share {
  background: linear-gradient(135deg, #D4711F 0%, #B8560F 100%);
  color: white;
  border-color: transparent;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 3px 12px rgba(196,98,26,.30);
}
.btn--share:hover {
  background: linear-gradient(135deg, #C4621A 0%, #A34F12 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 5px 20px rgba(196,98,26,.40);
}

/* ── Dark mode buttons ── */
[data-theme="dark"] #share-btn {
  background: linear-gradient(135deg, #C4621A 0%, #A34F12 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.10) inset, 0 3px 12px rgba(0,0,0,.35);
}
[data-theme="dark"] #share-btn:hover {
  background: linear-gradient(135deg, #D4711F 0%, #B8560F 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.10) inset, 0 5px 20px rgba(0,0,0,.4);
}
[data-theme="dark"] #copy-order-btn,
[data-theme="dark"] #copy-btn {
  background: linear-gradient(135deg, #2547C8 0%, #162E82 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 0 2px 10px rgba(0,0,0,.3);
}
[data-theme="dark"] #print-btn {
  background: rgba(42,34,24,.7);
  color: var(--c-text-muted);
  border-color: var(--c-border);
}
[data-theme="dark"] #print-btn:hover {
  background: rgba(58,46,32,.9);
  color: var(--c-text);
}
[data-theme="dark"] #reset-btn:hover {
  background: rgba(185,28,28,.12);
  border-color: rgba(185,28,28,.2);
}
[data-theme="dark"] .btn--share {
  background: linear-gradient(135deg, #C4621A 0%, #A34F12 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.10) inset, 0 3px 12px rgba(0,0,0,.35);
}

/* ─── AD SLOTS ───────────────────────────────────────────── */
/* Empty by default — no whitespace inside divs so :empty is reliable */
.ad-slot {
  display: none;
  margin-block: 0;
}
/* Shows only when AdSense <ins> tag is injected (div is no longer :empty) */
.ad-slot:not(:empty) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;        /* desktop: leaderboard 728×90 */
  background: var(--c-bg);
  border-block: 1px solid var(--c-border);
  margin-block: var(--sp-8);
  contain: layout;         /* CWV: prevent ad reflow causing CLS */
  overflow: hidden;
}
@media (max-width: 767px) {
  .ad-slot:not(:empty) {
    min-height: 50px;      /* mobile: banner 320×50 */
  }
}

/* ─── CONTENT SECTIONS ───────────────────────────────────── */
.content-wrap { padding-top: var(--sp-8); padding-bottom: var(--sp-20); }

/* ─────────────────────────────────────────────────────────
   STICKY TOC BAR  (Topical Authority + UX)
───────────────────────────────────────────────────────── */
.toc-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 90;
  background: rgba(253,248,243,0.95);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid rgba(232,221,210,0.7);
  box-shadow: 0 2px 8px rgba(100,40,5,.05);
}
.toc-bar__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  height: var(--toc-h);
  position: relative;
}
/* Right-fade affordance — signals overflowing links on tablet */
.toc-bar__inner::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 60px;
  background: linear-gradient(to right, transparent, rgba(253,248,243,0.97));
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.25s;
}
.toc-bar--at-end .toc-bar__inner::after { opacity: 0; }
[data-theme="dark"] .toc-bar__inner::after { background: linear-gradient(to right, transparent, rgba(24,18,14,0.97)); }
@media (max-width: 767px) { .toc-bar__inner::after { display: none; } }
.toc-bar__label {
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-text-faint);
  white-space: nowrap;
  flex-shrink: 0;
}
.toc-bar__list {
  display: flex;
  flex-wrap: nowrap;
  gap: 0 var(--sp-4);
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
  min-width: 0;
}
.toc-bar__list::-webkit-scrollbar { display: none; }
.toc-bar__list li { counter-increment: toc; flex-shrink: 0; }
.toc-bar__list a {
  font-size: var(--text-xs);
  color: var(--c-text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0 0 1px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.toc-bar__list a::before {
  content: counter(toc) ".";
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  color: var(--c-primary);
  opacity: 0.6;
  flex-shrink: 0;
}
.toc-bar__list a:hover { color: var(--c-primary); }
.toc-bar__list a.is-active {
  color: var(--c-primary);
  border-bottom-color: var(--c-primary);
  font-weight: var(--fw-semi);
}
.toc-bar__list a.is-active::before { opacity: 1; }
/* mobile toggle — hidden on desktop */
.toc-bar__toggle { display: none; }

/* Dark mode */
[data-theme="dark"] .toc-bar { background: rgba(24,18,14,0.95); border-bottom-color: rgba(255,255,255,.08); }
[data-theme="dark"] .toc-bar__list a { color: rgba(255,255,255,.55); }
[data-theme="dark"] .toc-bar__list a:hover { color: #f5a97c; }
[data-theme="dark"] .toc-bar__list a.is-active { color: #f5a97c; border-bottom-color: #f5a97c; }

/* ── Mobile: slide-down drawer ── */
@media (max-width: 767px) {
  :root { --toc-h: 48px; }
  .toc-bar__inner {
    height: var(--toc-h);
    position: relative;
    overflow: visible;
  }
  .toc-bar__label { display: none; }
  .toc-bar__list {
    position: absolute;
    top: 100%;
    left: calc(-1 * var(--sp-5));
    right: calc(-1 * var(--sp-5));
    flex-direction: column;
    flex-wrap: nowrap;
    background: rgba(253,248,243,0.99);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(232,221,210,0.8);
    box-shadow: 0 10px 28px rgba(100,40,5,.13);
    gap: 0;
    overflow: hidden;
    padding: var(--sp-2) 0;
    /* closed state */
    opacity: 0;
    transform: translateY(-8px);
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s 0.22s;
  }
  .toc-bar.is-open .toc-bar__list {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.22s ease, transform 0.22s ease;
  }
  .toc-bar__list li { flex-shrink: unset; }
  .toc-bar__list a {
    display: flex;
    padding: 11px var(--sp-5);
    border-bottom: none;
    border-left: 3px solid transparent;
    white-space: normal;
  }
  .toc-bar__list a:hover { background: rgba(196,98,26,.05); }
  .toc-bar__list a.is-active {
    border-left-color: var(--c-primary);
    background: rgba(196,98,26,.07);
    border-bottom: none;
  }
  /* show toggle button */
  .toc-bar__toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    background: none;
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    color: var(--c-text-muted);
    font-size: var(--text-sm);
    font-family: var(--font);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    -webkit-tap-highlight-color: transparent;
    text-align: left;
  }
  .toc-bar__toggle:hover,
  .toc-bar__toggle:focus-visible { background: rgba(196,98,26,.06); color: var(--c-primary); border-color: var(--c-primary); outline: none; }
  .toc-bar__toggle-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .toc-bar__chevron { transition: transform 0.22s ease; flex-shrink: 0; }
  .toc-bar.is-open .toc-bar__chevron { transform: rotate(180deg); }
  /* dark mobile */
  [data-theme="dark"] .toc-bar__list { background: rgba(24,18,14,0.99); border-bottom-color: rgba(255,255,255,.08); box-shadow: 0 10px 28px rgba(0,0,0,.35); }
  [data-theme="dark"] .toc-bar__toggle { border-color: rgba(255,255,255,.15); color: rgba(255,255,255,.6); }
  [data-theme="dark"] .toc-bar__list a:hover { background: rgba(245,169,124,.07); }
  [data-theme="dark"] .toc-bar__list a.is-active { border-left-color: #f5a97c; background: rgba(245,169,124,.08); color: #f5a97c; }
}

.content-section { margin-bottom: var(--sp-16); }

.content-section h2 {
  font-family: var(--font);
  font-size: clamp(1.4rem, 4vw, 1.875rem);
  font-weight: var(--fw-extra);
  letter-spacing: -0.03em;
  color: var(--c-text);
  margin-top: var(--sp-2);
  margin-bottom: var(--sp-4);
  padding-left: var(--sp-3);
  border-left: 3px solid var(--c-primary);
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--c-primary-light);
  color: var(--c-primary);
}

.section-intro {
  font-size: var(--text-sm);
  color: var(--c-text-muted);
  margin-bottom: var(--sp-7);
  max-width: 560px;
  line-height: 1.7;
}

/* ─── QUICK ANSWER CARDS ─────────────────────────────────── */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
}

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

@media (min-width: 640px) {
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
}

.quick-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  border-left: 3px solid var(--c-primary-light);
}

.quick-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--c-primary-light);
  border-left-color: var(--c-primary);
  transform: translateY(-2px);
}

.quick-card__group {
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  color: var(--c-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}

.quick-card__count {
  font-family: var(--font);
  font-size: 2.25rem;
  font-weight: 900;
  color: var(--c-primary);
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.quick-card__unit {
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  color: var(--c-text-muted);
  margin-bottom: var(--sp-2);
}

.quick-card__detail {
  font-size: 11px;
  color: var(--c-text-faint);
  border-top: 1px solid var(--c-border);
  padding-top: var(--sp-2);
  margin-top: var(--sp-2);
}

/* ─── REFERENCE TABLE — REDESIGNED ──────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-3);
}

.ref-table {
  font-size: var(--text-sm);
  min-width: 560px;
  border-collapse: collapse;
  width: 100%;
}

.ref-table thead {
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
}

.ref-table th {
  padding: var(--sp-3) var(--sp-5);
  text-align: left;
  font-size: 11px;
  font-weight: var(--fw-semi);
  color: rgba(255,255,255,0.85);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.ref-table th:first-child { border-radius: var(--r-lg) 0 0 0; padding-left: var(--sp-6); }
.ref-table th:last-child  { border-radius: 0 var(--r-lg) 0 0; }

.ref-table td {
  padding: var(--sp-3) var(--sp-5);
  color: var(--c-text);
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
  line-height: 1.4;
}

.ref-table td:first-child { padding-left: var(--sp-6); }

.ref-table tbody tr:last-child td { border-bottom: none; }

.ref-table tbody tr:hover td {
  background: var(--c-surface-tint);
  transition: background var(--t-fast);
}

.ref-table .row--highlight td {
  background: rgba(196,98,26,.05);
}

.ref-table .row--highlight:hover td {
  background: rgba(196,98,26,.09);
}

/* Size dot visuals */
.table-size-cell {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.table-size-dot {
  display: inline-block;
  border-radius: 50%;
  background: var(--c-primary-light);
  border: 2px solid var(--c-primary);
  flex-shrink: 0;
}
.table-size-dot--sm    { width: 10px; height: 10px; opacity: 0.5; }
.table-size-dot--md    { width: 14px; height: 14px; opacity: 0.65; }
.table-size-dot--lg    { width: 18px; height: 18px; opacity: 1; background: var(--c-primary); border-color: var(--c-primary-dark); }
.table-size-dot--xl    { width: 22px; height: 22px; opacity: 0.75; }
.table-size-dot--party { width: 26px; height: 26px; opacity: 0.6; }

/* Best value badge */
.table-best-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--c-primary);
  color: white;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* Diameter display */
.table-dim {
  font-weight: var(--fw-semi);
  color: var(--c-text-muted);
  font-size: var(--text-sm);
}

/* Slice count */
.table-slices {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: var(--fw-medium);
  color: var(--c-text-muted);
}

.table-slices--highlight {
  color: var(--c-primary);
  font-weight: var(--fw-semi);
}

/* Value bar (visual representation of cost-per-slice value) */
.table-value-bar {
  display: inline-block;
  width: 80px;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--c-border);
  overflow: hidden;
  vertical-align: middle;
}

.table-value-bar span {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: linear-gradient(to right, var(--c-primary-light), var(--c-primary));
  transition: width var(--t-base);
}

.row--highlight .table-value-bar span {
  background: linear-gradient(to right, var(--c-primary-light), var(--c-primary));
}

.table-note {
  font-size: var(--text-xs);
  color: var(--c-text-faint);
  padding-left: var(--sp-1);
  line-height: 1.6;
}

/* ─── DARK MODE: input-desc ──────────────────────────────── */
[data-theme="dark"] .input-desc { color: var(--c-text-faint); }

/* ─── DARK MODE: Redesigned table ───────────────────────── */
[data-theme="dark"] .ref-table thead { background: linear-gradient(135deg, #8B4513 0%, #6B3410 100%); }
[data-theme="dark"] .ref-table tbody tr:hover td { background: #231C13; }
[data-theme="dark"] .ref-table .row--highlight td { background: rgba(196,98,26,.10); }
[data-theme="dark"] .ref-table .row--highlight:hover td { background: rgba(196,98,26,.16); }
[data-theme="dark"] .table-size-dot { background: rgba(196,98,26,.25); border-color: var(--c-primary); }
[data-theme="dark"] .table-size-dot--lg { background: var(--c-primary); }
[data-theme="dark"] .table-value-bar { background: #2A2218; }

/* ─── GUIDE CARDS (APPETITE) ─────────────────────────────── */
.guide-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

@media (min-width: 480px) {
  .guide-grid { grid-template-columns: repeat(2, 1fr); }
}

.guide-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-xs);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.guide-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.guide-card__badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px var(--sp-3);
  border-radius: var(--r-pill);
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  margin-bottom: var(--sp-3);
}

.guide-card__badge--light   { background: #E8F5E9; color: #2E7D32; }
.guide-card__badge--avg     { background: var(--c-primary-light); color: var(--c-primary-dark); }
.guide-card__badge--hungry  { background: #FFF3E0; color: #E65100; }
.guide-card__badge--vhungry { background: #FCE4EC; color: #B71C1C; }

.guide-card__slices {
  font-family: var(--font);
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--c-text);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: var(--sp-3);
}

.guide-card p {
  font-size: var(--text-sm);
  color: var(--c-text-muted);
  line-height: 1.65;
}

.tip-box {
  background: var(--c-secondary-light);
  border: 1px solid rgba(30,63,171,.15);
  border-left: 3px solid var(--c-secondary);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5);
  font-size: var(--text-sm);
  color: var(--c-secondary-dark);
  line-height: 1.6;
}

/* ─── EVENT LIST ─────────────────────────────────────────── */
.event-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.event-item {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-xs);
  transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
}

.event-item:hover {
  transform: translateX(3px);
  box-shadow: var(--shadow-sm);
  border-color: var(--c-border-strong);
}

.event-item__header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}

.event-item__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--c-primary-light);
  color: var(--c-primary);
  flex-shrink: 0;
}

.event-item__name {
  font-size: var(--text-base);
  font-weight: var(--fw-semi);
  color: var(--c-text);
}

.event-item__badge {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  padding: 2px var(--sp-2);
  border-radius: var(--r-sm);
}

.event-item__badge--add    { background: #E8F5E9; color: #2E7D32; }
.event-item__badge--reduce { background: #FFF3E0; color: #E65100; }
.event-item__badge--neutral { background: var(--c-bg); color: var(--c-text-muted); border: 1px solid var(--c-border); }

.event-item p {
  font-size: var(--text-sm);
  color: var(--c-text-muted);
  line-height: 1.6;
}

/* ─── FAQ ────────────────────────────────────────────────── */
.faq-list {
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.faq-item {
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
}

.faq-item:last-child { border-bottom: none; }

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  color: var(--c-text);
  cursor: pointer;
  list-style: none;
  transition: background var(--t-fast), color var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}

.faq-question::-webkit-details-marker { display: none; }
.faq-question::marker { display: none; }

.faq-question::after {
  content: '';
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B5744' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transition: transform var(--t-base);
}

.faq-item[open] > .faq-question::after { transform: rotate(180deg); }

.faq-item[open] > .faq-question {
  color: var(--c-primary);
  background: rgba(196,98,26,.03);
}

.faq-item[open] > .faq-question::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23C4621A' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

.faq-question:hover {
  background: var(--c-bg);
  color: var(--c-primary);
}

.faq-answer {
  padding: 0 var(--sp-5) var(--sp-4);
  background: var(--c-bg);
}

.faq-answer p {
  font-size: var(--text-sm);
  color: var(--c-text-muted);
  line-height: 1.7;
}

/* ─── PLANNING TIPS ──────────────────────────────────────── */
.tips-list {
  list-style: none;
  counter-reset: tips;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
}

@media (min-width: 640px) {
  .tips-list { grid-template-columns: repeat(2, 1fr); }
}

.tips-list li {
  counter-increment: tips;
  display: flex;
  gap: var(--sp-4);
  align-items: flex-start;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-xs);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.tips-list li:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* Number badge */
.tips-list li::before {
  content: counter(tips);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: var(--c-primary);
  color: white;
  border-radius: 50%;
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  margin-top: 2px;
}

/* Text column: title stacked above body */
.tip-content {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  flex: 1;
  min-width: 0;
}

.tip-title {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  color: var(--c-text);
  line-height: 1.4;
}

.tip-body {
  display: block;
  font-size: var(--text-sm);
  color: var(--c-text-muted);
  line-height: 1.65;
}

/* ─── FOOTER ─────────────────────────────────────────────── */
.site-footer {
  background: #0D0A06;
  color: rgba(255,255,255,.5);
  padding-block: var(--sp-16) 0;
  border-top: 1px solid rgba(255,255,255,.06);
  position: relative;
  overflow: hidden;
}

/* Subtle warm glow behind brand column */
.site-footer::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 480px; height: 320px;
  background: radial-gradient(ellipse at 0% 0%, rgba(196,98,26,.07) 0%, transparent 70%);
  pointer-events: none;
}

/* Grid layout */
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-10);
  margin-bottom: var(--sp-12);
  position: relative;
}

@media (min-width: 560px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-8) var(--sp-6);
  }
  .footer-brand { grid-column: 1 / -1; }
}

@media (min-width: 900px) {
  .footer-grid {
    grid-template-columns: 1.9fr 1fr 1fr 1fr 1.3fr;
    gap: var(--sp-8);
    align-items: start;
  }
  .footer-brand { grid-column: auto; }
}

/* Brand / Bio */
.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 800;
  color: white;
  margin-bottom: var(--sp-4);
  letter-spacing: -0.025em;
}

.footer-logo svg { flex-shrink: 0; }

.footer-bio {
  font-size: 0.8125rem;
  color: rgba(255,255,255,.38);
  line-height: 1.8;
  max-width: 300px;
  margin-bottom: var(--sp-5);
}

/* Mini badge in footer brand */
.footer-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: rgba(196,98,26,.12);
  border: 1px solid rgba(196,98,26,.2);
  border-radius: var(--r-pill);
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(196,98,26,.8);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Nav columns */
.footer-col__title {
  font-size: 10px;
  font-weight: 800;
  color: rgba(255,255,255,.25);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  margin-bottom: var(--sp-4);
}

.footer-col__desc {
  font-size: 0.78rem;
  color: rgba(255,255,255,.3);
  line-height: 1.65;
  margin-bottom: var(--sp-4);
  max-width: 200px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: rgba(255,255,255,.45);
  text-decoration: none;
  padding: 5px 0;
  border-radius: 4px;
  transition: color 0.15s;
  position: relative;
}

.footer-links a:hover {
  color: rgba(255,255,255,.9);
}

/* Contact email */
.footer-links a svg {
  flex-shrink: 0;
  opacity: 0.55;
  transition: opacity 0.15s;
}
.footer-links a:hover svg { opacity: 1; }

.footer-links a.email-link {
  color: rgba(196,98,26,.75);
  font-weight: 500;
}
.footer-links a.email-link:hover { color: #F4AC70; }

/* Divider */
.footer-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255,255,255,.07) 20%, rgba(255,255,255,.07) 80%, transparent);
  margin-bottom: 0;
}

/* Bottom bar */
.footer-bottom {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  align-items: center;
  text-align: center;
  padding: var(--sp-5) 0 var(--sp-6);
}

@media (min-width: 640px) {
  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

.footer-copy {
  font-size: 0.75rem;
  color: rgba(255,255,255,.22);
  line-height: 1.6;
}

.footer-copy a {
  color: rgba(255,255,255,.38);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-copy a:hover { color: rgba(255,255,255,.7); }


/* ─── RESPONSIVE ADJUSTMENTS ─────────────────────────────── */
@media (max-width: 380px) {
  .stat-value { font-size: var(--text-base); }
  .output-number { font-size: 3.5rem; }
  .pill__label { font-size: 12px; }
  .pill { padding: var(--sp-2) var(--sp-3); min-height: 40px; }
}

@media (min-width: 640px) {
  .calc-section { padding-block: var(--sp-16) var(--sp-12); }
  .input-group { padding: 0 var(--sp-8) var(--sp-7); }
  .input-label { padding-top: 26px; padding-bottom: 16px; }
  .calc-output { padding: var(--sp-8); }
}

/* ═══════════════════════════════════════════════════════════
   DARK MODE TOKENS
   ═══════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  --c-bg:             #120E08;
  --c-surface:        #1D1710;
  --c-surface-tint:   #231C13;
  --c-border:         #2D2419;
  --c-border-strong:  #3E3225;
  --c-text:           #F4EDE2;
  --c-text-muted:     #B89E87;
  --c-text-faint:     #7A6452;
  --c-pill-idle:      #2A2218;
  --c-primary-light:  #3B2410;
  --c-secondary-light:#0B1638;
  --shadow-xs:  0 1px 2px rgba(0,0,0,.3);
  --shadow-sm:  0 2px 6px rgba(0,0,0,.35);
  --shadow-md:  0 4px 16px rgba(0,0,0,.4);
  --shadow-card:0 2px 12px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.25);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.45);
}

/* ─── DARK MODE: Hero gradient ─── */
[data-theme="dark"] .calc-section {
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(196,98,26,.10) 0%, transparent 65%),
    #120E08;
}

/* ─── DARK MODE: Output panel ─── */
[data-theme="dark"] .calc-card { background: #241A0F; }
[data-theme="dark"] .calc-inputs { background: #1D1710; }
[data-theme="dark"] .calc-output {
  background: linear-gradient(170deg, #241A0F 0%, #1E1609 60%, #180F05 100%);
  border-left-color: rgba(196,98,26,.15);
}

/* ─── DARK MODE: Output pizza icon ─── */
[data-theme="dark"] .output-pizza-icon {
  background: radial-gradient(circle at 38% 38%, rgba(196,98,26,.55), rgba(140,60,10,.3));
  box-shadow: 0 0 0 8px rgba(196,98,26,.06), 0 4px 18px rgba(0,0,0,.35);
  color: #F4AC70;
}

/* ─── DARK MODE: Stat items ─── */
[data-theme="dark"] .stat-item {
  background: rgba(42,34,24,0.8);
  border-color: rgba(255,255,255,.05);
}
[data-theme="dark"] .stat-item:last-child {
  background: linear-gradient(135deg, #0B1638 0%, rgba(30,63,171,.08) 100%);
  border-color: rgba(30,63,171,.2);
}

/* ─── DARK MODE: Recommendation box ─── */
[data-theme="dark"] .output-recommendation {
  background: rgba(42,34,24,0.8);
  border-color: rgba(196,98,26,.2);
  color: var(--c-text-muted);
}
[data-theme="dark"] .output-recommendation strong { color: var(--c-text); }

/* ─── DARK MODE: Output text ─── */
[data-theme="dark"] .output-label { color: rgba(196,98,26,.8); }
[data-theme="dark"] .output-size-label { color: var(--c-text-muted); }
[data-theme="dark"] .stat-value { color: var(--c-text); }
[data-theme="dark"] .stat-label { color: var(--c-text-faint); }
[data-theme="dark"] .stat-item { background: rgba(42,34,24,0.85); border-color: rgba(255,255,255,.05); }
[data-theme="dark"] .stat-item:last-child {
  background: linear-gradient(135deg, rgba(30,63,171,.2) 0%, rgba(30,63,171,.1) 100%);
  border-color: rgba(30,63,171,.3);
}
[data-theme="dark"] .stat-item:last-child .stat-value { color: #9EB3F0; }
[data-theme="dark"] .stat-item:last-child .stat-label { color: #7B96D9; }

/* ─── DARK MODE: Kids split ─── */
[data-theme="dark"] .split-label { color: var(--c-text-muted); }
[data-theme="dark"] .split-hint { color: var(--c-text-faint); }
[data-theme="dark"] .split-plus { color: var(--c-text-faint); }
[data-theme="dark"] .kids-toggle-label { color: var(--c-text-muted); }

/* ─── DARK MODE: FAQ ─── */
[data-theme="dark"] .faq-list { background: #1D1710; }
[data-theme="dark"] .faq-answer { background: #231C13; }
[data-theme="dark"] .faq-item[open] > .faq-question { background: rgba(196,98,26,.06); }
[data-theme="dark"] .faq-question:hover { background: #231C13; }

/* ─── DARK MODE: Cards ─── */
[data-theme="dark"] .quick-card,
[data-theme="dark"] .guide-card,
[data-theme="dark"] .event-item,
[data-theme="dark"] .tips-list li { background: #1D1710; }

[data-theme="dark"] .quick-card { border-left-color: rgba(196,98,26,.3); }

/* ─── DARK MODE: Section & Event icons ─── */
[data-theme="dark"] .section-icon,
[data-theme="dark"] .event-item__icon {
  background: rgba(196,98,26,.18);
  color: #F4AC70;
}

/* ─── DARK MODE: Pills ─── */
[data-theme="dark"] .pill {
  background: #2A2218;
  border-color: #3A2E20;
}
[data-theme="dark"] .pill:hover {
  background: #3B2410;
  color: #F4AC70;
  border-color: rgba(196,98,26,.4);
}

/* ─── DARK MODE: Toggle switch track ─── */
[data-theme="dark"] .toggle-switch { background: #2A2218; }

/* ─── DARK MODE: Number input ─── */
[data-theme="dark"] .number-input { background: #2A2218; border-color: var(--c-border); color: var(--c-primary); }

/* ─── DARK MODE: Pro tip ─── */
[data-theme="dark"] .pro-tip { background: #1A1A2E; border-color: rgba(30,63,171,.3); }
[data-theme="dark"] .pro-tip__text { color: #9EB3F0; }

/* ─── DARK MODE: Footer ─── */
[data-theme="dark"] .site-footer { background: #0A0806; }

/* ─── DARK MODE: Range slider ─── */
[data-theme="dark"] .range-slider {
  background: linear-gradient(
    to right,
    var(--c-primary) var(--fill-pct, 9.09%),
    #2A2218 var(--fill-pct, 9.09%)
  );
}

/* ─── DARK MODE: Label icons ─── */
[data-theme="dark"] .label-icon {
  background: rgba(196,98,26,.18);
  color: #F4AC70;
}
[data-theme="dark"] .input-group { background: #1D1710; }
[data-theme="dark"] .input-group:focus-within { background: rgba(196,98,26,.04); }
[data-theme="dark"] .input-group:focus-within .label-icon {
  background: var(--c-primary);
  color: white;
}

/* ─── DARK MODE: Fine-tune divider ─── */
[data-theme="dark"] .input-divider { background: #120E08; }

/* ─── DARK MODE: Tip box ─── */
[data-theme="dark"] .tip-box {
  background: #0B1638;
  border-color: rgba(30,63,171,.3);
  color: #9EB3F0;
}

/* ─── DARK MODE: Hardcoded badge colors override ─── */
[data-theme="dark"] .guide-card__badge--light   { background: #0D2B12; color: #81C784; }
[data-theme="dark"] .guide-card__badge--avg     { background: #3B2410; color: #F4AC70; }
[data-theme="dark"] .guide-card__badge--hungry  { background: #2D1A00; color: #FFB74D; }
[data-theme="dark"] .guide-card__badge--vhungry { background: #2A0A10; color: #EF9A9A; }

[data-theme="dark"] .event-item__badge--add    { background: #0D2B12; color: #81C784; }
[data-theme="dark"] .event-item__badge--reduce { background: #2D1A00; color: #FFB74D; }

/* ─── DARK MODE: Content section prose ─── */
[data-theme="dark"] .content-section p,
[data-theme="dark"] .content-section li,
[data-theme="dark"] .guide-card p,
[data-theme="dark"] .event-item p { color: var(--c-text-muted); }
[data-theme="dark"] .section-intro { color: var(--c-text-muted); }
[data-theme="dark"] .input-desc { color: var(--c-text-faint); }

/* ─── DARK MODE: Table ─── */
[data-theme="dark"] .ref-table thead { background: linear-gradient(135deg, #6B3410 0%, #4E2208 100%); }
[data-theme="dark"] .ref-table tbody tr:hover td { background: #231C13; }
[data-theme="dark"] .ref-table .row--highlight td { background: rgba(196,98,26,.10); }
[data-theme="dark"] .ref-table .row--highlight:hover td { background: rgba(196,98,26,.16); }
[data-theme="dark"] .table-size-dot { background: rgba(196,98,26,.25); border-color: var(--c-primary); }
[data-theme="dark"] .table-size-dot--lg { background: var(--c-primary); }
[data-theme="dark"] .table-value-bar { background: #2A2218; }
[data-theme="dark"] .calc-card { border-color: var(--c-border); box-shadow: 0 8px 40px rgba(0,0,0,.4); }

/* Quick cards — subtle orange left border */
.quick-card {
  border-left: 3px solid var(--c-primary-light);
}
.quick-card:hover {
  border-left-color: var(--c-primary);
}

/* ═══════════════════════════════════════════════════════════
   DARK MODE TOGGLE BUTTON
   ═══════════════════════════════════════════════════════════ */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--c-border);
  background: transparent;
  color: var(--c-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.theme-toggle:hover {
  background: var(--c-pill-idle);
  color: var(--c-primary);
  border-color: var(--c-primary-light);
}

.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle { border-color: var(--c-border); color: var(--c-text-muted); }

/* ═══════════════════════════════════════════════════════════
   PRO TIP CARD
   ═══════════════════════════════════════════════════════════ */
.pro-tip {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  background: var(--c-secondary-light);
  border: 1px solid rgba(30,63,171,.14);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  animation: fadeSlideIn var(--t-base) ease;
}
.pro-tip[hidden] { display: none; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pro-tip__icon {
  font-size: 1rem;
  line-height: 1.5;
  flex-shrink: 0;
}
.pro-tip__text {
  font-size: var(--text-xs);
  color: var(--c-secondary-dark);
  line-height: 1.6;
  font-weight: var(--fw-medium);
}

/* ═══════════════════════════════════════════════════════════
   SHARE BUTTON
   ═══════════════════════════════════════════════════════════ */
.btn--share {
  background: var(--c-primary);
  color: white;
  border-color: var(--c-primary);
  justify-content: center;
  font-weight: var(--fw-bold);
}
.btn--share:hover {
  background: var(--c-primary-dark);
  border-color: var(--c-primary-dark);
  box-shadow: 0 4px 12px rgba(196,98,26,.35);
}
[data-theme="dark"] .btn--share {
  background: var(--c-primary);
  border-color: var(--c-primary);
}

/* ═══════════════════════════════════════════════════════════
   PWA INSTALL BANNER
   ═══════════════════════════════════════════════════════════ */
.pwa-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
  color: white;
  padding: var(--sp-3) var(--sp-6);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
}
.pwa-banner[hidden] { display: none; }
.pwa-banner__text { flex: 1; }
.pwa-banner__actions { display: flex; gap: var(--sp-2); align-items: center; }
.pwa-banner__install {
  padding: var(--sp-1) var(--sp-4);
  background: white;
  color: var(--c-primary-dark);
  font-weight: var(--fw-bold);
  font-size: var(--text-xs);
  border-radius: var(--r-pill);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  transition: opacity var(--t-fast);
}
.pwa-banner__install:hover { opacity: 0.9; }
.pwa-banner__dismiss {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.7);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 var(--sp-1);
}
.pwa-banner__dismiss:hover { color: white; }

/* ═══════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════════ */
@media print {
  .site-header, .calc-inputs, .ad-slot, .content-wrap,
  .site-footer, .output-actions, .pwa-banner,
  .calc-hero p, .theme-toggle { display: none !important; }

  .calc-section { padding: 0; }
  .calc-card {
    display: block;
    box-shadow: none;
    border: 1px solid #ccc;
  }
  .calc-output {
    background: white !important;
    padding: 20px;
  }
  .calc-hero h1 { font-size: 24pt; }
  .output-number { font-size: 48pt; color: #C4621A !important; }
  body { background: white; }
}

/* ═══════════════════════════════════════════════════════════
   TRANSITION: smooth theme switch
   ═══════════════════════════════════════════════════════════ */
html { transition: background-color var(--t-base), color var(--t-base); }

/* ═══════════════════════════════════════════════════════════
   ENTRY ANIMATIONS
   ═══════════════════════════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes countPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.calc-hero { animation: fadeUp 0.5s ease both; }
.calc-card  { animation: fadeUp 0.5s 0.1s ease both; }

.output-number {
  display: block;
  transition: color var(--t-fast), transform var(--t-base);
}
.output-number.updated {
  animation: countPop 0.3s ease;
}

/* ═══════════════════════════════════════════════════════════
   INPUT-DESC ICON PILL
   ═══════════════════════════════════════════════════════════ */
.input-desc {
  font-size: var(--text-xs);
  color: var(--c-text-faint);
  line-height: 1.6;
  margin-bottom: var(--sp-5);
  margin-top: 0;
  display: flex;
  align-items: flex-start;
  gap: 5px;
}
.input-desc::before {
  content: '→';
  color: var(--c-primary);
  opacity: 0.45;
  font-size: 11px;
  line-height: 1.7;
  flex-shrink: 0;
}
[data-theme="dark"] .input-desc { color: var(--c-text-faint); }

/* ═══════════════════════════════════════════════════════════
   PRESETS BAR
   ═══════════════════════════════════════════════════════════ */
.presets-bar {
  border: 1px dashed var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
  background: rgba(196,98,26,.04);
}

.presets-bar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  cursor: pointer;
  user-select: none;
}

.presets-bar__title {
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  color: var(--c-text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Chevron indicator for collapsed/expanded state */
.presets-bar__title::after {
  content: '▸';
  font-size: 10px;
  transition: transform var(--t-fast);
  display: inline-block;
}
.presets-bar.is-open .presets-bar__title::after {
  transform: rotate(90deg);
}

.presets-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--t-base), margin-top var(--t-fast);
}
.presets-bar.is-open .presets-list {
  max-height: 200px;
  margin-top: var(--sp-2);
}

.presets-empty {
  font-size: 12px;
  color: var(--c-text-faint);
  font-style: italic;
}

.preset-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--c-border-strong);
  border-radius: 20px;
  overflow: hidden;
  background: var(--c-surface);
}

.preset-chip__load {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: var(--fw-semi);
  font-family: var(--font);
  cursor: pointer;
  background: transparent;
  color: var(--c-text);
  border: none;
  transition: background var(--t-fast), color var(--t-fast);
  line-height: 1.4;
}

.preset-chip__load:hover {
  background: var(--c-primary);
  color: #fff;
}

.preset-chip__del {
  padding: 4px 8px;
  font-size: 15px;
  background: transparent;
  border: none;
  border-left: 1px solid var(--c-border);
  color: var(--c-text-faint);
  cursor: pointer;
  font-family: var(--font);
  line-height: 1;
  transition: background var(--t-fast), color var(--t-fast);
}

.preset-chip__del:hover {
  background: #fff0f0;
  color: #c00;
}

.btn--xs {
  font-size: 11px;
  padding: 4px 10px;
  min-height: 28px;
  font-family: var(--font);
}

/* ═══════════════════════════════════════════════════════════
   CUSTOM SLICES ROW
   ═══════════════════════════════════════════════════════════ */
.custom-slices-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-top: var(--sp-4);
  padding: 12px 16px;
  background: rgba(196,98,26,.04);
  border: 1px dashed rgba(196,98,26,.2);
  border-radius: var(--r-md);
}

.custom-slices-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  color: var(--c-text-muted);
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.custom-slices-label svg {
  flex-shrink: 0;
  color: var(--c-primary);
  opacity: 0.7;
}

.custom-slices-label__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.custom-slices-label__sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--c-text-faint);
  line-height: 1.4;
}

/* Right-side: optional badge + input stacked/inline */
.custom-slices-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.custom-slices-label .input-hint,
.custom-slices-control .input-hint {
  font-size: 11px;
  font-weight: 500;
  color: var(--c-text-faint);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-pill);
  padding: 2px 9px;
  white-space: nowrap;
}

.number-input--xs {
  width: 60px;
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  padding: 7px 8px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--c-border-strong);
  text-align: center;
  background: var(--c-surface);
  color: var(--c-text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  -moz-appearance: textfield;
}
.number-input--xs::-webkit-inner-spin-button,
.number-input--xs::-webkit-outer-spin-button { -webkit-appearance: none; }
.number-input--xs:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(196,98,26,.12);
}

[data-theme="dark"] .custom-slices-row {
  background: rgba(196,98,26,.06);
  border-color: rgba(196,98,26,.15);
}
[data-theme="dark"] .custom-slices-control .input-hint {
  background: #1D1710;
  border-color: var(--c-border);
}
[data-theme="dark"] .number-input--xs {
  background: #2A2218;
  border-color: var(--c-border);
  color: var(--c-text);
}

/* ═══════════════════════════════════════════════════════════
   PRICE PER PIZZA INPUT
   ═══════════════════════════════════════════════════════════ */
.price-input-wrap {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--c-surface);
  width: 100%;
  max-width: 220px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.price-input-wrap:focus-within {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(196,98,26,.12);
}

.price-currency {
  padding: 0 var(--sp-3);
  color: var(--c-text-muted);
  font-weight: var(--fw-semi);
  font-size: var(--text-sm);
  background: rgba(0,0,0,.04);
  border-right: 1px solid var(--c-border);
  align-self: stretch;
  display: flex;
  align-items: center;
}

.price-input-wrap .number-input {
  border: none;
  border-radius: 0;
  box-shadow: none;
  flex: 1;
  min-width: 0;
  font-size: var(--text-sm);
  padding: 10px 12px;
}

.price-input-wrap .number-input:focus {
  box-shadow: none;
}

.price-input-wrap .number-input::placeholder {
  font-size: var(--text-sm);
  color: var(--c-text-faint);
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════
   DIETARY NEEDS  (input panel)
   ═══════════════════════════════════════════════════════════ */
.dietary-row {
  display: flex;
  gap: var(--sp-6);
  flex-wrap: wrap;
}

.dietary-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.dietary-label {
  font-size: 12px;
  font-weight: var(--fw-semi);
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* ═══════════════════════════════════════════════════════════
   DIETARY SUGGESTION  (output panel)
   ═══════════════════════════════════════════════════════════ */
.dietary-suggestion {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  background: rgba(45,107,10,.06);
  border: 1px solid rgba(45,107,10,.18);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  color: #2d6b0a;
  line-height: 1.5;
}
.dietary-suggestion[hidden] { display: none !important; }

.dietary-suggestion svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: #3a8010;
}

.dietary-suggestion p { margin: 0; }

/* ═══════════════════════════════════════════════════════════
   TAX & TIP SECTION  (output panel)
   ═══════════════════════════════════════════════════════════ */
.tax-tip-section {
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  background: rgba(255,255,255,.65);
  backdrop-filter: blur(4px);
}

.tax-tip-section__label {
  font-size: 11px;
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-text-muted);
  margin: 0 0 var(--sp-2);
}

.tax-tip-inputs {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-2);
}

.tax-tip-field {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  color: var(--c-text-muted);
}

.tax-tip-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tax-tip-unit {
  font-size: 12px;
  color: var(--c-text-faint);
}

.tax-tip-sep {
  color: var(--c-text-faint);
  font-size: var(--text-sm);
}

.tax-tip-total {
  font-size: var(--text-md);
  font-weight: var(--fw-bold);
  color: var(--c-text);
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════
   5TH STAT — total with tax+tip
   Hidden until user enters a pizza price. Animates in.
   ═══════════════════════════════════════════════════════════ */

/* The hidden attribute handles display:none — we animate the REVEAL */
#stat-total-item {
  transition: none; /* no transition when hidden */
}

#stat-total-item:not([hidden]) {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  text-align: left;
  background: linear-gradient(135deg,
    rgba(30,63,171,.08) 0%,
    rgba(30,63,171,.04) 100%
  );
  border: 1px solid rgba(30,63,171,.18);
  border-left: 3px solid var(--c-secondary);
  border-radius: var(--r-md);
  box-shadow: 0 1px 4px rgba(30,63,171,.08);
  /* Slide-in animation when it appears */
  animation: statTotalReveal 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes statTotalReveal {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#stat-total-item:not([hidden]) .stat-icon {
  margin: 0;
  color: var(--c-secondary);
  opacity: 0.8;
  flex-shrink: 0;
}

#stat-total-item:not([hidden]) .stat-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--c-secondary);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

#stat-total-item:not([hidden]) .stat-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(30,63,171,.6);
  margin-top: 2px;
}

/* Left side: icon + label stacked */
#stat-total-item:not([hidden]) > *:first-child {
  margin-right: auto;
}

[data-theme="dark"] #stat-total-item:not([hidden]) {
  background: linear-gradient(135deg,
    rgba(30,63,171,.18) 0%,
    rgba(30,63,171,.10) 100%
  );
  border-color: rgba(30,63,171,.3);
  border-left-color: #7B96D9;
}
[data-theme="dark"] #stat-total-item:not([hidden]) .stat-value { color: #9EB3F0; }
[data-theme="dark"] #stat-total-item:not([hidden]) .stat-label { color: rgba(155,179,240,.6); }
[data-theme="dark"] #stat-total-item:not([hidden]) .stat-icon { color: #7B96D9; }

/* ═══════════════════════════════════════════════════════════
   VARIETY CHIP COST
   ═══════════════════════════════════════════════════════════ */
.variety-chip__cost {
  font-size: 11px;
  font-weight: var(--fw-semi);
  color: var(--c-text-muted);
  margin-left: var(--sp-2);
  background: rgba(0,0,0,.05);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════
   DARK MODE — new components
   ═══════════════════════════════════════════════════════════ */
[data-theme="dark"] .presets-bar {
  background: rgba(196,98,26,.08);
  border-color: rgba(255,255,255,.1);
}

[data-theme="dark"] .preset-chip {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.15);
}

[data-theme="dark"] .preset-chip__load { color: var(--c-text); }

[data-theme="dark"] .preset-chip__del:hover {
  background: rgba(200,0,0,.2);
  color: #ff8080;
}

[data-theme="dark"] .price-input-wrap {
  background: var(--c-surface);
  border-color: rgba(255,255,255,.15);
}

[data-theme="dark"] .price-currency {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.1);
}

[data-theme="dark"] .tax-tip-section {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.12);
}

[data-theme="dark"] .dietary-suggestion {
  background: rgba(100,180,60,.1);
  border-color: rgba(100,180,60,.22);
  color: #8cca5c;
}

[data-theme="dark"] .dietary-suggestion svg { color: #8cca5c; }

[data-theme="dark"] .variety-chip__cost {
  background: rgba(255,255,255,.08);
  color: var(--c-text-muted);
}

/* ═══════════════════════════════════════════════════════════
   PRINT LAYOUT
   ═══════════════════════════════════════════════════════════ */
@media print {
  .site-header,
  .calc-hero,
  .pwa-banner,
  .calc-inputs,
  .output-actions,
  #pro-tip,
  .content-wrap,
  .site-footer,
  .ad-slot,
  .presets-bar { display: none !important; }

  body { background: #fff !important; }

  .calc-section { padding: 0 !important; }

  .calc-card {
    display: block !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
  }

  .calc-output {
    border: none !important;
    background: #fff !important;
    padding: 16px !important;
    color: #000 !important;
    min-height: unset !important;
  }

  .calc-section::before {
    content: 'Pizza Order Summary — pizzacalculator.pro';
    display: block;
    font-size: 18px;
    font-weight: 700;
    font-family: sans-serif;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #333;
  }

  .output-number { color: #000 !important; font-size: 48px !important; }
  .output-pizza-icon { display: none !important; }
  .stat-value { color: #000 !important; }
  .stat-item {
    background: #f5f5f5 !important;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
  .output-recommendation {
    font-size: 13px;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 4px;
  }
  .variety-chip {
    border: 1px solid #ccc !important;
    padding: 4px 8px;
    margin: 2px;
    display: inline-block;
  }
  .dietary-suggestion {
    border: 1px solid #b0d4a0 !important;
    background: #f0f8ec !important;
    color: #2d6b0a !important;
  }
  .tax-tip-section {
    border: 1px solid #ccc !important;
    background: #fafafa !important;
  }
  .tax-tip-total { font-size: 15px; font-weight: 700; }
}

/* ═══════════════════════════════════════════════════════════
   CORE WEB VITALS — RENDERING PERFORMANCE
   ═══════════════════════════════════════════════════════════ */

/* content-visibility: auto skips rendering off-screen sections,
   improving LCP and INP on long pages */
.content-wrap {
  content-visibility: auto;
  contain-intrinsic-size: auto 2000px;
}
.site-footer {
  content-visibility: auto;
  contain-intrinsic-size: auto 300px;
}

/* touch-action: manipulation removes 300ms tap delay on mobile
   across all interactive elements */
.btn,
.stepper__btn,
.pill,
.variety-card,
.theme-toggle,
.pwa-banner__install,
.preset-chip__load,
.preset-chip__del,
.presets-bar__header {
  touch-action: manipulation;
}

/* Ensure number inputs don't zoom on iOS (16px minimum) */
input[type="number"],
input[type="text"] {
  font-size: max(16px, 1em);
}

/* Override for inputs already using specific sizes inside compact widgets */
.price-input-wrap .number-input,
.number-input--xs,
.tax-tip-input-wrap input {
  font-size: var(--text-sm);
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — TABLET BREAKPOINT (768px–1024px)
   ═══════════════════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1023px) {
  :root { --max-w: 100%; }

  .calc-card {
    grid-template-columns: 1fr 340px;
  }

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

  .stat-value { font-size: var(--text-base); }

  .output-actions {
    grid-template-columns: 1fr;
  }
  #share-btn, #reset-btn { grid-column: 1 / -1; }
  #copy-order-btn, #copy-btn, #print-btn { grid-column: 1 / -1; }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE TWEAKS
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  /* Stats: compact 2-col on narrow output panel */
  .output-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-1);
  }
  .stat-item { padding: var(--sp-2) var(--sp-3); }
  .stat-value { font-size: var(--text-base); }

  /* Price input: full-width on mobile */
  .price-input-wrap { max-width: 100%; }

  /* Action buttons: stack on mobile */
  .output-actions {
    grid-template-columns: 1fr;
  }
  #share-btn, #copy-order-btn, #copy-btn, #print-btn, #reset-btn {
    grid-column: 1 / -1;
  }
  /* Copy Order + Copy side-by-side on medium phones */
  @media (min-width: 400px) {
    .output-actions { grid-template-columns: 1fr 1fr; }
    #share-btn  { grid-column: 1 / -1; }
    #reset-btn  { grid-column: 1 / -1; }
    #print-btn  { grid-column: 1 / -1; }
  }

  /* Dietary row wraps more naturally */
  .dietary-row { gap: var(--sp-4); }

  /* Reduce label padding on very small screens */
  .input-label { padding-top: 16px; padding-bottom: 10px; }
  .input-group { padding: var(--sp-4) var(--sp-4) var(--sp-5); }
}

/* ═══════════════════════════════════════════════════════════
   UI/UX IMPROVEMENTS — v2
   ═══════════════════════════════════════════════════════════ */

/* ── 1. OUTPUT HERO: More breathing room, larger icon ── */
.output-hero {
  padding: 36px 20px 8px;
  gap: 2px;
}

.output-pizza-icon {
  width: 68px;
  height: 68px;
  margin-bottom: 18px;
  box-shadow:
    0 0 0 10px rgba(196,98,26,.07),
    0 0 0 18px rgba(196,98,26,.04),
    0 6px 24px rgba(196,98,26,.22);
}

/* ── 2. OUTPUT NUMBER: slightly tighter on narrow panels ── */
@media (min-width: 768px) and (max-width: 1024px) {
  .output-number {
    font-size: clamp(4rem, 9vw, 6rem);
  }
}

/* ── 3. STAT ITEMS: prevent text truncation, better proportions ── */
.output-stats {
  gap: var(--sp-2);
}

.stat-item {
  padding: 12px 10px;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.stat-value {
  font-size: 1rem;
  white-space: normal;   /* allow wrapping instead of clipping */
  word-break: break-word;
  overflow: visible;
  text-overflow: unset;
  line-height: 1.25;
}

.stat-label {
  font-size: 9.5px;
  letter-spacing: 0.07em;
}

/* ── 4. RECOMMENDATION BOX: richer, more readable ── */
.output-recommendation {
  font-size: 0.8125rem;
  padding: 14px 16px;
  border-left-width: 4px;
  line-height: 1.75;
  background: rgba(255,255,255,0.95);
}

/* ── 5. VARIETY CHIPS: better contrast & spacing ── */
.variety-chip {
  padding: 10px 14px;
  border-radius: var(--r-md);
}

.variety-chip__count {
  font-size: 0.875rem;
  font-weight: 700;
}

.variety-chip__label {
  font-size: 0.75rem;
  color: var(--c-text-muted);
}

/* ── 6. OUTPUT ACTIONS: consistent button heights ── */
.output-actions {
  gap: 8px;
}

.output-actions .btn {
  min-height: 42px;
  justify-content: center;
  font-size: 0.8rem;
}

#share-btn {
  min-height: 46px;
  font-size: var(--text-sm);
  letter-spacing: 0.01em;
}

#reset-btn {
  min-height: 36px;
  font-size: 0.75rem;
  opacity: 0.6;
  border-color: transparent;
  color: var(--c-text-faint);
}

#reset-btn:hover {
  opacity: 1;
  background: rgba(220, 38, 38, 0.06);
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.2);
}

/* ── 7. PILL GROUPS: even spacing & better wrapping ── */
.pill-group {
  gap: var(--sp-2);
  row-gap: var(--sp-2);
}

.pill {
  padding: 9px 18px;
  min-height: 46px;
}

.pill__label {
  font-size: 0.8125rem;
  font-weight: 600;
}

.pill__note {
  font-size: 10.5px;
  opacity: 0.8;
}

.pill--active .pill__note {
  opacity: 0.9;
}

/* ── 8. INPUT HINT: slightly more visible ── */
.input-hint {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--c-text-faint);
  opacity: 0.85;
}

/* ── 9. INPUT DESC: improve readability ── */
.input-desc {
  font-size: 0.8rem;
  color: var(--c-text-muted);
  line-height: 1.6;
  margin-top: -6px;
  margin-bottom: 12px;
}

/* ── 10. DIETARY ROW: better layout ── */
.dietary-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-5);
  align-items: flex-end;
}

.dietary-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.dietary-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── 11. DIETARY SUGGESTION BOX: more polished ── */
.dietary-suggestion {
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 0.8125rem;
  border-left-width: 3px;
  gap: 10px;
}

/* ── 12. PRICE INPUT WRAP: better alignment ── */
.price-input-wrap {
  display: flex;
  align-items: center;
  border: 2px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  max-width: 160px;
  overflow: hidden;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.price-input-wrap:focus-within {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(196,98,26,.12);
}

.price-currency {
  padding: 0 12px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--c-text-muted);
  background: rgba(196,98,26,.06);
  border-right: 1px solid var(--c-border);
  height: 48px;
  display: flex;
  align-items: center;
  user-select: none;
}

.price-input-wrap .number-input {
  border: none;
  box-shadow: none;
  border-radius: 0;
  width: 110px;
  height: 48px;
  padding: 0 12px;
  font-size: 1rem;
  font-weight: 600;
}

.price-input-wrap .number-input:focus {
  outline: none;
  box-shadow: none;
  border-color: transparent;
}

/* ── 13. CUSTOM SLICES INPUT ROW: cleaner layout ── */
.custom-slices-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-top: var(--sp-2);
}

.custom-slices-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--c-text-muted);
}

/* ── 14. OUTPUT SIZE LABEL: slightly better weight ── */
.output-size-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-text-muted);
  margin-top: 14px;
  padding-top: 12px;
}

/* ── 15. PRESETS BAR: polish ── */
.presets-bar {
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-4);
  overflow: hidden;
  border: 1px solid rgba(196,98,26,.15);
}

.preset-chip {
  border-radius: var(--r-md);
  padding: 8px 14px;
  font-size: 0.8125rem;
}

/* ── 16. SHARE BUTTON: clearer CTA ── */
.btn--share {
  box-shadow: 0 2px 12px rgba(196,98,26,.28);
  letter-spacing: 0.01em;
}

.btn--share:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(196,98,26,.38);
}

/* ── 17. TAX/TIP SECTION: tighter feel ── */
.tax-tip-section {
  border-radius: var(--r-md);
  padding: 12px 16px;
}

.tax-tip-section__label {
  font-size: 10px;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}

/* ── 18. NUMBER INPUT: slightly bigger ── */
.number-input {
  height: 48px;
  font-size: 1.375rem;
}

/* ── 19. LABEL ICON: slightly larger tap target ── */
.label-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

/* ── 20. STEP COUNTER BADGE: cleaner ── */
.input-label::before {
  min-width: 22px;
  height: 22px;
  font-size: 10.5px;
  box-shadow: 0 1px 4px rgba(196,98,26,.25);
}

/* ── 21. INPUT GROUP: slightly more padding ── */
.input-group {
  padding: var(--sp-5) var(--sp-6) var(--sp-6);
}

@media (min-width: 640px) {
  .input-group {
    padding: 0 var(--sp-8) var(--sp-7);
  }
}

/* ── 22. OUTPUT STATS: use 2×2 grid, show 4 properly ── */
@media (min-width: 768px) {
  .output-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .stat-value {
    font-size: 1.05rem;
  }
}

/* ── 23. CALC OUTPUT PADDING ── */
@media (min-width: 640px) {
  .calc-output {
    padding: var(--sp-6) var(--sp-7) var(--sp-8);
  }
  .output-hero {
    padding-top: 32px;
  }
}

/* ── 24. VARIETIES BREAKDOWN section spacing ── */
.varieties-breakdown {
  gap: 8px;
}

/* ── 25. SMOOTH TRANSITION ON OUTPUT NUMBER change ── */
.output-number {
  transition: color var(--t-fast), transform 0.12s ease;
}

/* ── 26. DARK MODE FIXES for new price-input ── */
[data-theme="dark"] .price-input-wrap {
  background: #2A2218;
  border-color: var(--c-border);
}

[data-theme="dark"] .price-input-wrap:focus-within {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(196,98,26,.15);
}

[data-theme="dark"] .price-currency {
  background: rgba(196,98,26,.10);
  border-color: var(--c-border);
  color: var(--c-text-faint);
}

[data-theme="dark"] .price-input-wrap .number-input {
  background: #2A2218;
  color: var(--c-primary);
}

/* ── 27. MOBILE: tighten output further ── */
@media (max-width: 767px) {
  .stat-item {
    padding: 10px 8px;
    min-height: 64px;
  }
  .stat-value {
    font-size: 0.9375rem;
  }
  .output-actions {
    grid-template-columns: 1fr 1fr;
  }
  .output-hero {
    padding-top: 28px;
    padding-bottom: 4px;
  }
}

/* ── 28. SCROLL PADDING for sticky header + TOC bar ── */
[id] {
  scroll-margin-top: calc(var(--header-h) + var(--toc-h) + 16px);
}


/* ══════════════════════════════════════════════════════════
   ADDITIONAL POLISH — targeted fixes from screenshot audit
   ══════════════════════════════════════════════════════════ */

/* Fix: stat-item--accent (calories) should match the other stat items visually */
.stat-item--accent {
  background: rgba(255,255,255,0.8);
  border-color: rgba(196,98,26,.1);
}

[data-theme="dark"] .stat-item--accent {
  background: rgba(42,34,24,0.85);
  border-color: rgba(255,255,255,.05);
}

/* Fix: output-number animation on value change */
@keyframes numPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.output-number.is-updating {
  animation: numPop 0.22s ease-out;
}

/* Fix: variety-card selection state is clearer */
.variety-card.pill--active {
  box-shadow: 0 0 0 2px var(--c-primary), 0 2px 8px rgba(196,98,26,.15);
}

/* Fix: the 5th stat (total with tax+tip) stretches full width */
#stat-total-item:not([hidden]) {
  grid-column: 1 / -1;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  text-align: left;
  background: linear-gradient(135deg, rgba(30,63,171,.06) 0%, rgba(30,63,171,.03) 100%);
  border-color: rgba(30,63,171,.15);
}

#stat-total-item:not([hidden]) .stat-icon {
  margin: 0;
}

#stat-total-item:not([hidden]) .stat-value {
  font-size: 1.125rem;
  color: var(--c-secondary);
}

#stat-total-item:not([hidden]) .stat-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* Fix: output-stats 5th item row expand */
.output-stats:has(#stat-total-item:not([hidden])) {
  grid-template-columns: repeat(2, 1fr);
}

/* Fix: price input max-width override for better spacing */
.price-input-wrap {
  max-width: 200px !important;
  border-radius: var(--r-md) !important;
  border-width: 2px !important;
}

/* Fix: button group — "Copy Order" and "Copy" same height */
#copy-order-btn,
#copy-btn {
  min-height: 42px;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Fix: Show List (share) button full width, primary weight */
#share-btn {
  font-weight: 700;
  min-height: 44px;
  box-shadow: 0 2px 10px rgba(196,98,26,.25);
}

/* Fix: Print button text alignment */
#print-btn {
  justify-content: center;
  min-height: 42px;
  font-size: 0.8rem;
}

/* Fix: Reset button visual de-emphasis */
#reset-btn {
  grid-column: 1 / -1;
  justify-content: center;
  background: transparent;
  border-color: transparent;
  color: var(--c-text-faint);
  font-size: 0.75rem;
  font-weight: 500;
  min-height: 34px;
  transition: color var(--t-fast), background var(--t-fast);
}
#reset-btn:hover {
  color: #dc2626;
  background: rgba(220,38,38,.06);
  border-color: rgba(220,38,38,.15);
}

/* Fix: Presets bar — better visual grouping */
.presets-bar {
  background: rgba(196,98,26,.04);
  border: 1px solid rgba(196,98,26,.12);
  border-radius: var(--r-lg);
  margin: var(--sp-4) var(--sp-4) 0;
  overflow: hidden;
}

@media (min-width: 640px) {
  .presets-bar {
    margin: var(--sp-5) var(--sp-8) 0;
  }
}

/* Fix: label step counter — slightly tighter kerning */
.input-label {
  gap: 10px;
  letter-spacing: -0.015em;
}

/* Fix: kids split panel animation */
.kids-split-panel {
  transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Fix: smooth transitions on toggle */
.toggle-switch {
  transition: background 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-knob {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Fix: hero badge line-height */
.hero-badge {
  line-height: 1;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Fix: calc hero heading weight */
.calc-hero h1 {
  font-size: clamp(2.2rem, 5vw, 3rem);
  letter-spacing: -0.04em;
}

/* Fix: calc-card border radius consistency */
.calc-card {
  border-radius: 18px;
  box-shadow: 0 8px 40px rgba(100,40,5,.12), 0 2px 8px rgba(100,40,5,.08);
}

/* Fix: input group hover is too subtle */
.input-group:hover:not(:focus-within) {
  background: rgba(196,98,26,.012);
}

/* Fix: output panel — add subtle top padding on mobile */
@media (max-width: 767px) {
  .calc-output {
    padding: var(--sp-6) var(--sp-5) var(--sp-7);
    border-top: 2px solid rgba(196,98,26,.1);
  }
  .output-stats {
    gap: var(--sp-2);
  }
}

/* Fix: variety chips dark mode */
[data-theme="dark"] .variety-chip--0 .variety-chip__label { color: var(--c-text-faint); }
[data-theme="dark"] .variety-chip--1 .variety-chip__label { color: var(--c-text-faint); }
[data-theme="dark"] .variety-chip--2 .variety-chip__label { color: var(--c-text-faint); }
[data-theme="dark"] .variety-chip--3 .variety-chip__label { color: var(--c-text-faint); }


/* ═══════════════════════════════════════════════════════════
   V2 FINAL OVERRIDES — clean slate for conflicting rules
   ═══════════════════════════════════════════════════════════ */

/* ── RESET conflicting output-actions overrides from v1 patch ── */
.output-actions {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  grid-template-columns: unset !important;
}

.output-actions__row {
  display: flex;
  gap: 8px;
  width: 100%;
}
.output-actions__row .btn {
  flex: 1;
  min-width: 0;
}

/* Share full width */
#share-btn { width: 100%; }

/* Print full width */
#print-btn { width: 100%; }

/* Reset full width */
#reset-btn { width: 100%; }

/* ── RESET old grid-based button overrides ── */
#share-btn    { grid-column: unset !important; }
#reset-btn    { grid-column: unset !important; opacity: 1 !important; }
#copy-order-btn, #copy-btn, #print-btn { grid-column: unset !important; }

/* ── stat-item--total: override v1 patch conflicts ── */
#stat-total-item[hidden] { display: none !important; }

/* When shown: the :not([hidden]) rule above handles it */
/* Remove the v1 .output-stats:has() rule via override */
.output-stats:has(#stat-total-item:not([hidden])) {
  grid-template-columns: repeat(2, 1fr) !important;
}

/* ── STAT ITEMS: override v1 min-height / flex conflicts ── */
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 10px;
  min-height: 68px;
  text-align: center;
}

/* ── OUTPUT STATS: crisp 2-col ── */
.output-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

/* ── STAT VALUES: no truncation ── */
.stat-value {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: unset !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  word-break: break-word;
}

/* ── MOBILE OVERRIDES: buttons stay stacked ── */
@media (max-width: 767px) {
  .output-actions { gap: 7px !important; }
  #share-btn { min-height: 46px !important; }
  #copy-order-btn, #copy-btn { min-height: 40px !important; }
  #print-btn { min-height: 40px !important; }
  #reset-btn { min-height: 32px !important; }
  .output-actions__row { gap: 7px; }
}

/* ── TABLET (768-1023px): compact button text ── */
@media (min-width: 768px) and (max-width: 1023px) {
  .output-actions__row .btn { font-size: 0.75rem; padding: 0 12px; }
}

/* ── STICKY SHADOW: visual cue that panel is scrollable ── */
@media (min-width: 768px) {
  .calc-output {
    /* Subtle gradient fade at bottom edge when scrollable */
    mask-image: linear-gradient(
      to bottom,
      black calc(100% - 40px),
      transparent 100%
    );
    -webkit-mask-image: linear-gradient(
      to bottom,
      black calc(100% - 40px),
      transparent 100%
    );
  }
  /* Remove mask when not overflowing (JS could add a class, CSS fallback) */
  .calc-output:not(.is-scrollable) {
    mask-image: none;
    -webkit-mask-image: none;
  }
}

/* ── OUTPUT HERO improvements — sides match container --sp-6 (24px) ── */
.output-hero {
  padding: 28px var(--sp-6) 6px;
}

.output-pizza-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 14px;
  box-shadow:
    0 0 0 8px rgba(196,98,26,.07),
    0 0 0 16px rgba(196,98,26,.035),
    0 6px 20px rgba(196,98,26,.20);
}

/* ── RECOMMENDATION BOX: tighten ── */
.output-recommendation {
  font-size: 0.8125rem;
  line-height: 1.72;
  padding: 13px 15px;
  border-left-width: 3px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(4px);
}

/* ── PRO TIP: tighter ── */
.pro-tip {
  padding: 10px 14px;
}
.pro-tip__text { font-size: 0.75rem; }

/* ── CWV: reduce reflow triggers ── */
.output-number {
  /* Reserve space matching the animated value range */
  min-height: 5.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(5rem, 11vw, 7rem) !important;
  line-height: 1 !important;
}

/* ── CALC CARD: better sticky context ── */
.calc-card {
  /* Ensure grid children don't escape */
  contain: layout style;
}

/* ── HERO BADGES: uniform pill look ── */
.hero-badge {
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  box-shadow: 0 1px 3px rgba(100,40,5,.05);
  padding: 5px 13px;
  font-size: 0.6875rem;
  font-weight: 600;
  gap: 5px;
}
.hero-badge svg { width: 11px; height: 11px; }

/* ── INPUT DESC: consistent style ── */
.input-desc {
  font-size: 0.8rem;
  color: var(--c-text-muted);
  line-height: 1.6;
  margin-top: -4px;
  margin-bottom: 12px;
  padding-left: 1px;
}

/* Separator before the desc */
.input-desc::before {
  content: '—';
  margin-right: 5px;
  opacity: 0.4;
}

[data-theme="dark"] .input-desc::before { opacity: 0.25; }

/* ── PRESETS BAR: v2 clean ── */
.presets-bar {
  border-radius: var(--r-lg) !important;
  overflow: hidden !important;
  background: rgba(196,98,26,.03) !important;
  border: 1px solid rgba(196,98,26,.10) !important;
  margin: var(--sp-4) var(--sp-4) 0 !important;
}
@media (min-width: 640px) {
  .presets-bar { margin: var(--sp-5) var(--sp-8) 0 !important; }
}

/* ── SCROLLBAR HIDE for calc-output on WebKit ── */
.calc-output::-webkit-scrollbar { display: none; }
.calc-output { scrollbar-width: none; -ms-overflow-style: none; }

/* ── DARK MODE: buttons ── */
[data-theme="dark"] #print-btn {
  background: rgba(42,34,24,.8) !important;
  color: var(--c-text-muted) !important;
  border-color: var(--c-border) !important;
}
[data-theme="dark"] #print-btn:hover {
  background: rgba(60,48,34,.95) !important;
  color: var(--c-text) !important;
}
[data-theme="dark"] #reset-btn {
  color: var(--c-text-faint) !important;
}
[data-theme="dark"] #reset-btn:hover {
  color: #f87171 !important;
  background: rgba(248,113,113,.08) !important;
  border-color: rgba(248,113,113,.2) !important;
}

/* ── CWV: will-change only where needed ── */
.output-number { will-change: contents; }
.pill { will-change: auto; }
.btn { will-change: auto; }

/* ── CWV: content-visibility for below-fold sections ── */
.content-wrap {
  content-visibility: auto;
  contain-intrinsic-size: auto 2400px;
}
.site-footer {
  content-visibility: auto;
  contain-intrinsic-size: auto 320px;
}

/* ── CWV: Reduce INP — faster interaction response ── */
.btn, .pill, .toggle-switch, .stepper__btn {
  touch-action: manipulation;
}

/* ── SIZE GUIDE + APPETITE inline style for below-fold ── */
@media (min-width: 768px) {
  #pizza-size-guide,
  #appetite-guide,
  #event-planning,
  #faq,
  #planning-tips {
    content-visibility: auto;
    contain-intrinsic-size: auto 600px;
  }
}

/* ═══════════════════════════════════════════════════════════
   NEW FEATURES — styles appended
   ═══════════════════════════════════════════════════════════ */

/* ── H1 accent class (replaces inline style) ── */
.h1-accent { color: var(--c-primary); }

/* ── Footer faint copy (replaces inline style) ── */
.footer-copy--faint { color: rgba(255,255,255,.2); }

/* ─────────────────────────────────────────────────────────
   MODE SWITCHER (people vs budget)
───────────────────────────────────────────────────────── */
.mode-switcher {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-6) 0;
}

.mode-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 9px var(--sp-4);
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  color: var(--c-text-muted);
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.mode-btn:hover {
  background: var(--c-surface-tint);
  color: var(--c-primary);
  border-color: var(--c-primary-light);
}

.mode-btn--active {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
}

.mode-btn--active:hover {
  background: var(--c-primary-dark);
  border-color: var(--c-primary-dark);
  color: #fff;
}

[data-theme="dark"] .mode-btn {
  background: rgba(255,255,255,.04);
  border-color: var(--c-border);
  color: var(--c-text-muted);
}

[data-theme="dark"] .mode-btn--active {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #fff;
}

/* ─────────────────────────────────────────────────────────
   BUDGET PANEL
───────────────────────────────────────────────────────── */
.budget-panel { animation: fadeIn 0.2s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.budget-result {
  margin-top: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-secondary-light);
  border-left: 3px solid var(--c-secondary);
  border-radius: 0 var(--r-base) var(--r-base) 0;
  font-size: var(--text-sm);
  line-height: 1.65;
  color: var(--c-secondary-dark);
}

[data-theme="dark"] .budget-result {
  background: rgba(30,63,171,.15);
  border-color: var(--c-secondary);
  color: #8fa8f8;
}

/* ─────────────────────────────────────────────────────────
   ORDER TIMING ROW
───────────────────────────────────────────────────────── */
.timing-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: rgba(196,98,26,.04);
  border: 1px solid rgba(196,98,26,.12);
  border-radius: var(--r-md);
}

.timing-row__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  color: var(--c-text-muted);
  white-space: nowrap;
  cursor: default;
}

.timing-input {
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--c-text);
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-base);
  padding: 5px 10px;
  cursor: pointer;
  transition: border-color var(--t-fast);
}

.timing-input:focus {
  outline: none;
  border-color: var(--c-primary);
}

.timing-result {
  width: 100%;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--c-primary-dark);
  padding: var(--sp-2) 0 0;
  line-height: 1.5;
}

[data-theme="dark"] .timing-row { background: rgba(196,98,26,.07); border-color: rgba(196,98,26,.18); }
[data-theme="dark"] .timing-input { background: rgba(255,255,255,.06); border-color: var(--c-border); color: var(--c-text); }
[data-theme="dark"] .timing-result { color: #f5a97c; }

/* ─── EMPTY-STATE: timing-result placeholder ─────────── */
.timing-result--empty {
  font-weight: var(--fw-regular);
  color: var(--c-text-faint);
  font-style: italic;
}
[data-theme="dark"] .timing-result.timing-result--empty { color: rgba(255,255,255,.35); font-style: italic; }

/* ─── EMPTY-STATE: budget-result placeholder ─────────── */
.budget-result--empty {
  background: rgba(107,87,68,.06);
  border-left-color: var(--c-border-strong);
  color: var(--c-text-faint);
  font-style: italic;
  font-weight: var(--fw-regular);
}
.budget-result--error {
  background: rgba(220,38,38,.06);
  border-left-color: #dc2626;
  color: #b91c1c;
  font-style: normal;
  font-weight: var(--fw-medium);
}
.budget-avg-note {
  display: block;
  margin-top: var(--sp-2);
  color: var(--c-text-faint);
  font-size: var(--text-xs);
  font-weight: var(--fw-regular);
}
[data-theme="dark"] .budget-result--empty { background: rgba(255,255,255,.04); border-left-color: rgba(255,255,255,.2); color: rgba(255,255,255,.35); }
[data-theme="dark"] .budget-result--error { background: rgba(220,38,38,.12); border-left-color: #f87171; color: #fca5a5; }

/* ─── EMPTY-STATE: cps-verdict placeholder ───────────── */
.cps-verdict--empty {
  background: rgba(107,87,68,.05);
  border-color: var(--c-border);
  color: var(--c-text-faint);
}
.cps-verdict--empty svg { color: var(--c-border-strong); opacity: 0.7; }
.cps-verdict--empty p { font-style: italic; font-weight: var(--fw-regular); }
/* Double class for specificity — must beat [data-theme="dark"] .cps-verdict */
[data-theme="dark"] .cps-verdict.cps-verdict--empty { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.1); color: rgba(255,255,255,.35); }
[data-theme="dark"] .cps-verdict.cps-verdict--empty svg { color: rgba(255,255,255,.2); }

/* ─────────────────────────────────────────────────────────
   TOPPING CHIPS
───────────────────────────────────────────────────────── */
.topping-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.topping-row__label {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--c-text-faint);
  opacity: 0.8;
}

.topping-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.topping-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-pill);
  font-size: 0.725rem;
  font-weight: var(--fw-medium);
  color: var(--c-text-muted);
  white-space: nowrap;
}

.topping-chip--note {
  background: var(--c-primary-light);
  border-color: rgba(196,98,26,.2);
  color: var(--c-primary-dark);
  font-style: italic;
}

[data-theme="dark"] .topping-chip { background: rgba(255,255,255,.05); border-color: var(--c-border); color: var(--c-text-muted); }
[data-theme="dark"] .topping-chip--note { background: rgba(196,98,26,.15); border-color: rgba(196,98,26,.3); color: #f5a97c; }

/* ─────────────────────────────────────────────────────────
   SAVE CARD BUTTON
───────────────────────────────────────────────────────── */
.btn--card {
  background: linear-gradient(135deg, var(--c-secondary), var(--c-secondary-dark));
  color: #fff;
  border: none;
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  padding: 11px var(--sp-5);
  border-radius: var(--r-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  cursor: pointer;
  transition: opacity var(--t-fast), transform var(--t-fast);
  width: 100%;
}

.btn--card:hover { opacity: 0.9; transform: translateY(-1px); }
.btn--card:active { transform: translateY(0); }

[data-theme="dark"] .btn--card {
  background: linear-gradient(135deg, #2d4fcf, #1e3fab);
}

/* ─────────────────────────────────────────────────────────
   COST-PER-SLICE SECTION
───────────────────────────────────────────────────────── */
#cost-per-slice {
  content-visibility: auto;
  contain-intrinsic-size: auto 400px;
}

.cps-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.cps-inputs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--c-surface);
  box-shadow: var(--shadow-card);
}

.cps-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
  transition: background var(--t-fast);
}

.cps-row:last-child { border-bottom: none; }
.cps-row:hover { background: rgba(196,98,26,.015); }
.cps-row--highlight { background: var(--c-surface-tint); }
.cps-row--highlight:hover { background: rgba(196,98,26,.04); }

.cps-row__left {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}

.cps-size-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--c-border-strong);
}

.cps-size-dot--sm  { width: 8px;  height: 8px;  background: var(--c-text-faint); }
.cps-size-dot--md  { width: 10px; height: 10px; background: var(--c-text-muted); }
.cps-size-dot--lg  { width: 13px; height: 13px; background: var(--c-primary); }
.cps-size-dot--xl  { width: 15px; height: 15px; background: var(--c-primary-dark); }
.cps-size-dot--party { width: 18px; height: 18px; background: var(--c-secondary); }

.cps-size-label {
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  color: var(--c-text);
  white-space: nowrap;
}

.cps-size-label em {
  font-style: normal;
  font-weight: var(--fw-regular);
  color: var(--c-text-muted);
  font-size: var(--text-xs);
  margin-left: 4px;
}

.cps-price-wrap {
  width: 100px;
}

.cps-price-input {
  width: 70px !important;
  text-align: right;
}

.cps-result {
  min-width: 80px;
  text-align: right;
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  color: var(--c-text-muted);
  transition: color var(--t-fast), background var(--t-fast);
  padding: 3px 8px;
  border-radius: var(--r-base);
}

.cps-result--best {
  color: var(--c-primary);
  background: var(--c-primary-light);
  font-weight: var(--fw-bold);
}

.cps-verdict {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  background: var(--c-primary-light);
  border: 1px solid rgba(196,98,26,.2);
  border-radius: var(--r-lg);
  font-size: var(--text-sm);
  color: var(--c-primary-dark);
}

.cps-verdict svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--c-primary);
}

.cps-note {
  font-size: var(--text-xs);
  color: var(--c-text-faint);
  line-height: 1.6;
}

@media (max-width: 520px) {
  .cps-row { grid-template-columns: 1fr auto; gap: var(--sp-2); padding: var(--sp-3); }
  .cps-result { min-width: 60px; }
  .cps-size-label em { display: none; }
}

[data-theme="dark"] .cps-inputs { background: rgba(255,255,255,.03); border-color: var(--c-border); }
[data-theme="dark"] .cps-row:hover { background: rgba(196,98,26,.05); }
[data-theme="dark"] .cps-row--highlight { background: rgba(196,98,26,.08); }
[data-theme="dark"] .cps-result--best { background: rgba(196,98,26,.18); color: #f5a97c; }
[data-theme="dark"] .cps-verdict { background: rgba(196,98,26,.12); border-color: rgba(196,98,26,.25); color: #f5a97c; }

/* ─────────────────────────────────────────────────────────
   STAT: cost-per-person
───────────────────────────────────────────────────────── */
#stat-cost-per-item .stat-value { color: var(--c-secondary); }

/* ─────────────────────────────────────────────────────────
   CWV: cost-per-slice section below fold
───────────────────────────────────────────────────────── */
@media (min-width: 768px) {
  #cost-per-slice {
    content-visibility: auto;
    contain-intrinsic-size: auto 460px;
  }
}

