:root {
  color-scheme: light;
  --ink: #172018;
  --ink-soft: #617064;
  --paper: #f5f3eb;
  --surface: #ffffff;
  --lime: #c9ff52;
  --lime-deep: #9be124;
  --line: rgba(23, 32, 24, 0.1);
  --shadow: 0 28px 80px rgba(28, 31, 25, 0.16);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #e7e5de;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 10%, rgba(201, 255, 82, 0.26), transparent 22rem),
    linear-gradient(135deg, #eceae3, #dbdcd3);
  display: grid;
  place-items: center;
  padding: 42px 20px;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.prototype-note {
  position: fixed;
  top: 20px;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #5c6259;
  font-size: 13px;
}

.prototype-note span:first-child {
  color: #172018;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(23, 32, 24, 0.08);
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 700;
}

.prototype-note span:first-child.is-ready {
  color: #365204;
  background: rgba(201, 255, 82, 0.72);
}

.app-shell {
  position: relative;
  width: min(100%, 430px);
  height: min(900px, calc(100vh - 84px));
  min-height: 680px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid rgba(23, 32, 24, 0.08);
  border-radius: 44px;
  box-shadow: var(--shadow);
  isolation: isolate;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.screen::-webkit-scrollbar {
  display: none;
}

.screen.is-active {
  display: block;
  animation: screen-in 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-header,
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(20px + env(safe-area-inset-top)) 22px 12px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.wordmark-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--lime);
  border-radius: 12px;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.app-header {
  position: relative;
  align-items: flex-start;
}

.header-actions {
  position: absolute;
  z-index: 20;
  top: calc(20px + env(safe-area-inset-top));
  inset-inline-end: 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
}

.language-switcher {
  position: relative;
}

.language-button {
  min-width: 58px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 10px;
  font-weight: 850;
  box-shadow: 0 5px 14px rgba(23, 32, 24, 0.05);
}

.language-button > svg:first-child {
  width: 14px;
  height: 14px;
}

.language-button svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.language-chevron {
  width: 11px;
  height: 11px;
  transition: transform 160ms ease;
}

.language-button[aria-expanded="true"] .language-chevron {
  transform: rotate(180deg);
}

.language-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 7px);
  inset-inline-end: 0;
  width: 184px;
  max-height: 306px;
  overflow-y: auto;
  padding: 7px;
  border: 1px solid rgba(23, 32, 24, 0.1);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 44px rgba(23, 32, 24, 0.18);
  backdrop-filter: blur(18px);
}

.language-menu[hidden] {
  display: none;
}

.language-menu button {
  position: relative;
  width: 100%;
  min-height: 35px;
  display: flex;
  align-items: center;
  padding: 7px 30px 7px 11px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  cursor: pointer;
  text-align: start;
  font-size: 12px;
  font-weight: 700;
}

.language-menu button:hover,
.language-menu button:focus-visible {
  outline: none;
  background: rgba(201, 255, 82, 0.22);
}

.language-menu button[aria-checked="true"] {
  background: rgba(201, 255, 82, 0.42);
}

.language-menu button[aria-checked="true"]::after {
  position: absolute;
  inset-inline-end: 11px;
  content: "✓";
  color: #5d850d;
  font-weight: 900;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.64);
  cursor: pointer;
}

.icon-button svg,
.secondary-action svg,
.oil-note-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.capture-copy {
  padding: 22px 28px 18px;
}

.eyebrow {
  margin: 0 0 9px;
  color: #699210;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.capture-copy h1 {
  margin: 0;
  max-width: 330px;
  font-size: clamp(38px, 10vw, 52px);
  line-height: 0.98;
  letter-spacing: -0.07em;
}

html[lang="en"] .capture-copy h1,
html[lang="es-419"] .capture-copy h1,
html[lang="pt-BR"] .capture-copy h1,
html[lang="ms"] .capture-copy h1,
html[lang="id"] .capture-copy h1,
html[lang="ar"] .capture-copy h1 {
  font-size: clamp(33px, 8.5vw, 45px);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

html[lang="ja"] .capture-copy h1,
html[lang="ko"] .capture-copy h1 {
  font-size: clamp(35px, 9vw, 47px);
  line-height: 1.03;
  letter-spacing: -0.055em;
}

html[dir="rtl"] .capture-copy,
html[dir="rtl"] .history-intro,
html[dir="rtl"] .result-body,
html[dir="rtl"] .sheet-panel {
  text-align: right;
}

html[dir="rtl"] .annotated-meal {
  direction: ltr;
}

html[dir="rtl"] .food-callout strong {
  direction: rtl;
  text-align: right;
}

.capture-copy > p:last-child {
  margin: 15px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.model-picker {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: -2px 18px 12px;
  padding: 6px 7px 6px 11px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.5);
}

.model-picker-label {
  flex: 0 0 auto;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 750;
}

.provider-options {
  min-width: 0;
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
}

.provider-options::-webkit-scrollbar {
  display: none;
}

.provider-loading {
  padding: 6px 8px;
  color: #8b9188;
  font-size: 9px;
}

.provider-chip {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ink-soft);
  background: #ecebe4;
  cursor: pointer;
  font-size: 9px;
  font-weight: 750;
}

.provider-chip.is-selected {
  color: var(--ink);
  border-color: rgba(111, 157, 22, 0.24);
  background: var(--lime);
}

.provider-chip:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.camera-stage {
  position: relative;
  width: calc(100% - 36px);
  aspect-ratio: 1 / 1.02;
  display: block;
  margin: 4px 18px 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-xl);
  background: #20251f;
  cursor: pointer;
}

.camera-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.82) brightness(0.65);
  transform: scale(1.02);
}

.camera-shade {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, transparent 36%, rgba(0, 0, 0, 0.16) 100%);
}

.frame-corner {
  position: absolute;
  width: 30px;
  height: 30px;
  border-color: var(--lime);
  border-style: solid;
}

.corner-one { top: 24px; left: 24px; border-width: 3px 0 0 3px; border-radius: 12px 0 0 0; }
.corner-two { top: 24px; right: 24px; border-width: 3px 3px 0 0; border-radius: 0 12px 0 0; }
.corner-three { bottom: 24px; left: 24px; border-width: 0 0 3px 3px; border-radius: 0 0 0 12px; }
.corner-four { right: 24px; bottom: 24px; border-width: 0 3px 3px 0; border-radius: 0 0 12px 0; }

.camera-guidance {
  position: absolute;
  inset: auto 0 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: white;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
}

.camera-guidance strong {
  font-size: 14px;
}

.camera-guidance small {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
}

.capture-actions {
  display: grid;
  grid-template-columns: 1fr 88px 1fr;
  align-items: center;
  gap: 10px;
  padding: 18px 22px 10px;
}

.secondary-action,
.text-button,
.edit-link {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.shutter {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  justify-self: center;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.shutter span {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--lime);
  transition: transform 160ms ease;
}

.shutter:active span {
  transform: scale(0.9);
}

.capture-footnote {
  margin: 4px 0 26px;
  color: #8b9188;
  text-align: center;
  font-size: 11px;
}

.capture-footnote.is-error {
  color: #a44635;
  font-weight: 650;
}

.history-screen {
  background:
    radial-gradient(circle at 88% 8%, rgba(201, 255, 82, 0.22), transparent 15rem),
    var(--paper);
}

.history-header {
  position: sticky;
  z-index: 5;
  top: 0;
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  padding: calc(20px + env(safe-area-inset-top)) 22px 14px;
  background: linear-gradient(to bottom, rgba(245, 243, 235, 0.98) 74%, rgba(245, 243, 235, 0));
}

.history-header > div {
  text-align: center;
}

.history-header p {
  margin: 0 0 2px;
  color: #699210;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.history-header h2 {
  margin: 0;
  font-size: 17px;
}

.history-clear-button {
  width: 42px;
  padding: 7px 0;
  border: 0;
  color: #7d867b;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
}

.history-clear-button:disabled {
  cursor: default;
  opacity: 0.32;
}

.history-intro {
  margin: 12px 22px 16px;
  padding: 20px;
  border: 1px solid rgba(23, 32, 24, 0.07);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 12px 34px rgba(31, 38, 28, 0.06);
}

.history-intro > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.history-kicker {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.history-intro strong {
  font-size: 24px;
  letter-spacing: -0.05em;
}

.history-intro p {
  margin: 9px 0 0;
  color: #828980;
  font-size: 10px;
  line-height: 1.55;
}

.history-list {
  display: grid;
  gap: 22px;
  padding: 0 18px calc(28px + env(safe-area-inset-bottom));
}

.history-day-section {
  display: grid;
  gap: 9px;
}

.history-day-section + .history-day-section {
  padding-top: 4px;
  border-top: 1px solid rgba(23, 32, 24, 0.1);
}

.history-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
  border-left: 4px solid var(--lime-deep);
  border-radius: 17px;
  background: rgba(230, 243, 200, 0.72);
}

.history-day-section:nth-child(even) .history-day-header {
  border-left-color: #9eb6a4;
  background: rgba(229, 235, 226, 0.78);
}

.history-day-title strong,
.history-day-title span,
.history-day-summary time,
.history-day-summary span,
.history-day-summary strong {
  display: block;
}

.history-day-title strong {
  font-size: 20px;
  letter-spacing: -0.04em;
}

.history-day-title span {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 650;
}

.history-day-summary {
  min-width: 96px;
  text-align: right;
}

.history-day-summary time {
  color: var(--ink-soft);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.history-day-summary > span {
  margin-top: 4px;
  color: #6b7469;
  font-size: 8px;
}

.history-day-summary strong {
  margin-top: -1px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

.history-day-summary strong small {
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0;
}

.history-day-meals {
  display: grid;
  gap: 9px;
}

.history-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(23, 32, 24, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 28px rgba(31, 38, 28, 0.07);
}

.history-card-main {
  width: 100%;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 10px 46px 10px 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.history-thumb {
  width: 86px;
  height: 86px;
  object-fit: cover;
  border-radius: 16px;
  background: #dde0d8;
}

.history-card-copy {
  min-width: 0;
}

.history-card-items {
  display: block;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 9px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.history-card-time {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 9px;
  white-space: nowrap;
}

.history-period-badge {
  padding: 3px 6px;
  border-radius: 999px;
  color: #405a0d;
  background: rgba(201, 255, 82, 0.56);
  font-size: 8px;
  font-weight: 800;
}

.history-clock {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.history-card-copy strong {
  display: block;
  overflow: hidden;
  margin: 5px 0 7px;
  font-size: 15px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.history-card-calories {
  align-self: center;
  color: var(--ink);
  text-align: right;
  font-size: 20px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

.history-card-calories small {
  display: block;
  margin-top: 1px;
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0;
}

.history-delete-button {
  position: absolute;
  top: 9px;
  right: 8px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #929890;
  background: transparent;
  cursor: pointer;
}

.history-delete-button:hover {
  color: #9d3f32;
  background: #f7e9e5;
}

.history-delete-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-empty {
  display: none;
  min-height: 500px;
  padding: 74px 34px calc(40px + env(safe-area-inset-bottom));
  text-align: center;
}

.history-empty.is-visible {
  display: block;
}

.history-empty-icon {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  border-radius: 26px;
  color: #54760d;
  background: rgba(201, 255, 82, 0.7);
  transform: rotate(-4deg);
}

.history-empty-icon svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-empty h3 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.04em;
}

.history-empty p {
  margin: 9px auto 24px;
  max-width: 250px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
}

.history-empty .primary-button {
  max-width: 240px;
}

.analyzing-screen {
  background: #111510;
  color: white;
}

.analysis-photo {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.analysis-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.56) saturate(0.8);
}

.analysis-vignette {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(17, 21, 16, 0.08), rgba(17, 21, 16, 0.1) 48%, #111510 82%);
}

.scan-grid {
  position: absolute;
  inset: 9% 8% 34%;
  border: 1px solid rgba(201, 255, 82, 0.4);
  border-radius: 30px;
  background-image:
    linear-gradient(rgba(201, 255, 82, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 255, 82, 0.1) 1px, transparent 1px);
  background-size: 42px 42px;
}

.scan-line {
  position: absolute;
  z-index: 2;
  left: 8%;
  right: 8%;
  top: 12%;
  height: 2px;
  background: var(--lime);
  box-shadow: 0 0 26px 8px rgba(201, 255, 82, 0.25);
  animation: scan 1.7s ease-in-out infinite alternate;
}

@keyframes scan {
  to { top: 62%; }
}

.analysis-status {
  position: absolute;
  z-index: 3;
  inset: auto 0 0;
  min-height: 34%;
  padding: 36px 30px calc(34px + env(safe-area-inset-bottom));
}

.orb {
  width: 36px;
  height: 36px;
  position: relative;
  margin-bottom: 18px;
}

.orb span {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--lime);
  mix-blend-mode: screen;
  animation: orb 1.2s ease-in-out infinite alternate;
}

.orb span:nth-child(1) { left: 0; top: 10px; }
.orb span:nth-child(2) { left: 14px; top: 0; animation-delay: 160ms; }
.orb span:nth-child(3) { left: 18px; top: 18px; animation-delay: 320ms; }

@keyframes orb {
  to { transform: translate(4px, 4px) scale(0.72); opacity: 0.45; }
}

.analysis-status .eyebrow {
  color: var(--lime);
}

.analysis-status h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.04em;
}

.analysis-status > p:not(.eyebrow):not(.analysis-count) {
  margin: 8px 0 20px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 13px;
}

.progress-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.progress-track span {
  display: block;
  width: 18%;
  height: 100%;
  border-radius: inherit;
  background: var(--lime);
  transition: width 500ms ease;
}

.analysis-count {
  margin: 9px 0 0;
  color: rgba(255, 255, 255, 0.46);
  font-size: 11px;
}

.result-screen {
  background: var(--paper);
}

.result-header {
  position: relative;
  z-index: 2;
  padding-bottom: 10px;
}

.result-header > div {
  text-align: center;
}

.result-header p {
  margin: 0 0 2px;
  color: #699210;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.result-header h2 {
  margin: 0;
  font-size: 16px;
}

.annotated-meal {
  position: relative;
  width: calc(100% - 24px);
  aspect-ratio: 1 / 1.03;
  margin: 0 12px;
  overflow: hidden;
  border-radius: 28px;
  background: #1b1d19;
}

.annotated-meal > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 42%, rgba(9, 13, 8, 0.04) 58%, rgba(9, 13, 8, 0.13) 100%);
  transition: opacity 220ms ease;
}

.connector-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.connector-layer path {
  fill: none;
  stroke: rgba(216, 255, 124, 0.9);
  stroke-width: 1.5;
  stroke-linecap: square;
  stroke-linejoin: miter;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.58));
}

#markerLayer {
  pointer-events: none;
}

.marker {
  position: absolute;
  z-index: 2;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border: 2px solid #1b2119;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 3px rgba(201, 255, 82, 0.24);
}

.callout-rail {
  position: absolute;
  z-index: 3;
  top: 4.2%;
  right: 3.2%;
  bottom: 4.2%;
  width: 41.8%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 2px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(201, 255, 82, 0.5) rgba(255, 255, 255, 0.08);
  scrollbar-width: thin;
  transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 180ms ease;
}

.callout-rail::-webkit-scrollbar {
  width: 3px;
}

.callout-rail::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: rgba(201, 255, 82, 0.52);
}

.rail-toggle {
  position: absolute;
  z-index: 6;
  top: 14px;
  right: 44.2%;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: var(--lime);
  background: rgba(12, 17, 11, 0.48);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: right 240ms ease, transform 240ms ease, background 180ms ease;
}

.rail-toggle:hover {
  background: rgba(12, 17, 11, 0.66);
}

.rail-toggle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 240ms ease;
}

.annotated-meal.is-rail-collapsed .callout-rail {
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 24px));
}

.annotated-meal.is-rail-collapsed .connector-layer {
  opacity: 0;
}

.annotated-meal.is-rail-collapsed .image-gradient {
  opacity: 0;
}

.annotated-meal.is-rail-collapsed .rail-toggle {
  right: 12px;
}

.annotated-meal.is-rail-collapsed .rail-toggle svg {
  transform: rotate(180deg);
}

.food-callout {
  width: 100%;
  min-height: 42px;
  flex: 0 0 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 3px 7px 3px 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: white;
  background: rgba(8, 13, 8, 0.18);
  backdrop-filter: blur(2px) saturate(0.96);
  cursor: pointer;
  text-align: left;
}

.food-callout span {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.food-callout strong {
  overflow: hidden;
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.82);
}

.food-callout small {
  color: rgba(255, 255, 255, 0.58);
  font-size: 8px;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.food-callout b {
  color: var(--lime);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.86);
}

.food-callout b::after {
  content: " kcal";
  color: rgba(255, 255, 255, 0.5);
  font-size: 7px;
  font-weight: 500;
}

.confidence-chip {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 999px;
  color: white;
  background: rgba(13, 18, 12, 0.62);
  backdrop-filter: blur(12px);
  font-size: 9px;
  font-weight: 700;
}

.confidence-chip span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lime);
}

.result-body {
  padding: 20px 22px calc(30px + env(safe-area-inset-bottom));
}

.total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.total-row p {
  margin: 0 0 2px;
  color: var(--ink-soft);
  font-size: 12px;
}

.total-row strong {
  font-size: 36px;
  line-height: 1;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
}

.total-row strong small {
  color: var(--ink-soft);
  font-size: 13px;
  letter-spacing: 0;
}

.calorie-range {
  display: block;
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
}

.edit-link {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.portion-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 18px;
  padding: 4px;
  border-radius: 14px;
  background: #e9e8e0;
}

.portion-picker button {
  padding: 9px 4px;
  border: 0;
  border-radius: 10px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.portion-picker button.is-selected {
  color: var(--ink);
  background: white;
  box-shadow: 0 3px 10px rgba(30, 34, 28, 0.08);
}

.macro-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 18px;
}

.macro-row > div {
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.macro-row > div:first-child {
  padding-left: 0;
  border-left: 0;
}

.macro-row span,
.macro-row strong {
  display: block;
}

.macro-row span {
  color: var(--ink-soft);
  font-size: 10px;
}

.macro-row strong {
  margin-top: 3px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.oil-note {
  display: flex;
  gap: 12px;
  margin: 20px 0;
  padding: 14px;
  border-radius: 17px;
  background: #ecebd8;
}

.oil-note-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #fff9c7;
}

.oil-note strong {
  font-size: 12px;
}

.oil-note p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.45;
}

.primary-button {
  width: 100%;
  min-height: 52px;
  padding: 13px 18px;
  border: 0;
  border-radius: 17px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease;
}

.primary-button:active {
  transform: scale(0.98);
}

.text-button {
  width: 100%;
  padding: 15px 8px 8px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.result-disclaimer {
  margin: 12px 0 0;
  color: #9a9d96;
  text-align: center;
  font-size: 9px;
}

.edit-sheet {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: none;
}

.edit-sheet.is-open {
  display: block;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  background: rgba(14, 17, 13, 0.52);
  backdrop-filter: blur(3px);
}

.sheet-panel {
  position: absolute;
  inset: auto 0 0;
  padding: 10px 22px calc(24px + env(safe-area-inset-bottom));
  border-radius: 30px 30px 0 0;
  background: var(--surface);
  animation: sheet-in 240ms ease-out;
}

@keyframes sheet-in {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-handle {
  width: 38px;
  height: 4px;
  display: block;
  margin: 0 auto 18px;
  border-radius: 99px;
  background: #d9dbd5;
}

.sheet-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-heading p {
  margin: 0 0 2px;
  color: var(--ink-soft);
  font-size: 10px;
}

.sheet-heading h3 {
  margin: 0;
  font-size: 21px;
}

.weight-editor {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
}

.weight-editor button {
  width: 52px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  cursor: pointer;
  font-size: 22px;
}

.weight-editor > div {
  text-align: center;
}

.weight-editor strong {
  font-size: 42px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.06em;
}

.weight-editor span {
  margin-left: 5px;
  color: var(--ink-soft);
  font-size: 12px;
}

.sheet-calories {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12px;
}

.sheet-calories strong {
  color: var(--ink);
}

.toast {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  padding: 11px 16px;
  border-radius: 999px;
  color: white;
  background: rgba(23, 32, 24, 0.92);
  opacity: 0;
  pointer-events: none;
  font-size: 12px;
  font-weight: 700;
  max-width: calc(100% - 36px);
  text-align: center;
  white-space: normal;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 560px) {
  body {
    display: block;
    padding: 0;
    background: var(--paper);
  }

  .prototype-note {
    display: none;
  }

  .app-shell {
    width: 100%;
    height: 100dvh;
    min-height: 620px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (max-height: 760px) and (min-width: 561px) {
  .capture-copy {
    padding-top: 8px;
    padding-bottom: 10px;
  }

  .capture-copy h1 {
    font-size: 38px;
  }

  .camera-stage {
    width: min(calc(100% - 40px), 330px);
    margin-inline: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
