/* ==========================================================
   Bite Check — clickable prototype
   Art direction: warm, food-adjacent, calm.
   Palette derived from restaurant + celiac safety context —
   cream surface, deep ink, muted teal for "ready", warm
   amber/rust for "uncertain/detected". Not medical-sterile.
   ========================================================== */

:root,
[data-theme='light'] {
  /* Surfaces — warm cream */
  --bg: #f2ece2;
  --surface: #fbf6ec;
  --surface-2: #ffffff;
  --surface-sunk: #ece5d7;
  --border: #e0d7c4;
  --divider: #ebe3d1;

  /* Ink */
  --ink: #201d16;
  --ink-2: #4a4237;
  --ink-muted: #7f7869;
  --ink-faint: #b3ac9c;
  --ink-inverse: #fbf6ec;

  /* Semantic — warm not sterile */
  --safe: #2f6a54;          /* deep basil green */
  --safe-soft: #cee2d6;
  --amber: #c07526;         /* warm rust-amber */
  --amber-soft: #f3d9b8;
  --hot: #a1391c;           /* burnt sienna */
  --hot-soft: #eec6b8;

  /* Prototype chrome */
  --chrome: #1d1a15;
  --chrome-ink: #f2ece2;

  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1.25rem;
  --radius-xl: 1.75rem;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(32, 29, 22, 0.06);
  --shadow-md: 0 10px 30px -12px rgba(32, 29, 22, 0.18);
  --shadow-lg: 0 30px 70px -30px rgba(32, 29, 22, 0.35);

  --font-body: 'General Sans', 'Inter', system-ui, sans-serif;
  --font-display: 'Fraunces', 'Fraunces Fallback', Georgia, serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.125rem;

  --transition: 220ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

[data-theme='dark'] {
  --bg: #14120e;
  --surface: #1c1a15;
  --surface-2: #23201a;
  --surface-sunk: #100e0a;
  --border: #2f2a22;
  --divider: #26221b;

  --ink: #efe6d3;
  --ink-2: #cdc4b0;
  --ink-muted: #8a8272;
  --ink-faint: #4c4739;
  --ink-inverse: #14120e;

  --safe: #6ec498;
  --safe-soft: #23342b;
  --amber: #e2a458;
  --amber-soft: #3a2a19;
  --hot: #e07352;
  --hot-soft: #391e15;

  --chrome: #efe6d3;
  --chrome-ink: #14120e;
}

/* ------------- Base reset ------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 450;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 700px at 12% -5%, rgba(192, 117, 38, 0.08), transparent 60%),
    radial-gradient(900px 600px at 92% 0%, rgba(47, 106, 84, 0.06), transparent 60%);
}
[data-theme='dark'] body {
  background-image:
    radial-gradient(1200px 700px at 12% -5%, rgba(226, 164, 88, 0.09), transparent 60%),
    radial-gradient(900px 600px at 92% 0%, rgba(110, 196, 152, 0.05), transparent 60%);
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; text-wrap: balance; line-height: 1.1; }
p { text-wrap: pretty; }

/* ------------- Prototype chrome ------------- */
.proto-bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.9rem 1.5rem;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.proto-brand {
  display: flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.05rem; font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}
.proto-brand em { color: var(--ink-muted); font-style: normal; margin: 0 0.35rem; }
.proto-brand svg { color: var(--amber); }

.proto-nav {
  display: flex; gap: 0.35rem; flex-wrap: wrap;
  margin-left: auto;
}
.proto-chip {
  padding: 0.4rem 0.75rem;
  font-size: var(--text-xs); font-weight: 500;
  color: var(--ink-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  transition: var(--transition);
  white-space: nowrap;
}
.proto-chip:hover { color: var(--ink); background: var(--surface); }
.proto-chip.is-active {
  color: var(--ink); background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.proto-theme {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-muted);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: var(--transition);
}
.proto-theme:hover { color: var(--ink); border-color: var(--ink-faint); }

/* ------------- Stage ------------- */
.stage {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 460px);
  justify-content: center;
  gap: clamp(2rem, 4vw, 4rem);
  align-items: start;
  padding: clamp(2rem, 5vw, 4rem) 1.5rem 6rem;
  max-width: 1200px;
  margin: 0 auto;
}
@media (max-width: 900px) {
  .stage { grid-template-columns: 1fr; padding-top: 1.5rem; }
}

/* ------------- Phone frame ------------- */
.phone {
  position: relative;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 9 / 19.5;
  margin: 0 auto;
  background: #0d0b08;
  border-radius: 46px;
  padding: 12px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.06) inset,
    0 40px 90px -30px rgba(0,0,0,0.35),
    0 25px 50px -20px rgba(0,0,0,0.35);
  overflow: hidden;
}
.phone-notch {
  position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  width: 105px; height: 28px; border-radius: 999px;
  background: #0d0b08; z-index: 3;
}
.phone-status {
  position: absolute; top: 20px; left: 30px; right: 30px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; font-weight: 600; color: var(--ink);
  padding: 0 1rem;
  z-index: 4;
}
.status-time { color: var(--ink); }
.status-glyphs { display: inline-flex; gap: 6px; align-items: center; color: var(--ink); }
.battery {
  width: 24px; height: 11px; border-radius: 3px;
  border: 1px solid currentColor; padding: 1px;
  position: relative;
}
.battery::after {
  content: ''; position: absolute; right: -3px; top: 3px;
  width: 2px; height: 5px; background: currentColor; border-radius: 1px;
}
.battery span {
  display: block; width: 82%; height: 100%; background: currentColor; border-radius: 1px;
}
.phone-home {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 40%; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.35);
  z-index: 4;
}

.screens {
  position: absolute; inset: 12px;
  border-radius: 34px;
  overflow: hidden;
  background: var(--bg);
}

/* ------------- Screen switching ------------- */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: 58px 22px 32px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 320ms ease, transform 380ms cubic-bezier(0.2, 0.8, 0.3, 1);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.screen::-webkit-scrollbar { width: 0; }
.screen.is-active {
  opacity: 1; transform: none; pointer-events: auto;
}

/* ------------- Shared typography ------------- */
.eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.display {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--ink);
  margin-top: 0.25rem;
}
.display-tight { font-size: 1.75rem; }
.lede {
  margin-top: 0.75rem;
  font-size: var(--text-base);
  color: var(--ink-2);
  max-width: 30ch;
}

/* ------------- Buttons ------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 1.25rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: var(--text-base);
  transition: var(--transition);
  width: 100%;
}
.btn:active { transform: translateY(1px); }
.btn-sm { height: 40px; font-size: var(--text-sm); padding: 0 1rem; width: auto; }
.btn-lg { height: 56px; }
.btn-primary {
  background: var(--ink);
  color: var(--ink-inverse);
  box-shadow: var(--shadow-md);
}
.btn-primary:hover { background: color-mix(in srgb, var(--ink) 90%, var(--amber)); }
.btn-warning {
  background: var(--amber); color: #fff;
  box-shadow: 0 12px 30px -10px color-mix(in srgb, var(--amber) 70%, transparent);
}
.btn-warning:hover { background: color-mix(in srgb, var(--amber) 88%, var(--ink)); }
.btn-ghost {
  background: transparent; color: var(--ink-muted);
  font-weight: 500; font-size: var(--text-sm);
  padding: 0.6rem 1rem; border-radius: var(--radius-pill);
  transition: var(--transition);
  width: 100%; text-align: center;
}
.btn-ghost:hover { color: var(--ink); }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: var(--transition);
  flex-shrink: 0;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-faint); }
.icon-btn-onalert {
  background: color-mix(in srgb, var(--amber) 15%, var(--surface));
  border-color: color-mix(in srgb, var(--amber) 30%, var(--border));
  color: var(--ink);
}

.screen-body { flex: 1; }
.screen-actions {
  margin-top: 1.25rem;
  display: flex; flex-direction: column; gap: 0.5rem;
}

/* ==========================================================
   Screen 1: Pair
   ========================================================== */
.pair-hero {
  height: 210px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  margin-bottom: 0.5rem;
}
.pair-case {
  position: relative;
  width: 160px; height: 160px;
  display: flex; align-items: center; justify-content: center;
}
.pair-case-body {
  position: relative; z-index: 2;
  width: 130px; height: 40px;
  background: linear-gradient(180deg, #2a2620, #16130f);
  border-radius: 12px 12px 20px 20px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 15px 30px -12px rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding-top: 4px;
}
.pair-case-lid {
  position: absolute; top: -6px; left: 8px; right: 8px; height: 6px;
  background: #3a3529;
  border-radius: 6px 6px 0 0;
}
.pair-case-slot {
  width: 8px; height: 22px; border-radius: 4px;
  background: linear-gradient(180deg, #d8cfb8, #a89e83);
  box-shadow: inset 0 0 2px rgba(0,0,0,0.4);
}
.pair-case-led {
  position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
  width: 12px; height: 4px; border-radius: 4px;
  background: var(--amber);
  opacity: 0.5;
  transition: background 300ms, opacity 300ms, box-shadow 300ms;
}
.pair-case.is-pairing .pair-case-led {
  background: var(--safe);
  opacity: 1;
  box-shadow: 0 0 12px var(--safe), 0 0 24px color-mix(in srgb, var(--safe) 60%, transparent);
  animation: ledPulse 1.2s ease-in-out infinite;
}
.pair-case.is-paired .pair-case-led {
  background: var(--safe); opacity: 1;
  box-shadow: 0 0 8px var(--safe);
  animation: none;
}
@keyframes ledPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.pair-pulse {
  position: absolute; inset: 0;
  border: 1.5px solid var(--safe);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}
.pair-case.is-pairing .pair-pulse {
  animation: pulseOut 2s ease-out infinite;
}
.pair-case.is-pairing .pair-pulse-2 {
  animation: pulseOut 2s ease-out 1s infinite;
}
@keyframes pulseOut {
  0% { transform: scale(0.6); opacity: 0.6; }
  100% { transform: scale(1.4); opacity: 0; }
}

.pair-steps {
  list-style: none;
  margin-top: 1.5rem;
  display: flex; flex-direction: column; gap: 0.75rem;
}
.pair-step {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--ink-muted);
  transition: var(--transition);
}
.pair-step .pair-dot {
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--ink-faint);
  flex-shrink: 0;
  transition: var(--transition);
  position: relative;
}
.pair-step.is-done {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--safe) 35%, var(--border));
  background: color-mix(in srgb, var(--safe) 6%, var(--surface));
}
.pair-step.is-done .pair-dot {
  background: var(--safe); border-color: var(--safe);
}
.pair-step.is-done .pair-dot::after {
  content: ''; position: absolute; inset: 3px;
  background: #fff;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12l5 5L20 7'/></svg>") center/70% no-repeat;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12l5 5L20 7'/></svg>") center/70% no-repeat;
}
.pair-step.is-active .pair-dot {
  border-color: var(--amber);
  animation: dotSpin 1s linear infinite;
}
.pair-step.is-active { color: var(--ink); }
@keyframes dotSpin {
  0% { box-shadow: inset 0 0 0 2px transparent; transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.pair-step.is-active .pair-dot::before {
  content: ''; position: absolute; inset: -2px;
  border: 2px solid var(--amber);
  border-top-color: transparent;
  border-radius: 50%;
}

/* ==========================================================
   Screen 2: Home
   ========================================================== */
.screen-body-home { padding-bottom: 80px; }
.home-head { margin-bottom: 1.25rem; }

.ready-card {
  background: linear-gradient(160deg, var(--surface), color-mix(in srgb, var(--safe) 8%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--safe) 25%, var(--border));
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.9rem;
}
.ready-headline {
  display: flex; align-items: center; gap: 0.55rem;
  font-size: var(--text-sm); font-weight: 600;
  color: var(--safe);
}
.ready-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--safe);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--safe) 20%, transparent);
  animation: readyPulse 2.5s ease-in-out infinite;
}
@keyframes readyPulse {
  0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--safe) 20%, transparent); }
  50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--safe) 6%, transparent); }
}
.ready-meters {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
  margin-top: 1rem;
}
.meter-label {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}
.meter-value {
  font-family: var(--font-display);
  font-size: 1.5rem; font-weight: 500;
  color: var(--ink);
  margin-top: 0.15rem;
  line-height: 1;
}
.meter-value span { color: var(--ink-faint); font-size: 0.95rem; }
.meter-bar {
  height: 4px; border-radius: 4px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  margin-top: 0.55rem; overflow: hidden;
}
.meter-bar > div {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--safe), color-mix(in srgb, var(--safe) 60%, var(--amber)));
}

.context-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}
.context-label {
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-muted);
}
.context-place {
  font-family: var(--font-display);
  font-size: 1.25rem; font-weight: 500;
  margin-top: 0.15rem;
}
.context-hint {
  font-size: var(--text-sm);
  color: var(--ink-2);
  margin-top: 0.25rem;
}

.quick-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem;
}
.quick-action {
  display: flex; flex-direction: column; gap: 0.4rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  text-align: left;
  background: var(--ink);
  color: var(--ink-inverse);
  transition: var(--transition);
  box-shadow: var(--shadow-md);
}
.quick-action:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.quick-icon {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--amber) 45%, transparent);
  color: var(--ink-inverse);
}
.quick-label { font-weight: 600; font-size: var(--text-base); }
.quick-sub { font-size: var(--text-xs); color: color-mix(in srgb, var(--ink-inverse) 65%, transparent); }

.quick-action-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.quick-icon-secondary {
  background: color-mix(in srgb, var(--safe) 20%, transparent);
  color: var(--safe);
}
.quick-action-secondary .quick-sub { color: var(--ink-muted); }

/* Tab bar */
.tabbar {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 0.5rem 0.5rem 1.25rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.tab {
  padding: 0.5rem;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--ink-muted);
  border-radius: var(--radius-md);
  transition: var(--transition);
}
.tab.is-active { color: var(--ink); font-weight: 600; }

/* ==========================================================
   Screen 3: Live meal
   ========================================================== */
.screen-meal { padding-bottom: 40px; }
.meal-topline {
  display: flex; align-items: center; gap: 0.75rem;
  margin-bottom: 1rem;
}
.meal-place { flex: 1; min-width: 0; }
.meal-place-name {
  font-family: var(--font-display);
  font-size: 1.05rem; font-weight: 500;
  line-height: 1.15;
}
.meal-place-order {
  font-size: var(--text-xs);
  color: var(--ink-muted);
}
.meal-live {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--safe) 12%, transparent);
  color: var(--safe);
  font-size: var(--text-xs); font-weight: 600;
}
.meal-live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--safe);
  animation: readyPulse 1.6s ease-in-out infinite;
}

.meal-ring-wrap {
  position: relative;
  width: 220px; height: 220px;
  margin: 0.5rem auto 1rem;
}
.meal-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.meal-ring-track {
  fill: none;
  stroke: color-mix(in srgb, var(--ink) 8%, transparent);
  stroke-width: 4;
}
.meal-ring-fill {
  fill: none;
  stroke: var(--safe);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 22 100;
  transition: stroke 320ms, stroke-dasharray 320ms;
}
.screen-meal.is-amber .meal-ring-fill {
  stroke: var(--amber);
  stroke-dasharray: 68 100;
}
.meal-ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.meal-verdict-label {
  font-size: var(--text-xs); font-weight: 600;
  color: var(--safe);
  letter-spacing: 0.12em; text-transform: uppercase;
}
.screen-meal.is-amber .meal-verdict-label { color: var(--amber); }
.meal-verdict {
  font-family: var(--font-display);
  font-size: 3rem; font-weight: 500;
  line-height: 1;
  margin-top: 0.25rem;
}
.meal-verdict-sub {
  font-size: var(--text-xs); color: var(--ink-muted);
  margin-top: 0.25rem;
}

.meal-band {
  position: relative;
  height: 26px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--safe) 22%, var(--surface)) 0%,
    color-mix(in srgb, var(--safe) 22%, var(--surface)) 33%,
    color-mix(in srgb, var(--amber) 22%, var(--surface)) 33%,
    color-mix(in srgb, var(--amber) 22%, var(--surface)) 66%,
    color-mix(in srgb, var(--hot) 22%, var(--surface)) 66%,
    color-mix(in srgb, var(--hot) 22%, var(--surface)) 100%);
  padding: 0 0.5rem;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}
.meal-band-tick { z-index: 1; }
.meal-band-marker {
  position: absolute; top: 50%;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink);
  border: 3px solid var(--surface);
  transform: translate(-50%, -50%);
  transition: left 420ms cubic-bezier(0.2, 0.9, 0.3, 1), background 320ms;
  box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

.bite-log {
  list-style: none;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.bite-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  animation: fadeUp 380ms ease-out both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.bite-num {
  font-family: var(--font-display);
  font-size: 0.9rem; font-weight: 500;
  color: var(--ink-muted);
  min-width: 26px;
}
.bite-body { flex: 1; min-width: 0; }
.bite-title {
  display: block;
  font-size: var(--text-sm); font-weight: 500;
}
.bite-meta {
  display: block;
  font-size: 11px; color: var(--ink-muted);
}
.bite-verdict {
  font-size: var(--text-xs); font-weight: 600;
  color: var(--safe);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--safe) 12%, transparent);
}
.bite-item.is-amber .bite-verdict {
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 18%, transparent);
}
.bite-item.is-amber { border-color: color-mix(in srgb, var(--amber) 35%, var(--border)); }

.meal-hint {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: color-mix(in srgb, var(--amber) 8%, var(--surface));
  border: 1px dashed color-mix(in srgb, var(--amber) 40%, var(--border));
  border-radius: var(--radius-md);
  display: flex; flex-direction: column; gap: 0.6rem;
}
.meal-hint p {
  font-size: var(--text-xs); color: var(--ink-2);
}

/* ==========================================================
   Screen 4: Amber alert
   ========================================================== */
.screen-alert {
  padding-top: 58px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--amber) 14%, var(--bg)) 0%,
    var(--bg) 60%);
}
.alert-topline {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.5rem;
}
.alert-badge {
  padding: 0.35rem 0.7rem;
  background: color-mix(in srgb, var(--amber) 18%, transparent);
  color: var(--amber);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 0.06em;
}
.alert-glow {
  display: flex; justify-content: center;
  padding: 0.75rem 0 1.25rem;
}
.alert-ring {
  position: relative;
  width: 240px; height: 240px;
}
.alert-ring svg {
  width: 100%; height: 100%;
  animation: ringFadeIn 700ms ease-out both;
}
@keyframes ringFadeIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}
.alert-ring::before {
  content: ''; position: absolute; inset: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--amber) 18%, transparent), transparent 70%);
  animation: glow 3s ease-in-out infinite;
}
@keyframes glow {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
.alert-ring-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 0 2rem;
}
.alert-eyebrow {
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--amber);
}
.alert-headline {
  font-family: var(--font-display);
  font-size: 2.25rem; font-weight: 500;
  line-height: 1;
  margin-top: 0.4rem;
  color: var(--ink);
}
.alert-detail {
  font-size: var(--text-xs);
  color: var(--ink-2);
  margin-top: 0.6rem;
}

.alert-context {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
}
.alert-context-title {
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-muted);
}
.alert-context-body {
  font-size: var(--text-sm);
  color: var(--ink-2);
  margin-top: 0.4rem;
}
.alert-facts {
  list-style: none;
  margin-top: 0.9rem;
  border-top: 1px solid var(--divider);
  padding-top: 0.6rem;
  display: flex; flex-direction: column;
}
.alert-facts li {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0.4rem 0;
  font-size: var(--text-xs);
  border-bottom: 1px solid var(--divider);
}
.alert-facts li:last-child { border-bottom: none; }
.alert-facts span { color: var(--ink-muted); letter-spacing: 0.03em; }
.alert-facts b { font-weight: 600; color: var(--ink); font-family: var(--font-display); font-size: var(--text-sm); }

.alert-actions {
  margin-top: 1.1rem;
  display: flex; flex-direction: column; gap: 0.5rem;
}

/* ==========================================================
   Screen 5: Send back
   ========================================================== */
.sub-topline {
  display: flex; align-items: center; gap: 0.75rem;
  margin-bottom: 1rem;
}
.sub-title {
  font-family: var(--font-display);
  font-size: 1.1rem; font-weight: 500;
  flex: 1; text-align: center;
}
.sub-spacer { width: 36px; }

.screen-body-sendback { padding-bottom: 20px; }
.script-card {
  background: var(--ink);
  color: var(--ink-inverse);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.15rem 1rem;
  box-shadow: var(--shadow-md);
}
.script-eyebrow {
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: color-mix(in srgb, var(--ink-inverse) 55%, transparent);
}
.script-body {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1.35;
  margin-top: 0.65rem;
  color: var(--ink-inverse);
}
.script-actions {
  display: flex; gap: 0.4rem; margin-top: 1rem; flex-wrap: wrap;
}
.chip-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  background: color-mix(in srgb, var(--ink-inverse) 10%, transparent);
  color: var(--ink-inverse);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: 500;
  transition: var(--transition);
}
.chip-btn:hover { background: color-mix(in srgb, var(--ink-inverse) 20%, transparent); }

.section-title {
  margin: 1.5rem 0 0.65rem;
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 0.5rem;
}
.section-title p {
  font-family: var(--font-display);
  font-size: 1rem; font-weight: 500;
}
.section-title span {
  font-size: 11px;
  color: var(--ink-muted);
  text-align: right;
}

.alt-list {
  list-style: none;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.alt-item {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.8rem 0.95rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.alt-title {
  font-size: var(--text-sm); font-weight: 600;
}
.alt-meta {
  font-size: 11px; color: var(--ink-muted);
  margin-top: 0.1rem;
  max-width: 22ch;
  line-height: 1.35;
}
.pill {
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: 600;
  background: var(--ink);
  color: var(--ink-inverse);
  white-space: nowrap;
  transition: var(--transition);
}
.pill:hover { background: color-mix(in srgb, var(--ink) 88%, var(--amber)); }
.pill-caution {
  background: transparent;
  border: 1px solid var(--amber);
  color: var(--amber);
}
.pill-caution:hover { background: color-mix(in srgb, var(--amber) 15%, transparent); }
.pill-warn {
  background: color-mix(in srgb, var(--amber) 18%, transparent);
  color: var(--amber);
}
.pill-quiet {
  background: color-mix(in srgb, var(--safe) 14%, transparent);
  color: var(--safe);
}

.report-card {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex; align-items: center; gap: 0.9rem;
}
.report-title { font-size: var(--text-sm); font-weight: 600; }
.report-sub { font-size: 11px; color: var(--ink-muted); margin-top: 0.15rem; line-height: 1.35; }

.switch {
  position: relative; display: inline-block;
  width: 42px; height: 24px; flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0;
  background: var(--ink-faint);
  border-radius: var(--radius-pill);
  transition: var(--transition);
}
.switch span::before {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff;
  transition: var(--transition);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.switch input:checked + span { background: var(--safe); }
.switch input:checked + span::before { transform: translateX(18px); }

/* ==========================================================
   Screen 6: History
   ========================================================== */
.screen-body-history { padding-bottom: 20px; }
.stat-strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem;
  padding: 0.85rem 0.5rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.stat { text-align: center; }
.stat-num {
  font-family: var(--font-display);
  font-size: 1.5rem; font-weight: 500;
  line-height: 1;
}
.stat-num-warn { color: var(--amber); }
.stat-label {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 0.25rem;
  letter-spacing: 0.04em;
}

.map-card {
  position: relative;
  margin-top: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  color: var(--ink);
  overflow: hidden;
}
.map-card svg { width: 100%; height: 160px; display: block; }
.pin { transition: transform 200ms; }
.pin-ok { fill: var(--safe); }
.pin-warn { fill: var(--amber); }
.map-caption {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 0.3rem;
  padding: 0 0.35rem 0.15rem;
  letter-spacing: 0.03em;
}

.history-list {
  list-style: none;
  margin-top: 1rem;
  display: flex; flex-direction: column;
}
.history-item {
  position: relative;
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
  transition: var(--transition);
}
.history-item:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.history-item:last-child { border-bottom: none; }
.history-line {
  width: 4px;
  align-self: stretch;
  border-radius: 2px;
  background: color-mix(in srgb, var(--safe) 30%, transparent);
}
.history-item-warn .history-line { background: color-mix(in srgb, var(--amber) 50%, transparent); }
.history-place {
  font-family: var(--font-display);
  font-size: 1rem; font-weight: 500;
}
.history-meta {
  font-size: 11px; color: var(--ink-muted);
  margin-top: 0.1rem;
}
.history-item > div:nth-child(2) { flex: 1; min-width: 0; }
.history-item .pill { padding: 0.25rem 0.55rem; font-size: 10px; }

/* ==========================================================
   Screen 7: Dispose
   ========================================================== */
.screen-body-dispose { padding-bottom: 30px; }

.dispose-illus {
  margin: 1rem 0 0.5rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--ink-2);
}
.dispose-illus svg { width: 100%; height: 130px; display: block; }

.dispose-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  margin-bottom: 0.75rem;
}
.dispose-summary-label {
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-muted);
}
.dispose-list {
  list-style: none;
  margin-top: 0.6rem;
  display: flex; flex-direction: column;
}
.dispose-list li {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--divider);
  font-size: var(--text-xs);
}
.dispose-list li:last-child { border-bottom: none; }
.dispose-list span { color: var(--ink-muted); }
.dispose-list b { font-weight: 600; color: var(--ink); }

.reorder-card {
  background: color-mix(in srgb, var(--safe) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--safe) 30%, var(--border));
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex; align-items: center; gap: 0.8rem;
  margin-bottom: 1rem;
}
.reorder-card > div { flex: 1; }
.reorder-title { font-size: var(--text-sm); font-weight: 600; }
.reorder-sub { font-size: 11px; color: var(--ink-muted); margin-top: 0.15rem; }

/* ==========================================================
   Notes column
   ========================================================== */
.notes {
  padding: 2rem 0;
  color: var(--ink-2);
  max-width: 460px;
}
.notes-eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
}
.notes h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 500;
  margin-top: 0.5rem;
  color: var(--ink);
}
.notes h2 + ul, .notes h2 + ol { margin-top: 0.75rem; }
.notes h2 { margin-top: 1.75rem; }
.notes h2:first-of-type { margin-top: 0.35rem; }
.notes ul, .notes ol {
  padding-left: 1.15rem;
  display: flex; flex-direction: column; gap: 0.6rem;
}
.notes li {
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--ink-2);
}
.notes li b { color: var(--ink); font-weight: 600; }

/* ==========================================================
   Pass 2 (lab quality pass): every screen built out,
   full-bleed app on phones, flow rail on wide screens.
   ========================================================== */

/* ---------- Focus ---------- */
button:focus-visible, .report-card:focus-within {
  outline: 2px solid var(--amber); outline-offset: 2px;
}
.pin-g:focus { outline: none; }
.pin-g:focus-visible .pin { stroke: var(--ink); stroke-width: 3; }

/* ---------- Control bar ---------- */
.proto-bar { padding: 0.6rem 1.5rem; }
.proto-chip { min-height: 36px; padding: 0 0.85rem; font-size: 0.8rem; }
.proto-chip:focus-visible { outline-offset: 0; }
.proto-theme .i-sun { display: none; }
[data-theme='dark'] .proto-theme .i-sun { display: block; }
[data-theme='dark'] .proto-theme .i-moon { display: none; }
@media (max-width: 1100px) and (min-width: 561px) {
  .proto-bar { flex-wrap: wrap; row-gap: 0.4rem; }
  .proto-theme { margin-left: auto; }
  .proto-nav { order: 3; flex: 1 0 100%; margin-left: 0; justify-content: center; }
}

/* ---------- Stage ---------- */
.stage {
  grid-template-columns: auto minmax(0, 460px);
  padding: 1rem 1.5rem 5rem;
  max-width: 1440px;
  align-items: start;
}
.rail { display: none; }
@media (max-width: 900px) {
  .stage { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .notes { max-width: 560px; width: 100%; }
}
@media (min-width: 1500px) {
  .stage { grid-template-columns: 250px auto minmax(0, 500px); gap: 4.5rem; }
  .rail { display: block; position: sticky; top: calc(var(--lab-bar-h, 0px) + 80px); padding-top: 2rem; }
  .proto-nav { visibility: hidden; }
  .notes { padding-top: 2rem; }
  .notes-title { font-size: 2.1rem; }
  .notes-lede { font-size: 1.05rem; }
}
.rail-eyebrow, .now-eyebrow, .notes-h3 {
  font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-muted);
}
.rail-list { list-style: none; margin-top: 0.9rem; display: flex; flex-direction: column; gap: 0.25rem; border-left: 1px solid var(--border); }
.rail-step {
  display: flex; gap: 0.85rem; align-items: flex-start; width: 100%; text-align: left;
  padding: 0.6rem 0.9rem; margin-left: -1px; border-left: 2px solid transparent;
  color: var(--ink-muted); transition: var(--transition);
}
.rail-step:hover { color: var(--ink); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.rail-step.is-active { color: var(--ink); border-left-color: var(--amber); background: var(--surface); }
.rail-num { font-family: var(--font-display); font-size: 0.85rem; padding-top: 0.1rem; color: var(--ink-faint); }
.rail-step.is-active .rail-num { color: var(--amber); }
.rail-step b { display: block; font-weight: 600; font-size: var(--text-sm); }
.rail-step small { display: block; font-size: var(--text-xs); line-height: 1.4; margin-top: 0.1rem; }

/* ---------- Phone frame ---------- */
.phone { width: clamp(360px, calc((100dvh - var(--lab-bar-h, 0px) - 120px) * 0.4615), 410px); max-width: 100%; }
.phone.is-buzzing { animation: buzz 0.5s linear 2; }
@keyframes buzz {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px) rotate(-0.4deg); }
  40% { transform: translateX(4px) rotate(0.4deg); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) { .phone.is-buzzing { animation: none; outline: 3px solid var(--amber); } }

/* ---------- Screens ---------- */
.screen {
  padding: 56px 20px 28px;
  visibility: hidden;
  transition: opacity 320ms ease, transform 380ms cubic-bezier(0.2, 0.8, 0.3, 1), visibility 0s linear 380ms;
}
.screen.is-active { visibility: visible; transition-delay: 0s; }
.screen-tab { padding-bottom: 104px; }
.screen > .screen-body { flex: 1 0 auto; }
.screen-actions { padding-top: 0.5rem; }
.tab-head { margin-bottom: 1.1rem; }

/* ---------- Buttons ---------- */
.btn-sm { height: 44px; padding: 0 1.1rem; }
.btn-outline {
  background: transparent; color: var(--ink);
  border: 1px solid var(--border);
  font-size: var(--text-sm); font-weight: 600;
}
.btn-outline:hover { border-color: var(--ink-faint); background: var(--surface); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn-ghost { min-height: 44px; }
.btn-light { background: #fbf6ec; color: #201d16; margin-top: auto; }
.btn-light:hover { background: #fff; }
.btn-primary.is-on { background: var(--safe); color: #fff; }
.icon-btn { width: 40px; height: 40px; }
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  display: inline-block; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Set-up choices + segmented controls ---------- */
.choice-list { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1.25rem; }
.choice {
  display: flex; gap: 0.8rem; align-items: flex-start; text-align: left;
  padding: 0.9rem 1rem; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--border);
  transition: var(--transition);
}
.choice:hover { border-color: var(--ink-faint); }
.choice[aria-checked='true'] { border-color: color-mix(in srgb, var(--safe) 55%, var(--border)); background: color-mix(in srgb, var(--safe) 7%, var(--surface)); }
.choice-mark { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--ink-faint); flex-shrink: 0; margin-top: 0.1rem; position: relative; }
.choice[aria-checked='true'] .choice-mark { border-color: var(--safe); }
.choice[aria-checked='true'] .choice-mark::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: var(--safe); }
.choice-title { display: block; font-weight: 600; font-size: var(--text-sm); }
.choice-sub { display: block; font-size: var(--text-xs); color: var(--ink-muted); line-height: 1.4; margin-top: 0.15rem; }
.field-label, .set-label { font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-muted); margin: 1.4rem 0 0.55rem; }
.seg {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; padding: 4px;
  background: var(--surface-sunk); border: 1px solid var(--border); border-radius: var(--radius-pill);
}
.seg-3 { grid-template-columns: repeat(3, 1fr); }
.seg-btn {
  min-height: 40px; padding: 0 0.5rem; border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: 600; color: var(--ink-muted);
  transition: var(--transition); white-space: nowrap;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn[aria-checked='true'] { background: var(--surface-2); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- Home ---------- */
.home-head { margin-bottom: 1.1rem; }
.meter-of { color: var(--ink-faint); font-size: 0.95rem; }
.ready-foot { margin-top: 0.85rem; padding-top: 0.7rem; border-top: 1px solid color-mix(in srgb, var(--safe) 18%, var(--border)); font-size: var(--text-xs); color: var(--ink-muted); }
.ready-foot b { color: var(--ink); font-weight: 600; }
.quick-action { min-height: 44px; }
.next-row, .action-row {
  display: flex; align-items: center; gap: 0.8rem; width: 100%; text-align: left;
  padding: 0.75rem 0.9rem; min-height: 56px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  transition: var(--transition);
}
.next-row { margin-top: 0.75rem; }
.next-row:hover, .action-row:hover { border-color: var(--ink-faint); }
.action-row:disabled { opacity: 0.6; cursor: progress; }
.next-icon {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber);
}
.next-text { flex: 1; min-width: 0; }
.next-text b { display: block; font-size: var(--text-sm); font-weight: 600; }
.next-text small { display: block; font-size: var(--text-xs); color: var(--ink-muted); }
.next-chev { color: var(--ink-faint); font-size: 1.3rem; line-height: 1; }
.action-list { display: flex; flex-direction: column; gap: 0.5rem; }

/* ---------- Tab bar (shared across the four tab screens) ---------- */
.tabbar {
  z-index: 6; padding: 0.35rem 0.5rem 1rem;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity 220ms ease, transform 260ms ease, visibility 0s linear 260ms;
}
.screens.has-tabs .tabbar { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem;
  min-height: 52px; padding: 0.35rem 0.25rem; font-size: 0.7rem;
}
.tab svg { opacity: 0.75; }
.tab.is-active { color: var(--amber); }
.tab.is-active svg { opacity: 1; }
.tab:hover { color: var(--ink); }

/* ---------- Live meal ---------- */
.meal-live.is-done { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink-muted); }
.meal-live.is-done .meal-live-dot { animation: none; background: var(--ink-faint); }
.meal-hint-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.meal-hint-actions .btn { flex: 1 1 auto; }
.meal-ring-wrap { width: 200px; height: 200px; }
.bite-divider {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--safe); padding: 0.6rem 0.25rem 0.2rem;
}
.bite-item.is-hot { border-color: color-mix(in srgb, var(--hot) 40%, var(--border)); }
.bite-item.is-hot .bite-verdict { color: var(--hot); background: color-mix(in srgb, var(--hot) 16%, transparent); }

/* ---------- Alert ---------- */
.alert-ring { width: 220px; height: 220px; color: var(--ink); }
.alert-ring svg circle[data-alert-arc] { transition: stroke-dasharray 600ms ease; }
.alert-actions .btn-outline { height: 48px; }

/* ---------- Send back ---------- */
.chip-btn { min-height: 36px; padding: 0 0.8rem; }
.pill { min-height: 36px; padding: 0 0.85rem; }
.pill.is-ordered { background: var(--safe); color: #fff; }
.ordered-card {
  margin-top: 0.9rem; padding: 0.85rem 1rem;
  display: flex; align-items: center; gap: 0.75rem;
  background: color-mix(in srgb, var(--safe) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--safe) 32%, var(--border));
  border-radius: var(--radius-md);
  animation: fadeUp 320ms ease-out both;
}
.ordered-card[hidden] { display: none; }
.ordered-card > div { flex: 1; min-width: 0; }
.ordered-title { font-size: var(--text-sm); font-weight: 600; }
.ordered-sub { font-size: 11px; color: var(--ink-muted); margin-top: 0.1rem; line-height: 1.35; }
.report-card { cursor: pointer; }
.report-text { flex: 1; min-width: 0; }
.report-title, .report-sub { display: block; }
.report-card-flat { margin-top: 0; }
.switch { width: 48px; height: 28px; }
.switch span::before { width: 24px; height: 24px; }
.switch input:checked + span::before { transform: translateX(20px); }

/* ---------- History ---------- */
.map-card svg { height: auto; aspect-ratio: 360 / 170; }
.map-label { font-size: 9px; fill: var(--ink-faint); letter-spacing: 0.08em; text-transform: uppercase; }
.pin-g { cursor: pointer; }
.pin-hit { fill: transparent; }
.pin { stroke: var(--surface); stroke-width: 2; transition: opacity 160ms; }
.pin.is-dim { opacity: 0.25; }
.pin-label { font-size: 10px; font-weight: 600; fill: var(--ink-2); text-anchor: middle; opacity: 0; transition: opacity 160ms; pointer-events: none; }
.pin-g:hover .pin-label, .pin-g:focus-visible .pin-label { opacity: 1; }
.history-filter { margin-top: 1rem; }
.history-list li { list-style: none; border-bottom: 1px solid var(--divider); }
.history-list li:last-child { border-bottom: none; }
.history-item { width: 100%; text-align: left; border-bottom: none; padding: 0.7rem 0.4rem; min-height: 60px; border-radius: var(--radius-sm); }
.history-body { flex: 1; min-width: 0; }
.history-place, .history-meta { display: block; }
.history-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item .next-chev { margin-left: -0.2rem; }
.history-list .empty { padding: 1.5rem 0; text-align: center; font-size: var(--text-sm); color: var(--ink-muted); border: none; }

/* ---------- Meal detail ---------- */
.detail-head { margin-bottom: 1rem; }
.detail-head .pill { display: inline-flex; align-items: center; min-height: 28px; margin-top: 0.6rem; padding: 0 0.7rem; font-size: 11px; }
.detail-dish { font-size: var(--text-sm); color: var(--ink-2); margin-top: 0.3rem; }
.stat-num-sm { font-size: 1rem; line-height: 1.5rem; }
.detail-section { font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-muted); margin: 1.2rem 0 0.55rem; }
.detail-note { margin-top: 0.4rem; }
.detail-note p:last-child { font-size: var(--text-sm); color: var(--ink-2); }
.detail-share { margin-top: 1rem; font-size: var(--text-xs); color: var(--ink-muted); }

/* ---------- Case ---------- */
.case-hero {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  padding: 0.75rem 0 1rem; margin-bottom: 0.75rem;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--safe) 10%, transparent), transparent);
}
.case-hero .pair-case { width: 140px; height: 120px; }
.case-state { display: inline-flex; align-items: center; gap: 0.55rem; font-size: var(--text-sm); font-weight: 600; color: var(--safe); }
.status-list {
  list-style: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 0.35rem 1rem; margin-bottom: 0.9rem;
}
.status-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--divider); font-size: var(--text-sm); }
.status-list li:last-child { border-bottom: none; }
.status-list span { color: var(--ink-muted); }
.status-list b { font-weight: 600; text-align: right; }
.calib { margin: -0.2rem 0 0.9rem; padding: 0.75rem 1rem; border-radius: var(--radius-md); background: color-mix(in srgb, var(--safe) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--safe) 25%, var(--border)); }
.calib[hidden] { display: none; }
.calib-label { font-size: var(--text-xs); color: var(--ink-2); }
.calib-bar > div { transition: width 200ms linear; }

/* ---------- Cleanout ---------- */
.screen[data-screen='dispose'] .lede { max-width: none; }
.dispose-illus svg { height: 110px; }

/* ---------- Settings ---------- */
.set-group { margin-bottom: 0.3rem; }
.set-group .set-label { margin-top: 1.1rem; }
.set-group:first-of-type .set-label { margin-top: 0; }
.set-help { font-size: var(--text-xs); color: var(--ink-muted); margin-top: 0.5rem; }
.set-btn { margin-top: 0.6rem; width: 100%; }
.about { margin-top: 1.4rem; font-size: 11px; line-height: 1.5; color: var(--ink-muted); }

/* ---------- Sheets, server card, toast (all inside the phone) ---------- */
.sheet-backdrop {
  position: absolute; inset: 0; z-index: 20;
  background: rgba(20, 18, 14, 0.45); opacity: 0; transition: opacity 200ms ease;
}
.sheet-backdrop.is-on { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 21;
  padding: 0.6rem 1.25rem 1.6rem;
  background: var(--surface); border-radius: 24px 24px 0 0;
  box-shadow: 0 -20px 40px -20px rgba(0,0,0,0.35);
  transform: translateY(100%); transition: transform 300ms cubic-bezier(0.2, 0.9, 0.3, 1);
}
.sheet.is-on { transform: none; }
.sheet-grip { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--ink-faint); margin: 0 auto 0.9rem; }
.sheet-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 500; margin-bottom: 0.8rem; }
.sheet-actions { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }
.sheet-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.sheet-row .btn { height: 48px; }
.share-preview { padding: 0.9rem 1rem; border-radius: var(--radius-md); background: var(--bg); border: 1px solid var(--border); }
.share-eyebrow { font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--amber); }
.share-main { font-family: var(--font-display); font-size: 1.05rem; margin-top: 0.2rem; }
.share-meta { font-size: var(--text-xs); color: var(--ink-muted); margin-top: 0.1rem; }
.ask-script { font-family: var(--font-display); font-size: 1.05rem; line-height: 1.4; color: var(--ink); }
.server-card {
  position: absolute; inset: 0; z-index: 22;
  display: flex; flex-direction: column; gap: 1rem;
  padding: 64px 26px 32px;
  background: #201d16; color: #fbf6ec;
  opacity: 0; transform: scale(0.98); transition: opacity 220ms ease, transform 260ms ease;
}
.server-card.is-on { opacity: 1; transform: none; }
.server-eyebrow { font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: #e8a447; }
.server-big { font-family: var(--font-display); font-size: 2.4rem; line-height: 1.02; font-weight: 500; }
.server-text { font-size: 1.15rem; line-height: 1.45; color: #efe6d3; }
.server-text b { color: #fff; }
.sheet[hidden], .server-card[hidden], .sheet-backdrop[hidden] { display: none; }
.toast {
  position: absolute; left: 14px; right: 14px; bottom: 18px; z-index: 30;
  padding: 0.75rem 0.95rem; border-radius: var(--radius-md);
  background: var(--ink); color: var(--ink-inverse);
  font-size: var(--text-xs); font-weight: 500; line-height: 1.4;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity 200ms ease, transform 240ms ease;
}
.toast.is-on { opacity: 1; transform: none; }
.screens.has-tabs .toast { bottom: 86px; }

/* ---------- Notes column ---------- */
.notes { padding: 1.5rem 0 2rem; max-width: 500px; }
.notes-title { font-family: var(--font-display); font-size: 1.85rem; font-weight: 500; line-height: 1.08; color: var(--ink); margin-top: 0.5rem; }
.notes-lede { margin-top: 0.9rem; font-size: var(--text-base); line-height: 1.6; color: var(--ink-2); }
.notes-callout {
  margin-top: 1.1rem; padding: 0.85rem 1rem; border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--amber) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--amber) 30%, var(--border));
  font-size: var(--text-sm); line-height: 1.5; color: var(--ink-2);
}
.notes-callout b { color: var(--ink); }
.now-card {
  margin-top: 1.4rem; padding: 1.1rem 1.2rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.now-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 500; margin-top: 0.3rem; color: var(--ink); }
.now-body { font-size: var(--text-sm); line-height: 1.55; color: var(--ink-2); margin-top: 0.35rem; }
.now-try { margin-top: 0.7rem; font-size: var(--text-sm); color: var(--ink); display: flex; gap: 0.6rem; align-items: baseline; }
.now-try span:first-child {
  flex-shrink: 0; font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.15rem 0.5rem; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--safe) 15%, transparent); color: var(--safe);
}
.notes-h3 { margin-top: 1.8rem; }
.principles { list-style: none; margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.85rem; padding: 0; }
.principles li { font-size: var(--text-sm); line-height: 1.55; color: var(--ink-2); padding-left: 1rem; border-left: 2px solid var(--border); }
.principles b { display: block; color: var(--ink); font-weight: 600; }

/* ---------- Review fixes ---------- */
.screen > * { flex-shrink: 0; }
.meter-value [data-swabs] { color: inherit; font-size: inherit; }
.history-item .pill, .detail-head .pill { min-height: 0; height: 24px; display: inline-flex; align-items: center; padding: 0 0.6rem; font-size: 10.5px; }
.section-title { flex-direction: column; align-items: flex-start; gap: 0.1rem; }
.section-title span { text-align: left; }
.notes-h3, .now-eyebrow { font-family: var(--font-body); }
.meal-band { height: auto; background: none; border: none; padding: 16px 2px 0; }
.meal-band::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 8px; border-radius: var(--radius-pill);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--safe) 45%, var(--surface)) 0 33%,
    color-mix(in srgb, var(--amber) 45%, var(--surface)) 33% 66%,
    color-mix(in srgb, var(--hot) 45%, var(--surface)) 66% 100%);
}
.meal-band-marker { top: 4px; }
.meal-band-tick { font-size: 9.5px; }
.bite-title { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.bite-time { flex-shrink: 0; font-size: 11px; font-weight: 500; color: var(--ink-faint); }

.alt-meta { max-width: none; }

[data-theme='dark'] .btn-warning { color: #14120e; }
[data-theme='dark'] .pill.is-ordered { color: #14120e; }
[data-theme='dark'] .btn-primary.is-on { color: #14120e; }

/* ---------- Phones: the app fills the screen, no device frame ---------- */
@media (max-width: 560px) {
  .proto-bar { position: sticky; padding: 0; gap: 0; height: 52px; flex-wrap: nowrap; }
  .proto-brand, .proto-theme { display: none; }
  .proto-nav {
    margin: 0; flex: 1; height: 100%; align-items: center; flex-wrap: nowrap;
    overflow-x: auto; padding: 0 12px; gap: 4px; scrollbar-width: none;
  }
  .proto-nav::-webkit-scrollbar { display: none; }
  .proto-chip { min-height: 44px; padding: 0 14px; font-size: 13px; flex-shrink: 0; }
  .stage { display: block; padding: 0; max-width: none; }
  .phone {
    width: 100%; max-width: none; aspect-ratio: auto; min-height: 560px;
    border-radius: 0; padding: 0; box-shadow: none; background: var(--bg);
  }
  .phone.is-buzzing { animation: none; }
  .phone-notch, .phone-status, .phone-home { display: none; }
  .screens { inset: 0; border-radius: 0; }
  .screen { padding: 18px 18px 26px; }
  .screen-tab { padding-bottom: 100px; }
  .tabbar { padding-bottom: max(0.5rem, env(safe-area-inset-bottom)); }
  .icon-btn { width: 44px; height: 44px; }
  .chip-btn, .pill { min-height: 44px; }
  .seg-btn { min-height: 44px; }
  .server-card { padding-top: 40px; }
  .notes { padding: 2rem 18px 3rem; max-width: none; border-top: 1px solid var(--border); }
  .notes-title { font-size: 1.6rem; }
}
