/* Tally — styles. Tokens first; dark mode follows the system setting. */
html { -webkit-text-size-adjust: 100%; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
/* Layout: single phone-width column; day summary up top, capture actions, then the meal log. Bottom sheet for analysis. */
:root {
  --bg: #f3f5f2;
  --surface: #ffffff;
  --surface-2: #e8ece6;
  --fg: #18201b;
  --muted: #5d6a61;
  --line: #d5dcd3;
  --accent: #1f6b4f;
  --accent-fg: #ffffff;
  --carbs: #c98a12;
  --protein: #2f6fb4;
  --fat: #c4485f;
  --danger: #b4352c;
  --ring-track: #dfe5dc;
  --shadow: 0 10px 30px rgba(24, 40, 30, .14);
  --f-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --f-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111613; --surface: #1a211d; --surface-2: #232c26; --fg: #e8eee9; --muted: #98a59c;
    --line: #2e3831; --accent: #5cc49a; --accent-fg: #0c1a13; --carbs: #e7aa3c; --protein: #6aa6ea;
    --fat: #ec7a8f; --danger: #f07a6f; --ring-track: #28322b; --shadow: 0 10px 30px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111613; --surface: #1a211d; --surface-2: #232c26; --fg: #e8eee9; --muted: #98a59c;
  --line: #2e3831; --accent: #5cc49a; --accent-fg: #0c1a13; --carbs: #e7aa3c; --protein: #6aa6ea;
  --fat: #ec7a8f; --danger: #f07a6f; --ring-track: #28322b; --shadow: 0 10px 30px rgba(0,0,0,.5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 15px; line-height: 1.45;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 12px 48px;
}
.wrap { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }

header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-family: var(--f-display); font-weight: 800; font-size: 26px; letter-spacing: -.02em; margin: 0; }
.brand span { color: var(--accent); }
.iconbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; height: 38px; min-width: 38px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: 14px; }
.iconbtn:hover { border-color: var(--muted); }

.datebar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.datebar .label { font-weight: 600; font-size: 15px; text-align: center; flex: 1; }
.datebar .label small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }

.summary { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 18px; display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.ring { position: relative; width: 136px; height: 136px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring .big { font-family: var(--f-display); font-weight: 800; font-size: 34px; line-height: 1; letter-spacing: -.03em; }
.ring .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.macros { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.macro .row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; }
.macro .name { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.macro .val { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.eaten-note { font-size: 11px; color: var(--muted); margin-top: 3px; }
.bar { height: 8px; background: var(--ring-track); border-radius: 99px; overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; border-radius: 99px; transition: width .4s ease; }
.over { color: var(--danger) !important; }
@media (max-width: 380px) { .summary { grid-template-columns: 1fr; justify-items: center; } .macros { width: 100%; } }

.capture h2, .log h2 { font-family: var(--f-display); font-weight: 700; font-size: 18px; margin: 0 0 10px; letter-spacing: -.01em; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action { position: relative; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 6px; min-height: 96px; }
.action:hover { border-color: var(--accent); }
.action.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.action svg { width: 26px; height: 26px; }
.action b { font-weight: 600; font-size: 15px; }
.action span { font-size: 12.5px; opacity: .78; line-height: 1.3; }
.action input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.notice { font-size: 13px; color: var(--muted); background: var(--surface-2); border-radius: 12px; padding: 10px 12px; margin-top: 10px; }

.meal { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.meal + .meal { margin-top: 10px; }
.meal-head { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px 8px; }
.meal-head b { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.meal-head span { font-family: var(--f-mono); font-size: 13px; }
.entry { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.entry .t { min-width: 0; }
.entry .t div { font-weight: 600; overflow-wrap: anywhere; }
.entry .t small { color: var(--muted); font-size: 12px; display: block; }
.entry .m { font-family: var(--f-mono); font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; margin-top: 2px; flex-wrap: wrap; }
.entry .kcal { font-family: var(--f-display); font-weight: 700; font-size: 18px; text-align: right; }
.entry .kcal small { font-family: var(--f-body); font-weight: 500; font-size: 11px; color: var(--muted); display: block; }
.del { border: 0; background: transparent; color: var(--muted); width: 32px; height: 32px; border-radius: 50%; }
.del:hover { background: var(--surface-2); color: var(--danger); }
.empty { text-align: center; padding: 28px 18px; border: 1.5px dashed var(--line); border-radius: 18px; color: var(--muted); }
.empty b { color: var(--fg); display: block; font-size: 16px; margin-bottom: 4px; }
.status { font-size: 12px; color: var(--muted); text-align: center; }

/* sheet */
.scrim { position: fixed; inset: 0; background: rgba(10, 16, 12, .45); z-index: 20; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--shadow);
  max-height: 92%; overflow-y: auto; padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.sheet-inner { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 2px; }
.sheet h3 { font-family: var(--f-display); font-weight: 700; font-size: 20px; margin: 0; letter-spacing: -.01em; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.preview { width: 100%; max-height: 220px; object-fit: cover; border-radius: 14px; background: var(--surface-2); }
.thinking { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } .bar i { transition: none; } }
.pill { display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; padding: 3px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.pill.high { color: var(--accent); }
.pill.low { color: var(--danger); }
.code { font-family: var(--f-mono); font-size: 12.5px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
/* 16px or larger keeps iPhone Safari from zooming in when a field is tapped. */
input.in, select.in, textarea.in { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 9px 10px; font-size: 16px; color: var(--fg); width: 100%; min-width: 0; }
textarea.in { font: inherit; font-size: 16px; resize: vertical; min-height: 84px; }
.items { display: flex; flex-direction: column; gap: 10px; }
.item { border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.item .top { display: flex; gap: 8px; align-items: center; }
.item .grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.item .grid4 input { padding: 7px 4px; font-family: var(--f-mono); font-size: 16px; text-align: center; }
.item .portion { font-size: 12px; color: var(--muted); }
.item .qty { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); gap: 6px; align-items: center; }
.item .qty .note { font-size: 12px; margin: 0; }
.item .qty input { font-family: var(--f-mono); text-align: center; padding: 7px 4px; }
.item .qty select { padding: 7px 6px; }
/* Each macro box carries its own label directly above it, so the label never drifts away from the field. */
.item .mf { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.item .mf span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: center; font-weight: 600; white-space: nowrap; }
.totals { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 14px; padding: 12px 14px; flex-wrap: wrap; }
.totals .k { font-family: var(--f-display); font-weight: 800; font-size: 26px; }
.totals .mm { font-family: var(--f-mono); font-size: 12.5px; display: flex; gap: 10px; flex-wrap: wrap; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn { border: 0; border-radius: 14px; padding: 13px 16px; font-weight: 600; font-size: 15px; background: var(--accent); color: var(--accent-fg); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--fg); }
.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: default; }
.err { color: var(--danger); font-size: 14px; }
.note { font-size: 13px; color: var(--muted); }
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; display: inline-flex; gap: 6px; align-items: baseline; }
.chip small { font-family: var(--f-mono); font-size: 11px; color: var(--muted); font-weight: 500; }
.chip.on { border-color: var(--accent); color: var(--accent); }
.goal-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) 1fr 1fr minmax(0, .8fr); gap: 8px 8px; align-items: center; }
.goal-grid .gh { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; text-align: center; }
.goal-grid .gname { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.goal-grid input { text-align: center; font-family: var(--f-mono); padding: 8px 4px; }
.goal-grid .gk { font-family: var(--f-mono); font-size: 13px; color: var(--muted); text-align: right; }
#g-sum { flex-direction: column; gap: 4px; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }

/* standalone additions */
.actions { grid-template-columns: 1fr 1fr; }
.scanner { position: relative; width: 100%; aspect-ratio: 3 / 4; max-height: 60vh; background: #000; border-radius: 16px; overflow: hidden; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .frame { position: absolute; left: 10%; right: 10%; top: 35%; bottom: 35%; border: 3px solid rgba(255,255,255,.9); border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); }
.scanner .laser { position: absolute; left: 12%; right: 12%; top: 50%; height: 2px; background: #f3c766; box-shadow: 0 0 8px #f3c766; animation: scan 1.6s ease-in-out infinite alternate; }
@keyframes scan { from { transform: translateY(-40px); } to { transform: translateY(40px); } }
@media (prefers-reduced-motion: reduce) { .scanner .laser { animation: none; } }
.scan-tools { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 8px; z-index: 2; }
.scan-tool { min-width: 48px; height: 40px; padding: 0 12px; border-radius: 20px; border: 1px solid rgba(255,255,255,.5); background: rgba(0,0,0,.55); color: #fff; font: 600 14px/1 system-ui, sans-serif; }
.scan-tool.on { background: #f3c766; color: #111; border-color: #f3c766; }
.mic { width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; margin: 6px auto 0; box-shadow: var(--shadow); }
.mic svg { width: 34px; height: 34px; }
.mic.live { background: var(--danger); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .mic.live { animation: none; } }
.center-note { text-align: center; }
.off-card { display: flex; gap: 12px; align-items: center; }
.off-card img { width: 64px; height: 64px; object-fit: contain; border-radius: 10px; background: #fff; flex: none; }
.src-link { font-size: 12px; color: var(--muted); }
.src-link a { color: inherit; }

/* Type or say it: small mic beside the hint */
.mic-row { display: flex; gap: 12px; align-items: center; }
.mic-row .note { margin: 0; }
.mic.small { width: 52px; height: 52px; margin: 0; flex: none; }
.mic.small svg { width: 24px; height: 24px; }
/* Refine a breakdown: correction box + mic under the totals */
.refine { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.refine .f { margin: 0; }
.refine-row { display: flex; gap: 10px; align-items: flex-start; }
.refine-row textarea { flex: 1; min-height: 52px; }
.refine .note { margin: 0; }
.refine .spinner { display: inline-block; }

/* Search foods */
.search-row { display: flex; gap: 8px; }
.search-row .btn { flex: none; width: auto; padding-left: 16px; padding-right: 16px; }
.results { display: flex; flex-direction: column; gap: 8px; }
.result { display: flex; gap: 10px; align-items: center; text-align: left; width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 12px; padding: 8px 10px; font: inherit; cursor: pointer; }
.result:hover { border-color: var(--accent); }
.result img, .result .ph { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; background: #fff; flex: none; }
.result .ph { background: var(--ring-track); }
.result .rt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.result .rt b { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sr-head { margin: 4px 0 -2px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.result .rt .note { font-size: 12.5px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result .rk { font-size: 12.5px; white-space: nowrap; flex: none; opacity: .85; }

/* saved meals / favorites: favorites and copying from past days */
.log-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.log-head h2 { margin: 0 !important; }
.log-head .iconbtn { white-space: nowrap; flex-shrink: 0; }
.entry { grid-template-columns: 1fr auto auto auto; gap: 4px 8px; }
.star { border: 0; background: transparent; color: var(--muted); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; padding: 0; }
.star:hover { background: var(--surface-2); }
.star.on { color: var(--carbs); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--surface-2); border-radius: 12px; padding: 4px; }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: 8px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.daychips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 4px; scrollbar-width: thin; }
.daychips .chip { flex: none; }
.picklist { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.pick { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line); }
.picklist > .pick:first-child { border-top: 0; }
label.pick { grid-template-columns: auto 1fr auto; cursor: pointer; }
label.pick input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.pick .t { min-width: 0; }
.pick .t div { font-weight: 600; overflow-wrap: anywhere; }
.pick .t small { color: var(--muted); font-size: 12px; display: block; }
.pick .m { font-family: var(--f-mono); font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.pick .kcal { font-family: var(--f-display); font-weight: 700; font-size: 16px; text-align: right; }
.pick .kcal small { font-family: var(--f-body); font-weight: 500; font-size: 11px; color: var(--muted); display: block; }
.pick-meal { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px 6px; background: var(--surface-2); border-top: 1px solid var(--line); }
.picklist > .pick-meal:first-child { border-top: 0; }
.pick-meal b { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }

/* saved meals: named groups of ingredients, logged as one entry */
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.check span { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.check small { color: var(--muted); font-size: 12px; }
.ing-head { display: flex; justify-content: space-between; align-items: baseline; }
.ing-head .note { margin: 0; font-size: 12px; }
.ing-add { display: flex; gap: 8px; flex-wrap: wrap; }
.ing-add .btn { flex: 1 1 140px; }
.ask { display: flex; flex-direction: column; gap: 8px; border: 1px dashed var(--line); border-radius: 14px; padding: 10px; }
.ask .btn { align-self: flex-start; }
.item .amt { padding: 7px 10px; font-size: 16px; }
.yields span { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.yields input { width: 80px; text-align: center; font-family: var(--f-mono); }
.btn.ghost.danger { color: var(--danger); }
.new-meal { width: 100%; }
.mcard { padding: 10px 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.picklist > .mcard:first-child { border-top: 0; }
.mc-top { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; }
.mcard .t { min-width: 0; }
.mcard .t div { font-weight: 600; overflow-wrap: anywhere; }
.mcard .t small { color: var(--muted); font-size: 12px; display: block; overflow-wrap: anywhere; }
.mcard .m { font-family: var(--f-mono); font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.mcard .kcal { font-family: var(--f-display); font-weight: 700; font-size: 16px; text-align: right; }
.mcard .kcal small { font-family: var(--f-body); font-weight: 500; font-size: 11px; color: var(--muted); display: block; }
.mc-act { display: flex; align-items: center; gap: 10px; }
.mc-act .mc-links { margin-right: auto; display: flex; gap: 14px; white-space: nowrap; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { border: 0; background: transparent; color: var(--fg); width: 34px; height: 34px; font-size: 18px; line-height: 1; }
.stepper button:disabled { opacity: .35; }
.stepper span { min-width: 82px; text-align: center; font-family: var(--f-mono); font-size: 12.5px; }

/* ---------- Themes (Settings → Theme). Colors, fonts and backgrounds only; layout and features are the same in every theme.
   No data-skin = Classic, which follows the system light/dark setting above. ---------- */
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-card { text-align: left; border: 1.5px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.theme-card:hover { border-color: var(--muted); }
.theme-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-card b { font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.theme-card small { font-size: 12px; color: var(--muted); line-height: 1.3; }
.theme-sw { display: flex; height: 26px; border-radius: 8px; overflow: hidden; border: 1px solid rgba(127,127,127,.25); }
.theme-sw i { flex: 1; }
.theme-sw i:first-child { flex: 2; }

/* Space Retro: synthwave neon on deep purple with a starfield */
:root[data-skin="retro"] {
  --bg: #0b0620; --surface: #160c33; --surface-2: #22144a; --fg: #f4ecff; --muted: #a99bd1; --line: #3a2a6e;
  --accent: #ff3ea5; --accent-fg: #1a0526; --carbs: #ffcf3f; --protein: #35e0ff; --fat: #ff7a4a; --danger: #ff5470;
  --ring-track: #2a1a57; --shadow: 0 10px 40px rgba(255, 62, 165, .25);
  --f-display: "Orbitron", "Avenir Next", system-ui, sans-serif;
  --f-body: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --f-mono: "Space Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}
:root[data-skin="retro"] body {
  background-color: var(--bg);
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 68% 9%, #ffd6f0 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 85% 32%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 32% 44%, #bfefff 50%, transparent 51%),
    radial-gradient(1px 1px at 52% 71%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 8% 83%, #ffd6f0 50%, transparent 51%),
    radial-gradient(1px 1px at 91% 76%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 41% 93%, #bfefff 50%, transparent 51%),
    linear-gradient(180deg, #0b0620 0%, #1a0b3a 60%, #3b0f4f 100%);
  background-size: 240px 240px, 300px 300px, 280px 280px, 220px 220px, 260px 260px, 320px 320px, 200px 200px, 340px 340px, 100% 100%;
  background-attachment: fixed;
}
:root[data-skin="retro"] .brand { text-transform: uppercase; letter-spacing: .06em; text-shadow: 0 0 12px rgba(255, 62, 165, .7); }
:root[data-skin="retro"] .brand span { color: var(--protein); }
:root[data-skin="retro"] .summary { box-shadow: 0 0 0 1px rgba(53, 224, 255, .25), 0 0 32px rgba(53, 224, 255, .12); }
:root[data-skin="retro"] .ring .big, :root[data-skin="retro"] .totals .k { font-size: 30px; text-shadow: 0 0 10px rgba(255, 62, 165, .55); }
:root[data-skin="retro"] .action.primary { background: linear-gradient(135deg, #ff3ea5, #b23cff); border-color: transparent; box-shadow: 0 0 22px rgba(255, 62, 165, .35); }
:root[data-skin="retro"] .capture h2, :root[data-skin="retro"] .log h2, :root[data-skin="retro"] .sheet h3 { text-transform: uppercase; letter-spacing: .08em; font-size: 15px; }
:root[data-skin="retro"] .sheet { border-top: 1px solid var(--accent); }

/* Terminal: green phosphor CRT */
:root[data-skin="terminal"] {
  --bg: #050a05; --surface: #08130a; --surface-2: #0f2212; --fg: #b8ffb0; --muted: #62b066; --line: #1d4a22;
  --accent: #39ff6a; --accent-fg: #021004; --carbs: #ffd84a; --protein: #4ad6ff; --fat: #ff6a6a; --danger: #ff6a6a;
  --ring-track: #11301a; --shadow: 0 0 30px rgba(57, 255, 106, .15);
  --f-display: "VT323", ui-monospace, Menlo, monospace;
  --f-body: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}
:root[data-skin="terminal"] body { font-size: 14px; }
:root[data-skin="terminal"] body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px);
}
:root[data-skin="terminal"] .brand { font-size: 36px; text-shadow: 0 0 8px rgba(57, 255, 106, .6); }
:root[data-skin="terminal"] .brand span::after { content: "_"; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { :root[data-skin="terminal"] .brand span::after { animation: none; } }
:root[data-skin="terminal"] .ring .big, :root[data-skin="terminal"] .entry .kcal, :root[data-skin="terminal"] .totals .k { font-size: 44px; font-weight: 400; text-shadow: 0 0 8px rgba(57, 255, 106, .5); }
:root[data-skin="terminal"] .entry .kcal, :root[data-skin="terminal"] .pick .kcal { font-size: 26px; }
:root[data-skin="terminal"] .capture h2, :root[data-skin="terminal"] .log h2, :root[data-skin="terminal"] .sheet h3 { font-size: 26px; font-weight: 400; }
:root[data-skin="terminal"] :is(.summary, .action, .meal, .iconbtn, .btn, .theme-card, .item, .result, .chip, .picklist, input.in, select.in, textarea.in, .totals, .notice, .empty) { border-radius: 4px; }
:root[data-skin="terminal"] .sheet { border-radius: 6px 6px 0 0; border-top: 1px solid var(--accent); }

/* Sunrise: warm, light, soft */
:root[data-skin="sunrise"] {
  --bg: #fff4ea; --surface: #fffaf6; --surface-2: #fde7d6; --fg: #3a1f17; --muted: #8a5f50; --line: #f1d3c0;
  --accent: #e2572f; --accent-fg: #ffffff; --carbs: #c98a00; --protein: #3d6fd1; --fat: #c2366b; --danger: #b4352c;
  --ring-track: #f6dccb; --shadow: 0 10px 30px rgba(140, 60, 30, .16);
  --f-display: "Fraunces", Georgia, serif;
  --f-body: "DM Sans", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
:root[data-skin="sunrise"] body { background: linear-gradient(180deg, #ffe3cc 0, var(--bg) 320px) var(--bg) no-repeat; }
:root[data-skin="sunrise"] .action.primary { background: linear-gradient(135deg, #f0753d, #d9416a); border-color: transparent; }

/* Blush: soft rose, cream and lavender. Rounded everything, no hard borders, gentle pink shadows. */
:root[data-skin="blush"] {
  --bg: #fbf1ef; --surface: #fffaf9; --surface-2: #f8e7e9; --fg: #4a2f3c; --muted: #8f6b7b; --line: #f0dade;
  --accent: #b9587d; --accent-fg: #ffffff; --carbs: #c98a4e; --protein: #7d70c2; --fat: #df6f86; --danger: #c0394f;
  --ring-track: #f5e0e4; --shadow: 0 14px 36px rgba(185, 88, 125, .16);
  --soft: 0 6px 22px rgba(185, 88, 125, .10), 0 1px 3px rgba(185, 88, 125, .08);
  --f-display: "Quicksand", "Avenir Next", system-ui, sans-serif;
  --f-body: "Nunito", system-ui, -apple-system, sans-serif;
  --f-mono: "Nunito", system-ui, sans-serif;
  color-scheme: light;
}
:root[data-skin="blush"] body {
  background-color: var(--bg);
  background-image:
    radial-gradient(520px 380px at 100% -60px, rgba(242, 196, 206, .75), transparent 70%),
    radial-gradient(460px 360px at -80px 220px, rgba(214, 205, 240, .6), transparent 70%),
    radial-gradient(420px 320px at 110% 75%, rgba(250, 221, 200, .5), transparent 70%);
  background-attachment: fixed;
}
:root[data-skin="blush"] .brand { font-weight: 700; letter-spacing: 0; color: var(--fg); }
:root[data-skin="blush"] .brand span { color: var(--accent); }
:root[data-skin="blush"] .brand span::after { content: " \2661"; font-size: .62em; vertical-align: .3em; color: #e7a3b6; }
:root[data-skin="blush"] :is(.capture h2, .log h2, .sheet h3) { font-family: var(--f-display); font-weight: 700; letter-spacing: 0; }
/* Cards float on soft shadows instead of outlines */
:root[data-skin="blush"] :is(.summary, .action, .meal, .result, .theme-card, .picklist) { border-color: transparent; box-shadow: var(--soft); }
:root[data-skin="blush"] .summary { border-radius: 28px; }
:root[data-skin="blush"] .action { border-radius: 24px; }
:root[data-skin="blush"] .meal { border-radius: 24px; }
:root[data-skin="blush"] .theme-card { border-radius: 20px; }
:root[data-skin="blush"] .theme-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--soft); }
:root[data-skin="blush"] :is(.action, .result, .theme-card):hover { border-color: #ecc6d2; }
:root[data-skin="blush"] .action.primary { border-color: transparent; background: linear-gradient(135deg, #e8a0b4, #b9587d 70%); color: #fff; box-shadow: 0 10px 26px rgba(185, 88, 125, .28); }
:root[data-skin="blush"] .action.primary span { color: #fff; opacity: .9; }
:root[data-skin="blush"] .btn { border-radius: 999px; font-weight: 700; }
:root[data-skin="blush"] .btn:not(.ghost) { background: linear-gradient(135deg, #d27d9b, #b9587d); box-shadow: 0 6px 16px rgba(185, 88, 125, .22); }
:root[data-skin="blush"] .btn.small { border-radius: 999px; }
:root[data-skin="blush"] .iconbtn { border-color: transparent; box-shadow: var(--soft); }
:root[data-skin="blush"] :is(input.in, select.in, textarea.in) { background: #fff; border-color: var(--line); border-radius: 14px; }
:root[data-skin="blush"] :is(.item, .totals, .notice, .seg, .ask, .picklist, .preview, .scanner) { border-radius: 18px; }
:root[data-skin="blush"] .empty { border-radius: 24px; border-color: #ecc6d2; background: rgba(255, 250, 249, .6); }
:root[data-skin="blush"] .chip.on { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
:root[data-skin="blush"] .sheet { border-radius: 30px 30px 0 0; }
:root[data-skin="blush"] .scrim { background: rgba(74, 47, 60, .28); }
:root[data-skin="blush"] .bar { height: 10px; }
:root[data-skin="blush"] :is(.ring .big, .totals .k, .mr-kcal) { font-family: var(--f-display); font-weight: 700; letter-spacing: -.01em; }
:root[data-skin="blush"] .pill { background: #f6dde3; color: #9a4d6a; }

/* Retro Desktop: a 90s desktop OS look. Teal desktop, gray bevelled 3D panels, navy title bars. Pure CSS, no borrowed assets. */
:root[data-skin="desktop"] {
  --bg: #008080; --surface: #c0c0c0; --surface-2: #c0c0c0; --fg: #000000; --muted: #3a3a3a; --line: #808080;
  --accent: #000080; --accent-fg: #ffffff; --carbs: #b07800; --protein: #0050d0; --fat: #a00000; --danger: #a00000;
  --ring-track: #ffffff; --shadow: 2px 2px 0 rgba(0, 0, 0, .5);
  --f-display: "Pixelify Sans", Tahoma, Verdana, sans-serif;
  --f-body: "DotGothic16", Tahoma, Verdana, "Segoe UI", system-ui, sans-serif;
  --f-mono: "DotGothic16", "Courier New", Courier, ui-monospace, monospace;
  --raised: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff, inset -2px -2px #808080, inset 2px 2px #dfdfdf;
  --sunken: inset -1px -1px #ffffff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
  --titlebar: linear-gradient(90deg, #000080, #1084d0);
  color-scheme: light;
}
:root[data-skin="desktop"] body { font-size: 14px; }
/* Square corners and flat borders everywhere; the bevel comes from box-shadow. */
:root[data-skin="desktop"] :is(.summary, .action, .meal, .iconbtn, .btn, .theme-card, .theme-sw, .item, .result, .chip, .picklist, input.in, select.in, textarea.in,
  .totals, .notice, .empty, .sheet, .seg, .seg button, .stepper, .ask, .preview, .scanner, .scanner .frame, .bar, .bar i, .del, .star, .mic, .result img, .result .ph, .off-card img, .pill, .dot) { border-radius: 0; }

/* Raised gray panels and buttons */
:root[data-skin="desktop"] :is(.summary, .action, .meal, .iconbtn, .btn, .btn.ghost, .theme-card, .result, .chip, .picklist, .seg button.on, .stepper button, .mic) {
  background: var(--surface); color: var(--fg); border: 0; box-shadow: var(--raised);
}
:root[data-skin="desktop"] :is(.action, .iconbtn, .btn, .theme-card, .result, .chip, .stepper button, .mic, .seg button):active:not(:disabled) { box-shadow: var(--sunken); }
:root[data-skin="desktop"] :is(.action, .iconbtn, .btn, .theme-card, .result, .chip):hover { border-color: transparent; }
:root[data-skin="desktop"] :focus-visible { outline: 1px dotted #000; outline-offset: -5px; }
:root[data-skin="desktop"] .btn { font-weight: 400; min-height: 40px; }
:root[data-skin="desktop"] .btn:not(.ghost) { outline: 1px solid #000; outline-offset: -1px; }
:root[data-skin="desktop"] .btn.ghost.danger { color: var(--danger); }
:root[data-skin="desktop"] .btn:disabled { opacity: 1; color: #808080; text-shadow: 1px 1px #fff; }
:root[data-skin="desktop"] .action.primary { background: var(--surface); color: var(--fg); outline: 1px solid #000; outline-offset: -1px; }
:root[data-skin="desktop"] .action span { opacity: 1; color: var(--muted); }
:root[data-skin="desktop"] .chip.on, :root[data-skin="desktop"] .theme-card.on { box-shadow: var(--sunken); color: var(--fg); background: #d8d8d8; }
:root[data-skin="desktop"] .theme-card.on b { color: var(--accent); }
:root[data-skin="desktop"] .mic.live { background: var(--danger); color: #fff; }

/* Sunken white fields and wells */
:root[data-skin="desktop"] :is(input.in, select.in, textarea.in) { background: #ffffff; color: #000; border: 0; box-shadow: var(--sunken); padding: 8px 9px; }
:root[data-skin="desktop"] :is(.notice, .totals, .empty, .item, .ask, .seg, .stepper) { background: var(--surface); border: 0; box-shadow: var(--sunken); }
:root[data-skin="desktop"] .preview, :root[data-skin="desktop"] .scanner { box-shadow: var(--sunken); }
:root[data-skin="desktop"] .bar { height: 14px; background: #ffffff; box-shadow: var(--sunken); padding: 2px; }
:root[data-skin="desktop"] .bar i { background-image: repeating-linear-gradient(90deg, transparent 0 8px, #ffffff 8px 10px) !important; }
:root[data-skin="desktop"] #ringArc { stroke-linecap: butt; }
:root[data-skin="desktop"] .ring svg circle:first-child { stroke: #ffffff; }
:root[data-skin="desktop"] .ring svg { filter: drop-shadow(1px 1px 0 #808080); }
:root[data-skin="desktop"] .pick, :root[data-skin="desktop"] .mcard, :root[data-skin="desktop"] .entry { border-top-color: #a0a0a0; }
:root[data-skin="desktop"] .pick-meal { background: #b0b0b0; border-top-color: #808080; }
:root[data-skin="desktop"] .pill { background: #ffffff; box-shadow: var(--sunken); color: var(--fg); }
:root[data-skin="desktop"] .linkish { color: #0000ee; font-weight: 400; }

/* Text that sits right on the teal desktop is white, like desktop icon labels */
:root[data-skin="desktop"] .brand { color: #ffffff; font-weight: 700; font-size: 28px; letter-spacing: 0; text-shadow: 2px 2px 0 #004040; }
:root[data-skin="desktop"] .brand span { color: #ffff00; }
:root[data-skin="desktop"] .datebar .label, :root[data-skin="desktop"] .capture > h2, :root[data-skin="desktop"] .log-head h2,
  :root[data-skin="desktop"] .log > .status, :root[data-skin="desktop"] .log-hint { color: #ffffff; text-shadow: 1px 1px 0 #004040; }
:root[data-skin="desktop"] .datebar .label small { color: #c8ffff; }
:root[data-skin="desktop"] .capture h2, :root[data-skin="desktop"] .log h2 { font-weight: 700; letter-spacing: 0; }

/* Navy title bars: the day summary, each meal and every sheet are "windows" */
:root[data-skin="desktop"] .summary { padding: 3px 12px 14px; row-gap: 12px; }
:root[data-skin="desktop"] .summary::before {
  content: "Today's totals"; grid-column: 1 / -1; justify-self: stretch; margin: 0 -9px; padding: 3px 6px;
  background: var(--titlebar); color: #fff; font-weight: 700; font-size: 13px;
}
:root[data-skin="desktop"] .meal { padding: 3px; }
:root[data-skin="desktop"] .meal-head { background: var(--titlebar); padding: 3px 6px; }
:root[data-skin="desktop"] .meal-head b, :root[data-skin="desktop"] .meal-head span { color: #fff; font-weight: 700; letter-spacing: .02em; }
:root[data-skin="desktop"] .meal-head .linkish { color: #fff; }
:root[data-skin="desktop"] .meal .entry:first-of-type { border-top: 0; }
:root[data-skin="desktop"] .scrim { background: rgba(0, 32, 32, .35); }
:root[data-skin="desktop"] .sheet { box-shadow: var(--raised), 0 -2px 0 rgba(0, 0, 0, .25); padding-top: 3px; }
:root[data-skin="desktop"] .grab { display: none; }
:root[data-skin="desktop"] .sheet-head { position: sticky; top: 0; z-index: 2; background: var(--titlebar); margin: 0 -13px; padding: 3px 3px 3px 8px; }
:root[data-skin="desktop"] .sheet h3 { color: #fff; font-family: var(--f-body); font-weight: 700; font-size: 15px; letter-spacing: 0; }
:root[data-skin="desktop"] .sheet-head .iconbtn { height: 26px; min-width: 28px; padding: 0 6px; font-size: 13px; font-weight: 700; }
/* Text and numbers use a bitmap-style pixel font with clearly shaped 2s and 8s, like an old system font.
   Bold is drawn the bitmap way, by repeating the glyph 1px to the right, which keeps the pixel edges crisp. */
:root[data-skin="desktop"] body { -webkit-font-smoothing: none; font-size: 15px; }
:root[data-skin="desktop"] :is(.ring .big, .totals .k, .entry .kcal, .pick .kcal, .mcard .kcal) { font-family: var(--f-body); font-weight: 400; letter-spacing: 0; font-variant-numeric: tabular-nums; text-shadow: 1px 0 0 currentColor; }
:root[data-skin="desktop"] .ring .big { font-size: 34px; text-shadow: 1px 0 0 currentColor, 2px 0 0 currentColor; }
:root[data-skin="desktop"] .totals .k { font-size: 26px; }
:root[data-skin="desktop"] :is(b, strong, .action b, .entry .t div, .pick .t div, .mcard .t div, .macro .name, .theme-card b, .btn, .meal-head b, .meal-head span, .sheet h3, .goal-grid .gname) { font-weight: 400; text-shadow: 1px 0 0 currentColor; }
:root[data-skin="desktop"] .summary::before { font-weight: 400; text-shadow: 1px 0 0 currentColor; }
:root[data-skin="desktop"] .datebar .label { font-weight: 400; text-shadow: 1px 0 0 #fff, 1px 1px 0 #004040, 2px 1px 0 #004040; }
:root[data-skin="desktop"] .macro .val { color: #202020; }

/* Tap a logged entry to edit it */
.entry[data-edit] { cursor: pointer; transition: background .12s; -webkit-tap-highlight-color: transparent; }
.entry[data-edit]:hover, .entry[data-edit]:active { background: var(--surface-2); }
.entry[data-edit]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.log-hint { color: var(--muted); font-size: 12px; text-align: center; margin: 8px 0 0; }
.ask .scanner { aspect-ratio: 4 / 3; max-height: 45vh; }

/* Macro Rocket view of the day summary (rocket.js; toggle with the button in the summary's corner). */
.summary { position: relative; }
.sumtoggle { position: absolute; top: 8px; right: 8px; z-index: 3; width: 32px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface-2); color: var(--fg); line-height: 1; display: grid; place-items: center; cursor: pointer; }
.summary.rockets-on > .ring, .summary.rockets-on > .macros { display: none; }
/* A small header row holds the view toggle so it never sits on top of the bars or numbers.
   Retro Desktop already has a title bar for this. */
:root:not([data-skin="desktop"]) .summary { padding-top: 12px; row-gap: 10px; }
:root:not([data-skin="desktop"]) .summary::before { content: "Today's totals"; grid-column: 1 / -1; justify-self: stretch; height: 28px; display: flex; align-items: center;
  font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
:root:not([data-skin="desktop"]) .sumtoggle { top: 12px; right: 14px; }
.summary > .rockets { grid-column: 1 / -1; width: 100%; }
.mrocket { --mr-shell: var(--surface); --mr-line: var(--line); --mr-ink: var(--fg); --mr-star: var(--muted); --mr-sky: transparent;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: center; }
.mr-art { min-width: 0; }
.mr-svg { display: block; width: 100%; height: auto; aspect-ratio: 400 / 430; max-height: 280px; margin: 0 auto; overflow: hidden; background: var(--mr-sky); border-radius: 12px; }
.mr-anim.mr-fill { transition: transform .4s ease-out; }
.mr-anim.mr-flame { transition: transform .4s ease-out, opacity .2s; }
.mr-anim.mr-ship { transition: transform 1.6s cubic-bezier(.5, 0, .8, .4); }
.mrocket:not(.launched) .mr-anim.mr-ship { transition: transform .9s cubic-bezier(.2, .7, .3, 1); }
.mr-anim .mr-flicker { animation: mr-flicker .14s ease-in-out infinite alternate; }
@keyframes mr-flicker { from { transform: scale(.92, .9); opacity: .85; } to { transform: scale(1.05, 1.06); opacity: 1; } }
.mr-letter { font: 700 17px var(--f-mono); }
.mr-stars circle { opacity: .55; }
.mr-panel { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.mr-kcal { font-family: "Fraunces", Georgia, "Times New Roman", serif; font-weight: 700; font-size: 34px; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mr-kcal small { font-family: var(--f-body); font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.mr-status { font-size: 13px; color: var(--muted); font-weight: 600; }
.mr-status.ok { color: var(--accent); }
.mr-rows { display: flex; flex-direction: column; gap: 7px; margin-top: 6px; }
.mr-row { display: grid; grid-template-columns: 10px 1fr; column-gap: 7px; align-items: center; font-size: 13px; }
.mr-sw { width: 10px; height: 10px; border-radius: 3px; }
.mr-name { font-weight: 600; }
.mr-val { grid-column: 2; font-family: var(--f-mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 380px) { .mrocket { grid-template-columns: 1fr; } .mr-svg { width: auto; height: 240px; max-height: none; } }
@media (prefers-reduced-motion: reduce) { .mr-anim, .mr-anim .mr-flicker { transition: none !important; animation: none !important; } }

/* Macro Rocket on the themes */
:root[data-skin="desktop"] .sumtoggle { top: 5px; right: 6px; width: 22px; height: 19px; background: var(--surface); border: 0; border-radius: 0; box-shadow: var(--raised); }
:root[data-skin="desktop"] .sumtoggle svg { width: 12px; height: 12px; }
:root[data-skin="desktop"] .sumtoggle:active { box-shadow: var(--sunken); }
:root[data-skin="desktop"] .mrocket { --mr-shell: #ffffff; --mr-line: #000000; --mr-star: #808080; --mr-sky: #ffffff; }
:root[data-skin="desktop"] .mr-svg { border-radius: 0; box-shadow: var(--sunken); }
:root[data-skin="desktop"] .mr-kcal { font-family: var(--f-body); font-weight: 400; text-shadow: 1px 0 0 currentColor, 2px 0 0 currentColor; letter-spacing: 0; }
:root[data-skin="desktop"] .mr-kcal small { color: #404040; text-shadow: none; }
:root[data-skin="desktop"] :is(.mr-name, .mr-status) { font-weight: 400; text-shadow: 1px 0 0 currentColor; }
:root[data-skin="desktop"] .mr-status { color: #202020; }
:root[data-skin="desktop"] .mr-status.ok { color: var(--accent); }
:root[data-skin="desktop"] .mr-val { color: #202020; }
:root[data-skin="desktop"] .mr-sw { border-radius: 0; box-shadow: 1px 1px 0 #000; }
:root[data-skin="retro"] .mrocket { --mr-shell: #1c1240; --mr-line: #8f7cff; --mr-star: #ffffff; }
:root[data-skin="blush"] .mrocket { --mr-protein: #8e82c8; --mr-carbs: #e0a16a; --mr-fat: #e07a93; --mr-shell: #ffffff; --mr-line: #b07890; --mr-ink: #4a2f3c; --mr-star: #e7a3b6; }
:root[data-skin="blush"] .mr-svg { background: linear-gradient(180deg, #fbe6ec, #fff6f2); border-radius: 22px; }
:root[data-skin="blush"] .mr-sw { border-radius: 50%; }
:root[data-skin="terminal"] .mrocket { --mr-shell: #071407; --mr-line: #39ff6a; --mr-ink: #b8ffb0; --mr-star: #62b066; --mr-ok: #39ff6a;
  --mr-protein: #4ad6ff; --mr-carbs: #ffd84a; --mr-fat: #ff6a6a; }
:root[data-skin="desktop"] .mrocket.cards { --mr-protein: #0050d0; --mr-carbs: #b07800; --mr-fat: #a00000; }
:root[data-skin="blush"] .mrocket { --mr-ok: #b9587d; }

/* Flowers: the Sunrise theme's version of the Macro Rocket */
.mrocket { --mr-ground: var(--surface-2); }
.mr-anim.fl-stem, .mr-anim.fl-head, .mr-anim.fl-leaves { transition: transform .5s ease-out, opacity .3s; }
.mr-anim.fl-petals { transition: transform .6s cubic-bezier(.3, 1.5, .5, 1); }
.mr-anim.fl-sun { transition: transform 1.6s cubic-bezier(.2, .7, .3, 1); }
.mrocket.flowers.launched:not(.still) .fl-sway { animation: fl-sway 2.4s ease-in-out infinite alternate; }
.mrocket.flowers.launched:not(.still) .fl-sway[data-sway="carbs"] { animation-delay: -.8s; }
.mrocket.flowers.launched:not(.still) .fl-sway[data-sway="fat"] { animation-delay: -1.6s; }
.mrocket.flowers.launched:not(.still) .fl-sun > g { animation: fl-spin 18s linear infinite; transform-origin: 330px 70px; }
@keyframes fl-sway { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
@keyframes fl-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .mrocket.flowers .fl-sway, .mrocket.flowers .fl-sun > g { animation: none !important; } }
:root[data-skin="sunrise"] .mrocket { --mr-ground: #f6d9bf; --mr-line: #8a4a2a; --mr-shell: #fff; }
:root[data-skin="sunrise"] .mr-kcal { font-family: "Fraunces", Georgia, serif; }
.fl-letter { font-size: 20px; }

/* Other theme pictures (rocket.js scenes). .launched = finished state; .mr-go = a fresh finish is playing. */
.mr-art { position: relative; }
.mr-fx { position: absolute; pointer-events: none; }
.mrocket { --mr-ok: var(--accent); }
@keyframes mr-wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(5deg); } 75% { transform: rotate(-5deg); } }
@keyframes mr-drift { from { transform: translateX(-120px); } to { transform: translateX(520px); } }
@keyframes mr-blink { 50% { opacity: 0; } }
/* Butterflies (Blush) */
.bf-fill { transition: transform .5s ease-out; }
.bf .bf-coc { transition: opacity .8s; }
.bf .bf-fly { opacity: 0; }
.mrocket:not(.still) .bf-cloud { animation: mr-drift 52s linear infinite; animation-delay: -20s; }
.mrocket:not(.launched):not(.still) .bf[data-full="true"] .bf-coc { animation: mr-wiggle .9s ease-in-out infinite; transform-origin: 0 108px; }
.mrocket.launched .bf .bf-coc { opacity: .3; }
.mrocket.launched .bf .bf-fly { opacity: 1; }
.mrocket.launched .bf-fly0 { transform: translate(-20px, 150px); }
.mrocket.launched .bf-fly1 { transform: translate(5px, 175px); }
.mrocket.launched .bf-fly2 { transform: translate(15px, 140px); }
.mrocket.launched.mr-go:not(.still) .bf-fly0 { animation: bf-path0 2.6s ease-out both; }
.mrocket.launched.mr-go:not(.still) .bf-fly1 { animation: bf-path1 2.6s ease-out .2s both; }
.mrocket.launched.mr-go:not(.still) .bf-fly2 { animation: bf-path2 2.6s ease-out .4s both; }
.mrocket.launched:not(.still) .bf-hover { animation: bf-bob 1.3s ease-in-out infinite alternate; }
.mrocket.launched:not(.still) .bf-wing { animation: bf-flap .16s ease-in-out infinite alternate; }
@keyframes bf-flap { from { transform: scaleX(1); } to { transform: scaleX(.22); } }
@keyframes bf-bob { from { transform: translateY(-5px); } to { transform: translateY(5px); } }
@keyframes bf-path0 { 0% { transform: translate(0, 0) scale(.3); } 30% { transform: translate(-30px, 60px) scale(1); } 60% { transform: translate(20px, 100px) scale(1); } 100% { transform: translate(-20px, 150px) scale(1); } }
@keyframes bf-path1 { 0% { transform: translate(0, 0) scale(.3); } 30% { transform: translate(30px, 50px) scale(1); } 60% { transform: translate(-25px, 120px) scale(1); } 100% { transform: translate(5px, 175px) scale(1); } }
@keyframes bf-path2 { 0% { transform: translate(0, 0) scale(.3); } 30% { transform: translate(20px, 70px) scale(1); } 60% { transform: translate(-20px, 95px) scale(1); } 100% { transform: translate(15px, 140px) scale(1); } }
/* Build pipeline (Terminal): full width under the calories; the bars replace the macro rows. */
.mrocket.pipeline { grid-template-columns: minmax(0, 1fr); gap: 10px; }
.mrocket.pipeline .mr-panel { order: -1; flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.mrocket.pipeline .mr-rows { display: none; }
.mrocket.pipeline .mr-svg, .mrocket.pipeline .mr-svg[class] { width: 100%; height: auto; aspect-ratio: 640 / 330; max-height: none; background: #030803; border: 1px solid var(--line); border-radius: 4px; }
.pl-txt text { font-family: var(--f-display); white-space: pre; }
.pl-big { filter: drop-shadow(0 0 4px currentColor); }
.mrocket:not(.still) .pl-cursor { animation: mr-blink 1.1s steps(1) infinite; }
.mrocket.mr-go:not(.still) .pl-big { animation: pl-flash 1.2s steps(1) 1; }
@keyframes pl-flash { 0%, 20%, 40%, 60% { opacity: 1; } 10%, 30%, 50% { opacity: .1; } 100% { opacity: 1; } }
/* Mountain climb (Classic): colours come from the theme, so it follows light and dark mode. */
.mrocket.mountain { --mr-protein: var(--protein); --mr-carbs: var(--carbs); --mr-fat: var(--fat);
  --mt-far: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); --mt-rock: color-mix(in srgb, var(--muted) 65%, var(--surface-2));
  --mt-grass: color-mix(in srgb, var(--accent) 45%, var(--muted)); --mt-trail: var(--surface); }
.mt-sky { fill: var(--surface-2); }
.mt-letter { font: 700 13px var(--f-display); fill: #fff; }
.mrocket.mountain:not(.still) .mt-climber { transition: transform .5s ease-out; }
.mrocket.mountain:not(.still) .mt-done { transition: stroke-dasharray .5s ease-out; }
.mt-flag { transform: scaleY(0); transform-origin: 0 0; }
.mt-cloth { transform-origin: 0 -48px; }
.mrocket.launched .mt-flag { transform: scaleY(1); }
.mrocket.launched.mr-go:not(.still) .mt-flag { animation: mt-flag .8s ease-out .5s both; }
.mrocket.launched:not(.still) .mt-cloth { animation: mt-wave .8s ease-in-out infinite alternate; }
.mrocket.launched.mr-go:not(.still) .mt-hop { animation: mt-hop .5s ease-out .5s 3; }
.mrocket.launched.mr-go:not(.still) .mt-hop1 { animation-delay: .65s; }
.mrocket.launched.mr-go:not(.still) .mt-hop2 { animation-delay: .8s; }
@keyframes mt-flag { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes mt-wave { from { transform: skewY(-6deg); } to { transform: skewY(6deg); } }
@keyframes mt-hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-12px); } }
/* Solitaire (Retro Desktop) */
.sol-rank, .sol-t, .sol-slot { font-family: var(--f-display); font-weight: 700; }
.sol-rank { font-size: 19px; }
.sol-slot { font-size: 30px; fill: #004d00; }
.sol-t { font-size: 14px; fill: #000; }
.sol-big { font-size: 26px; }
.sol-small { font-family: var(--f-body); font-weight: 400; }
.sol-win { opacity: 0; }
.mrocket.launched .sol-win { opacity: 1; }
.mrocket.launched.mr-go:not(.still) .sol-win { animation: sol-win .01s 4.6s both; }
@keyframes sol-win { from { opacity: 0; } to { opacity: 1; } }
.mrocket:not(.still) .sol-new { animation: sol-deal .32s ease-out; }
@keyframes sol-deal { from { transform: translate(var(--dx), -320px); } to { transform: translate(0, 0); } }
@media (prefers-reduced-motion: reduce) { .mrocket .bf-fly, .mrocket .bf-hover, .mrocket .bf-wing, .mrocket .bf-coc, .mrocket .bf-cloud, .mrocket .pl-cursor, .mrocket .pl-big, .mrocket .sol-win, .mrocket .sol-new, .mrocket .mt-flag, .mrocket .mt-cloth, .mrocket .mt-hop { animation: none !important; } }

/* Mission Control: sleek launch-control look. Near-black, white type, hairline steel borders, square corners,
   wide uppercase labels. Michroma (wide display) + Barlow (DIN-like body), both free Google Fonts. */
:root[data-skin="mission"] {
  --bg: #000000; --surface: #0b0d10; --surface-2: #15181d; --fg: #f2f4f7; --muted: #8a929e; --line: #262a31;
  --accent: #f2f4f7; --accent-fg: #000000; --carbs: #ffb547; --protein: #4da3ff; --fat: #c9ced6; --danger: #ff5a4f;
  --ring-track: #1c2026; --shadow: 0 -1px 0 #262a31, 0 20px 60px rgba(0, 0, 0, .8);
  --f-display: "Michroma", "Eurostile", "Avenir Next", system-ui, sans-serif;
  --f-body: "Barlow", "DIN Alternate", system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}
/* A faint blue horizon glow at the top, like Earth's limb from orbit, over pure black. */
:root[data-skin="mission"] body {
  background-color: #000;
  background-image: radial-gradient(140% 60% at 50% -38%, rgba(77, 163, 255, .22) 0, rgba(77, 163, 255, .07) 45%, transparent 70%);
  background-repeat: no-repeat; background-attachment: fixed;
}
:root[data-skin="mission"] :is(.summary, .action, .meal, .iconbtn, .btn, .theme-card, .theme-sw, .item, .result, .chip, .picklist, input.in, select.in, textarea.in,
  .totals, .notice, .empty, .seg, .seg button, .stepper, .sumtoggle, .mr-svg, .pill) { border-radius: 2px; }
:root[data-skin="mission"] .sheet { border-radius: 0; border-top: 1px solid #3a404a; }
:root[data-skin="mission"] .bar { height: 4px; border-radius: 0; }
:root[data-skin="mission"] .bar i { border-radius: 0; }
:root[data-skin="mission"] #ringArc { stroke-linecap: butt; }
:root[data-skin="mission"] .mr-sw { border-radius: 0; }
/* Wordmark and headings: wide, uppercase, generous tracking. */
:root[data-skin="mission"] .brand { font-family: var(--f-display); font-weight: 400; font-size: 22px; text-transform: uppercase; letter-spacing: .32em; }
:root[data-skin="mission"] .brand span { color: var(--fg); }
:root[data-skin="mission"] :is(.capture h2, .log h2, .sheet h3) { font-family: var(--f-display); font-weight: 400; font-size: 13px; text-transform: uppercase; letter-spacing: .22em; }
:root[data-skin="mission"] :is(.meal-head b, .summary::before, .macro .name, .datebar .label) { text-transform: uppercase; letter-spacing: .16em; font-weight: 600; }
:root[data-skin="mission"] .datebar .label { font-size: 13px; }
:root[data-skin="mission"] .summary::before { font-family: var(--f-display); font-weight: 400; font-size: 10px; letter-spacing: .24em; }
/* Numbers read like telemetry: light, tabular, no tight negative tracking. */
:root[data-skin="mission"] :is(.ring .big, .totals .k, .entry .kcal, .pick .kcal, .mcard .kcal, .mr-kcal) { font-family: var(--f-body); font-weight: 500; letter-spacing: 0; font-variant-numeric: tabular-nums; }
:root[data-skin="mission"] .ring .big { font-size: 36px; }
/* Buttons: white primary like a launch button, ghost buttons outlined; labels uppercase. */
:root[data-skin="mission"] :is(.btn, .iconbtn) { text-transform: uppercase; letter-spacing: .12em; font-size: 13px; }
:root[data-skin="mission"] .btn.small { font-size: 12px; }
:root[data-skin="mission"] .action.primary { background: #f2f4f7; color: #000; border-color: #f2f4f7; }
:root[data-skin="mission"] .action b { text-transform: uppercase; letter-spacing: .1em; font-size: 13px; }
:root[data-skin="mission"] :is(.action, .iconbtn, .btn.ghost, .chip, .theme-card):hover { border-color: #8a929e; }
:root[data-skin="mission"] .chip.on, :root[data-skin="mission"] .theme-card.on { border-color: var(--fg); color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
:root[data-skin="mission"] .seg button.on { box-shadow: inset 0 0 0 1px #3a404a; }
:root[data-skin="mission"] .linkish { color: var(--protein); }
/* Thin HUD corner brackets on the day summary. */
:root[data-skin="mission"] .summary {
  background:
    linear-gradient(#8a929e, #8a929e) top left / 10px 1px, linear-gradient(#8a929e, #8a929e) top left / 1px 10px,
    linear-gradient(#8a929e, #8a929e) top right / 10px 1px, linear-gradient(#8a929e, #8a929e) top right / 1px 10px,
    linear-gradient(#8a929e, #8a929e) bottom left / 10px 1px, linear-gradient(#8a929e, #8a929e) bottom left / 1px 10px,
    linear-gradient(#8a929e, #8a929e) bottom right / 10px 1px, linear-gradient(#8a929e, #8a929e) bottom right / 1px 10px,
    var(--surface);
  background-repeat: no-repeat;
}
/* Macro Rocket: a white launcher on a black sky with a blue horizon. */
:root[data-skin="mission"] .mrocket { --mr-shell: #f2f4f7; --mr-line: #9aa2ad; --mr-ink: #0b0d10; --mr-star: #ffffff;
  --mr-sky: linear-gradient(180deg, #000 0, #000 70%, #0a1a2e 100%); --mr-ground: #15181d; }
:root[data-skin="mission"] .mr-svg { border: 1px solid var(--line); }
:root[data-skin="mission"] .mr-status { text-transform: uppercase; letter-spacing: .14em; font-size: 11px; }
:root[data-skin="mission"] .mr-name { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; }
/* Privacy policy and terms pages. */
.legal { gap: 6px; padding: 16px 18px 40px; margin: 16px auto; line-height: 1.55; background: var(--surface); color: var(--fg); border-radius: 14px; box-sizing: border-box; }
.legal .note { color: var(--muted); }
.legal h1 { margin: 4px 0 0; }
.legal h2 { font-size: 18px; margin: 18px 0 0; }
.legal p, .legal ul { margin: 6px 0; }
.legal ul { padding-left: 20px; }
.legal li { margin: 6px 0; }
.legal a { color: var(--accent); }
.legal-links { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.legal-links a { color: var(--accent); }
.status a { color: inherit; }

/* Account, sync and Tally Plus */
.acct-box { display: flex; flex-direction: column; gap: 10px; }
.acct-box .row2 .btn { white-space: normal; }
.code-big { font-size: 34px; font-weight: 700; letter-spacing: .12em; text-align: center; padding: 14px; border-radius: 14px; background: var(--surface-2); color: var(--fg); user-select: all; }
.plus-perks { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.plus-perks b { color: var(--fg); }
.plus-plans { display: flex; flex-direction: column; gap: 10px; }
.plus-plans small { font-weight: 500; opacity: .8; }
.install-hint { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.install-hint a { color: var(--accent); font-weight: 600; }
/* Fuel Run mini-game (game.js): full-screen canvas over the app, coloured from the current theme. */
.fr { position: fixed; inset: 0; z-index: 60; background: var(--bg); touch-action: none; user-select: none; -webkit-user-select: none; overscroll-behavior: contain; }
.fr-cv { position: absolute; inset: 0; display: block; }
.fr-bar { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 10px); right: calc(env(safe-area-inset-right, 0px) + 10px); display: flex; gap: 8px; z-index: 2; }
.fr-bar .iconbtn { min-width: 40px; height: 40px; justify-content: center; font-size: 13px; }
.fr-panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(340px, calc(100% - 32px)); max-height: calc(100% - 120px); overflow: auto;
  background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 22px 20px; display: flex; flex-direction: column; gap: 12px; z-index: 3; }
.fr-panel h2 { font-family: var(--f-display); font-size: 26px; margin: 0; text-align: center; }
.fr-how { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14.5px; }
.fr-bonus { margin: 0; font-size: 13.5px; color: var(--accent); font-weight: 600; }
.fr-best { margin: 0; font-size: 13.5px; color: var(--muted); text-align: center; }
.fr-big { margin: 0; font-family: var(--f-display); font-size: 44px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.fr-panel .btn { width: 100%; }
:root[data-skin="desktop"] .fr { --game-sky1: #000000; --game-sky2: #000060; --game-star: #ffffff; --game-rock: #808080; --game-hud: #ffffff; --game-muted: #c0c0c0; --game-accent: #00ffff; }
:root[data-skin="desktop"] .fr-panel { border: 0; border-radius: 0; box-shadow: var(--raised); }
:root[data-skin="retro"] .fr { --game-sky1: #0b0620; --game-sky2: #22144a; --game-rock: #6b5fa0; }
:root[data-skin="mission"] .fr { --game-sky1: #000000; --game-sky2: #0a1424; --game-rock: #3b424c; --game-flame: #ffb547; }
:root[data-skin="mission"] .fr-panel { border-radius: 0; }
:root[data-skin="terminal"] .fr { --game-rock: #1d4a22; --game-flame: #39ff6a; }
:root[data-skin="blush"] .fr { --game-sky1: #fdf3f1; --game-sky2: #f3dfe8; --game-rock: #cdb6c6; --game-star: #e7a3b6; }
:root[data-skin="blush"] .fr-panel { border: 0; border-radius: 28px; }
.arcade-card { display: flex; align-items: center; gap: 12px; }
.arcade-card .btn { flex: none; }
.arcade-card .note { margin: 0; flex: 1; }
.game-invite { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); z-index: 19;
  border: 0; border-radius: 999px; padding: 12px 18px; font: 600 15px var(--f-body); background: var(--accent); color: var(--accent-fg); box-shadow: var(--shadow); }
:root[data-skin="desktop"] .game-invite { border-radius: 0; box-shadow: var(--raised); background: var(--surface); color: var(--fg); }
/* Lunchbox Quest tile puzzle (puzzle.js): always drawn as a Retro Desktop window, whatever the app theme. */
.lq { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; touch-action: none; user-select: none; -webkit-user-select: none;
  overscroll-behavior: contain; background: #008080; color: #000; font: 14px "DotGothic16", Tahoma, Verdana, sans-serif;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) calc(env(safe-area-inset-right, 0px) + 8px) calc(env(safe-area-inset-bottom, 0px) + 8px) calc(env(safe-area-inset-left, 0px) + 8px);
  --lq-raised: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff, inset -2px -2px #808080, inset 2px 2px #dfdfdf;
  --lq-sunken: inset -1px -1px #ffffff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a; }
.lq button { font: inherit; color: #000; background: #c0c0c0; border: 0; border-radius: 0; box-shadow: var(--lq-raised); cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: none; }
.lq button:active:not(:disabled), .lq button.on { box-shadow: var(--lq-sunken); }
.lq button:disabled { color: #808080; text-shadow: 1px 1px #fff; cursor: default; }
.lq button:focus-visible { outline: 1px dotted #000; outline-offset: -5px; }
.lq-win { width: min(100%, 470px); max-height: 100%; display: flex; flex-direction: column; gap: 6px; padding: 3px 3px 8px; background: #c0c0c0; box-shadow: var(--lq-raised), 2px 2px 0 rgba(0,0,0,.5); overflow: hidden; }
.lq-title { display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 3px 0 5px; background: linear-gradient(90deg, #000080, #1084d0); color: #fff;
  font: 700 15px "Pixelify Sans", Tahoma, sans-serif; letter-spacing: .02em; flex: none; }
.lq-title span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lq-ico { width: 18px; height: 18px; flex: none; }
.lq-tb { width: 22px; height: 20px; padding: 0; font: 700 13px Tahoma, sans-serif !important; line-height: 1; }
.lq-hud { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; padding: 0 5px; flex: none; }
.lq-cell { background: #000; box-shadow: var(--lq-sunken); padding: 4px 8px 3px; display: flex; flex-direction: column; align-items: center; min-width: 56px; }
.lq-cell small { font-size: 9.5px; color: #c0c0c0; letter-spacing: .06em; white-space: nowrap; }
.lq-cell b { font: 700 18px "Pixelify Sans", "Courier New", monospace; color: #ff3030; letter-spacing: .04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lq-cell b.lq-warn { color: #ffff00; }
.lq-food b { display: flex; gap: 10px; }
.lq-food i { font-style: normal; }
.lq-food .lq-P { color: #6fa8ff; } .lq-food .lq-C { color: #ffb050; } .lq-food .lq-F { color: #7fe08a; }
.lq-board { align-self: center; padding: 2px; box-shadow: var(--lq-sunken); background: #000; line-height: 0; touch-action: none; flex: none; }
.lq-board canvas { display: block; }
.lq-inv { padding: 0 6px; min-height: 18px; display: flex; align-items: center; font-size: 13px; flex: none; }
.lq-inv > span { display: flex; align-items: center; gap: 4px; }
.lq-dim { color: #404040; }
.lq-gear { width: 22px; height: 22px; display: block; }
.lq-status { margin: 0 5px; padding: 4px 7px; min-height: 40px; box-shadow: var(--lq-sunken); background: #ffffe1; font-size: 13px; line-height: 1.35; flex: none; }
.lq-status:empty { background: #c0c0c0; }
.lq-pad { display: grid; grid-template-columns: repeat(3, 62px); grid-template-rows: repeat(3, 52px); gap: 4px; justify-content: center; flex: none; }
.lq-pad button { font-size: 20px; }
.lq-pad[hidden] { display: none; }
.lq-tools { display: flex; gap: 6px; justify-content: space-between; padding: 0 5px; flex: none; }
.lq-tools button { min-height: 34px; padding: 0 14px; font-size: 13.5px; }
@media (pointer: fine) and (min-height: 760px) { .lq-pad { grid-template-rows: repeat(3, 44px); } }
@media (max-height: 700px) { .lq-pad { grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(3, 40px); } .lq-status { min-height: 34px; } }
.lq-dlg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .25); padding: 16px; z-index: 2; }
.lq-dlg[hidden] { display: none; }
.lq-dwin { width: min(100%, 380px); max-height: calc(100% - 20px); display: flex; flex-direction: column; background: #c0c0c0; padding: 3px; box-shadow: var(--lq-raised), 2px 2px 0 rgba(0,0,0,.5); }
.lq-dbody { padding: 10px 10px 8px; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.lq-dbody p { margin: 0; line-height: 1.4; }
.lq-big { font-size: 15.5px; }
.lq-btns { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.lq-btns button { min-width: 84px; min-height: 34px; padding: 0 12px; }
.lq-btns .lq-def { outline: 1px solid #000; outline-offset: -1px; }
.lq-levels { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.lq-levels button { display: grid; grid-template-columns: 26px 1fr; grid-template-rows: auto auto; text-align: left; padding: 6px 8px; column-gap: 6px; min-height: 46px; }
.lq-levels b { grid-row: span 2; font: 700 18px "Pixelify Sans", Tahoma, sans-serif; color: #000080; align-self: center; }
.lq-levels button:disabled b { color: #808080; }
.lq-levels span { font-size: 13px; line-height: 1.2; }
.lq-levels small { font-size: 11px; color: #404040; }
.lq-levels .lq-done small { color: #006000; }

/* Suggested goals (first open and Goals → Suggest goals for me) */
.sg-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.3fr) minmax(0, 1fr); gap: 8px; }
.sg-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sg-out { flex-direction: column; align-items: flex-start; gap: 6px; min-height: 86px; justify-content: center; }
.sg-out .k small { font-family: var(--f-body, inherit); font-size: 13px; font-weight: 600; color: var(--muted); }
.sg-out .note { margin: 0; }
div.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
.notice a { color: var(--accent); font-weight: 600; }

/* Ask Arti chat */
.goal-help { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.chat { display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 88%; padding: 10px 12px; border-radius: 16px; font-size: 14.5px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.arti { align-self: flex-start; background: var(--surface-2); color: var(--fg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
:root[data-skin="desktop"] .bubble, :root[data-skin="mission"] .bubble, :root[data-skin="terminal"] .bubble { border-radius: 0; }
.bubble.me { align-self: flex-end; background: var(--accent); color: var(--accent-fg); border-bottom-right-radius: 4px; }
.chat-goals { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); white-space: normal; }
.chat-goals b { font-size: 18px; }
.chat-goals span { font-size: 13px; }
.chat-goals .btn { align-self: flex-start; }
.chat-in { display: flex; gap: 8px; align-items: flex-end; }
.chat-in textarea { flex: 1; min-height: 0; }
.chat-in .btn { flex: none; }

/* "Save your log" card above the date, and the beta-updates email row in Settings */
.save-prompt { display: flex; flex-direction: column; gap: 8px; margin: 0 0 12px; padding: 14px; border: 1px solid var(--accent); }
.save-prompt b { color: var(--fg); font-size: 15px; }
.save-prompt p { margin: 0; }
.email-row { display: flex; gap: 8px; }
.email-row .in { flex: 1; min-width: 0; }
.email-row .btn { flex: none; }
.f .opt { color: var(--muted); font-weight: 400; }
