/*
 * Body Fuel Flow Explorer
 * Copyright © 2026 Anthony Adams. All rights reserved.
 * Public visibility does not grant permission to reuse this work. See COPYRIGHT.md.
 */

:root {
    --bg: #071019;
    --panel: rgba(15, 27, 39, 0.88);
    --panel-light: rgba(25, 40, 55, 0.78);

    --border: rgba(255, 255, 255, 0.08);

    --text: #edf6ff;
    --muted: #8496a8;

    --protein: #4fa8ff;
    --carb: #56e890;
    --fat: #ffad42;

    --purple: #a67cff;
    --red: #ff665b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "SF Pro Display",
        "Helvetica Neue",
        sans-serif;

    color: var(--text);

    background:
        radial-gradient(
            circle at 50% 20%,
            #17314a 0%,
            #09131e 38%,
            #04080d 100%
        );
}

.skip-link {
    position: fixed;
    z-index: 2000;
    top: 10px;
    left: 10px;
    padding: 9px 12px;
    border: 2px solid #8dd3ff;
    border-radius: 8px;
    background: #07131e;
    color: #f3f9ff;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transform: translateY(-160%);
    transition: transform .16s ease;
}

.skip-link:focus {
    outline: none;
    transform: translateY(0);
}

.app {
    width: 100%;
    min-height: 100vh;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.site-footer {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 5px 20px 8px;
    color: #6f8496;
    font-size: 9px;
    line-height: 1.35;
}


/* TOP */

.topbar {
    min-height: 94px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 30px;

    padding: 16px 26px;

    background:
        linear-gradient(
            180deg,
            rgba(22, 36, 50, 0.95),
            rgba(10, 20, 30, 0.94)
        );

    border-bottom: 1px solid var(--border);

    backdrop-filter: blur(20px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    white-space: nowrap;
}

.brand-icon {
    font-size: 32px;
    color: #56c8ff;
    filter: drop-shadow(0 0 12px #42bfff);
}

.brand h1 {
    margin: 0;
    font-size: 19px;
}

.brand p {
    margin: 3px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.learn-link {
    display: inline-block;
    margin-left: 7px;
    color: #70c9fa;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.learn-link:hover {
    color: #c8eeff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.welcome-open {
    margin: 0 0 0 7px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #b4d8eb;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.welcome-open:hover {
    color: #eefaff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.presets {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preset-label {
    color: var(--muted);
    font-size: 12px;
    margin-right: 4px;
}

.preset {
    border: 1px solid var(--border);
    background: rgba(255,255,255,.04);

    color: #c6d4df;

    padding: 9px 13px;

    border-radius: 9px;

    cursor: pointer;

    transition: .2s ease;
}

.preset:hover {
    background: rgba(255,255,255,.09);
}

.preset.active {
    border-color: #4ea8ff;

    background:
        linear-gradient(
            180deg,
            rgba(65,157,255,.28),
            rgba(65,157,255,.10)
        );

    box-shadow:
        0 0 18px rgba(60,160,255,.28),
        inset 0 0 15px rgba(60,160,255,.09);
}

.reset-button {
    flex: 0 0 auto;
    padding: 9px 11px;
    border: 1px solid rgba(255,255,255,.11);
    border-radius: 9px;
    background: rgba(255,255,255,.025);
    color: #91a5b5;
    cursor: pointer;
    transition:
        color .2s ease,
        background .2s ease,
        border-color .2s ease;
}

.reset-button:hover,
.reset-button:focus-visible {
    outline: none;
    color: #eaf6ff;
    border-color: rgba(79,168,255,.48);
    background: rgba(79,168,255,.11);
}


/* MAIN */

.workspace {
    flex: 1;

    width: 100%;
    min-width: 0;

    display: grid;

    grid-template-columns:
        minmax(250px, 300px)
        minmax(520px, 1fr)
        minmax(250px, 300px);

    gap: 18px;

    padding: 18px;
}

.panel {
    background:
        linear-gradient(
            145deg,
            rgba(20,34,48,.92),
            rgba(9,18,27,.88)
        );

    border: 1px solid var(--border);

    border-radius: 16px;

    box-shadow:
        0 25px 50px rgba(0,0,0,.28),
        inset 0 1px 0 rgba(255,255,255,.035);

    padding: 18px;
}


/* CONTROL PANEL */

.controls-panel section {
    margin-bottom: 28px;
}

.section-heading {
    margin-bottom: 18px;
}

.section-heading h2 {
    margin: 0;
    font-size: 15px;
}

.section-heading h2.heading-with-info {
    display: flex;
    align-items: center;
    gap: 7px;
}

.section-heading span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.control {
    margin-bottom: 22px;
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;

    font-size: 13px;
}

.control-row strong {
    font-size: 12px;
}

.horizon-control {
    margin-bottom: 0;
}

.horizon-control input[type="range"] {
    height: 5px;
    background:
        radial-gradient(circle at 0% 50%, #547287 0 2px, transparent 2.5px),
        radial-gradient(circle at 33.333% 50%, #547287 0 2px, transparent 2.5px),
        radial-gradient(circle at 66.666% 50%, #547287 0 2px, transparent 2.5px),
        radial-gradient(circle at 100% 50%, #547287 0 2px, transparent 2.5px),
        linear-gradient(90deg, #467fba, #55c3c8 67%, #e3a34a);
}

.activity-control .control-row {
    align-items: flex-start;
}

#activityLabel {
    max-width: 122px;
    line-height: 1.15;
    text-align: right;
}

.activity-control input[type="range"] {
    height: 5px;
    background:
        radial-gradient(circle at 0% 50%, #547287 0 2px, transparent 2.5px),
        radial-gradient(circle at 33.333% 50%, #547287 0 2px, transparent 2.5px),
        radial-gradient(circle at 66.666% 50%, #547287 0 2px, transparent 2.5px),
        radial-gradient(circle at 100% 50%, #547287 0 2px, transparent 2.5px),
        linear-gradient(90deg, #4d91bd, #68c690 44%, #e5b052 72%, #ef725f);
}

.horizon-scale,
.activity-scale {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin-top: 9px;
    color: #607789;
    font-size: 8px;
}

.horizon-scale span,
.activity-scale span {
    text-align: center;
    transition: color .2s ease, text-shadow .2s ease;
}

.horizon-scale span:first-child,
.activity-scale span:first-child {
    text-align: left;
}

.horizon-scale span:last-child,
.activity-scale span:last-child {
    text-align: right;
}

.horizon-scale span.is-active,
.activity-scale span.is-active {
    color: #d8edf9;
    text-shadow: 0 0 9px rgba(92, 198, 236, .55);
}

.horizon-description,
.activity-description {
    min-height: 2.5em;
    margin: 10px 0 0;
    color: #6f8495;
    font-size: 8px;
    line-height: 1.4;
}

.activity-reference {
    margin: 10px 0 0;
    color: #a6cadc;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.3;
}

.activity-description {
    margin-top: 4px;
}

.goal-planner {
    margin-bottom: 18px;
    padding: 12px;
    border: 1px solid rgba(104, 155, 190, .18);
    border-radius: 12px;
    background:
        linear-gradient(
            145deg,
            rgba(56, 112, 150, .10),
            rgba(255, 255, 255, .018)
        );
}

.planner-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 11px;
}

.planner-heading strong {
    color: #dbeaf4;
    font-size: 11px;
}

.planner-heading > span:last-child {
    color: #708596;
    font-size: 9px;
}

.weight-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 50px;
    gap: 7px;
}

.weight-field,
.weight-unit {
    display: grid;
    gap: 5px;
    min-width: 0;
    color: #8095a6;
    font-size: 9px;
}

.weight-field input,
.weight-unit select {
    width: 100%;
    min-width: 0;
    height: 31px;
    padding: 0 8px;
    border: 1px solid rgba(159, 184, 203, .20);
    border-radius: 8px;
    outline: none;
    background: rgba(3, 12, 20, .58);
    color: #e4f1f9;
    font: 600 11px/1 -apple-system, BlinkMacSystemFont, sans-serif;
}

.weight-unit select {
    appearance: none;
    padding-right: 18px;
    background-image:
        linear-gradient(45deg, transparent 50%, #7890a2 50%),
        linear-gradient(135deg, #7890a2 50%, transparent 50%);
    background-position:
        calc(100% - 10px) 13px,
        calc(100% - 6px) 13px;
    background-size: 4px 4px, 4px 4px;
    background-repeat: no-repeat;
}

.weight-field input:focus,
.weight-unit select:focus {
    border-color: rgba(79, 168, 255, .65);
    box-shadow: 0 0 0 3px rgba(79, 168, 255, .10);
}

.trajectory-card {
    --trajectory-color: #71889a;
    display: grid;
    grid-template-columns: 25px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, .055);
}

.trajectory-card[data-state="toward"] {
    --trajectory-color: #62e69a;
}

.trajectory-card[data-state="maintaining"] {
    --trajectory-color: #55baff;
}

.trajectory-card[data-state="away"] {
    --trajectory-color: #ff8b66;
}

.trajectory-icon {
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    border: 1px solid color-mix(in srgb, var(--trajectory-color) 58%, transparent);
    border-radius: 50%;
    color: var(--trajectory-color);
    background: color-mix(in srgb, var(--trajectory-color) 9%, transparent);
    box-shadow: 0 0 12px color-mix(in srgb, var(--trajectory-color) 16%, transparent);
    font-size: 14px;
}

.trajectory-card > span:last-child {
    min-width: 0;
}

.trajectory-card small,
.trajectory-card strong,
.trajectory-card em {
    display: block;
}

.trajectory-card small {
    margin-bottom: 2px;
    color: #718698;
    font-size: 8px;
    letter-spacing: .7px;
    text-transform: uppercase;
}

.trajectory-card strong {
    color: var(--trajectory-color);
    font-size: 10px;
}

.trajectory-card em {
    margin-top: 2px;
    overflow: hidden;
    color: #718596;
    font-size: 8px;
    font-style: normal;
    line-height: 1.35;
}

.label-with-info {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.info-button {
    appearance: none;
    position: relative;
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 15px;
    height: 15px;
    padding: 0;
    border: 1px solid rgba(159,184,203,.42);
    border-radius: 50%;
    background: rgba(255,255,255,.035);
    color: #8fa7b9;
    font: 700 9px/1 -apple-system, BlinkMacSystemFont, sans-serif;
    cursor: help;
    vertical-align: middle;
    transition:
        color .2s ease,
        border-color .2s ease,
        background .2s ease,
        box-shadow .2s ease;
}

.info-button::after {
    content: "";
    position: absolute;
    inset: -7px;
}

.info-button:hover,
.info-button:focus-visible,
.info-button[aria-expanded="true"] {
    outline: none;
    color: #eaf6ff;
    border-color: #55baff;
    background: rgba(79,168,255,.16);
    box-shadow: 0 0 10px rgba(79,168,255,.3);
}

input[type="range"] {
    appearance: none;
    width: 100%;
    height: 4px;

    margin-top: 14px;

    background: #263645;
    border-radius: 10px;

    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;

    width: 17px;
    height: 17px;

    border-radius: 50%;

    background: #dbe7ef;

    box-shadow:
        0 0 0 4px rgba(255,255,255,.06),
        0 3px 8px rgba(0,0,0,.4);
}

input[type="range"]:disabled {
    cursor: not-allowed;
    opacity: .42;
}

.protein input {
    accent-color: var(--protein);
}

.carbs input {
    accent-color: var(--carb);
}

.fats input {
    accent-color: var(--fat);
}

.calorie-control {
    margin-bottom: 20px;
    padding: 12px;
    border: 1px solid rgba(79, 168, 255, .19);
    border-radius: 11px;
    background: rgba(255, 255, 255, .032);
}

.calorie-control > input[type="range"] {
    background:
        linear-gradient(
            90deg,
            rgba(79, 168, 255, .82),
            rgba(83, 213, 189, .82)
        );
}

.starting-balance {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
}

.starting-balance small,
.starting-balance strong {
    display: block;
}

.starting-balance small {
    margin-bottom: 2px;
    color: #7b90a1;
    font-size: 8px;
}

.starting-balance strong {
    color: #a9c6d9;
    font-size: 9px;
}

.starting-balance button {
    flex: 0 0 auto;
    padding: 5px 8px;
    border: 1px solid rgba(79, 168, 255, .32);
    border-radius: 7px;
    background: rgba(79, 168, 255, .09);
    color: #77c1ff;
    font: 700 9px/1 -apple-system, BlinkMacSystemFont, sans-serif;
    cursor: pointer;
}

.starting-balance button:hover,
.starting-balance button:focus-visible {
    outline: none;
    border-color: #55baff;
    background: rgba(79, 168, 255, .16);
}

.starting-balance button:disabled {
    cursor: not-allowed;
    opacity: .4;
}

.calorie-status {
    min-height: 2.7em;
    margin: 9px 0 0;
    color: #6f8495;
    font-size: 8px;
    line-height: 1.35;
}

.calorie-status.is-constrained {
    color: #ffbd6e;
}

.macro-value {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.macro-lock {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 43px;
    padding: 4px 6px;
    border: 1px solid rgba(159, 184, 203, .17);
    border-radius: 7px;
    background: rgba(255, 255, 255, .025);
    color: #748a9b;
    font: 700 8px/1 -apple-system, BlinkMacSystemFont, sans-serif;
    cursor: pointer;
    transition:
        color .2s ease,
        border-color .2s ease,
        background .2s ease;
}

.macro-lock:hover,
.macro-lock:focus-visible {
    outline: none;
    color: #dbeaf4;
    border-color: rgba(79, 168, 255, .46);
}

.macro-lock[aria-pressed="true"] {
    color: #78c6ff;
    border-color: rgba(79, 168, 255, .54);
    background: rgba(79, 168, 255, .13);
    box-shadow: 0 0 10px rgba(79, 168, 255, .10);
}

.lock-symbol {
    position: relative;
    width: 7px;
    height: 6px;
    margin-top: 2px;
    border: 1px solid currentColor;
    border-radius: 1px;
}

.lock-symbol::before {
    content: "";
    position: absolute;
    left: 1px;
    bottom: 4px;
    width: 3px;
    height: 4px;
    border: 1px solid currentColor;
    border-bottom: 0;
    border-radius: 4px 4px 0 0;
    transform: translateX(1px);
}

.macro-lock[aria-pressed="false"] .lock-symbol::before {
    transform: translateX(3px) rotate(18deg);
    transform-origin: bottom left;
}

.control.is-locked input[type="range"] {
    opacity: .38;
    cursor: not-allowed;
}


/* CENTER */

.body-stage {
    position: relative;

    min-height: 690px;

    overflow: hidden;

    isolation: isolate;

    border-radius: 18px;

    border: 1px solid var(--border);

    background:
        radial-gradient(
            ellipse at center 44%,
            rgba(54,132,184,.18),
            transparent 30%
        ),
        radial-gradient(
            ellipse at center 104%,
            rgba(19,89,125,.16),
            transparent 47%
        ),
        radial-gradient(
            circle at center 35%,
            rgba(36,83,116,.38),
            rgba(7,17,27,.68) 45%,
            rgba(2,7,12,.94) 100%
        );

    box-shadow:
        inset 0 0 80px rgba(0,0,0,.4),
        0 30px 60px rgba(0,0,0,.25);
}

.body-stage::before,
.body-stage::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.body-stage::before {
    z-index: 0;
    background:
        linear-gradient(
            90deg,
            transparent 0%,
            rgba(80,171,222,.025) 34%,
            rgba(108,205,246,.075) 50%,
            rgba(80,171,222,.025) 66%,
            transparent 100%
        ),
        repeating-linear-gradient(
            0deg,
            rgba(126,205,238,.018) 0,
            rgba(126,205,238,.018) 1px,
            transparent 1px,
            transparent 5px
        );
    opacity: .72;
    mix-blend-mode: screen;
}

.body-stage::after {
    z-index: 1;
    border-radius: inherit;
    box-shadow:
        inset 0 1px rgba(174,224,255,.07),
        inset 0 0 0 1px rgba(0,0,0,.32),
        inset 0 -80px 100px rgba(0,5,10,.22);
}

.stage-label {
    position: absolute;
    top: 23px;
    left: 26px;

    z-index: 20;
}

.stage-label span {
    font-size: 10px;
    color: #678197;
    letter-spacing: 3px;
}

.stage-label h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 0;
    font-size: 21px;
}

.body-container {
    position: absolute;
    inset: 78px 30px 110px;

    display: flex;
    align-items: center;
    justify-content: center;
}


/* LAYERED ANATOMICAL BODY */

.human {
    position: relative;
    width: 280px;
    height: 560px;
    z-index: 8;
    mix-blend-mode: normal;
}

.human::before,
.human::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

.human::before {
    z-index: 0;
    inset: 4% -13% 2%;
    border-radius: 44%;
    background: radial-gradient(ellipse, rgba(72,170,224,.15), rgba(40,110,157,.035) 54%, transparent 72%);
    filter: blur(12px);
}

.human::after {
    z-index: 2;
    inset: 3% 14% 4%;
    background: linear-gradient(90deg, transparent 20%, rgba(175,232,255,.09) 49%, rgba(103,199,244,.035) 53%, transparent 80%);
    opacity: .55;
    mix-blend-mode: screen;
}

.body-anatomy {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 1;
    filter: contrast(1.1) saturate(1.06) brightness(.98);
    user-select: none;
}


/* BODY REGIONS */

.region {
    transition:
        opacity .35s ease,
        transform .35s ease,
        box-shadow .35s ease;
}

.anatomy-signal {
    position: absolute;
    z-index: 3;
    pointer-events: none;
    mix-blend-mode: screen;
    filter: blur(3.5px) saturate(1.1);
}

.brain {
    top: 2.7%;
    left: 41.5%;
    width: 17%;
    height: 6.2%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(143,139,255,.52), rgba(91,101,255,.08) 58%, transparent 75%);
    box-shadow: 0 0 15px rgba(102,117,255,.38);
}

.liver {
    top: 28%;
    left: 28%;
    width: 34%;
    height: 7%;
    border-radius: 50% 30% 45% 40%;
    background: radial-gradient(ellipse, rgba(255,111,74,.42), rgba(219,82,50,.06) 58%, transparent 76%);
    box-shadow: 0 0 16px rgba(219,102,74,.28);
}

.repair {
    top: 20%;
    left: 31%;
    width: 38%;
    height: 18%;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(157,110,255,.3), rgba(157,110,255,.04) 55%, transparent 76%);
}

.muscle,
.leg-muscle {
    position: absolute;
    z-index: 3;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(255,99,81,.34), rgba(184,48,38,.04) 54%, transparent 76%);
    box-shadow: 0 0 12px rgba(255,77,61,.18);
    mix-blend-mode: screen;
    filter: blur(4px) saturate(1.08);
}

.muscle-left {
    top: 19%;
    left: 11%;
    width: 16%;
    height: 24%;
}

.muscle-right {
    top: 19%;
    right: 11%;
    width: 16%;
    height: 24%;
}

.leg-muscle-left {
    top: 54.5%;
    left: 30%;
    width: 17%;
    height: 27%;
}

.leg-muscle-right {
    top: 54.5%;
    right: 30%;
    width: 17%;
    height: 27%;
}

.glycogen-reserve {
    top: 34%;
    left: 32%;
    width: 36%;
    height: 15%;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(89,238,151,.28), rgba(55,211,127,.03) 58%, transparent 76%);
    box-shadow: 0 0 14px rgba(75,231,143,.14);
}

.fat-reserve {
    position: absolute;
    z-index: 4;
    top: 42%;
    left: 34%;
    width: 32%;
    height: 12%;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(255,177,65,.28), rgba(255,142,36,.03) 58%, transparent 76%);
    box-shadow: 0 0 14px rgba(255,155,42,.14);
    mix-blend-mode: screen;
    filter: blur(4px) saturate(1.08);
}


/* CHECKPOINT 1: ROUTING MAP */

.routing-stage {
    position: absolute;
    z-index: 2;
    inset: 86px 20px 112px;
    display: grid;
    grid-template-columns:
        minmax(128px, 165px)
        minmax(190px, 1fr)
        minmax(150px, 195px);
    gap: 12px;
    align-items: center;
}

.routing-network {
    position: absolute;
    inset: 0;
    z-index: 5;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.circulation-web {
    color: #72d7ea;
    mix-blend-mode: screen;
}

.circulation-spine,
.circulation-crosslink {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

.circulation-spine {
    stroke-width: 1.5;
    stroke-dasharray: 3 7;
    opacity: .34;
}

.circulation-crosslink {
    stroke-width: 1;
    opacity: .22;
}

.circulation-core-ring,
.circulation-core,
.circulation-node {
    fill: rgba(117, 223, 239, .68);
    stroke: rgba(212, 249, 255, .82);
    vector-effect: non-scaling-stroke;
    filter: url(#routeGlow);
    transition:
        fill .45s ease,
        stroke .45s ease,
        opacity .45s ease;
}

.circulation-core-ring {
    fill: rgba(76, 196, 212, .08);
    stroke-width: 1.2;
}

.circulation-core {
    stroke-width: 1;
}

.circulation-node {
    opacity: .68;
    stroke-width: .7;
}

.route-channel {
    opacity: .55;
    mix-blend-mode: screen;
    transition: opacity .45s ease;
}

.route-envelope,
.route-filament {
    fill: none;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
    transition:
        stroke-width .45s ease,
        opacity .45s ease;
}

.route-envelope {
    stroke: currentColor;
    stroke-width: 10;
    opacity: .12;
    filter: url(#routeGlowSoft);
}

.route-path {
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
    opacity: .82;
    filter: url(#routeGlow);
    transition:
        stroke-width .45s ease,
        opacity .45s ease;
}

.route-path-core {
    filter: url(#routeGlow);
}

.route-filament {
    stroke: rgba(239, 251, 255, .94);
    stroke-width: 1;
    opacity: .18;
    filter: url(#routeGlow);
}

.route-terminal {
    fill: currentColor;
    stroke: rgba(242, 252, 255, .90);
    stroke-width: .8;
    vector-effect: non-scaling-stroke;
    opacity: .44;
    filter: url(#routeGlow);
    transition:
        r .45s ease,
        opacity .45s ease,
        stroke-width .45s ease;
}

.route-share {
    stroke-dasharray: 2 7;
}

.route-particle {
    fill: currentColor;
    opacity: 0;
    stroke: rgba(255,255,255,.72);
    stroke-width: .65;
    filter: url(#routeGlow);
    transition: opacity .35s ease;
}

.route-particle-small {
    opacity: 0;
}

.route-channel[data-flow-level="low"] .route-path,
.route-channel[data-flow-level="low"] .route-particle,
.route-channel[data-flow-level="low"] .route-terminal {
    filter: none;
}

.route-channel[data-flow-level="dominant"] .route-path,
.route-channel[data-flow-level="dominant"] .route-particle,
.route-channel[data-flow-level="dominant"] .route-terminal {
    filter: url(#routeGlowStrong);
}

.route-channel[data-flow-level="dominant"] .route-terminal {
    stroke-width: 1.4;
}

.channel-protein { color: var(--protein); }
.channel-carbs { color: var(--carb); }
.channel-fat { color: var(--fat); }
.channel-fuel { color: #58b8ff; }
.channel-liver { color: #ff9a72; }
.channel-fatUse { color: #ff9871; }
.channel-muscle { color: #ff7167; }
.channel-repair { color: #b287ff; }
.channel-glycogen { color: #76e699; }
.channel-storage { color: #ffb04d; }

.stored-release {
    color: #ffd078;
    opacity: 0;
}

.route-path-release {
    stroke-dasharray: 3 13;
}

.route-envelope-release {
    stroke-dasharray: 5 15;
    filter: url(#routeGlow);
}

.route-filament-release {
    stroke-dasharray: 1 19;
}

.routing-stage.is-releasing .route-path-release,
.routing-stage.is-releasing .route-envelope-release,
.routing-stage.is-releasing .route-filament-release {
    animation: release-flow 1.45s linear infinite;
}

@keyframes release-flow {
    to {
        stroke-dashoffset: -30;
    }
}

.release-label {
    fill: currentColor;
    opacity: .76;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.4px;
    paint-order: stroke;
    stroke: rgba(3,10,16,.9);
    stroke-width: 4px;
}

@media (min-width: 901px) and (max-width: 1100px) {
    .release-label {
        letter-spacing: .6px;
    }
}

.routing-column {
    position: relative;
    z-index: 14;
    min-width: 0;
}

.routing-kicker {
    margin: 0 0 10px;
    color: #71899c;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
}

.input-stack,
.destination-stack {
    display: flex;
    flex-direction: column;
}

.input-stack {
    gap: 22px;
}

.destination-stack {
    gap: 8px;
}

.route-card,
.destination-card {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
    border: 1px solid rgba(255,255,255,.10);
    background:
        radial-gradient(circle at 85% 50%, color-mix(in srgb, currentColor 12%, transparent), transparent 48%),
        linear-gradient(135deg, rgba(29,46,61,.94), rgba(12,23,33,.91));
    box-shadow:
        0 12px 24px rgba(0,0,0,.24),
        inset 0 1px rgba(255,255,255,.04);
    backdrop-filter: blur(12px);
}

.route-card {
    gap: 6px;
    min-height: 88px;
    padding: 10px 8px 10px 11px;
    border-radius: 12px;
}

.macro-total-tag {
    position: absolute;
    z-index: 2;
    top: -7px;
    right: -6px;
    min-width: 46px;
    padding: 3px 6px;
    border: 1px solid color-mix(in srgb, currentColor 42%, transparent);
    border-radius: 999px;
    color: color-mix(in srgb, currentColor 82%, white);
    background: rgba(4, 20, 31, .88);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .28), 0 0 10px color-mix(in srgb, currentColor 18%, transparent);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .02em;
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
}

.macro-energy-rate {
    display: inline-block;
    margin-top: 3px;
    color: color-mix(in srgb, currentColor 72%, white);
    font-size: 8px;
    font-weight: 750;
    letter-spacing: .035em;
    line-height: 1;
    opacity: .82;
}

.route-protein {
    color: var(--protein);
    border-color: rgba(79,168,255,.25);
}

.route-carbs {
    color: var(--carb);
    border-color: rgba(86,232,144,.25);
}

.route-fat {
    color: var(--fat);
    border-color: rgba(255,173,66,.25);
}

.route-visual {
    flex: 0 0 58px;
    width: 58px;
    height: 58px;
    overflow: visible;
    filter: drop-shadow(0 0 7px color-mix(in srgb, currentColor 45%, transparent));
}

img.route-visual {
    display: block;
    object-fit: contain;
    mix-blend-mode: screen;
    filter:
        contrast(1.08)
        saturate(1.04)
        drop-shadow(0 0 5px color-mix(in srgb, currentColor 36%, transparent));
}

.route-visual path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: .52;
}

.route-visual circle {
    fill: color-mix(in srgb, currentColor 70%, #dff5ff);
    stroke: rgba(255,255,255,.62);
    stroke-width: 1;
}

.route-card div,
.destination-card div {
    min-width: 0;
}

.route-card strong,
.route-card small,
.destination-card strong,
.destination-card small {
    display: block;
}

.route-card strong {
    overflow: hidden;
    color: var(--text);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.route-card small {
    margin-top: 4px;
    color: currentColor;
    font-size: 9px;
}

.destination-card {
    gap: 7px;
    min-height: 60px;
    padding: 7px 8px;
    border-radius: 10px;
    transition:
        border-color .35s ease,
        box-shadow .35s ease,
        transform .35s ease;
}

.destination-card.is-prioritized {
    transform: translateX(-3px);
    border-color: color-mix(in srgb, currentColor 42%, transparent);
    box-shadow:
        0 12px 24px rgba(0,0,0,.24),
        0 0 20px color-mix(in srgb, currentColor 15%, transparent),
        inset 0 1px rgba(255,255,255,.05);
}

.destination-visual {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    overflow: visible;
    filter: drop-shadow(0 0 6px color-mix(in srgb, currentColor 42%, transparent));
}

img.destination-visual {
    display: block;
    object-fit: contain;
    mix-blend-mode: screen;
    filter:
        contrast(1.08)
        saturate(1.03)
        drop-shadow(0 0 4px color-mix(in srgb, currentColor 32%, transparent));
}

.destination-visual path:first-child {
    fill: color-mix(in srgb, currentColor 64%, #f2f7ff);
    fill-opacity: .78;
    stroke: rgba(255,255,255,.68);
    stroke-width: 1;
    stroke-linejoin: round;
}

.destination-visual path + path {
    fill: none;
    stroke: rgba(255,255,255,.48);
    stroke-width: 1.2;
    stroke-linecap: round;
}

.destination-visual circle {
    fill: color-mix(in srgb, currentColor 66%, #f0f7ff);
    fill-opacity: .74;
    stroke: rgba(255,255,255,.58);
    stroke-width: 1;
}

.fat-cluster circle {
    fill-opacity: .82;
}

.destination-card strong {
    overflow: hidden;
    color: #dceaf4;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.destination-card small {
    overflow: hidden;
    margin-top: 2px;
    color: #71879a;
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.destination-card b {
    margin-left: auto;
    color: currentColor;
    font-size: 10px;
}

.response-dial {
    position: absolute;
    z-index: 3;
    top: -6px;
    right: -5px;
    width: 28px;
    height: 28px;
    border: 1px solid color-mix(in srgb, currentColor 54%, transparent);
    border-radius: 50%;
    background: rgba(4, 20, 31, .94);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, .4),
        0 0 10px color-mix(in srgb, currentColor 22%, transparent),
        inset 0 0 8px rgba(0, 0, 0, .6);
    opacity: .96;
}

.response-dial::before {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: repeating-conic-gradient(
        from 225deg,
        color-mix(in srgb, currentColor 90%, white) 0 2deg,
        color-mix(in srgb, currentColor 34%, transparent) 2deg 42deg,
        color-mix(in srgb, currentColor 82%, white) 42deg 45deg
    );
    -webkit-mask: radial-gradient(circle, transparent 48%, #000 52% 68%, transparent 72%);
    mask: radial-gradient(circle, transparent 48%, #000 52% 68%, transparent 72%);
    clip-path: polygon(0 0, 100% 0, 100% 78%, 50% 58%, 0 78%);
    opacity: .92;
}

.response-dial::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 6px;
    width: 4px;
    height: 4px;
    border: 1px solid rgba(255, 255, 255, .68);
    border-radius: 50%;
    background: color-mix(in srgb, currentColor 86%, white);
    transform: translateX(-50%);
    box-shadow: 0 0 5px currentColor;
}

.response-dial-needle {
    position: absolute;
    z-index: 2;
    left: calc(50% - 1px);
    bottom: 8px;
    width: 2px;
    height: 8px;
    border-radius: 999px;
    background: color-mix(in srgb, currentColor 82%, white);
    box-shadow: 0 0 4px currentColor;
    transform: rotate(var(--dial-angle, -110deg));
    transform-origin: 50% 100%;
    transition: transform .55s cubic-bezier(.2, .7, .2, 1);
}

.response-dial[data-emphasis="empty"] {
    opacity: .18;
}

.destination-brain { color: #62b9ff; }
.destination-liver { color: #ff9a72; }
.destination-muscle { color: #ff756d; }
.destination-repair { color: #b58cff; }
.destination-glycogen { color: #7de79a; }
.destination-storage { color: #ffb459; }
.destination-fat-use { color: #ff9d69; }

.routing-stage .body-container {
    position: relative;
    inset: auto;
    width: 100%;
    height: 100%;
    min-width: 0;
}

.body-halo {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(440px, 154%);
    aspect-ratio: 1;
    transform: translate(-50%, -50%) scale(1);
    border-radius: 50%;
    background:
        radial-gradient(circle, rgba(47,128,178,.26), rgba(23,72,105,.075) 48%, transparent 72%);
    border: 1px solid rgba(93,190,239,.08);
    box-shadow:
        0 0 60px rgba(36,133,188,.08),
        inset 0 0 60px rgba(49,144,195,.045);
    transition:
        transform .55s ease,
        background .55s ease,
        border-color .55s ease,
        box-shadow .55s ease;
}

.body-halo::before,
.body-halo::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.body-halo::before {
    inset: 10%;
    border: 1px solid rgba(97,189,236,.075);
    box-shadow: inset 0 0 36px rgba(58,160,214,.045);
}

.body-halo::after {
    inset: 22%;
    border: 1px dashed rgba(112,206,246,.105);
    animation: halo-drift 28s linear infinite;
    transition:
        inset .55s ease,
        border-color .55s ease,
        opacity .55s ease;
}

.routing-stage[data-balance-state="matched"] .body-halo {
    background:
        radial-gradient(circle, rgba(66, 203, 195, .24), rgba(28, 112, 127, .09) 48%, transparent 72%);
    border-color: rgba(100, 226, 214, .20);
    box-shadow:
        0 0 78px rgba(53, 202, 193, .18),
        inset 0 0 70px rgba(81, 221, 210, .08);
}

.routing-stage[data-balance-state="matched"] .body-halo::before,
.routing-stage[data-balance-state="matched"] .body-halo::after {
    border-color: rgba(106, 230, 218, .22);
}

.routing-stage[data-balance-state="deficit"] .body-halo {
    transform: translate(-50%, -50%) scale(.91);
    background:
        radial-gradient(circle, rgba(255, 84, 99, .23), rgba(124, 27, 46, .09) 46%, transparent 69%);
    border-color: rgba(255, 112, 123, .38);
    box-shadow:
        0 0 68px rgba(255, 62, 82, .24),
        inset 0 0 78px rgba(255, 91, 105, .13);
}

.routing-stage[data-balance-state="deficit"] .body-halo::before,
.routing-stage[data-balance-state="deficit"] .body-halo::after {
    border-color: rgba(255, 121, 131, .42);
}

.routing-stage[data-balance-state="deficit"] .body-halo::after {
    inset: 27%;
    animation-direction: reverse;
    animation-duration: 13s;
}

.routing-stage[data-balance-state="surplus"] .body-halo {
    transform: translate(-50%, -50%) scale(1.12);
    background:
        radial-gradient(circle, rgba(255, 166, 54, .26), rgba(141, 72, 14, .09) 48%, transparent 72%);
    border-color: rgba(255, 190, 92, .36);
    box-shadow:
        0 0 104px rgba(255, 151, 38, .27),
        0 0 0 16px rgba(255, 166, 54, .035),
        inset 0 0 82px rgba(255, 197, 105, .12);
}

.routing-stage[data-balance-state="surplus"] .body-halo::before,
.routing-stage[data-balance-state="surplus"] .body-halo::after {
    border-color: rgba(255, 199, 106, .40);
}

.routing-stage[data-balance-state="surplus"] .body-halo::after {
    inset: 17%;
    animation-duration: 18s;
}

.routing-stage[data-balance-state="deficit"] .circulation-web {
    color: #ff717c;
}

.routing-stage[data-balance-state="surplus"] .circulation-web {
    color: #ffac50;
}

@keyframes halo-drift {
    to {
        transform: rotate(360deg);
    }
}

.routing-stage .human {
    transform: translateY(-8px) scale(1.34);
    transform-origin: center center;
}

/* MESSAGE */

.stage-message {
    position: absolute;

    bottom: 24px;
    left: 50%;

    transform: translateX(-50%);

    width: min(620px, 85%);

    padding: 15px 20px;

    border-radius: 12px;

    background: rgba(8,19,29,.80);

    border: 1px solid var(--border);

    backdrop-filter: blur(15px);

    text-align: center;

    z-index: 30;
}

.stage-balance-summary {
    display: table;
    margin: 0 auto 6px;
    padding: 3px 8px;
    border: 1px solid rgba(100, 226, 214, .28);
    border-radius: 999px;
    background: rgba(56, 180, 171, .12);
    color: #87e7dc;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .45px;
    text-transform: uppercase;
}

.stage-message[data-balance-state="deficit"] .stage-balance-summary {
    border-color: rgba(255, 109, 120, .48);
    background: rgba(173, 39, 57, .20);
    color: #ff939b;
}

.stage-message[data-balance-state="surplus"] .stage-balance-summary {
    border-color: rgba(255, 174, 68, .38);
    background: rgba(190, 99, 19, .17);
    color: #ffbd67;
}

.stage-message[data-balance-state="matched"] {
    border-color: rgba(100, 226, 214, .24);
}

.stage-message[data-balance-state="deficit"] {
    border-color: rgba(255, 103, 115, .34);
    box-shadow: 0 0 26px rgba(255, 57, 77, .08);
}

.stage-message[data-balance-state="surplus"] {
    border-color: rgba(255, 174, 68, .30);
    box-shadow: 0 0 26px rgba(255, 151, 38, .08);
}

.stage-message strong {
    font-size: 15px;
}

.stage-message p {
    margin: 5px 0 0;

    font-size: 12px;
    line-height: 1.5;

    color: var(--muted);
}

.motion-toggle {
    position: absolute;
    z-index: 31;
    bottom: 112px;
    left: 50%;
    display: flex;
    align-items: center;
    gap: 7px;
    transform: translateX(-50%);
    padding: 7px 11px;
    border: 1px solid rgba(142,174,197,.23);
    border-radius: 999px;
    background: rgba(8,19,29,.86);
    color: #91a6b6;
    font-size: 9px;
    cursor: pointer;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 18px rgba(0,0,0,.25);
}

.motion-toggle:hover,
.motion-toggle:focus-visible {
    outline: none;
    color: #e8f5ff;
    border-color: rgba(79,168,255,.52);
}

.motion-toggle strong {
    color: #dceaf4;
    font-size: 9px;
}

.motion-icon {
    color: #62caff;
    font-size: 13px;
}

.body-stage.flow-paused .route-path-release,
.body-stage.flow-paused .route-envelope-release,
.body-stage.flow-paused .route-filament-release {
    animation-play-state: paused;
}


/* OUTPUT */

.output-panel {
    padding: 16px;
}

.output-panel .section-heading {
    margin-bottom: 11px;
}

.output-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 6px;
    align-items: center;
    min-height: 84px;
    margin-bottom: 8px;
    padding: 9px 8px 8px 11px;
    border-radius: 11px;
    background:
        radial-gradient(
            circle at 88% 50%,
            color-mix(in srgb, var(--gauge-color) 8%, transparent),
            transparent 42%
        ),
        linear-gradient(
            145deg,
            rgba(255,255,255,.062),
            rgba(255,255,255,.016)
        );
    border: 1px solid color-mix(in srgb, var(--gauge-color) 11%, rgba(255,255,255,.08));
    box-shadow:
        0 8px 18px rgba(0,0,0,.09),
        inset 0 1px rgba(255,255,255,.035);
}

.output-copy {
    min-width: 0;
}

.output-name {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: visible;
    color: #b9c8d4;
    font-size: 10px;
    white-space: nowrap;
}

.output-name i {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gauge-color);
    box-shadow: 0 0 9px var(--gauge-color);
}

.output-symbol {
    flex: 0 0 18px;
    display: block;
    width: 18px;
    height: 18px;
    object-fit: contain;
    border-radius: 50%;
    mix-blend-mode: screen;
    filter:
        contrast(1.08)
        saturate(1.04)
        drop-shadow(0 0 4px color-mix(in srgb, var(--gauge-color) 42%, transparent));
}

.output-symbol-fuel {
    display: grid;
    place-items: center;
    color: var(--gauge-color);
    background: color-mix(in srgb, var(--gauge-color) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--gauge-color) 34%, transparent);
    box-shadow: 0 0 8px color-mix(in srgb, var(--gauge-color) 24%, transparent);
    font-size: 11px;
}

.output-name .info-button {
    width: 13px;
    height: 13px;
    margin-left: 1px;
    font-size: 8px;
}

.output-copy strong,
.output-copy .output-value {
    display: inline-block;
    margin-top: 3px;
    color: #f2f8ff;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.output-copy em {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 5px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 8px;
    font-style: normal;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .1px;
    transition:
        color .25s ease,
        background .25s ease,
        border-color .25s ease,
        box-shadow .25s ease;
}

.output-copy em.status-good {
    color: #79f0a7;
    border-color: rgba(98, 230, 154, .30);
    background: rgba(42, 170, 99, .15);
    box-shadow: 0 0 9px rgba(64, 221, 133, .10);
}

.output-copy em.status-caution {
    color: #ffd15f;
    border-color: rgba(255, 202, 72, .34);
    background: rgba(197, 145, 25, .16);
    box-shadow: 0 0 9px rgba(255, 194, 50, .10);
}

.output-copy em.status-alert {
    color: #ff7d73;
    border-color: rgba(255, 102, 91, .36);
    background: rgba(204, 66, 56, .17);
    box-shadow: 0 0 10px rgba(255, 89, 77, .12);
}

.output-copy small {
    display: block;
    overflow: hidden;
    margin-top: 5px;
    color: #6f8394;
    font-size: 8px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.gauge {
    position: relative;
    width: 92px;
    justify-self: end;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 84%, color-mix(in srgb, var(--gauge-color) 10%, transparent), transparent 58%);
}

.gauge svg {
    display: block;
    width: 100%;
    overflow: visible;
    filter: drop-shadow(0 5px 10px rgba(0,0,0,.16));
}

.gauge-track,
.gauge-value {
    fill: none;
    stroke-width: 7;
    stroke-linecap: round;
}

.gauge-track {
    stroke: rgba(117,137,153,.22);
}

.gauge-value {
    stroke: var(--gauge-color);
    filter: drop-shadow(0 0 4px color-mix(in srgb, var(--gauge-color) 48%, transparent));
    transition: stroke-dasharray .45s ease;
}

.gauge-needle {
    stroke: #d8e4ec;
    stroke-width: 2;
    stroke-linecap: round;
    filter: drop-shadow(0 0 3px rgba(255,255,255,.55));
    transition: transform .45s ease;
}

.gauge-hub {
    fill: #d8e4ec;
    stroke: var(--gauge-color);
    stroke-width: 2;
}

.model-note {
    margin-top: 12px;
    font-size: 10px;
    line-height: 1.5;
    color: #667888;
}

.model-note strong {
    display: block;
    margin-bottom: 2px;
    color: #8da0af;
    font-size: 9px;
    letter-spacing: .35px;
    text-transform: uppercase;
}


/* A consistent keyboard indicator supplements hover and color changes. */
.preset:focus-visible,
.reset-button:focus-visible,
.welcome-open:focus-visible,
.welcome-close:focus-visible,
.welcome-primary:focus-visible,
.welcome-secondary:focus-visible,
.learn-link:focus-visible,
.info-popover-link:focus-visible,
.info-button:focus-visible,
.starting-balance button:focus-visible,
.macro-lock:focus-visible,
.motion-toggle:focus-visible,
input[type="range"]:focus-visible,
.weight-field input:focus-visible,
.weight-unit select:focus-visible {
    outline: 2px solid #8dd3ff;
    outline-offset: 3px;
}


/* FIRST-VISIT INVITATION */

.welcome-dialog {
    width: min(790px, calc(100vw - 30px));
    max-width: none;
    max-height: calc(100dvh - 30px);
    margin: auto;
    padding: 0;
    overflow: auto;
    border: 1px solid rgba(91, 184, 236, .34);
    border-radius: 22px;
    background:
        radial-gradient(circle at 78% 34%, rgba(46, 151, 211, .18), transparent 34%),
        linear-gradient(145deg, rgba(15, 33, 48, .99), rgba(5, 15, 24, .995));
    color: var(--text);
    box-shadow:
        0 36px 100px rgba(0, 0, 0, .7),
        0 0 52px rgba(37, 156, 224, .12),
        inset 0 1px rgba(255, 255, 255, .06);
}

.welcome-dialog::backdrop {
    background: rgba(1, 7, 12, .78);
    backdrop-filter: blur(9px) saturate(.72);
}

.welcome-dialog[open] {
    animation: welcome-dialog-in .28s ease-out;
}

.welcome-panel {
    position: relative;
    padding: 36px 38px 23px;
}

.welcome-close {
    position: absolute;
    z-index: 4;
    top: 14px;
    right: 15px;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(124, 171, 201, .25);
    border-radius: 50%;
    background: rgba(5, 17, 27, .72);
    color: #9cb2c1;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.welcome-close:hover {
    border-color: rgba(118, 208, 255, .58);
    color: #f0fbff;
}

.welcome-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(250px, .85fr);
    gap: 30px;
    align-items: center;
}

.welcome-kicker {
    display: block;
    margin-bottom: 11px;
    color: #72d3ff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2.4px;
    text-transform: uppercase;
}

.welcome-copy h2 {
    max-width: 470px;
    margin: 0;
    color: #f3f9fd;
    font-size: clamp(25px, 3.2vw, 38px);
    line-height: 1.08;
    letter-spacing: -.8px;
}

.welcome-copy > p {
    max-width: 470px;
    margin: 15px 0 0;
    color: #9cb2c2;
    font-size: 14px;
    line-height: 1.58;
}

.welcome-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 13px;
    margin-top: 24px;
}

.welcome-primary,
.welcome-secondary {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
}

.welcome-primary {
    padding: 0 19px;
    border: 1px solid #69cfff;
    background: linear-gradient(180deg, #238fca, #126392);
    color: #fff;
    box-shadow: 0 0 24px rgba(52, 174, 235, .28);
    cursor: pointer;
}

.welcome-primary:hover {
    background: linear-gradient(180deg, #31a4e2, #1671a5);
}

.welcome-secondary {
    padding: 0 6px;
    color: #8ddaff;
    text-decoration: none;
}

.welcome-secondary:hover {
    color: #e4f7ff;
}

.welcome-machine {
    position: relative;
    min-height: 330px;
    overflow: hidden;
    isolation: isolate;
}

.welcome-machine::before {
    content: "";
    position: absolute;
    z-index: -3;
    inset: 32px 3px 12px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(45, 177, 238, .2), rgba(8, 35, 53, .04) 54%, transparent 72%);
    filter: blur(3px);
}

.welcome-machine img {
    position: absolute;
    z-index: 2;
    left: 50%;
    bottom: 0;
    width: 150px;
    height: 300px;
    object-fit: contain;
    transform: translateX(-50%);
    filter: drop-shadow(0 0 12px rgba(63, 183, 241, .48));
}

.welcome-orbit {
    position: absolute;
    z-index: -1;
    left: 50%;
    top: 52%;
    border: 1px solid rgba(82, 184, 232, .18);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.welcome-orbit-outer {
    width: 270px;
    height: 270px;
    border-style: dashed;
}

.welcome-orbit-inner {
    width: 202px;
    height: 202px;
}

.welcome-route {
    position: absolute;
    z-index: 1;
    height: 3px;
    border-radius: 999px;
    transform-origin: 0 50%;
    filter: drop-shadow(0 0 6px currentColor);
}

.welcome-route-protein {
    left: 5px;
    top: 87px;
    width: 154px;
    color: #48adff;
    background: currentColor;
    transform: rotate(22deg);
}

.welcome-route-carbs {
    left: 0;
    top: 162px;
    width: 157px;
    color: #51e692;
    background: currentColor;
    transform: rotate(1deg);
}

.welcome-route-fats {
    left: 2px;
    top: 243px;
    width: 165px;
    color: #ffb142;
    background: currentColor;
    transform: rotate(-24deg);
}

.welcome-route-brain,
.welcome-route-muscle,
.welcome-route-storage {
    left: 52%;
    width: 151px;
}

.welcome-route-brain {
    top: 163px;
    color: #4fb8ff;
    background: currentColor;
    transform: rotate(-37deg);
}

.welcome-route-muscle {
    top: 168px;
    color: #ff675f;
    background: currentColor;
    transform: rotate(9deg);
}

.welcome-route-storage {
    top: 174px;
    color: #6be299;
    background: currentColor;
    transform: rotate(39deg);
}

.welcome-route-dot,
.welcome-core {
    position: absolute;
    z-index: 3;
    border-radius: 50%;
}

.welcome-route-dot {
    width: 9px;
    height: 9px;
    background: #c6efff;
    box-shadow: 0 0 11px #68cfff;
}

.welcome-route-dot-input {
    left: 35px;
    top: 157px;
}

.welcome-route-dot-output {
    right: 35px;
    top: 206px;
}

.welcome-core {
    left: 50%;
    top: 50%;
    width: 26px;
    height: 26px;
    border: 1px solid rgba(180, 244, 255, .86);
    background: radial-gradient(circle, rgba(224, 255, 255, .9), rgba(62, 210, 224, .32) 30%, rgba(43, 164, 205, .08) 64%, transparent 70%);
    box-shadow: 0 0 22px rgba(91, 225, 235, .76);
    transform: translate(-50%, -50%);
}

.welcome-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 23px 0 0;
    padding: 16px 0 0;
    border-top: 1px solid rgba(105, 163, 198, .17);
    list-style: none;
}

.welcome-steps li {
    display: grid;
    grid-template-columns: 25px minmax(0, 1fr);
    gap: 9px;
    align-items: start;
}

.welcome-step-number {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(91, 201, 251, .44);
    border-radius: 50%;
    color: #72d3ff;
    font-size: 10px;
    font-weight: 800;
}

.welcome-steps strong,
.welcome-steps small {
    display: block;
}

.welcome-steps strong {
    color: #e7f2f8;
    font-size: 11px;
    line-height: 1.35;
}

.welcome-steps small {
    margin-top: 3px;
    color: #7890a1;
    font-size: 9px;
    line-height: 1.45;
}

.welcome-caveat {
    margin: 15px 0 0;
    color: #647b8b;
    font-size: 9px;
    line-height: 1.4;
    text-align: center;
}

@keyframes welcome-dialog-in {
    from {
        opacity: 0;
        transform: translateY(13px) scale(.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 650px) {

    .welcome-dialog {
        width: min(94vw, 520px);
        max-height: calc(100dvh - 18px);
        border-radius: 17px;
    }

    .welcome-panel {
        padding: 29px 22px 20px;
    }

    .welcome-hero {
        grid-template-columns: minmax(0, 1fr);
        gap: 9px;
    }

    .welcome-copy h2 {
        padding-right: 22px;
        font-size: 28px;
    }

    .welcome-copy > p {
        font-size: 13px;
    }

    .welcome-machine {
        min-height: 235px;
    }

    .welcome-machine img {
        width: 108px;
        height: 216px;
    }

    .welcome-orbit-outer {
        width: 214px;
        height: 214px;
    }

    .welcome-orbit-inner {
        width: 164px;
        height: 164px;
    }

    .welcome-route-protein,
    .welcome-route-carbs,
    .welcome-route-fats {
        left: calc(50% - 150px);
        width: 130px;
    }

    .welcome-route-protein {
        top: 61px;
    }

    .welcome-route-carbs {
        top: 115px;
    }

    .welcome-route-fats {
        top: 176px;
    }

    .welcome-route-brain,
    .welcome-route-muscle,
    .welcome-route-storage {
        left: 51%;
        width: 126px;
    }

    .welcome-route-brain {
        top: 117px;
    }

    .welcome-route-muscle {
        top: 120px;
    }

    .welcome-route-storage {
        top: 125px;
    }

    .welcome-core {
        width: 21px;
        height: 21px;
    }

    .welcome-route-dot-input {
        left: calc(50% - 124px);
        top: 111px;
    }

    .welcome-route-dot-output {
        right: calc(50% - 123px);
        top: 148px;
    }

    .welcome-steps {
        grid-template-columns: minmax(0, 1fr);
        margin-top: 16px;
        gap: 9px;
    }

    .welcome-actions {
        margin-top: 18px;
    }
}

@media (max-width: 390px) {

    .welcome-machine {
        min-height: 200px;
    }

    .welcome-machine img {
        width: 90px;
        height: 180px;
    }

    .welcome-orbit-outer {
        width: 184px;
        height: 184px;
    }

    .welcome-orbit-inner {
        width: 138px;
        height: 138px;
    }

    .welcome-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .welcome-secondary {
        min-height: 34px;
    }
}


/* EDUCATIONAL POPOVER */

.info-popover {
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: min(280px, calc(100vw - 24px));
    padding: 12px 13px;
    border: 1px solid rgba(111,169,207,.28);
    border-radius: 10px;
    background: rgba(7,18,28,.97);
    color: #8fa4b5;
    box-shadow:
        0 18px 45px rgba(0,0,0,.5),
        inset 0 1px rgba(255,255,255,.04);
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition:
        opacity .16s ease,
        transform .16s ease;
}

.info-popover.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.info-popover.pinned {
    pointer-events: auto;
}

.info-popover strong,
.info-popover span {
    display: block;
}

.info-popover strong {
    margin-bottom: 5px;
    color: #e7f3fb;
    font-size: 11px;
}

.info-popover span {
    font-size: 10px;
    line-height: 1.5;
}

.info-popover-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 9px;
    color: #71caff;
    font-size: 10px;
    font-weight: 800;
    text-decoration: none;
}

.info-popover-link[hidden] {
    display: none;
}

.info-popover-link:hover {
    color: #d5f2ff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.info-popover-link span {
    display: inline;
    font-size: inherit;
    line-height: inherit;
}

@media (prefers-reduced-motion: reduce) {

    .route-particle {
        display: none;
    }

    .route-path-release {
        animation: none !important;
    }

    .body-halo::after {
        animation: none;
    }

    .route-channel,
    .route-path,
    .region,
    .gauge-value,
    .gauge-needle,
    .info-popover,
    .skip-link {
        transition: none;
    }
}

/* V3 food-source workspace */
.food-source-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
    padding: 4px;
    border: 1px solid rgba(112, 205, 245, 0.18);
    border-radius: 14px;
    background: rgba(2, 17, 28, 0.5);
}

.food-source-tab {
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--muted);
    background: transparent;
    font: inherit;
    font-weight: 700;
}

.food-source-tab.is-active {
    color: #f4fbff;
    border-color: rgba(91, 211, 255, 0.55);
    background: linear-gradient(135deg, rgba(23, 113, 153, 0.48), rgba(18, 69, 102, 0.38));
    box-shadow: inset 0 0 20px rgba(57, 190, 240, 0.08);
}

.food-source-tab:focus-visible,
.usda-search-form input:focus-visible,
.usda-search-form button:focus-visible,
.usda-result-card button:focus-visible {
    outline: 3px solid rgba(105, 218, 255, 0.9);
    outline-offset: 2px;
}

.food-source-panel[hidden] {
    display: none !important;
}

body.core-mode .food-source-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.clear-foods-wrap {
    display: grid;
    justify-items: end;
    gap: 3px;
}

.clear-foods-wrap small {
    max-width: 150px;
    color: rgba(191, 211, 224, 0.68);
    font-size: 11px;
    line-height: 1.25;
    text-align: right;
}

.food-selection-count {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    min-height: 44px;
    color: rgba(191, 211, 224, 0.76);
    font-size: 13px;
    font-weight: 700;
}

body.core-mode .hero-energy-readout {
    position: absolute;
    top: 8px;
    left: 10px;
    z-index: 11;
    width: clamp(150px, 20%, 205px);
    padding: 5px 7px 6px;
    color: #edf9fd;
    background: linear-gradient(90deg, rgba(4, 24, 38, 0.72), rgba(4, 24, 38, 0.08));
    pointer-events: none;
}

body.core-mode .hero-energy-heading {
    display: flex;
    align-items: center;
    gap: 4px;
}

body.core-mode .hero-energy-heading > span {
    color: rgba(124, 184, 207, 0.82);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.16em;
    line-height: 1.2;
}

body.core-mode .hero-energy-readout output {
    display: block;
    margin-top: 2px;
    color: #f4fbfe;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.2;
}

body.core-mode .hero-energy-meter {
    position: relative;
    display: block;
    width: 100%;
    height: 3px;
    margin: 5px 0 4px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(104, 153, 174, 0.18);
}

body.core-mode .hero-energy-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #45b9ec, #63dfca, #efbd69);
    box-shadow: 0 0 8px rgba(74, 202, 235, 0.42);
    transition: width 320ms ease;
}

body.core-mode .hero-energy-reference {
    position: absolute;
    top: -2px;
    bottom: -2px;
    left: 71.43%;
    width: 1px;
    background: rgba(241, 250, 252, 0.68);
}

body.core-mode .hero-energy-readout .model-energy-context {
    display: block;
    color: rgba(166, 197, 210, 0.72);
    font-size: 9px;
    line-height: 1.25;
}

body.core-mode .hero-energy-readout .energy-info-button {
    width: 24px;
    min-width: 24px;
    height: 24px;
    min-height: 24px;
    margin-left: auto;
    border-color: transparent;
    background: transparent;
    opacity: 0.72;
    pointer-events: auto;
}

@media (max-width: 520px) {
    body.core-mode .hero-energy-readout {
        top: 4px;
        left: 5px;
        width: 138px;
        padding-left: 5px;
    }

    body.core-mode .hero-energy-readout output {
        font-size: 16px;
    }
}

/* Keep the iPad portrait teaching readouts in separate visual lanes. */
@media (min-width: 521px) and (max-width: 900px) {
    body.core-mode .hero-energy-readout {
        top: 5px;
        left: clamp(150px, 22vw, 185px);
    }
}

.usda-food-panel,
.my-foods-panel {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    padding: 12px 3px 4px;
}

.usda-food-panel[hidden],
.my-foods-panel[hidden] {
    display: none;
}

.my-foods-shelf {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    margin-bottom: 0;
    padding: 10px;
    border: 1px solid rgba(101, 204, 239, .25);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(12, 51, 68, .9), rgba(7, 29, 43, .88));
    overflow: hidden;
}

.my-foods-heading {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.my-foods-heading h3 {
    margin: 0;
    color: #f2fbff;
    font-size: 14px;
}

.my-foods-heading span,
.my-foods-empty {
    color: rgba(190, 216, 228, .72);
    font-size: 11px;
    line-height: 1.35;
}

.send-all-to-pantry {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 5px 10px;
    border: 1px solid rgba(108, 220, 211, .38);
    border-radius: 9px;
    color: #c9f6ef;
    background: rgba(20, 94, 91, .28);
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}

.send-all-to-pantry:is(:hover, :focus-visible) {
    border-color: rgba(117, 235, 225, .72);
    background: rgba(24, 119, 113, .42);
}

.send-all-to-pantry:disabled {
    opacity: .35;
    cursor: default;
}

.my-foods-empty {
    margin: 4px 0 0;
}

.my-foods-list {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    gap: 12px;
    align-content: start;
    grid-auto-rows: max-content;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.my-foods-list::-webkit-scrollbar {
    width: 7px;
}

.my-foods-list::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(91, 183, 210, .42);
}

.my-foods-group {
    --group-accent: 137, 219, 235;
    display: grid;
    gap: 8px;
    align-content: start;
    padding: 8px;
    border: 1px solid rgba(var(--group-accent), .18);
    border-left: 3px solid rgba(var(--group-accent), .72);
    border-radius: 10px;
    background: linear-gradient(100deg, rgba(var(--group-accent), .09), rgba(5, 27, 39, .08) 42%);
}

.my-foods-group h4 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0;
    color: rgb(var(--group-accent));
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .10em;
    text-transform: uppercase;
}

.my-foods-group h4::before {
    content: "";
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: rgb(var(--group-accent));
    box-shadow: 0 0 9px rgba(var(--group-accent), .7);
}

.my-foods-group h4 > span {
    margin-right: auto;
}

.my-foods-group h4 > small {
    color: rgba(var(--group-accent), .68);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: none;
}

.my-foods-group[data-macro-group="protein"] { --group-accent: 92, 190, 255; }
.my-foods-group[data-macro-group="carbs"] { --group-accent: 86, 224, 158; }
.my-foods-group[data-macro-group="fats"] { --group-accent: 246, 181, 75; }
.my-foods-group[data-macro-group="mixed"] { --group-accent: 185, 151, 255; }

.my-foods-group .usda-result-card {
    border-color: rgba(var(--group-accent), .24);
    background: rgba(5, 28, 40, .58);
}

.my-foods-group .usda-result-copy strong {
    color: #f1f9fc;
    font-weight: 780;
}

.my-foods-group .usda-result-copy span {
    color: rgba(var(--group-accent), .72);
}

.my-foods-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    gap: 7px;
    container-type: inline-size;
}

.my-foods-group .usda-result-card {
    min-height: 58px;
    padding: 7px 8px;
    gap: 6px;
}

@media (max-width: 520px) {
    .my-foods-heading {
        align-items: flex-start;
    }

    .send-all-to-pantry {
        max-width: 132px;
        white-space: normal;
    }
}

.my-foods-group .usda-result-copy strong {
    font-size: 12px;
    line-height: 1.18;
    text-wrap: pretty;
}

.my-foods-group .usda-result-copy span {
    font-size: 10px;
    line-height: 1.2;
}

.my-foods-group .usda-result-copy small {
    display: none;
}

.my-foods-group .usda-card-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
}

/* When the food workspace is narrow, protect the copy from the controls.
   Wider iPad cards keep the compact single-row treatment. */
@container (max-width: 620px) {
    .my-foods-group .usda-result-card {
        grid-template-columns: minmax(0, 1fr);
        align-content: start;
    }

    .my-foods-group .usda-card-actions {
        width: max-content;
        max-width: 100%;
        justify-self: end;
    }
}

.my-foods-group .remove-saved-food {
    width: 24px;
    min-height: 24px;
    overflow: hidden;
    padding: 0;
    color: transparent;
    font-size: 0;
}

.my-foods-group .remove-saved-food::before {
    content: "×";
    color: rgba(255, 215, 177, .88);
    font-size: 16px;
}

.undo-saved-food,
.remove-saved-food,
.move-saved-food,
.save-pantry-food {
    border: 1px solid rgba(247, 176, 105, .32);
    border-radius: 8px;
    color: rgba(255, 215, 177, .88);
    background: rgba(94, 52, 25, .26);
}

.move-saved-food,
.save-pantry-food {
    min-height: 30px;
    padding: 3px 8px;
    white-space: nowrap;
}

.move-saved-food {
    color: rgba(166, 237, 230, .9);
    border-color: rgba(84, 218, 208, .3);
    background: rgba(20, 94, 91, .24);
}

.save-pantry-food:disabled {
    color: rgba(186, 210, 220, .55);
    border-color: rgba(125, 166, 181, .18);
    background: rgba(33, 66, 78, .18);
}

@media (max-width: 680px) {
    .food-source-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.undo-saved-food {
    min-height: 34px;
    padding: 0 10px;
    white-space: nowrap;
}

.usda-search-form {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 10px;
    border: 1px solid rgba(100, 192, 226, 0.2);
    border-radius: 14px;
    background: rgba(6, 27, 41, 0.96);
}

.usda-search-form label {
    display: block;
    margin-bottom: 6px;
    color: #f1f9fc;
    font-weight: 750;
}

.usda-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.usda-search-input-wrap {
    position: relative;
    min-width: 0;
}

.usda-search-form input,
.usda-search-form button {
    min-height: 44px;
    border: 1px solid rgba(97, 202, 241, 0.3);
    border-radius: 10px;
    font: inherit;
}

.usda-search-form input {
    width: 100%;
    min-width: 0;
    padding: 0 42px 0 12px;
    color: #f5fbff;
    background: rgba(2, 14, 23, 0.82);
}

/* Safari supplies its own clear control for search inputs; the Explorer uses
   the larger accessible button beside it instead. */
.usda-search-form input[type="search"]::-webkit-search-cancel-button,
.usda-search-form input[type="search"]::-webkit-search-decoration {
    display: none;
    -webkit-appearance: none;
    appearance: none;
}

.usda-search-form .usda-search-row > button[type="submit"] {
    padding: 0 16px;
    color: rgba(225, 241, 248, 0.78);
    font-weight: 750;
    background: rgba(39, 91, 113, 0.34);
}

.usda-search-clear {
    position: absolute;
    top: 50%;
    right: 7px;
    width: 32px;
    min-height: 32px !important;
    padding: 0;
    border-color: transparent !important;
    color: rgba(224, 242, 250, 0.78);
    font-size: 22px !important;
    line-height: 1;
    background: rgba(91, 142, 162, 0.2);
    transform: translateY(-50%);
}

.usda-search-clear[hidden] {
    display: none;
}

.usda-search-form.is-searching button {
    opacity: 0.6;
    pointer-events: none;
}

.usda-search-form p,
.usda-search-state {
    color: rgba(197, 218, 230, 0.76);
    font-size: 12px;
    line-height: 1.4;
}

.usda-search-form p {
    margin: 7px 0 0;
}

.usda-search-state {
    padding: 10px 4px 7px;
}

.usda-results {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    gap: 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
    padding-right: 3px;
    padding-bottom: 4px;
}

.usda-result-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-height: 72px;
    padding: 10px 11px;
    border: 1px solid rgba(92, 164, 193, 0.22);
    border-radius: 13px;
    background: rgba(9, 34, 49, 0.7);
}

.usda-result-card.is-selected {
    border-color: rgba(85, 220, 230, 0.72);
    background: rgba(11, 54, 68, 0.86);
    box-shadow: inset 3px 0 0 rgba(79, 220, 225, 0.9);
}

.usda-result-card.is-saved {
    min-height: 66px;
}

.usda-card-actions {
    display: grid;
    justify-items: end;
    gap: 3px;
}

.remove-saved-food {
    min-height: 24px;
    padding: 2px 7px;
    font-size: 10px;
}

.usda-result-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.usda-result-copy strong {
    color: #f3f9fc;
    font-size: 14px;
    line-height: 1.2;
}

.usda-result-copy span,
.usda-result-copy small {
    color: rgba(197, 218, 230, 0.74);
    font-size: 12px;
    line-height: 1.25;
}

.usda-result-copy small {
    color: rgba(121, 205, 232, 0.7);
}

@media (max-width: 680px) {
    .food-workspace-actions {
        align-items: start;
    }

    .clear-foods-wrap small {
        max-width: 120px;
    }

    .usda-result-card {
        grid-template-columns: minmax(0, 1fr);
    }

    .usda-portion-stepper {
        justify-self: end;
    }
}

@media (max-width: 520px) {
    body.core-mode .release-label {
        display: none;
    }

    body.core-mode .body-stage.is-releasing .core-response p::before {
        content: "Stored reserves released — ";
        color: #e9bf77;
        font-weight: 750;
    }
}


/* Simplified core: food + Pattern Timeline + one continuously visible hero. */
[hidden],
.legacy-backstage[hidden] {
    display: none !important;
}

.core-mode,
.core-mode body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.core-mode .app {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

.core-mode .topbar {
    flex: 0 0 auto;
    min-height: 58px;
    padding: 8px 14px;
}

.core-mode .brand h1 { font-size: 17px; }
.core-mode .brand p { font-size: 9px; }

.core-mode .core-workspace {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    overflow: hidden;
    padding: 8px;
    gap: 8px;
}

.core-mode .controls-panel {
    display: contents;
}

.core-mode .body-stage,
.core-mode .food-browser-section,
.core-mode .horizon-section {
    min-width: 0;
    min-height: 0;
    margin: 0;
    border: 1px solid rgba(87, 187, 219, .15);
    border-radius: 14px;
    background: linear-gradient(150deg, rgba(8, 27, 42, .96), rgba(5, 17, 29, .98));
    box-shadow: inset 0 0 32px rgba(32, 128, 165, .055), 0 10px 28px rgba(0, 0, 0, .18);
}

.core-mode .body-stage {
    display: block;
    position: relative;
    width: 100%;
    height: auto;
    overflow: hidden;
}

.core-mode .stage-label {
    top: 10px;
    left: 14px;
    z-index: 12;
}

.core-mode .stage-label > span { font-size: 6px; }
.core-mode .stage-label h2 { margin-top: 2px; font-size: 13px; }
.core-mode .stage-label .info-button { display: none; }

.core-mode .routing-stage {
    inset: 46px 7px 53px;
    border-radius: 12px;
}

.core-mode .routing-column {
    z-index: 8;
}

.core-mode .route-card,
.core-mode .destination-card {
    cursor: help;
}

.core-mode .route-card:focus-visible,
.core-mode .destination-card:focus-visible,
.core-mode .timeline-options button:focus-visible,
.core-mode .food-tile-help:focus-visible,
.core-mode .core-explanation-close:focus-visible {
    outline: 2px solid #8bdcff;
    outline-offset: 2px;
}

.core-mode .destination-card b {
    display: none;
}

.core-mode .destination-card {
    grid-template-columns: 30px minmax(0, 1fr);
    min-height: 39px;
    padding: 4px 6px;
    opacity: calc(.32 + var(--signal, .30) * .66);
    transition: opacity .5s ease, filter .5s ease, transform .5s ease, border-color .5s ease;
}

body.core-mode .destination-card {
    overflow: visible;
}

@media (max-width: 650px) {
    body.core-mode .response-dial {
        top: -4px;
        right: -3px;
        width: 24px;
        height: 24px;
    }

    body.core-mode .response-dial::after {
        bottom: 5px;
    }

    body.core-mode .response-dial-needle {
        bottom: 7px;
        height: 7px;
    }
}

@media (min-width: 521px) and (max-width: 900px) {
    body.core-mode .routing-stage .input-stack {
        top: 58% !important;
    }

    body.core-mode .macro-total-tag {
        top: -4px;
        right: -2px;
    }
}

.core-mode .destination-card strong { font-size: 7px; }
.core-mode .destination-card small { margin-top: 2px; font-size: 5.5px; }
.core-mode .destination-visual { width: 27px; height: 27px; }

.core-mode .destination-card.is-prioritized {
    border-color: rgba(155, 224, 244, .32);
    filter: brightness(1.12);
}

.core-mode .body-stage.is-empty .route-channel {
    opacity: 0 !important;
    visibility: hidden;
}

.core-mode .body-stage.is-empty .destination-card {
    opacity: .055;
    filter: saturate(.25) brightness(.62);
}

.core-mode .body-stage.is-empty .circulation-web {
    opacity: .20 !important;
}

.core-mode .body-stage.is-empty .anatomy-signal,
.core-mode .body-stage.is-empty .fat-reserve {
    opacity: .17 !important;
}

.core-mode .body-stage.is-empty .body-anatomy {
    opacity: .95;
    filter: saturate(.95) contrast(1.04) drop-shadow(0 0 11px rgba(78, 191, 226, .34));
}

.core-mode .body-stage.is-empty .body-halo {
    opacity: .82;
    filter: brightness(1.08);
}

.core-mode .body-stage.is-empty .route-card {
    opacity: .48;
}

.core-mode .body-stage.is-emphasized[data-emphasis="food"][data-input-emphasis="protein"] .route-protein,
.core-mode .body-stage.is-emphasized[data-emphasis="food"][data-input-emphasis="carbs"] .route-carbs,
.core-mode .body-stage.is-emphasized[data-emphasis="food"][data-input-emphasis="fats"] .route-fat,
.core-mode .body-stage.is-emphasized[data-emphasis="horizon"][data-timeline="0"] :is(.destination-brain, .destination-muscle, .destination-glycogen),
.core-mode .body-stage.is-emphasized[data-emphasis="horizon"][data-timeline="1"] :is(.destination-liver, .destination-glycogen),
.core-mode .body-stage.is-emphasized[data-emphasis="horizon"][data-timeline="2"] :is(.destination-repair, .destination-fat-use, .destination-storage),
.core-mode .body-stage.is-emphasized[data-emphasis="horizon"][data-timeline="3"] :is(.destination-liver, .destination-fat-use, .destination-storage) {
    opacity: 1;
    filter: brightness(1.42) saturate(1.16);
    transform: translateY(-1px);
    transition-duration: .18s;
}

.core-mode .stage-message.core-response {
    right: 10px;
    bottom: 7px;
    left: 10px;
    z-index: 13;
    min-height: 38px;
    padding: 8px 12px;
    border-color: rgba(100, 193, 222, .14);
    background: rgba(5, 20, 31, .88);
}

.core-mode .stage-message.core-response .stage-balance-summary,
.core-mode .stage-message.core-response strong {
    display: none;
}

.core-mode .stage-message.core-response p {
    margin: 0;
    color: #b2cbd6;
    font-size: 8px;
    line-height: 1.35;
}

.core-mode .motion-toggle {
    right: 14px;
    bottom: 53px;
    left: auto;
    min-height: 30px;
    padding: 5px 8px;
    transform: none;
    opacity: .66;
    font-size: 6px;
}

.core-mode .horizon-section {
    padding: 9px 11px;
    overflow: hidden;
}

.core-mode .horizon-section .section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 6px;
}

.core-mode .horizon-section .section-heading h2 { font-size: 11px; }
.core-mode .horizon-section .section-heading span { max-width: none; margin-top: 2px; font-size: 7px; }
.core-mode .core-info-button { flex: 0 0 30px; width: 30px; height: 30px; min-height: 30px; }
.core-mode .horizon-control { padding: 0; border: 0; background: transparent; }
.core-mode .horizon-control > .control-row,
.core-mode .horizon-control > input { display: none; }

.core-mode .timeline-options {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin: 0;
}

.core-mode .timeline-options button {
    min-height: 36px;
    border: 1px solid rgba(92, 176, 207, .15);
    border-radius: 8px;
    color: #7794a5;
    background: rgba(24, 66, 87, .16);
    font: 800 8px/1 inherit;
}

.core-mode .timeline-options button.is-active {
    color: #e4f8ff;
    border-color: rgba(108, 216, 247, .40);
    background: linear-gradient(135deg, rgba(38, 141, 180, .34), rgba(72, 92, 181, .24));
    box-shadow: 0 0 14px rgba(59, 177, 215, .12);
}

.core-mode .horizon-description {
    min-height: 0;
    margin: 5px 0 0;
    color: #718b9a;
    font-size: 6.5px;
    line-height: 1.3;
}

.core-mode .food-browser-section {
    display: flex;
    flex-direction: column;
    padding: 10px;
    overflow: hidden;
}

.core-mode .core-food-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    flex: 0 0 auto;
    margin: 0;
}

.core-mode .core-food-heading h2 { font-size: 13px; }
.core-mode .core-food-heading span { margin-top: 2px; font-size: 7px; }
.core-mode .food-browser-intro { flex: 0 0 auto; margin: 3px 0 6px; font-size: 6.5px; }

.core-mode .food-filters {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 7px;
    overflow: visible;
}

.core-mode .food-workspace-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: stretch;
    gap: 4px;
    margin-bottom: 7px;
}

.core-mode .food-workspace-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 3px;
}

.core-mode .food-workspace-bar .food-filters {
    flex: 1 1 auto;
    margin-bottom: 0;
}

.core-mode .clear-foods-action,
.core-mode .food-workspace-actions .undo-clear {
    min-height: 44px;
    padding: 6px 9px;
    border: 1px solid rgba(238, 169, 113, .30);
    border-radius: 9px;
    color: #ffcba6;
    background: rgba(118, 61, 37, .18);
    font-size: 7px;
    font-weight: 850;
    white-space: nowrap;
}

.core-mode .clear-foods-action.is-inactive {
    color: #69808c;
    border-color: rgba(103, 134, 148, .14);
    background: rgba(25, 46, 56, .32);
    box-shadow: none;
}

.core-mode .clear-foods-action:focus-visible,
.core-mode .food-workspace-actions .undo-clear:focus-visible {
    outline: 2px solid #8bdcff;
    outline-offset: 2px;
}

.core-mode .food-filter {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 34px;
    padding: 6px 9px;
    font-size: 7px;
    white-space: nowrap;
}

.core-mode .food-grid {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding: 2px 2px 4px;
}

.core-mode .food-grid[hidden] { display: none !important; }

.core-mode .food-tile-wrap {
    position: relative;
    min-width: 0;
}

.core-mode .food-tile-wrap.is-selected .food-tile {
    border-color: rgba(117, 221, 248, .62);
    background:
        linear-gradient(135deg, rgba(29, 100, 126, .34), rgba(31, 47, 76, .42)),
        rgba(9, 29, 43, .94);
    box-shadow:
        0 0 0 1px rgba(122, 223, 249, .16),
        0 0 18px rgba(58, 182, 218, .16),
        inset 0 0 18px rgba(76, 189, 220, .08);
}

.core-mode .food-tile-wrap.is-selected .food-art {
    filter: brightness(1.2);
}

.core-mode .food-tile {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: minmax(34px, 1fr) auto;
    align-items: center;
    gap: 5px 7px;
    width: 100%;
    min-height: 106px;
    padding: 8px 8px 7px;
}

.core-mode .food-tile-copy {
    padding-right: 40px;
}

.core-mode .catalog-portion-stepper {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 44px minmax(30px, 1fr) 44px;
    align-items: center;
    gap: 4px;
}

.core-mode .catalog-portion-stepper button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border: 1px solid rgba(106, 193, 221, .24);
    border-radius: 9px;
    color: #d8f4fd;
    background: rgba(21, 63, 82, .72);
    font: 850 16px/1 inherit;
}

.core-mode .catalog-portion-stepper button:disabled {
    cursor: default;
    color: #58717e;
    border-color: rgba(91, 126, 141, .13);
    background: rgba(17, 39, 50, .46);
    opacity: .62;
}

.core-mode .catalog-portion-stepper button:focus-visible {
    outline: 2px solid #8bdcff;
    outline-offset: 2px;
}

.core-mode .catalog-portion-count {
    display: grid;
    place-items: center;
    min-width: 30px;
    height: 32px;
    border: 1px solid rgba(102, 169, 192, .17);
    border-radius: 8px;
    color: #7894a3;
    background: rgba(5, 22, 33, .68);
    font-size: 10px;
    font-weight: 900;
}

.core-mode .food-tile-wrap.is-selected .catalog-portion-count {
    color: #effcff;
    border-color: rgba(136, 225, 248, .44);
    background: rgba(29, 111, 142, .62);
    box-shadow: 0 0 10px rgba(76, 198, 229, .16);
}

.core-mode .food-tile-help {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 3;
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border: 1px solid rgba(111, 199, 226, .18);
    border-radius: 9px;
    color: #77bed5;
    background: rgba(14, 47, 64, .82);
    transform: none;
    font: 800 9px/1 inherit;
}

.core-mode .food-browser-status {
    flex: 0 0 auto;
    min-height: 10px;
    margin: 2px 0 0;
    font-size: 6px;
}

.core-mode .core-my-day {
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.core-mode .core-my-day:not([hidden]) {
    display: flex;
    flex-direction: column;
}

.core-mode .core-my-day .tray-heading { flex: 0 0 auto; display: flex; }
.core-mode .core-my-day .tray-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.core-mode .core-my-day .tray-row {
    min-height: 52px;
    margin-bottom: 5px;
}

.core-mode .core-my-day .tray-empty { flex: 1 1 auto; min-height: 80px; }
.core-mode .core-my-day .timing-note { flex: 0 0 auto; margin: 4px 0 0; font-size: 6px; }
.core-mode .core-my-day .undo-clear { align-self: flex-start; flex: 0 0 auto; }

.core-mode .site-footer {
    flex: 0 0 auto;
    min-height: 25px;
    padding: 5px max(12px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    font-size: 6px;
}

.core-mode .core-explanation-dialog {
    width: min(480px, calc(100vw - 24px));
    max-width: none;
    padding: 0;
    border: 1px solid rgba(100, 211, 243, .28);
    border-radius: 16px;
    color: #dceef5;
    background: rgba(6, 22, 34, .98);
    box-shadow: 0 24px 80px rgba(0, 0, 0, .62), inset 0 0 32px rgba(42, 146, 183, .08);
}

.core-mode .core-explanation-dialog::backdrop {
    background: rgba(1, 8, 14, .68);
    backdrop-filter: blur(4px);
}

.core-explanation-sheet { position: relative; padding: 22px; }
.core-explanation-sheet h2 { margin: 0; color: #e5f6fc; font-size: 17px; }
.core-explanation-sheet p { margin: 10px 0 0; color: #9db7c4; font-size: 11px; line-height: 1.6; }
.core-explanation-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(116, 196, 221, .18);
    border-radius: 10px;
    color: #b9d6e1;
    background: rgba(42, 90, 111, .16);
    font-size: 19px;
}


@media (max-width: 900px) {
    .core-mode .core-workspace {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(310px, 1.25fr) auto minmax(275px, .95fr);
        padding: 7px max(7px, env(safe-area-inset-right)) 7px max(7px, env(safe-area-inset-left));
    }

    .core-mode .body-stage { grid-column: 1; grid-row: 1; min-height: 0; }
    .core-mode .horizon-section { grid-column: 1; grid-row: 2; }
    .core-mode .food-browser-section { grid-column: 1; grid-row: 3; max-height: none; }
    .core-mode .food-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

    .core-mode .input-stack {
        top: 58px;
        bottom: auto;
        left: 4px;
        width: 120px;
        gap: 4px;
    }

    .core-mode .destination-stack {
        top: 45px;
        right: 4px;
        bottom: auto;
        left: auto;
        width: 154px;
        gap: 3px;
    }

    .core-mode .body-container { left: 50%; width: 48%; transform: translateX(-50%); }
    .core-mode .human { height: min(92%, 330px); }
}


@media (min-width: 901px) {
    .core-mode .core-workspace {
        display: grid;
        grid-template-columns: minmax(320px, 38vw) minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) auto;
    }

    .core-mode .food-browser-section { grid-column: 1; grid-row: 1 / 3; }
    .core-mode .body-stage { grid-column: 2; grid-row: 1; min-height: 0; height: auto; }
    .core-mode .horizon-section { grid-column: 2; grid-row: 2; }
    .core-mode .food-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .core-mode .destination-stack { gap: 4px; }
}


@media (max-width: 520px) {
    .core-mode .topbar { min-height: 66px; padding: 8px 10px; }
    .core-mode .brand h1 { font-size: 15px; }
    .core-mode .brand p { font-size: 7px; }
    .core-mode .core-workspace {
        grid-template-rows: minmax(300px, 1.15fr) auto minmax(250px, .88fr);
        gap: 5px;
        padding: 5px;
    }
    .core-mode .stage-label { top: 8px; left: 10px; }
    .core-mode .stage-label h2 { font-size: 11px; }
    .core-mode .routing-stage { inset: 39px 3px 53px; }
    .core-mode .routing-kicker { display: none; }
    .core-mode .input-stack { top: 44px; left: 2px; width: 94px; }
    .core-mode .destination-stack { top: 38px; right: 2px; width: 119px; gap: 2px; }
    .core-mode .route-card { grid-template-columns: minmax(0, 1fr) 27px; min-height: 39px; padding: 4px; }
    .core-mode .route-card strong { font-size: 6px; }
    .core-mode .route-card small { display: none; }
    .core-mode .route-visual { width: 25px; height: 25px; }
    .core-mode .destination-card { grid-template-columns: 23px minmax(0, 1fr); min-height: 31px; padding: 2px 3px; }
    .core-mode .destination-visual { width: 21px; height: 21px; }
    .core-mode .destination-card strong { font-size: 5.3px; line-height: 1.08; }
    .core-mode .destination-card small { display: none; }
    .core-mode .body-container { width: 52%; }
    .core-mode .human { height: min(90%, 245px); }
    .core-mode .stage-message.core-response p { font-size: 6.5px; }
    .core-mode .motion-toggle { display: none; }
    .core-mode .horizon-section { padding: 7px 8px; }
    .core-mode .horizon-section .section-heading span { font-size: 6px; }
    .core-mode .timeline-options button { min-height: 32px; }
    .core-mode .horizon-description { font-size: 5.8px; }
    .core-mode .food-browser-section { padding: 7px; }
    .core-mode .food-workspace-bar { flex-wrap: wrap; }
    .core-mode .food-workspace-actions { min-height: 44px; }
    .core-mode .clear-foods-action,
    .core-mode .food-workspace-actions .undo-clear { min-height: 44px; }
    .core-mode .food-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
    .core-mode .food-filter { min-height: 30px; padding: 4px 3px; font-size: 6px; }
    .core-mode .food-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
    .core-mode .food-tile { min-height: 106px; }
    .core-mode .food-art { width: 27px; height: 27px; }
    .core-mode .food-tile-copy strong { font-size: 7px; }
    .core-mode .food-tile-copy small { font-size: 6px; }
    .core-mode .site-footer span:last-child { display: none; }
    .core-mode .core-explanation-dialog {
        width: calc(100vw - 10px);
        margin: auto 5px max(5px, env(safe-area-inset-bottom));
        border-radius: 16px 16px 10px 10px;
    }
}


@media (prefers-reduced-motion: reduce) {
    .core-mode .route-channel,
    .core-mode .destination-card,
    .core-mode .route-card {
        transition: none !important;
        animation: none !important;
    }
    .core-mode .body-stage.is-emphasized .destination-card,
    .core-mode .body-stage.is-emphasized .route-card {
        outline: 1px solid rgba(140, 221, 246, .58);
        outline-offset: 1px;
    }
}


/* RESPONSIVE LAYOUT */

/*
   At full dashboard width, fit the explorer to the available browser height.
   The two dense information rails can scroll without moving the body stage.
*/
@media (min-width: 1251px) {

    html,
    body {
        height: 100%;
        overflow: hidden;
    }

    .app {
        height: 100%;
        min-height: 0;
    }

    .topbar {
        flex: 0 0 auto;
    }

    .workspace {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        align-items: stretch;
    }

    .panel,
    .body-stage {
        min-height: 0;
    }

    .body-stage {
        height: 100%;
    }

    .controls-panel,
    .output-panel {
        height: 100%;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        scrollbar-color: rgba(105, 143, 169, .45) transparent;
    }

    .controls-panel::-webkit-scrollbar,
    .output-panel::-webkit-scrollbar {
        width: 6px;
    }

    .controls-panel::-webkit-scrollbar-track,
    .output-panel::-webkit-scrollbar-track {
        background: transparent;
    }

    .controls-panel::-webkit-scrollbar-thumb,
    .output-panel::-webkit-scrollbar-thumb {
        border-radius: 999px;
        background: rgba(105, 143, 169, .34);
    }
}


/* Preserve the full dashboard composition in shorter desktop windows. */
@media (min-width: 1251px) and (max-height: 900px) {

    .topbar {
        min-height: 74px;
        gap: 20px;
        padding: 10px 18px;
    }

    .brand {
        gap: 11px;
    }

    .brand-icon {
        font-size: 28px;
    }

    .brand h1 {
        font-size: 17px;
    }

    .brand p {
        font-size: 11px;
    }

    .preset,
    .reset-button {
        padding: 7px 10px;
        font-size: 11px;
    }

    .workspace {
        gap: 12px;
        padding: 12px;
    }

    .panel {
        padding: 14px;
    }

    .controls-panel section {
        margin-bottom: 18px;
    }

    .controls-panel section:last-child,
    .control:last-child {
        margin-bottom: 0;
    }

    .section-heading {
        margin-bottom: 12px;
    }

    .control {
        margin-bottom: 15px;
    }

    input[type="range"] {
        margin-top: 10px;
    }

    .goal-planner {
        margin-bottom: 12px;
        padding: 10px;
    }

    .planner-heading {
        margin-bottom: 8px;
    }

    .trajectory-card {
        margin-top: 8px;
        padding-top: 8px;
    }

    .calorie-control {
        margin-bottom: 14px;
        padding: 10px;
    }

    .starting-balance {
        margin-top: 9px;
    }

    .calorie-status {
        min-height: 0;
        margin-top: 7px;
    }

    .stage-label {
        top: 16px;
        left: 20px;
    }

    .stage-label h2 {
        font-size: 18px;
    }

    .routing-stage {
        inset: 68px 14px 92px;
        gap: 10px;
    }

    .input-stack {
        gap: 12px;
    }

    .destination-stack {
        gap: 6px;
    }

    .route-card {
        min-height: 72px;
        padding: 7px 6px 7px 9px;
    }

    .route-visual {
        flex-basis: 50px;
        width: 50px;
        height: 50px;
    }

    .destination-card {
        min-height: 50px;
        padding: 5px 6px;
    }

    .destination-visual {
        flex-basis: 33px;
        width: 33px;
        height: 33px;
    }

    .routing-stage .human {
        width: clamp(190px, 30vh, 260px);
        height: clamp(380px, 60vh, 520px);
        transform: translateY(8px) scale(1.34);
    }

    .stage-message {
        bottom: 12px;
        padding: 10px 16px;
    }

    .stage-message strong {
        font-size: 13px;
    }

    .stage-message p {
        margin-top: 3px;
        font-size: 10px;
    }

    .motion-toggle {
        bottom: 82px;
        padding: 5px 9px;
    }

    .output-panel {
        padding: 14px;
    }

    .output-card {
        grid-template-columns: minmax(0, 1fr) 78px;
        min-height: 72px;
        margin-bottom: 6px;
        padding: 7px 6px 6px 9px;
    }

    .output-copy strong,
    .output-copy .output-value {
        font-size: 18px;
    }

    .output-copy small {
        margin-top: 3px;
    }

    .gauge {
        width: 78px;
    }

    .model-note {
        margin-top: 8px;
    }

}

/* Keep the complete routing story readable in very short desktop windows. */
@media (min-width: 1251px) and (max-height: 720px) {

    .topbar {
        min-height: 62px;
        padding-block: 7px;
    }

    .workspace {
        gap: 9px;
        padding: 9px;
    }

    .routing-stage {
        inset: 56px 10px 74px;
        gap: 8px;
    }

    .input-stack {
        gap: 7px;
    }

    .destination-stack {
        gap: 4px;
    }

    .route-card {
        min-height: 58px;
        padding-block: 5px;
    }

    .route-visual {
        flex-basis: 42px;
        width: 42px;
        height: 42px;
    }

    .destination-card {
        min-height: 42px;
        padding-block: 4px;
    }

    .destination-visual {
        flex-basis: 29px;
        width: 29px;
        height: 29px;
    }

    .routing-stage .human {
        width: clamp(165px, 28vh, 210px);
        height: clamp(330px, 55vh, 420px);
        transform: translateY(8px) scale(1.18);
    }

    .stage-message {
        bottom: 8px;
    }

    .motion-toggle {
        bottom: 64px;
    }
}

@media (max-width: 1250px) {

    .workspace {
        grid-template-columns:
            250px
            minmax(520px, 1fr);
        align-items: start;
    }

    .body-stage {
        min-width: 0;
    }

    .output-panel {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .output-panel .section-heading,
    .output-panel .model-note {
        grid-column: 1 / -1;
    }

    .output-card {
        margin-bottom: 0;
    }

    .presets {
        min-width: 0;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        padding-bottom: 3px;
        scrollbar-width: thin;
    }
}


@media (max-width: 900px) {

    .topbar {
        flex-wrap: wrap;
        gap: 14px;
    }

    .presets {
        width: 100%;
    }

    .workspace {
        grid-template-columns: minmax(0, 1fr);
        padding: 12px;
    }

    .body-stage {
        min-height: 720px;
    }

    .controls-panel {
        display: grid;
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
        gap: 22px;
    }

    .controls-panel section:first-child {
        grid-row: 1 / span 2;
    }

    .controls-panel section {
        margin-bottom: 0;
    }

    .output-panel {
        grid-column: auto;
    }
}


/*
   Tablet live split: keep the machine in view while the control rail scrolls.
   The routing cards stay visible as compact edge labels so an iPad still tells
   the complete inputs -> body -> destinations story without crowding the hero.
*/
@media (min-width: 651px) and (max-width: 1250px) {

    html,
    body {
        height: 100%;
        overflow: hidden;
    }

    .app {
        height: 100dvh;
        min-height: 0;
    }

    .topbar {
        flex: 0 0 auto;
        min-height: 72px;
        gap: 12px;
        padding: 10px 14px;
    }

    .presets {
        padding-bottom: 0;
        scrollbar-width: none;
    }

    .presets::-webkit-scrollbar {
        display: none;
    }

    .workspace {
        flex: 1 1 auto;
        min-height: 0;
        grid-template-columns:
            clamp(300px, 38vw, 390px)
            minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) auto;
        gap: 10px;
        align-items: stretch;
        overflow: hidden;
        padding: 10px;
    }

    .controls-panel {
        grid-column: 1;
        grid-row: 1 / 3;
        display: block;
        height: 100%;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: rgba(105, 143, 169, .45) transparent;
        padding: 14px;
    }

    .controls-panel section {
        margin-bottom: 20px;
    }

    .controls-panel::-webkit-scrollbar,
    .output-panel::-webkit-scrollbar {
        width: 5px;
        height: 5px;
    }

    .controls-panel::-webkit-scrollbar-thumb,
    .output-panel::-webkit-scrollbar-thumb {
        border-radius: 999px;
        background: rgba(105, 143, 169, .34);
    }

    .body-stage {
        grid-column: 2;
        grid-row: 1;
        width: 100%;
        height: 100%;
        min-height: 0;
    }

    .stage-label {
        top: 15px;
        left: 17px;
    }

    .stage-label h2 {
        font-size: 17px;
    }

    .routing-stage {
        inset: 58px 8px 78px;
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .routing-stage .input-stack,
    .routing-stage .destination-stack {
        position: absolute;
        z-index: 16;
        display: flex;
        transform: none;
    }

    .routing-stage .input-stack {
        top: 31%;
        bottom: 30%;
        left: 0;
        width: clamp(96px, 23%, 108px);
        justify-content: space-between;
        gap: 0;
    }

    .routing-stage .destination-stack {
        top: 19%;
        right: 0;
        bottom: 14%;
        width: clamp(116px, 29%, 136px);
        justify-content: space-between;
        gap: 0;
    }

    .routing-stage .routing-kicker {
        position: absolute;
        bottom: calc(100% + 5px);
        margin: 0;
        font-size: 7px;
        letter-spacing: 1.35px;
    }

    .routing-stage .route-card {
        flex: 0 0 46px;
        width: 100%;
        min-height: 46px;
        gap: 3px;
        padding: 4px 3px 4px 6px;
        border-radius: 8px;
        box-shadow:
            0 7px 14px rgba(0,0,0,.24),
            inset 0 1px rgba(255,255,255,.04);
    }

    .routing-stage .route-card strong {
        font-size: 8px;
    }

    .routing-stage .route-card small {
        margin-top: 2px;
        font-size: 7px;
    }

    .routing-stage .route-visual {
        flex-basis: 28px;
        width: 28px;
        height: 28px;
    }

    .routing-stage .destination-card {
        flex: 0 0 40px;
        width: 100%;
        min-height: 40px;
        gap: 3px;
        padding: 3px 4px;
        border-radius: 7px;
        box-shadow:
            0 7px 14px rgba(0,0,0,.22),
            inset 0 1px rgba(255,255,255,.04);
    }

    .routing-stage .destination-card.is-prioritized {
        transform: translateX(-2px);
    }

    .routing-stage .destination-visual {
        flex-basis: 24px;
        width: 24px;
        height: 24px;
    }

    .routing-stage .destination-card strong {
        font-size: 7.5px;
        line-height: 1.05;
        text-overflow: clip;
        white-space: normal;
    }

    .routing-stage .destination-card small {
        display: none;
    }

    .routing-stage .destination-card b {
        font-size: 7.5px;
    }

    .routing-stage .body-container {
        grid-column: 1;
        width: 100%;
        height: 100%;
    }

    .routing-stage .human {
        width: min(47%, 210px);
        height: min(100%, 420px);
        transform: translateY(5px) scale(1.12);
    }

    .routing-stage .body-halo {
        width: min(430px, 110%);
    }

    .stage-message {
        bottom: 9px;
        width: calc(100% - 20px);
        padding: 9px 12px;
    }

    .stage-message strong {
        font-size: 12px;
    }

    .stage-message p {
        margin-top: 3px;
        font-size: 9px;
        line-height: 1.35;
    }

    .motion-toggle {
        bottom: 104px;
        padding: 5px 9px;
    }

    .output-panel {
        grid-column: 2;
        grid-row: 2;
        display: grid;
        grid-template-columns: repeat(6, minmax(145px, 1fr));
        grid-auto-flow: column;
        gap: 7px;
        min-width: 0;
        max-height: 100px;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-inline: contain;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        padding: 9px;
    }

    .output-panel .section-heading,
    .output-panel .model-note {
        display: none;
    }

    .output-card {
        grid-template-columns: minmax(0, 1fr) 52px;
        gap: 4px;
        min-height: 80px;
        margin: 0;
        padding: 7px;
        scroll-snap-align: start;
    }

    .output-name {
        gap: 4px;
        font-size: 9px;
    }

    .output-symbol {
        width: 15px;
        height: 15px;
        flex-basis: 15px;
    }

    .output-copy strong,
    .output-copy .output-value {
        font-size: 16px;
    }

    .output-copy em {
        margin-left: 3px;
        padding: 2px 4px;
        font-size: 7px;
    }

    .output-copy small {
        display: none;
    }

    .gauge {
        width: 52px;
    }

    .site-footer {
        padding: 3px 12px 5px;
        font-size: 8px;
    }
}


/* Give the live body more room when an iPad is held in landscape. */
@media (min-width: 651px) and (max-width: 1250px) and (max-height: 800px) {

    .routing-stage {
        inset-block: 52px 50px;
    }

    .routing-stage .human {
        height: min(100%, 480px);
        transform: translateY(3px) scale(1);
    }

    .stage-message {
        bottom: 7px;
        display: grid;
        grid-template-columns: max-content minmax(0, 1fr);
        align-items: center;
        gap: 8px;
        width: calc(100% - 16px);
        padding: 7px 10px;
        text-align: left;
    }

    .stage-balance-summary {
        margin: 0;
        white-space: nowrap;
    }

    .stage-message strong {
        overflow: hidden;
        font-size: 11px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .stage-message p {
        display: none;
    }

    .motion-toggle {
        bottom: 48px;
    }
}


@media (max-width: 650px) {

    .site-footer {
        flex-direction: column;
        gap: 2px;
        padding-inline: 14px;
    }

    .topbar {
        padding: 14px;
    }

    .brand {
        white-space: normal;
    }

    .brand h1 {
        font-size: 17px;
    }

    .preset-label {
        display: none;
    }

    .preset,
    .reset-button {
        white-space: nowrap;
    }

    .controls-panel {
        grid-template-columns: minmax(0, 1fr);
    }

    .controls-panel section:first-child {
        grid-row: auto;
    }

    .body-stage {
        min-height: 1140px;
    }

    .stage-label {
        top: 18px;
        left: 18px;
    }

    .stage-label h2 {
        font-size: 18px;
    }

    .routing-stage {
        inset: 82px 12px 132px;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(450px, 1fr) auto;
        gap: 16px;
        align-items: stretch;
    }

    .routing-network {
        display: none;
    }

    .input-stack {
        grid-row: 1;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .input-stack .routing-kicker,
    .destination-stack .routing-kicker {
        grid-column: 1 / -1;
        margin-bottom: 0;
    }

    .route-card {
        min-height: 92px;
        padding: 8px;
    }

    .route-card strong {
        font-size: 10px;
    }

    .route-card small {
        font-size: 8px;
    }

    .route-visual {
        position: absolute;
        right: 3px;
        bottom: 3px;
        width: 47px;
        height: 47px;
        opacity: .62;
    }

    .routing-stage .body-container {
        position: relative;
        inset: auto;
        grid-row: 2;
        width: 100%;
        min-height: 450px;
    }

    .routing-stage .human {
        width: 220px;
        height: 440px;
        transform: translateY(0) scale(1);
    }

    .routing-stage .body-halo {
        width: min(410px, 118%);
    }

    .destination-stack {
        grid-row: 3;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .destination-card {
        min-height: 58px;
    }

    .destination-card b {
        display: none;
    }

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

    .stage-message {
        bottom: 16px;
        width: calc(100% - 24px);
    }

    .motion-toggle {
        bottom: 112px;
    }

}


@media (max-width: 460px) {

    .topbar {
        gap: 10px;
        padding: 12px;
    }

    .brand-icon {
        font-size: 27px;
    }

    .brand h1 {
        font-size: 16px;
    }

    .brand p {
        font-size: 10px;
    }

    .workspace {
        padding: 8px;
        gap: 10px;
    }

    .panel {
        padding: 14px;
    }

    .body-stage {
        min-height: 1110px;
    }

    .stage-label {
        left: 14px;
    }

    .stage-label span {
        font-size: 8px;
        letter-spacing: 2.2px;
    }

    .stage-label h2 {
        font-size: 16px;
    }

    .routing-stage {
        inset-inline: 8px;
        gap: 12px;
    }

    .route-card {
        min-height: 84px;
        padding: 7px;
    }

    .route-card strong {
        font-size: 9px;
    }

    .routing-stage .human {
        width: 205px;
        height: 410px;
    }

    .routing-stage .body-container {
        min-height: 420px;
    }

    .output-panel {
        grid-template-columns: minmax(0, 1fr);
    }

    .destination-visual {
        flex-basis: 31px;
        width: 31px;
        height: 31px;
    }

    .destination-card strong {
        font-size: 9px;
    }

    .destination-card small {
        display: none;
    }
}


/* PHASE 2 — FOOD-FIRST EXPERIENCE */

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

.example-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    min-width: 0;
}

.example-label {
    margin-right: 2px;
    color: #7890a3;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.25px;
    text-transform: uppercase;
}

.example-day-button,
.clear-start-button,
.tray-clear,
.undo-clear,
.food-filter,
.food-tile,
.portion-stepper button,
.tray-remove,
.technical-source button,
.experiment-card button {
    appearance: none;
    border: 1px solid rgba(110, 166, 205, .22);
    color: #c9dbe8;
    background: rgba(35, 67, 91, .18);
    font: inherit;
    cursor: pointer;
}

.example-day-button,
.clear-start-button {
    min-height: 36px;
    padding: 8px 11px;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 750;
    white-space: nowrap;
}

.example-day-button.active {
    color: #eef9ff;
    border-color: rgba(89, 199, 244, .55);
    background: linear-gradient(145deg, rgba(44, 144, 189, .30), rgba(45, 104, 146, .16));
    box-shadow: 0 0 16px rgba(67, 184, 229, .12);
}

.clear-start-button {
    color: #9eb2c1;
    background: rgba(255, 255, 255, .025);
}

.food-browser-section {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.food-browser-intro {
    margin: -8px 0 12px;
    color: #8da1b1;
    font-size: 9px;
    line-height: 1.45;
}

.food-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 12px;
}

.familiar-food-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.familiar-food-toolbar .food-filters {
    flex: 1 1 auto;
    min-width: 0;
}

.reset-familiar-foods {
    flex: 0 0 auto;
    min-height: 32px;
    margin-bottom: 12px;
    padding: 6px 10px;
    border-color: rgba(244, 179, 112, .28);
    color: #d8b58f;
    background: rgba(89, 54, 27, .16);
    font-size: 9px;
    font-weight: 750;
}

.reset-familiar-foods:disabled {
    opacity: .42;
    cursor: default;
}

.tab-count {
    display: inline-grid;
    min-width: 20px;
    min-height: 20px;
    margin-left: 5px;
    padding: 1px 6px;
    place-items: center;
    border: 1px solid rgba(93, 199, 231, .22);
    border-radius: 999px;
    color: #8edcf3;
    background: rgba(35, 119, 150, .16);
    font-size: .78em;
    line-height: 1;
}

@media (max-width: 700px) {
    .familiar-food-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .reset-familiar-foods {
        align-self: flex-end;
    }
}

.food-filter {
    min-height: 32px;
    padding: 6px 8px;
    border-radius: 999px;
    color: #8fa5b6;
    font-size: 8px;
    font-weight: 750;
}

.food-filter[aria-pressed="true"] {
    color: #e8f8ff;
    border-color: rgba(82, 196, 235, .44);
    background: rgba(47, 151, 190, .22);
}

.food-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1px 3px 3px 1px;
    scrollbar-width: thin;
    scrollbar-color: rgba(105, 143, 169, .38) transparent;
}

.food-tile {
    position: relative;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    min-width: 0;
    min-height: 61px;
    padding: 7px;
    overflow: hidden;
    border-radius: 11px;
    text-align: left;
    background:
        radial-gradient(circle at 16% 50%, rgba(73, 181, 226, .15), transparent 32%),
        linear-gradient(145deg, rgba(255,255,255,.055), rgba(255,255,255,.012));
    box-shadow: inset 0 1px rgba(255,255,255,.035);
    transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.food-tile:hover {
    border-color: rgba(96, 200, 238, .42);
    background: linear-gradient(145deg, rgba(77, 177, 217, .13), rgba(255,255,255,.02));
    transform: translateY(-1px);
}

.food-art {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(98, 207, 244, .27);
    border-radius: 50%;
    color: #8fdcff;
    background: radial-gradient(circle, rgba(60, 164, 208, .25), rgba(20, 56, 78, .08));
    box-shadow: inset 0 0 12px rgba(86, 197, 235, .10), 0 0 12px rgba(58, 178, 222, .08);
    font-size: 17px;
}

.food-tile[data-art-group="main"] .food-art { color: #ad9aff; border-color: rgba(166,124,255,.28); }
.food-tile[data-art-group="sides"] .food-art { color: #74e5aa; border-color: rgba(86,232,144,.26); }
.food-tile[data-art-group="snacks"] .food-art { color: #ffc875; border-color: rgba(255,173,66,.28); }
.food-tile[data-art-group="drinks"] .food-art { color: #77d7ed; border-color: rgba(86,201,229,.28); }

.food-tile-copy {
    min-width: 0;
}

.food-tile-copy strong,
.food-tile-copy small {
    display: block;
}

.food-tile-copy strong {
    color: #dcebf5;
    font-size: 9px;
    line-height: 1.2;
}

.food-tile-copy small {
    margin-top: 3px;
    color: #7890a2;
    font-size: 8px;
    line-height: 1.25;
}

.food-browser-status {
    min-height: 1.3em;
    margin: 8px 0 0;
    color: #82bbd5;
    font-size: 8px;
}

.mobile-day-summary {
    display: none;
}

.output-panel.day-panel {
    display: block;
    padding: 14px;
}

.today-section,
.narration-card,
.phase-guardrail,
.explore-model {
    width: 100%;
}

.today-section {
    margin-bottom: 12px;
}

.tray-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px !important;
}

.tray-clear,
.undo-clear {
    min-height: 32px;
    padding: 6px 8px;
    border-radius: 8px;
    color: #98aebe;
    font-size: 8px;
    font-weight: 750;
}

.tray-clear:disabled {
    opacity: .4;
    cursor: default;
}

.example-note,
.timing-note,
.phase-guardrail,
.technical-note {
    color: #8399aa;
    font-size: 8px;
    line-height: 1.45;
}

.example-note {
    margin: 0 0 9px;
    padding: 7px 8px;
    border-left: 2px solid rgba(98, 213, 231, .46);
    background: rgba(65, 153, 179, .07);
}

.tray-list {
    display: grid;
    gap: 5px;
    max-height: 238px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
    scrollbar-width: thin;
}

.tray-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 28px;
    align-items: center;
    gap: 7px;
    min-height: 46px;
    padding: 5px 5px 5px 8px;
    border: 1px solid rgba(255,255,255,.065);
    border-radius: 9px;
    background: rgba(255,255,255,.025);
}

.tray-row-copy {
    min-width: 0;
}

.tray-row-copy strong,
.tray-row-copy span,
.tray-row-copy small {
    display: block;
}

.tray-row-copy strong {
    overflow: hidden;
    color: #d7e7f1;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tray-row-copy span,
.tray-row-copy small {
    margin-top: 2px;
    color: #74899a;
    font-size: 7px;
}

.tray-row-copy small {
    color: #71b6d2;
}

.portion-stepper {
    display: grid;
    grid-template-columns: 28px 32px 28px;
    align-items: center;
}

.portion-stepper button,
.tray-remove {
    display: grid;
    place-items: center;
    min-width: 28px;
    min-height: 32px;
    padding: 0;
    color: #b9cedb;
    background: rgba(64, 104, 131, .17);
    font-size: 14px;
}

.portion-stepper button:first-child { border-radius: 7px 0 0 7px; }
.portion-stepper button:last-child { border-radius: 0 7px 7px 0; }

.portion-stepper output {
    display: grid;
    place-items: center;
    height: 32px;
    border-block: 1px solid rgba(110, 166, 205, .22);
    color: #d9edf8;
    background: rgba(16, 40, 57, .45);
    font-size: 9px;
    font-weight: 800;
}

.tray-remove {
    border-radius: 7px;
    color: #91a5b3;
}

.tray-empty {
    padding: 24px 12px;
    border: 1px dashed rgba(101, 178, 211, .22);
    border-radius: 11px;
    text-align: center;
    background: rgba(36, 88, 114, .055);
}

.tray-empty strong,
.tray-empty span {
    display: block;
}

.tray-empty strong { color: #cfe5f1; font-size: 11px; }
.tray-empty span { margin-top: 5px; color: #7990a1; font-size: 8px; }

.undo-clear {
    margin-top: 7px;
    color: #85d5ee;
}

.timing-note {
    margin: 8px 0 0;
}

.narration-card {
    margin-top: 10px;
    padding: 13px;
    border: 1px solid rgba(94, 200, 233, .18);
    border-radius: 13px;
    background:
        radial-gradient(circle at 90% 12%, rgba(91, 199, 232, .10), transparent 35%),
        linear-gradient(145deg, rgba(42, 91, 119, .14), rgba(255,255,255,.018));
}

.narration-kicker {
    color: #65bbd9;
    font-size: 7px;
    font-weight: 850;
    letter-spacing: 1.2px;
}

.narration-card h2 {
    margin: 4px 0 10px;
    font-size: 15px;
}

.narration-card > strong {
    display: block;
    color: #e0eef6;
    font-size: 10px;
}

.narration-card p {
    margin: 5px 0 0;
    color: #9db1bf;
    font-size: 9px;
    line-height: 1.48;
}

.narration-card .narration-context {
    color: #778e9f;
}

.experiment-card {
    margin-top: 11px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,.07);
}

.experiment-card span {
    display: block;
    margin-bottom: 6px;
    color: #c6a9ff;
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
}

.experiment-card button {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border-color: rgba(166, 124, 255, .28);
    border-radius: 9px;
    color: #ddceff;
    background: rgba(111, 73, 173, .13);
    font-size: 9px;
    font-weight: 750;
    line-height: 1.35;
    text-align: left;
}

.phase-guardrail {
    margin: 10px 0;
    padding: 9px 10px;
    border-radius: 9px;
    background: rgba(255,255,255,.025);
}

.explore-model {
    padding-top: 2px;
    border-top: 1px solid rgba(255,255,255,.075);
}

.explore-model > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 52px;
    color: #c9dbe6;
    cursor: pointer;
    list-style: none;
}

.explore-model > summary::-webkit-details-marker { display: none; }
.explore-model > summary strong,
.explore-model > summary small { display: block; }
.explore-model > summary strong { font-size: 11px; }
.explore-model > summary small { margin-top: 3px; color: #748a9b; font-size: 8px; font-weight: 400; }
.explore-model[open] > summary > span:last-child { transform: rotate(45deg); }

.technical-source {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 5px 0 10px;
    padding: 9px;
    border: 1px solid rgba(89, 192, 222, .18);
    border-radius: 9px;
    background: rgba(47, 135, 164, .08);
}

.technical-source[data-source="manual"] {
    border-color: rgba(183, 141, 255, .30);
    background: rgba(127, 84, 190, .10);
}

.technical-source strong,
.technical-source span { display: block; }
.technical-source strong { color: #d9eaf4; font-size: 9px; }
.technical-source span { margin-top: 3px; color: #7890a0; font-size: 7px; }
.technical-source button { min-height: 34px; padding: 6px 8px; border-radius: 8px; color: #ddceff; font-size: 8px; font-weight: 750; }

.technical-totals {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.technical-totals > span {
    padding: 8px;
    border: 1px solid rgba(255,255,255,.055);
    border-radius: 8px;
    background: rgba(255,255,255,.025);
}

.technical-totals small,
.technical-totals strong { display: block; }
.technical-totals small { color: #718798; font-size: 7px; }
.technical-totals strong { margin-top: 3px; color: #d7e9f3; font-size: 11px; }
.technical-note { margin: 7px 0 12px; }

.technical-presets.presets {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 5px;
    margin-bottom: 15px;
}

.technical-presets .preset-label { width: 100%; margin-bottom: 2px; }
.technical-presets .preset { min-height: 32px; padding: 6px 8px; font-size: 8px; }
.technical-controls { margin-bottom: 16px; }
.technical-controls .section-heading { margin-top: 8px; }
.model-output-heading { margin-top: 15px; }

.explore-model .output-card {
    grid-template-columns: minmax(0, 1fr) 78px;
    min-height: 74px;
}

.explore-model .output-copy em,
.explore-model .output-copy em.status-good,
.explore-model .output-copy em.status-caution,
.explore-model .output-copy em.status-alert {
    color: #a9c1cf;
    border-color: rgba(124, 166, 190, .22);
    background: rgba(81, 122, 147, .10);
    box-shadow: none;
}

.body-stage.is-empty .route-channel,
.body-stage.is-empty .circulation-web,
.body-stage.is-empty .anatomy-signal,
.body-stage.is-empty .fat-reserve {
    opacity: .10 !important;
}

.stage-message[data-balance-state="empty"] .stage-balance-summary {
    color: #8aa6b7;
    background: rgba(95, 132, 153, .12);
    border-color: rgba(117, 156, 179, .20);
}

.food-filter:focus-visible,
.food-tile:focus-visible,
.example-day-button:focus-visible,
.clear-start-button:focus-visible,
.tray-clear:focus-visible,
.undo-clear:focus-visible,
.portion-stepper button:focus-visible,
.tray-remove:focus-visible,
.experiment-card button:focus-visible,
.technical-source button:focus-visible,
.explore-model > summary:focus-visible,
.mobile-day-summary:focus-visible {
    outline: 2px solid #8bdcff;
    outline-offset: 2px;
}


/* Desktop and iPad landscape keep chooser, hero, and day interpretation together. */
@media (min-width: 901px) {
    .workspace {
        grid-template-columns:
            clamp(292px, 25vw, 350px)
            minmax(390px, 1fr)
            clamp(288px, 24vw, 340px);
        gap: 12px;
        padding: 12px;
    }

    .controls-panel,
    .output-panel.day-panel {
        height: 100%;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .controls-panel {
        display: flex;
        flex-direction: column;
        padding: 14px;
    }

    .controls-panel .food-browser-section {
        flex: 1 1 auto;
        min-height: 270px;
        margin-bottom: 14px;
    }

    .controls-panel .activity-section,
    .controls-panel .horizon-section {
        flex: 0 0 auto;
        margin-bottom: 12px;
    }

    .body-stage {
        grid-column: 2;
        grid-row: 1;
        height: 100%;
        min-height: 0;
    }

    .output-panel.day-panel {
        grid-column: 3;
        grid-row: 1;
        max-height: none;
        overflow-x: hidden;
    }
}


/* iPad landscape uses compact side rails while protecting the hero. */
@media (min-width: 901px) and (max-width: 1250px) {
    html,
    body {
        height: 100%;
        overflow: hidden;
    }

    .app { height: 100dvh; min-height: 0; }
    .topbar { min-height: 68px; padding: 9px 12px; }
    .brand h1 { font-size: 16px; }
    .brand p { font-size: 9px; }

    .workspace {
        flex: 1 1 auto;
        grid-template-columns: minmax(270px, 31vw) minmax(350px, 1fr) minmax(270px, 30vw);
        grid-template-rows: minmax(0, 1fr);
        overflow: hidden;
        padding: 9px;
        gap: 8px;
    }

    .controls-panel,
    .output-panel.day-panel { padding: 11px; }
    .food-grid { gap: 5px; }
    .food-tile { min-height: 54px; grid-template-columns: 31px minmax(0,1fr); padding: 5px; }
    .food-art { width: 31px; height: 31px; font-size: 14px; }
    .food-filter { min-height: 29px; padding: 5px 7px; }
    .controls-panel section { margin-bottom: 10px; }
    .controls-panel .activity-description,
    .controls-panel .horizon-description { min-height: 0; }
    .tray-list { max-height: 190px; }
    .narration-card { padding: 10px; }
    .phase-guardrail { padding: 7px 8px; }

    .routing-stage { inset: 58px 7px 76px; }
}


/* iPad portrait and smaller: hero first, then interpretation and controls. */
@media (max-width: 900px) {
    html,
    body { height: auto; overflow-y: auto; }
    .app { height: auto; min-height: 100vh; }

    .topbar { gap: 10px; padding: 10px 12px; }
    .example-controls { width: 100%; justify-content: flex-start; overflow-x: auto; padding-bottom: 2px; }
    .example-label { flex: 0 0 auto; }

    .workspace {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 10px;
        overflow: visible;
    }

    .mobile-day-summary {
        order: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 46px;
        padding: 9px 12px;
        border: 1px solid rgba(88, 192, 226, .25);
        border-radius: 11px;
        color: #d9edf7;
        background: rgba(29, 77, 102, .34);
        font: inherit;
    }

    .mobile-day-summary span { font-size: 10px; font-weight: 800; }
    .mobile-day-summary strong { color: #8bcbe2; font-size: 9px; }

    .body-stage { order: 1; width: 100%; min-height: 720px; }
    .output-panel.day-panel { order: 2; display: block; max-height: none; overflow: visible; }
    .controls-panel {
        order: 3;
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .controls-panel .activity-section { order: 1; }
    .controls-panel .horizon-section { order: 2; }
    .controls-panel .food-browser-section { order: 3; }
    .food-browser-section { max-height: 580px; }
    .food-grid { max-height: 440px; }
    .tray-list { max-height: 300px; }
    .technical-totals { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .explore-model .output-card { display: grid; }
}


@media (max-width: 650px) {
    .example-controls {
        flex-wrap: wrap;
        overflow: visible;
    }

    .example-label {
        flex-basis: 100%;
    }

    .example-day-button,
    .clear-start-button,
    .reset-button { min-height: 42px; }
    .body-stage { min-height: 1000px; }
    .food-filter { min-width: 44px; min-height: 40px; padding-inline: 11px; }
    .food-tile { min-height: 72px; }
    .portion-stepper button,
    .tray-remove { min-width: 42px; min-height: 42px; }
    .portion-stepper { grid-template-columns: 42px 38px 42px; }
    .portion-stepper output { height: 42px; }
    .tray-row { grid-template-columns: minmax(0,1fr) auto 42px; }
    .technical-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


@media (max-width: 420px) {
    .example-day-button,
    .clear-start-button {
        padding-inline: 8px;
        font-size: 9px;
    }

    .mobile-day-summary {
        width: 100%;
        align-self: stretch;
    }

    .food-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .food-tile { grid-template-columns: 30px minmax(0,1fr); gap: 5px; padding: 6px; }
    .food-art { width: 30px; height: 30px; font-size: 14px; }
    .food-tile-copy strong { font-size: 8px; }
    .tray-row { grid-template-columns: minmax(0, 1fr) auto; }
    .tray-remove { grid-column: 2; }
    .portion-stepper { grid-row: 1 / 3; grid-column: 2; margin-right: 48px; }
}


/* Phase 2A journey refinement: Build first, then reveal the full routing view. */
.workspace[data-view="build"] .body-stage,
.workspace[data-view="build"] .narration-card,
.workspace[data-view="build"] .see-day-summary,
.workspace[data-view="build"] .phase-guardrail,
.workspace[data-view="build"] .explore-model,
.workspace[data-view="see"] .build-start,
.workspace[data-view="see"] .body-teaser,
.workspace[data-view="see"] .controls-panel,
.workspace[data-view="see"] .today-section,
.workspace[data-view="see"] .live-body-dock {
    display: none;
}

.experience-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    border: 1px solid rgba(100, 205, 235, .16);
    border-radius: 13px;
    background: rgba(5, 18, 30, .72);
    box-shadow: inset 0 0 20px rgba(36, 137, 174, .06);
}

.experience-tab {
    min-height: 42px;
    padding: 8px 16px;
    border: 0;
    border-radius: 9px;
    color: #7594a7;
    background: transparent;
    font: 800 10px/1.2 inherit;
    letter-spacing: .04em;
}

.experience-tab.active {
    color: #e8f8ff;
    background: linear-gradient(135deg, rgba(45, 161, 201, .28), rgba(76, 105, 190, .20));
    box-shadow: inset 0 0 0 1px rgba(123, 222, 251, .20), 0 5px 16px rgba(0, 0, 0, .18);
}

.experience-tab:focus-visible,
.see-body-button:focus-visible,
.change-day-button:focus-visible,
.live-body-dock button:focus-visible,
.meal-group > summary:focus-visible,
.custom-edit-panel > summary:focus-visible {
    outline: 2px solid #8bdcff;
    outline-offset: 2px;
}

.build-start,
.body-teaser,
.see-day-summary {
    border: 1px solid rgba(95, 199, 229, .14);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(12, 35, 51, .88), rgba(7, 21, 34, .92));
    box-shadow: inset 0 0 34px rgba(25, 114, 151, .06), 0 10px 30px rgba(0, 0, 0, .16);
}

.build-start {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 16px;
}

.view-kicker {
    display: block;
    margin-bottom: 5px;
    color: #4fbfe2;
    font-size: 7px;
    font-weight: 850;
    letter-spacing: .15em;
}

.build-start h2,
.see-day-summary h2 {
    margin: 0;
    color: #e4f3f9;
    font-size: 15px;
}

.build-start p {
    max-width: 540px;
    margin: 5px 0 0;
    color: #7690a0;
    font-size: 9px;
    line-height: 1.45;
}

.build-start .example-controls {
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 440px;
}

.body-teaser {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 130px;
    grid-template-rows: 1fr auto;
    align-items: center;
    gap: 8px 14px;
    min-height: 190px;
    padding: 16px;
    overflow: hidden;
}

.body-teaser::before {
    content: "";
    position: absolute;
    inset: 12% -18% auto 30%;
    height: 80%;
    background: radial-gradient(circle, rgba(41, 171, 217, .14), transparent 66%);
    pointer-events: none;
}

.teaser-copy { position: relative; z-index: 2; }
.teaser-copy h2 { margin: 0; color: #e5f6fc; font-size: 16px; line-height: 1.2; }
.teaser-copy p { margin: 7px 0 0; color: #87a6b7; font-size: 9px; line-height: 1.5; }

.simple-body {
    position: relative;
    isolation: isolate;
    display: grid;
    place-items: center;
    width: 104px;
    height: 154px;
    margin-inline: auto;
}

.simple-body::before,
.simple-body::after {
    content: "";
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    pointer-events: none;
}

.simple-body::before {
    width: 72px;
    height: 132px;
    background: radial-gradient(ellipse, rgba(72, 200, 237, .26), rgba(55, 105, 220, .07) 48%, transparent 72%);
    filter: blur(5px);
}

.simple-body::after {
    width: 86px;
    height: 142px;
    border: 1px solid rgba(111, 215, 246, .20);
    box-shadow: 0 0 18px rgba(65, 190, 229, .15), inset 0 0 20px rgba(68, 170, 219, .08);
}

.simple-body img {
    width: auto;
    height: 146px;
    opacity: .82;
    filter: saturate(.85) contrast(1.05) drop-shadow(0 0 9px rgba(72, 189, 224, .28));
}

.simple-route {
    position: absolute;
    z-index: 2;
    width: 60px;
    height: 1px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, rgba(102, 218, 248, .85), transparent);
    box-shadow: 0 0 7px rgba(86, 206, 241, .60);
    opacity: .42;
}

.simple-route-a { top: 38%; left: -3px; transform: rotate(17deg); }
.simple-route-b { top: 55%; right: -2px; transform: rotate(-18deg); }
.simple-route-c { top: 69%; left: 9px; transform: rotate(31deg); }

.simple-body[data-emphasis="food"] .simple-route { background-color: #d4a2ff; }
.simple-body[data-emphasis="movement"] .simple-route { background-color: #ff7b68; }
.simple-body[data-emphasis="horizon"]::after { border-color: rgba(255, 187, 89, .58); }
.simple-body[data-emphasis="empty"] { opacity: .46; }

.simple-body.is-emphasized::before {
    animation: live-body-emphasis .9s ease-out;
}

@keyframes live-body-emphasis {
    0% { opacity: .55; transform: scale(.92); }
    35% { opacity: 1; transform: scale(1.09); }
    100% { opacity: .72; transform: scale(1); }
}

.see-body-button,
.change-day-button,
.live-body-dock button {
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid rgba(99, 205, 239, .28);
    border-radius: 9px;
    color: #c9f3ff;
    background: rgba(29, 126, 164, .20);
    font: 800 9px/1.2 inherit;
}

.see-body-button { position: relative; z-index: 2; justify-self: start; }

.live-body-dock { display: none; }

.meal-group,
.custom-edit-panel {
    margin-bottom: 6px;
    border: 1px solid rgba(92, 183, 211, .13);
    border-radius: 10px;
    background: rgba(9, 28, 42, .64);
    overflow: clip;
}

.meal-group > summary,
.custom-edit-panel > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    padding: 8px 11px;
    color: #d3eaf3;
    cursor: pointer;
    font-size: 9px;
    font-weight: 800;
    list-style: none;
}

.meal-group > summary::-webkit-details-marker,
.custom-edit-panel > summary::-webkit-details-marker { display: none; }
.meal-group > summary::after,
.custom-edit-panel > summary::after { content: "+"; color: #5ebddd; font-size: 14px; }
.meal-group[open] > summary::after,
.custom-edit-panel[open] > summary::after { content: "−"; }
.meal-group > summary small { margin-left: auto; margin-right: 10px; color: #708c9e; font-size: 8px; }
.meal-rows,
.custom-edit-rows { padding: 0 6px 6px; }

.day-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 7px;
}

.day-chips span {
    padding: 6px 8px;
    border: 1px solid rgba(98, 187, 216, .14);
    border-radius: 999px;
    color: #a7c2cf;
    background: rgba(45, 103, 129, .12);
    font-size: 8px;
}

.see-day-summary { padding: 13px; }
.see-summary-grid { display: grid; gap: 6px; margin: 10px 0; }
.see-summary-grid > span { padding: 8px; border-radius: 8px; background: rgba(255,255,255,.025); }
.see-summary-grid small,
.see-summary-grid strong { display: block; }
.see-summary-grid small { color: #6c8798; font-size: 7px; }
.see-summary-grid strong { margin-top: 3px; color: #d6ebf4; font-size: 9px; }
.change-day-button { width: 100%; }

.body-stage.is-emphasized[data-emphasis="food"] .channel-protein,
.body-stage.is-emphasized[data-emphasis="food"] .channel-carbs,
.body-stage.is-emphasized[data-emphasis="food"] .channel-fat,
.body-stage.is-emphasized[data-emphasis="movement"] .channel-muscle,
.body-stage.is-emphasized[data-emphasis="horizon"] .route-channel {
    filter: brightness(1.35) saturate(1.16);
}


@media (min-width: 901px) {
    .workspace {
        grid-template-columns: minmax(0, 1fr) minmax(330px, 390px);
        grid-template-rows: auto auto minmax(0, 1fr);
        gap: 10px;
        padding: 10px;
    }

    .experience-nav { grid-column: 1 / -1; grid-row: 1; justify-self: center; width: min(560px, 64vw); }

    .workspace[data-view="build"] .build-start { grid-column: 1; grid-row: 2; }
    .workspace[data-view="build"] .body-teaser { grid-column: 2; grid-row: 2; }
    .workspace[data-view="build"] .controls-panel { grid-column: 1; grid-row: 3; display: block; height: auto; overflow-y: auto; }
    .workspace[data-view="build"] .output-panel.day-panel { grid-column: 2; grid-row: 3; display: block; height: auto; overflow-y: auto; }
    .workspace[data-view="build"] .today-section { display: block; }
    .workspace[data-view="build"] .output-panel .tray-heading { display: flex; }
    .workspace[data-view="build"] .food-browser-section { flex: 0 0 auto; min-height: 0; }
    .workspace[data-view="build"] .food-grid { max-height: 260px; overflow-y: auto; overscroll-behavior: contain; }

    .workspace[data-view="see"] {
        grid-template-columns: minmax(480px, 1fr) minmax(320px, 390px);
        grid-template-rows: auto minmax(0, 1fr);
    }
    .workspace[data-view="see"] .body-stage { grid-column: 1; grid-row: 2; display: block; min-height: 0; height: 100%; }
    .workspace[data-view="see"] .output-panel.day-panel {
        grid-column: 2;
        grid-row: 2;
        display: flex;
        flex-direction: column;
        gap: 10px;
        height: auto;
        min-height: 0;
        overflow-y: auto;
    }
    .workspace[data-view="see"] .narration-card { display: block; order: 1; }
    .workspace[data-view="see"] .see-day-summary { display: block; order: 2; }
    .workspace[data-view="see"] .phase-guardrail { display: block; order: 3; }
    .workspace[data-view="see"] .explore-model { display: block; order: 4; flex: 0 0 auto; }
}


@media (min-width: 901px) and (max-width: 1250px) {
    .workspace {
        grid-template-columns: minmax(0, 1fr) minmax(300px, 34vw);
        grid-template-rows: auto auto minmax(0, 1fr);
    }
    .body-teaser { min-height: 150px; grid-template-columns: minmax(0, 1fr) 95px; padding: 12px; }
    .body-teaser .simple-body { width: 78px; height: 112px; }
    .body-teaser .simple-body img { height: 108px; }
    .build-start { padding: 10px 12px; }
    .build-start .example-controls { max-width: 400px; }
    .workspace[data-view="build"] .controls-panel .food-browser-section { min-height: 0; }
    .workspace[data-view="build"] .food-grid { max-height: 190px; }
    .workspace[data-view="build"] .tray-list { max-height: none; }
}


@media (max-width: 900px) {
    html,
    body { width: 100%; max-width: 100%; overflow-x: hidden; }
    .app { padding-bottom: 0; }

    .workspace {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 9px;
        padding: 9px;
    }

    .experience-nav { grid-column: 1; grid-row: 1; position: sticky; top: 5px; z-index: 25; }

    .workspace[data-view="build"] { padding-bottom: 100px; }
    .workspace[data-view="build"] .build-start { grid-column: 1; grid-row: 2; display: block; }
    .workspace[data-view="build"] .body-teaser { grid-column: 1; grid-row: 3; display: grid; }
    .workspace[data-view="build"] .controls-panel,
    .workspace[data-view="build"] .output-panel.day-panel { display: contents; }
    .workspace[data-view="build"] .food-browser-section { grid-column: 1; grid-row: 4; display: block; }
    .workspace[data-view="build"] .today-section { grid-column: 1; grid-row: 5; display: block; }
    .workspace[data-view="build"] .activity-section { grid-column: 1; grid-row: 6; display: block; }
    .workspace[data-view="build"] .horizon-section { grid-column: 1; grid-row: 7; display: block; }

    .build-start .example-controls { justify-content: flex-start; max-width: none; margin-top: 11px; }
    .body-teaser { min-height: 150px; grid-template-columns: minmax(0, 1fr) 92px; padding: 12px 14px; }
    .body-teaser .simple-body { width: 72px; height: 106px; }
    .body-teaser .simple-body img { height: 102px; }
    .teaser-copy h2 { font-size: 14px; }
    .food-browser-section { max-height: 510px; padding: 13px; border: 1px solid rgba(95, 199, 229, .14); border-radius: 14px; background: rgba(7, 22, 34, .88); }
    .workspace[data-view="build"] .output-panel .tray-heading { display: flex; }
    .food-grid { max-height: 365px; }
    .today-section,
    .activity-section,
    .horizon-section { padding: 13px; border: 1px solid rgba(95, 199, 229, .14); border-radius: 14px; background: rgba(7, 22, 34, .88); }
    .tray-list { max-height: 260px; }

    .workspace[data-view="build"] .live-body-dock {
        position: fixed;
        z-index: 40;
        right: max(9px, env(safe-area-inset-right));
        bottom: max(8px, env(safe-area-inset-bottom));
        left: max(9px, env(safe-area-inset-left));
        display: grid;
        grid-template-columns: 42px minmax(0, 1fr) auto;
        align-items: center;
        gap: 9px;
        min-height: 76px;
        padding: 7px 8px;
        border: 1px solid rgba(102, 215, 245, .28);
        border-radius: 15px;
        background: rgba(5, 20, 32, .94);
        box-shadow: 0 0 0 1px rgba(21, 85, 111, .20), 0 12px 34px rgba(0,0,0,.48), inset 0 0 24px rgba(34, 140, 178, .08);
        backdrop-filter: blur(14px);
    }
    .dock-body { width: 38px; height: 60px; }
    .dock-body img { height: 57px; }
    .dock-body::before { width: 31px; height: 52px; }
    .dock-body::after { width: 36px; height: 57px; }
    .dock-body .simple-route { width: 25px; }
    .dock-copy span { color: #54c1e3; font-size: 7px; font-weight: 850; letter-spacing: .08em; }
    .dock-copy p { margin: 3px 0 0; color: #b8d1dc; font-size: 8px; line-height: 1.3; }
    .live-body-dock button { min-width: 92px; min-height: 44px; }

    .workspace[data-view="see"] .body-stage { grid-column: 1; grid-row: 2; display: block; width: 100%; min-height: 690px; }
    .workspace[data-view="see"] .output-panel.day-panel { display: contents; }
    .workspace[data-view="see"] .narration-card { grid-column: 1; grid-row: 3; display: block; }
    .workspace[data-view="see"] .see-day-summary { grid-column: 1; grid-row: 4; display: block; }
    .workspace[data-view="see"] .phase-guardrail { grid-column: 1; grid-row: 5; display: block; }
    .workspace[data-view="see"] .explore-model { grid-column: 1; grid-row: 6; display: block; }
    .see-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}


@media (max-width: 650px) {
    .topbar { align-items: center; }
    .brand p { line-height: 1.5; }
    .experience-tab { min-height: 44px; padding-inline: 8px; }
    .build-start .example-controls { display: grid; grid-template-columns: 1fr 1fr auto; width: 100%; }
    .example-day-button,
    .clear-start-button { white-space: normal; }
    .food-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .body-teaser { grid-template-columns: minmax(0, 1fr) 80px; }
    .body-teaser .simple-body { width: 64px; }
    .workspace[data-view="see"] .body-stage { min-height: 880px; }
}


@media (max-width: 420px) {
    .workspace { padding: 7px; }
    .build-start { padding: 12px; }
    .build-start .example-controls { grid-template-columns: 1fr 1fr; }
    .build-start .reset-button { grid-column: 1 / -1; justify-self: start; }
    .food-browser-section { max-height: 475px; }
    .food-grid { max-height: 330px; }
    .food-tile { min-height: 66px; }
    .tray-row { grid-template-columns: minmax(0, 1fr) auto; }
    .portion-stepper { grid-row: 1 / 3; grid-column: 2; margin-right: 46px; }
    .tray-remove { grid-column: 2; }
    .see-summary-grid { grid-template-columns: 1fr; }
    .live-body-dock { grid-template-columns: 36px minmax(0, 1fr) auto !important; }
    .live-body-dock button { min-width: 84px; padding-inline: 8px; }
}


@media (prefers-reduced-motion: reduce) {
    .simple-body.is-emphasized::before { animation: none; opacity: 1; filter: blur(2px); }
    .simple-body.is-emphasized::after { border-width: 2px; }
    .body-stage.is-emphasized .route-channel { transition: none; }
}


/* Keep core overrides last so preserved Phase 1/2 responsive rules stay backstage. */
body.core-mode .core-workspace .body-stage {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
}

body.core-mode .core-workspace .controls-panel {
    display: contents !important;
}

body.core-mode .core-workspace {
    align-items: stretch !important;
}

body.core-mode .core-workspace #foodBrowserSection {
    display: flex !important;
    max-height: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

body.core-mode .core-workspace #foodGrid {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

body.core-mode .body-stage.is-empty .route-channel {
    opacity: 0 !important;
    visibility: hidden !important;
}

body.core-mode .body-stage.is-empty .destination-card {
    opacity: .055 !important;
    filter: saturate(.25) brightness(.62) !important;
}

body.core-mode .body-stage.is-empty .body-anatomy {
    opacity: .95 !important;
}

body.core-mode .body-stage .destination-card b,
body.core-mode .stage-label .info-button {
    display: none !important;
}

body.core-mode .body-stage .stage-message.core-response {
    width: auto !important;
    max-width: none !important;
    transform: none !important;
}

body.core-mode .body-stage .stage-message.core-response p {
    display: block !important;
}

body.core-mode .body-stage .stage-label {
    right: 10px !important;
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 10px !important;
}

body.core-mode .body-stage .stage-title-copy {
    min-width: 0;
}

body.core-mode .body-stage .stage-label .motion-toggle {
    position: static !important;
    display: inline-flex !important;
    flex: 0 0 auto !important;
    min-height: 30px !important;
    margin: 0 !important;
    padding: 5px 9px !important;
    transform: none !important;
    opacity: .78 !important;
    font-size: 7px !important;
}

body.core-mode .body-stage .stage-label .motion-toggle strong {
    font-size: 7px !important;
    white-space: nowrap;
}

body.core-mode .body-stage .stage-label .motion-icon {
    font-size: 11px !important;
}

body.core-mode .core-workspace .output-panel[hidden],
body.core-mode .core-workspace .legacy-backstage[hidden] {
    display: none !important;
}

@media (max-width: 900px) {
    body.core-mode .core-workspace {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-rows: minmax(310px, 1.25fr) auto minmax(275px, .95fr) !important;
        overflow: hidden !important;
    }

    body.core-mode .core-workspace .body-stage { grid-column: 1 !important; grid-row: 1 !important; }
    body.core-mode .core-workspace .horizon-section { grid-column: 1 !important; grid-row: 2 !important; }
    body.core-mode .core-workspace #foodBrowserSection { grid-column: 1 !important; grid-row: 3 !important; }
}

@media (min-width: 901px) {
    body.core-mode .core-workspace {
        display: grid !important;
        grid-template-columns: minmax(320px, 38vw) minmax(0, 1fr) !important;
        grid-template-rows: minmax(0, 1fr) auto !important;
        overflow: hidden !important;
    }

    body.core-mode .core-workspace #foodBrowserSection { grid-column: 1 !important; grid-row: 1 / 3 !important; }
    body.core-mode .core-workspace .body-stage { grid-column: 2 !important; grid-row: 1 !important; }
    body.core-mode .core-workspace .horizon-section { grid-column: 2 !important; grid-row: 2 !important; }
}

@media (min-width: 901px) {
    body.core-mode .food-workspace-bar .food-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}


/* Accessibility fallback: high zoom may scroll vertically, but never conceal controls. */
@media (max-height: 700px),
       (min-width: 521px) and (max-width: 900px) and (max-height: 850px) {
    body.core-mode {
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
    }

    body.core-mode .app {
        height: auto;
        min-height: 100dvh;
        overflow: visible;
    }

    body.core-mode .core-workspace {
        flex: 0 0 auto;
        height: auto;
        overflow: visible !important;
    }

    body.core-mode .core-workspace #foodBrowserSection {
        min-height: 430px !important;
    }

    body.core-mode .core-workspace #foodGrid {
        min-height: 130px !important;
    }
}

@media (max-width: 900px) and (max-height: 700px),
       (min-width: 521px) and (max-width: 900px) and (max-height: 850px) {
    body.core-mode .core-workspace {
        grid-template-rows: 260px auto 430px !important;
    }

    body.core-mode .core-workspace .body-stage {
        height: 260px !important;
        min-height: 260px !important;
    }

    body.core-mode .core-workspace #foodBrowserSection {
        height: 430px !important;
        max-height: 430px !important;
    }
}

@media (min-width: 901px) and (max-height: 700px) {
    body.core-mode .core-workspace {
        height: 720px;
        min-height: 720px;
        grid-template-rows: minmax(0, 1fr) auto !important;
    }

    body.core-mode .core-workspace .body-stage {
        height: 100% !important;
    }
}

@media (max-width: 520px) {
    body.core-mode .core-workspace {
        grid-template-rows: minmax(300px, 1.15fr) auto minmax(250px, .88fr) !important;
    }

    body.core-mode .routing-stage {
        display: grid !important;
        grid-template-columns: 90px minmax(0, 1fr) 112px !important;
        grid-template-rows: minmax(0, 1fr) !important;
        align-items: stretch !important;
        gap: 2px !important;
    }

    body.core-mode .routing-stage .input-stack,
    body.core-mode .routing-stage .destination-stack {
        position: relative !important;
        inset: auto !important;
        display: flex !important;
        width: auto !important;
        height: 100% !important;
        min-height: 0 !important;
    }

    body.core-mode .routing-stage .input-stack {
        grid-column: 1 !important;
        grid-row: 1 !important;
        justify-content: center !important;
        gap: 4px !important;
    }

    body.core-mode .routing-stage .route-card {
        min-height: 46px !important;
        padding: 4px 6px !important;
    }

    body.core-mode .routing-stage .route-visual {
        flex-basis: 32px !important;
        width: 32px !important;
        height: 32px !important;
    }

    body.core-mode .routing-stage .body-container {
        position: relative !important;
        inset: auto !important;
        grid-column: 2 !important;
        grid-row: 1 !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        transform: none !important;
    }

    body.core-mode .routing-stage .human {
        width: min(100%, 124px) !important;
        height: min(94%, 245px) !important;
        transform: none !important;
    }

    body.core-mode .routing-stage .destination-stack {
        grid-column: 3 !important;
        grid-row: 1 !important;
        gap: 2px !important;
    }

    body.core-mode .routing-stage .destination-card {
        flex: 1 1 0 !important;
        min-height: 0 !important;
    }

    body.core-mode .routing-stage .routing-network {
        display: block !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
    }

    body.core-mode .body-stage .stage-label .motion-toggle {
        display: inline-flex !important;
        min-height: 28px !important;
        padding: 4px 7px !important;
    }

    body.core-mode .body-stage .stage-label .motion-toggle strong {
        font-size: 6px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.core-mode .body-stage.is-emphasized .route-card,
    body.core-mode .body-stage.is-emphasized .destination-card {
        outline: 2px solid rgba(156, 229, 250, .66);
        outline-offset: 1px;
        transition: none !important;
    }

    body.core-mode .body-stage.is-emphasized .route-channel {
        transition: none !important;
    }
}


/* Phase 2 core refinement: readable food-energy context and iPad-first type. */
:root {
    --muted: #a7bdca;
}

body.core-mode .brand {
    min-width: 0;
    white-space: normal;
}

body.core-mode .brand p {
    color: #b5c9d4;
    font-size: 15px;
    line-height: 1.4;
}

body.core-mode .food-browser-intro,
body.core-mode .section-heading span,
body.core-mode .horizon-description,
body.core-mode .food-browser-status {
    color: #afc5d0;
    line-height: 1.45;
}

body.core-mode .core-food-heading h2,
body.core-mode .horizon-section .section-heading h2 {
    font-size: 18px;
    line-height: 1.2;
}

body.core-mode .core-food-heading span,
body.core-mode .horizon-section .section-heading span,
body.core-mode .food-browser-intro,
body.core-mode .horizon-description {
    font-size: 15px;
}

body.core-mode .food-browser-intro {
    margin: 4px 0 8px;
}

body.core-mode .food-workspace-bar {
    flex-direction: column;
    gap: 7px;
}

body.core-mode .food-workspace-actions {
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    width: 100%;
    gap: 6px;
}

body.core-mode .estimated-energy-summary {
    position: relative;
    display: flex;
    flex: 1 1 270px;
    min-width: 0;
    min-height: 52px;
    flex-direction: column;
    justify-content: center;
    padding: 7px 50px 7px 11px;
    border: 1px solid rgba(130, 191, 211, .22);
    border-radius: 10px;
    color: #eef9fc;
    background: rgba(20, 55, 70, .34);
}

body.core-mode .estimated-energy-summary > span {
    color: #b2c7d2;
    font-size: 14px;
    line-height: 1.35;
}

body.core-mode .estimated-energy-summary strong {
    display: block;
    margin-top: 2px;
    font-size: 16px;
    line-height: 1.35;
}

body.core-mode .estimated-energy-summary output {
    color: #f4fbfe;
    white-space: nowrap;
}

body.core-mode .estimated-energy-summary .energy-info-button {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 44px;
    height: 44px;
    min-height: 44px;
    font-size: 15px;
}

body.core-mode .clear-foods-action,
body.core-mode .food-workspace-actions .undo-clear,
body.core-mode .food-filter,
body.core-mode .timeline-options button {
    min-height: 44px;
    font-size: 15px;
    line-height: 1.2;
}

body.core-mode .food-filter {
    height: auto;
    white-space: normal;
}

body.core-mode .food-workspace-bar .food-filters {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    width: 100%;
}

body.core-mode .food-tile {
    min-height: 128px;
    padding: 9px;
}

body.core-mode .food-tile-copy strong {
    font-size: 16px;
    line-height: 1.2;
}

body.core-mode .food-tile-copy small {
    color: #b0c5d0;
    font-size: 14px;
    line-height: 1.35;
}

body.core-mode .catalog-portion-count {
    font-size: 16px;
}

body.core-mode .food-browser-status {
    min-height: 20px;
    font-size: 14px;
}

body.core-mode .horizon-section {
    padding: 11px 13px;
}

body.core-mode .horizon-description {
    margin-top: 7px;
}

body.core-mode .core-info-button {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
    min-height: 44px;
    font-size: 15px;
}

body.core-mode .stage-message.core-response {
    min-height: 52px;
    padding: 9px 12px;
}

body.core-mode .stage-message.core-response p {
    color: #c4d7df;
    font-size: 15px;
    line-height: 1.4;
}

body.core-mode .routing-stage {
    bottom: 66px;
}

body.core-mode .stage-label > span {
    color: #9eb9c7;
    font-size: 10px;
}

body.core-mode .stage-label h2 {
    font-size: 16px;
}

body.core-mode .body-stage .stage-label .motion-toggle,
body.core-mode .body-stage .stage-label .motion-toggle strong {
    font-size: 15px !important;
}

body.core-mode .body-stage .stage-label .motion-toggle {
    min-height: 44px !important;
    padding: 7px 10px !important;
}

body.core-mode .body-stage .stage-label .motion-icon {
    font-size: 16px !important;
}

body.core-mode .route-card strong,
body.core-mode .destination-card strong {
    font-size: 10px;
    line-height: 1.15;
}

body.core-mode .route-card small,
body.core-mode .destination-card small {
    font-size: 8px;
    line-height: 1.2;
}

body.core-mode .site-footer {
    min-height: 34px;
    padding-top: 7px;
    padding-bottom: max(7px, env(safe-area-inset-bottom));
    color: #9fb5c2;
    font-size: 13px;
    line-height: 1.4;
}

body.core-mode .core-explanation-dialog {
    width: min(560px, calc(100vw - 24px));
    max-height: min(82dvh, 720px);
    overflow-y: auto;
}

body.core-mode .core-explanation-sheet h2 {
    padding-right: 42px;
    font-size: 21px;
    line-height: 1.25;
}

body.core-mode .core-explanation-sheet p {
    color: #bed0d8;
    font-size: 16px;
    line-height: 1.65;
    white-space: pre-line;
}

body.core-mode .core-explanation-details {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(130, 194, 215, .18);
    color: #c8d9df;
    font-size: 15px;
    line-height: 1.55;
}

body.core-mode .core-explanation-details summary {
    min-height: 44px;
    padding: 10px 4px;
    color: #e4f4f8;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
}

body.core-mode .core-explanation-details summary:focus-visible {
    outline: 2px solid #8bdcff;
    outline-offset: 2px;
}

body.core-mode .core-explanation-details ul {
    margin: 4px 0 0;
    padding-left: 24px;
}

body.core-mode .core-explanation-details li + li {
    margin-top: 5px;
}

@media (max-width: 900px) {
    body.core-mode .core-workspace {
        grid-template-rows: minmax(290px, .95fr) auto minmax(300px, 1fr) !important;
    }

    body.core-mode .food-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    body.core-mode .topbar {
        min-height: 58px;
    }

    body.core-mode .brand {
        gap: 9px;
    }

    body.core-mode .brand h1 {
        font-size: 17px;
    }

    body.core-mode .brand p {
        display: none;
    }

    body.core-mode .core-workspace {
        grid-template-rows: minmax(189px, .8fr) auto minmax(371px, 1.4fr) !important;
    }

    body.core-mode .stage-label h2 {
        font-size: 13px;
    }

    body.core-mode .body-stage .stage-label .motion-toggle,
    body.core-mode .body-stage .stage-label .motion-toggle strong {
        font-size: 13px !important;
    }

    body.core-mode .stage-message.core-response p {
        font-size: 14px;
    }

    body.core-mode .route-card strong,
    body.core-mode .destination-card strong {
        font-size: 8px;
    }

    body.core-mode .food-workspace-bar .food-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body.core-mode .food-browser-intro,
    body.core-mode .horizon-description {
        display: none;
    }

    body.core-mode .estimated-energy-summary {
        flex-basis: 210px;
        min-height: 54px;
    }

    body.core-mode .estimated-energy-summary > span {
        display: none;
    }

    body.core-mode .estimated-energy-summary strong {
        font-size: 15px;
    }

    body.core-mode .food-tile-copy strong {
        font-size: 15px;
    }

    body.core-mode .site-footer {
        font-size: 13px;
    }
}

@media (max-height: 700px) {
    body.core-mode .brand p,
    body.core-mode .food-browser-intro,
    body.core-mode .horizon-description {
        display: none;
    }

    body.core-mode .core-workspace {
        grid-template-rows: minmax(155px, 1.1fr) auto minmax(145px, .9fr) !important;
    }
}

@media (min-width: 901px) {
    body.core-mode .food-workspace-bar .food-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}


/* Keep this responsive correction last so legacy layout rules stay backstage. */
body.core-mode .food-tile {
    grid-template-rows: minmax(48px, auto) 44px;
    min-height: 106px;
    height: 100%;
    padding: 6px 7px;
    gap: 2px 6px;
    align-content: center;
}

body.core-mode .food-tile-copy strong,
body.core-mode .food-tile-copy small {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

body.core-mode .catalog-portion-stepper {
    width: 120px;
    height: 44px;
    grid-template-columns: 44px 32px 44px;
    gap: 0;
    justify-self: end;
}

body.core-mode .catalog-portion-stepper button {
    position: relative;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    border: 0;
    color: transparent;
    background: transparent;
    font-size: 0;
}

body.core-mode .catalog-portion-stepper button::before {
    position: absolute;
    inset: 7px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(106, 193, 221, .26);
    border-radius: 8px;
    color: #d8f4fd;
    background: rgba(21, 63, 82, .72);
    font: 850 16px/1 -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    content: "";
}

body.core-mode .catalog-portion-stepper .catalog-portion-decrease::before { content: "−"; }
body.core-mode .catalog-portion-stepper .catalog-portion-increase::before { content: "+"; }

body.core-mode .catalog-portion-stepper button:disabled {
    border: 0;
    color: transparent;
    background: transparent;
    opacity: 1;
}

body.core-mode .catalog-portion-stepper button:disabled::before {
    color: #58717e;
    border-color: rgba(91, 126, 141, .13);
    background: rgba(17, 39, 50, .46);
    opacity: .62;
}

body.core-mode .catalog-portion-stepper button:focus-visible { outline: none; }
body.core-mode .catalog-portion-stepper button:focus-visible::before {
    outline: 2px solid #8bdcff;
    outline-offset: 2px;
}

body.core-mode .catalog-portion-count {
    height: 30px;
    align-self: center;
    margin: 0 2px;
}

@media (min-width: 521px) and (max-width: 900px) {
    body.core-mode .food-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    body.core-mode .food-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 901px) and (orientation: landscape) {
    html { height: 100%; }

    body.core-mode {
        height: 100%;
        min-height: 100%;
        overflow: hidden;
    }

    body.core-mode .app {
        height: 100vh;
        height: 100svh;
        height: 100dvh;
        min-height: 100svh;
        max-height: 100dvh;
        overflow: hidden;
    }

    body.core-mode .core-workspace {
        flex: 1 1 0%;
        height: auto !important;
        min-height: 0 !important;
        grid-template-rows: minmax(0, 1fr) auto !important;
        overflow: hidden !important;
    }

    body.core-mode .core-workspace #foodBrowserSection {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: hidden !important;
    }

    body.core-mode .core-workspace .body-stage {
        height: 100% !important;
        min-height: 0 !important;
    }

    body.core-mode .site-footer { margin-top: 0; }
}


/* Focused hierarchy and unobstructed hero refinement. */
body.core-mode .brand h1 {
    font-size: 19px;
    line-height: 1.15;
}

body.core-mode .brand p {
    color: #a9bec9;
    font-size: 14px;
    line-height: 1.35;
}

body.core-mode :is(.core-food-heading, .horizon-section .section-heading) h2 {
    color: #edf9fd;
    font-size: 18px;
    line-height: 1.2;
}

body.core-mode :is(.core-food-heading, .horizon-section .section-heading) span,
body.core-mode .food-browser-intro,
body.core-mode .horizon-description {
    color: #9db4c0;
    font-size: 14px;
    line-height: 1.45;
}

body.core-mode .food-browser-intro {
    margin: 3px 0 7px;
}

body.core-mode .estimated-energy-summary > span {
    color: #9fb6c1;
    font-size: 13px;
    line-height: 1.35;
}

body.core-mode .estimated-energy-summary .model-energy-context {
    margin-top: 3px;
    color: #9fb6c1;
    font-size: 13px;
    line-height: 1.35;
}

body.core-mode .food-workspace-actions :is(.clear-foods-action, .undo-clear) {
    align-self: center;
}

body.core-mode .estimated-energy-summary strong,
body.core-mode .food-tile-copy strong {
    font-size: 16px;
    line-height: 1.2;
}

body.core-mode .food-tile-copy small {
    color: #a9bec9;
    font-size: 14px;
    line-height: 1.35;
}

body.core-mode .food-browser-status {
    min-height: 17px;
    color: #829aa7;
    font-size: 12px;
    line-height: 1.4;
}

body.core-mode .stage-message.core-response p {
    color: #b3c8d1;
    font-size: 14px;
    line-height: 1.4;
}

body.core-mode .site-footer {
    min-height: 30px;
    padding-top: 5px;
    padding-bottom: max(5px, env(safe-area-inset-bottom));
    color: #8198a5;
    font-size: 12px;
    line-height: 1.45;
}

/* The generous explanation type is intentionally independent of chrome text. */
body.core-mode .core-explanation-sheet p {
    font-size: 16px;
    line-height: 1.65;
}

body.core-mode .body-stage,
body.core-mode .horizon-section,
body.core-mode .food-browser-section,
body.core-mode .estimated-energy-summary {
    background-image: none;
}

body.core-mode .core-workspace .body-stage {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border-color: rgba(76, 159, 190, .17);
    background:
        radial-gradient(ellipse at center 45%, rgba(32, 97, 139, .19), transparent 42%),
        linear-gradient(155deg, rgba(4, 17, 29, .99), rgba(2, 10, 19, .995));
    box-shadow: inset 0 0 42px rgba(22, 93, 128, .07), 0 10px 28px rgba(0, 0, 0, .20);
}

body.core-mode .horizon-section {
    border-color: rgba(91, 176, 208, .18);
    background: linear-gradient(150deg, rgba(10, 35, 54, .97), rgba(7, 25, 42, .985));
    box-shadow: inset 0 0 28px rgba(45, 126, 164, .045), 0 8px 22px rgba(0, 0, 0, .14);
}

body.core-mode .food-browser-section {
    border-color: rgba(78, 165, 194, .20);
    background: linear-gradient(150deg, rgba(12, 40, 57, .98), rgba(7, 25, 38, .99));
    box-shadow: inset 0 0 30px rgba(42, 137, 166, .05), 0 8px 22px rgba(0, 0, 0, .15);
}

body.core-mode .estimated-energy-summary {
    border-color: rgba(119, 183, 204, .17);
    background: rgba(14, 43, 57, .58);
    box-shadow: inset 0 1px rgba(203, 241, 251, .025);
}

body.core-mode .body-stage .stage-label {
    position: relative !important;
    inset: auto !important;
    z-index: 12;
    width: 100% !important;
    min-width: 0;
    max-width: 100%;
    min-height: 52px;
    padding: 10px 12px 4px;
}

body.core-mode .body-stage .stage-title-copy > span {
    color: #7896a6;
    font-size: 10px;
    line-height: 1.2;
}

body.core-mode .body-stage .stage-label h2 {
    font-size: 16px;
    line-height: 1.2;
}

body.core-mode .routing-stage {
    position: relative !important;
    inset: auto !important;
    grid-template-rows: minmax(0, 1fr) !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100%;
    min-height: 0;
    margin: 0 7px;
}

body.core-mode .routing-stage .body-container {
    min-height: 0;
    overflow: hidden;
}

body.core-mode .routing-stage .human {
    width: auto !important;
    max-width: 230px;
    height: calc(100% - 12px) !important;
    max-height: 460px;
    min-height: 0;
    aspect-ratio: 1 / 2;
    transform: none !important;
}

@media (min-width: 521px) {
    body.core-mode .routing-stage .input-stack,
    body.core-mode .routing-stage .destination-stack {
        top: 50% !important;
        bottom: auto !important;
        transform: translateY(-50%) !important;
    }
}

body.core-mode .body-stage .stage-message.core-response {
    position: relative !important;
    inset: auto !important;
    display: block !important;
    z-index: 12;
    width: auto !important;
    min-width: 0;
    max-width: calc(100% - 20px) !important;
    min-height: 44px;
    margin: 6px 10px 8px;
    padding: 8px 12px;
    transform: none !important;
    border-color: rgba(92, 169, 194, .13);
    background: rgba(6, 25, 37, .82);
    backdrop-filter: none;
}

body.core-mode .body-stage .stage-message.core-response p {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: break-word;
}

body.core-mode .core-info-button {
    color: #7f9eab;
    border-color: rgba(113, 172, 194, .20);
    background: rgba(31, 72, 89, .20);
    box-shadow: none;
}

body.core-mode .core-info-button:hover,
body.core-mode .core-info-button[aria-expanded="true"] {
    color: #c8e2eb;
    border-color: rgba(103, 191, 219, .36);
    background: rgba(44, 103, 124, .28);
    box-shadow: 0 0 8px rgba(74, 175, 205, .10);
}

body.core-mode .core-info-button:focus-visible {
    outline: 2px solid #8bdcff;
    outline-offset: 2px;
    color: #eaf8fd;
    border-color: rgba(116, 210, 238, .62);
    background: rgba(48, 118, 143, .38);
    box-shadow: none;
}

body.core-mode .estimated-energy-summary .energy-info-button {
    opacity: .82;
}

body.core-mode .estimated-energy-summary .energy-info-button:is(:hover, :focus-visible, [aria-expanded="true"]) {
    opacity: 1;
}

/* The energy help is a distinct info dot, not another energy datum. */
body.core-mode .hero-energy-readout .energy-info-button {
    flex: 0 0 22px;
    width: 22px;
    min-width: 22px;
    height: 22px;
    min-height: 22px;
    margin-left: auto;
    padding: 0;
    border: 1px solid rgba(116, 202, 228, .48);
    border-radius: 50%;
    color: #9fc8d6;
    background: rgba(29, 83, 104, .30);
    box-shadow: inset 0 0 0 1px rgba(8, 27, 38, .55);
    font-size: 11px;
    line-height: 1;
    opacity: .9;
}

body.core-mode .hero-energy-readout .energy-info-button:is(:hover, :focus-visible, [aria-expanded="true"]) {
    color: #effbff;
    border-color: #79d8f3;
    background: rgba(43, 121, 150, .46);
    box-shadow: 0 0 0 2px rgba(72, 179, 214, .13);
    opacity: 1;
}

@media (min-width: 521px) and (max-width: 900px) and (min-height: 851px) {
    body.core-mode .core-workspace {
        grid-template-rows: minmax(425px, 1.15fr) auto minmax(285px, .85fr) !important;
    }
}

@media (max-width: 520px) {
    body.core-mode {
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
    }

    body.core-mode .app {
        height: auto;
        min-height: 100dvh;
        overflow: visible;
    }

    body.core-mode .core-workspace {
        height: auto;
        grid-template-rows: minmax(330px, auto) auto minmax(360px, auto) !important;
        overflow: visible !important;
    }

    body.core-mode .core-workspace .body-stage {
        height: auto !important;
        min-height: 380px !important;
    }

    body.core-mode .body-stage .stage-label {
        min-height: 48px;
        padding: 8px 9px 3px;
    }

    body.core-mode .body-stage .stage-label h2 {
        font-size: 13px;
    }

    body.core-mode .routing-stage {
        margin: 0 3px;
    }

    body.core-mode .body-stage .stage-message.core-response {
        margin: 5px 7px 7px;
        padding: 7px 9px;
    }

    body.core-mode .stage-message.core-response p {
        font-size: 13px;
    }

    body.core-mode .site-footer {
        font-size: 12px;
    }
}

@media (min-width: 521px) and (max-width: 900px) and (max-height: 850px) {
    body.core-mode {
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
    }

    body.core-mode .app {
        height: auto;
        min-height: 100dvh;
        overflow: visible;
    }

    body.core-mode .core-workspace {
        height: auto;
        grid-template-rows: 410px auto 430px !important;
        overflow: visible !important;
    }

    body.core-mode .core-workspace .body-stage {
        height: 410px !important;
        min-height: 410px !important;
    }

    body.core-mode .core-workspace #foodBrowserSection {
        height: 430px !important;
        min-height: 430px !important;
        max-height: 430px !important;
    }
}

@media (min-width: 521px) and (max-width: 650px) {
    body.core-mode .routing-stage {
        display: grid !important;
        grid-template-columns: 120px minmax(0, 1fr) 154px !important;
        grid-template-rows: minmax(0, 1fr) !important;
        align-items: stretch !important;
        gap: 4px !important;
    }

    body.core-mode .routing-stage .input-stack,
    body.core-mode .routing-stage .destination-stack {
        position: relative !important;
        inset: auto !important;
        display: flex !important;
        width: auto !important;
        height: 100% !important;
        min-height: 0 !important;
        transform: none !important;
    }

    body.core-mode .routing-stage .input-stack {
        grid-column: 1 !important;
        grid-row: 1 !important;
        justify-content: center !important;
        gap: 4px !important;
    }

    body.core-mode .routing-stage .route-card {
        min-height: 46px !important;
        padding: 4px 6px !important;
    }

    body.core-mode .routing-stage .route-visual {
        flex-basis: 32px !important;
        width: 32px !important;
        height: 32px !important;
    }

    body.core-mode .routing-stage .body-container {
        position: relative !important;
        inset: auto !important;
        grid-column: 2 !important;
        grid-row: 1 !important;
        width: 100% !important;
        height: 100% !important;
        transform: none !important;
    }

    body.core-mode .routing-stage .destination-stack {
        grid-column: 3 !important;
        grid-row: 1 !important;
        gap: 2px !important;
    }

    body.core-mode .routing-stage .destination-card {
        flex: 1 1 0 !important;
        min-height: 0 !important;
    }
}


/* Surgical food-tray and portrait-footer polish. */
body.core-mode .food-tile-wrap {
    min-height: 84px;
}

body.core-mode .food-tile {
    grid-template-columns: 36px minmax(0, 1fr) 108px;
    grid-template-rows: minmax(76px, auto);
    min-height: 84px;
    height: 100%;
    padding: 3px 5px;
    gap: 2px;
    align-content: center;
    border: 1px solid rgba(102, 157, 178, .15);
    border-radius: 10px;
    background: rgba(16, 45, 59, .34);
    box-shadow: none;
    transform: none;
}

body.core-mode .food-tile:hover {
    border-color: rgba(117, 176, 198, .25);
    background: rgba(20, 53, 68, .42);
    box-shadow: none;
    transform: none;
}

body.core-mode .food-tile-wrap.is-selected .food-tile {
    border-color: rgba(106, 207, 221, .40);
    background: rgba(23, 65, 77, .50);
    box-shadow: inset 3px 0 rgba(90, 210, 217, .62);
}

body.core-mode .food-art {
    grid-column: 1;
    grid-row: 1;
    width: 26px;
    height: 26px;
    align-self: center;
    justify-self: center;
    border: 1px solid rgba(112, 172, 193, .13);
    border-radius: 8px;
    background: rgba(31, 69, 84, .28);
    box-shadow: none;
    font-size: 13px;
}

body.core-mode .food-tile-wrap.is-selected .food-art {
    border-color: rgba(114, 207, 218, .24);
    background: rgba(43, 91, 101, .34);
    box-shadow: none;
}

body.core-mode .food-tile-copy {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    min-width: 0;
    padding: 0;
}

body.core-mode .food-tile-copy strong {
    margin: 0;
}

body.core-mode .food-tile-copy small {
    margin-top: 2px;
}

body.core-mode .catalog-portion-stepper {
    grid-column: 3;
    grid-row: 1;
    width: 108px;
    height: 44px;
    grid-template-columns: 44px 20px 44px;
    gap: 0;
    align-self: center;
    justify-self: end;
    overflow: visible;
    border: 1px solid rgba(105, 166, 189, .19);
    border-radius: 10px;
    background: rgba(9, 34, 46, .44);
    box-shadow: none;
}

body.core-mode .catalog-portion-stepper button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
}

body.core-mode .catalog-portion-stepper button::before {
    inset: 8px;
    border: 0;
    border-radius: 7px;
    color: #d5edf5;
    background: rgba(43, 86, 103, .42);
    box-shadow: none;
}

body.core-mode .catalog-portion-stepper button:is(:hover, :active)::before {
    background: rgba(55, 112, 131, .56);
}

body.core-mode .catalog-portion-stepper button:disabled::before {
    color: #607783;
    border: 0;
    background: transparent;
    opacity: .72;
}

body.core-mode .catalog-portion-count,
body.core-mode .food-tile-wrap.is-selected .catalog-portion-count {
    width: 20px;
    min-width: 20px;
    height: 44px;
    margin: 0;
    border: 0;
    border-radius: 0;
    color: #a9bdc7;
    background: transparent;
    box-shadow: none;
    font-size: 14px;
    font-weight: 750;
    line-height: 44px;
}

body.core-mode .food-tile-wrap.is-selected .catalog-portion-count {
    color: #f0fdff;
}

body.core-mode .food-tile-help {
    top: 50%;
    right: auto;
    left: -1px;
    width: 44px;
    height: 44px;
    transform: translateY(-50%);
    border: 0;
    border-radius: 9px;
    color: transparent;
    background: transparent;
    box-shadow: none;
    font-size: 0;
}

body.core-mode .food-tile-help::before {
    position: absolute;
    top: 3px;
    right: 3px;
    display: grid;
    width: 14px;
    height: 14px;
    place-items: center;
    border: 1px solid rgba(139, 190, 207, .34);
    border-radius: 50%;
    color: #91abb6;
    background: #102d3a;
    content: "i";
    font: 800 9px/1 -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

body.core-mode .food-tile-help:hover {
    border: 0;
    color: transparent;
    background: transparent;
    box-shadow: none;
}

body.core-mode .food-tile-help:hover::before {
    border-color: rgba(142, 213, 231, .52);
    color: #c9e8f1;
}

body.core-mode .food-tile-help:focus-visible {
    outline: 2px solid #8bdcff;
    outline-offset: -2px;
    border: 0;
    box-shadow: none;
}

@media (max-width: 900px) and (orientation: portrait) {
    body.core-mode .site-footer {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        justify-items: center;
        gap: 1px;
        min-height: 0;
        margin: 0;
        padding: 3px 10px max(3px, env(safe-area-inset-bottom));
        color: #7f95a1;
        font-size: 11px;
        line-height: 1.4;
        text-align: center;
    }

    body.core-mode .site-footer span,
    body.core-mode .site-footer span:last-child {
        display: block;
        max-width: none;
    }
}

@media (min-width: 901px) and (max-width: 1100px) {
    body.core-mode .food-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (min-width: 521px) and (max-width: 700px) {
    body.core-mode .food-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    body.core-mode .food-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    body.core-mode .estimated-energy-summary .model-energy-context {
        display: block;
    }

    body.core-mode .food-tile {
        grid-template-columns: 32px minmax(0, 1fr) 108px;
    }

    body.core-mode .site-footer {
        padding-right: 8px;
        padding-left: 8px;
    }
}


/* Final food-row snapping and follow-up timeline order. */
body.core-mode .core-workspace #foodGrid {
    scroll-snap-type: y proximity;
    scroll-padding-block: 2px 8px;
    padding-block: 0 !important;
    -webkit-overflow-scrolling: touch;
}

body.core-mode .food-tile-wrap {
    scroll-snap-align: start;
    scroll-snap-stop: normal;
    scroll-margin-block: 2px 8px;
}

@media (max-width: 900px) {
    body.core-mode .core-workspace {
        grid-template-rows: minmax(310px, 1.25fr) minmax(275px, .95fr) auto !important;
    }

    body.core-mode .core-workspace .body-stage {
        grid-column: 1 !important;
        grid-row: 1 !important;
    }

    body.core-mode .core-workspace #foodBrowserSection {
        grid-column: 1 !important;
        grid-row: 2 !important;
    }

    body.core-mode .core-workspace .horizon-section {
        grid-column: 1 !important;
        grid-row: 3 !important;
    }
}

@media (min-width: 521px) and (max-width: 900px) and (min-height: 851px) {
    body.core-mode {
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
    }

    body.core-mode .app {
        height: auto;
        min-height: 100dvh;
        max-height: none;
        overflow: visible;
    }

    body.core-mode .core-workspace {
        flex: 1 0 auto;
        height: auto;
        grid-template-rows: 425px minmax(319px, 1fr) auto !important;
        overflow: visible !important;
    }

    body.core-mode .core-workspace #foodBrowserSection {
        min-height: 319px !important;
    }

    body.core-mode .core-workspace #foodGrid {
        min-height: 84px !important;
    }
}

@media (min-width: 521px) and (max-width: 900px) and (max-height: 850px) {
    body.core-mode .core-workspace {
        grid-template-rows: 410px 430px auto !important;
    }
}

@media (max-width: 520px) {
    body.core-mode .core-workspace {
        grid-template-rows: minmax(380px, auto) minmax(360px, auto) auto !important;
    }
}

@media (min-width: 901px) {
    body.core-mode .core-workspace {
        grid-template-rows: minmax(0, 1fr) auto !important;
    }

    body.core-mode .core-workspace #foodBrowserSection {
        grid-column: 1 !important;
        grid-row: 1 !important;
    }

    body.core-mode .core-workspace .body-stage {
        grid-column: 2 !important;
        grid-row: 1 !important;
    }

    body.core-mode .core-workspace .horizon-section {
        grid-column: 1 / -1 !important;
        grid-row: 2 !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.core-mode .core-workspace #foodGrid {
        scroll-behavior: auto;
    }
}


/* First-visit purpose statement. Isolated from the working Explorer beneath it. */
.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.intro-reopen {
    min-height: 44px;
    padding: 8px 10px;
    border: 0;
    color: #91adba;
    background: transparent;
    font: 700 13px/1.25 inherit;
    cursor: pointer;
}

.intro-reopen:hover {
    color: #e1f5fb;
}

.intro-reopen:focus-visible,
.explorer-intro button:focus-visible {
    outline: 3px solid #90dcf7;
    outline-offset: 3px;
}

.explorer-intro {
    width: min(1120px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: 0;
    overflow: auto;
    border: 1px solid rgba(100, 202, 237, .34);
    border-radius: 22px;
    color: #eaf7fb;
    background:
        radial-gradient(circle at 72% 12%, rgba(63, 173, 218, .13), transparent 34%),
        linear-gradient(145deg, rgba(13, 38, 53, .99), rgba(4, 18, 29, .995));
    box-shadow: 0 30px 100px rgba(0, 0, 0, .68), 0 0 70px rgba(48, 165, 211, .09);
}

.explorer-intro::backdrop {
    background: rgba(1, 8, 14, .84);
    backdrop-filter: blur(11px) saturate(.76);
}

.explorer-intro-panel {
    padding: clamp(24px, 4vw, 54px);
}

.explorer-intro-kicker {
    display: block;
    margin-bottom: 9px;
    color: #65ccef;
    font-size: 12px;
    font-weight: 850;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.explorer-intro h2 {
    max-width: 760px;
    margin: 0;
    color: #f4fcff;
    font-size: clamp(34px, 5vw, 62px);
    line-height: 1.02;
    letter-spacing: -.035em;
}

.explorer-intro-lead {
    max-width: 720px;
    margin: 15px 0 30px;
    color: #b8d0da;
    font-size: clamp(17px, 2vw, 21px);
    line-height: 1.48;
}

.explorer-intro-sections {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.explorer-intro-card {
    position: relative;
    min-width: 0;
    padding: 22px;
    overflow: hidden;
    border: 1px solid rgba(128, 193, 216, .17);
    border-radius: 15px;
    background: rgba(11, 35, 49, .72);
}

.explorer-intro-card-primary {
    border-color: rgba(94, 203, 240, .3);
    background: linear-gradient(145deg, rgba(18, 61, 79, .84), rgba(10, 33, 47, .72));
}

.explorer-intro-number {
    display: block;
    margin-bottom: 22px;
    color: #55c5eb;
    font-size: 12px;
    font-weight: 850;
    letter-spacing: .16em;
}

.explorer-intro-card h3 {
    margin: 0 0 12px;
    color: #eefbff;
    font-size: 20px;
    line-height: 1.18;
}

.explorer-intro-card p,
.explorer-intro-card li {
    color: #b7cbd4;
    font-size: 15px;
    line-height: 1.48;
}

.explorer-intro-card p {
    margin: 0 0 10px;
}

.explorer-intro-card p:last-child {
    margin-bottom: 0;
}

.explorer-intro-card .explorer-intro-question {
    color: #f0fbff;
    font-size: 17px;
    font-weight: 790;
}

.explorer-intro-card ul {
    display: grid;
    gap: 7px;
    margin: 0;
    padding-left: 19px;
}

.explorer-intro-card li::marker {
    color: #5bc9ee;
}

.explorer-intro-closeout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    margin-top: 18px;
    padding: 20px 22px;
    border: 1px solid rgba(102, 201, 233, .2);
    border-radius: 15px;
    background: rgba(5, 24, 36, .72);
}

.explorer-intro-closeout p {
    margin: 0;
    color: #bcd2db;
    font-size: 17px;
    line-height: 1.4;
}

.explorer-intro-closeout strong {
    color: #f1fbff;
}

.explorer-intro-enter {
    flex: 0 0 auto;
    min-height: 50px;
    padding: 12px 22px;
    border: 1px solid rgba(126, 225, 255, .68);
    border-radius: 10px;
    color: #f7fdff;
    background: linear-gradient(180deg, #2385aa, #15617e);
    box-shadow: 0 8px 24px rgba(28, 135, 177, .24);
    font: 820 16px/1.2 inherit;
    cursor: pointer;
}

.explorer-intro-enter:hover {
    background: linear-gradient(180deg, #2a97bf, #196d8c);
}

.explorer-intro-caveat {
    margin: 14px 0 0;
    color: #718d99;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
}

@media (max-width: 820px) {
    .explorer-intro-sections {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .explorer-intro-card {
        padding: 18px;
    }

    .explorer-intro-card:last-child {
        grid-column: 1 / -1;
    }

    .explorer-intro-card:last-child ul {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 28px;
    }

    .explorer-intro-number {
        margin-bottom: 10px;
    }
}

@media (max-width: 720px) {
    .topbar-actions {
        width: 100%;
        justify-content: stretch;
    }

    .topbar-actions > button {
        flex: 1 1 0;
    }

    .explorer-intro {
        width: calc(100vw - 16px);
        max-height: calc(100dvh - 16px);
        border-radius: 16px;
    }

    .explorer-intro-panel {
        padding: 22px 17px;
    }

    .explorer-intro-sections,
    .explorer-intro-card:last-child ul {
        grid-template-columns: 1fr;
    }

    .explorer-intro-card:last-child {
        grid-column: auto;
    }

    .explorer-intro-closeout {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    .explorer-intro,
    .explorer-intro-enter {
        scroll-behavior: auto;
        transition: none;
    }
}

/* Optional guided “Show me” wrapper. Kept isolated from the explorer layout. */
.guide-replay {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid rgba(142, 204, 224, .24);
    border-radius: 9px;
    color: #bad1dc;
    background: rgba(8, 27, 39, .48);
    font: 700 14px/1.25 inherit;
    cursor: pointer;
}

.guide-replay:hover {
    border-color: rgba(142, 204, 224, .44);
    color: #e7f7fc;
}

.guide-replay:focus-visible,
.guide-invitation button:focus-visible,
.guide-coach button:focus-visible {
    outline: 3px solid #90dcf7;
    outline-offset: 2px;
}

.guide-invitation {
    position: fixed;
    z-index: 675;
    top: 102px;
    right: 18px;
    width: min(320px, calc(100vw - 24px));
    padding: 13px;
    border: 1px solid rgba(126, 197, 222, .28);
    border-radius: 12px;
    background: rgba(8, 28, 41, .97);
    box-shadow: 0 14px 42px rgba(0, 0, 0, .34);
}

.guide-invitation p {
    margin: 0 0 10px;
    color: #effaff;
    font-size: 16px;
    font-weight: 760;
    line-height: 1.35;
}

.guide-invitation-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.guide-invitation button,
.guide-coach button {
    min-height: 44px;
    border: 1px solid rgba(139, 201, 222, .28);
    border-radius: 8px;
    padding: 8px 11px;
    color: #dceff6;
    background: rgba(21, 54, 70, .78);
    font: 730 15px/1.25 inherit;
    cursor: pointer;
}

.guide-invitation .guide-invitation-primary,
.guide-coach .guide-primary-action,
.guide-coach .guide-next {
    border-color: rgba(115, 214, 244, .5);
    color: #f5fcff;
    background: #155b75;
}

.guide-dimmer {
    position: fixed;
    z-index: 650;
    inset: 0;
    pointer-events: none;
    background: rgba(1, 7, 12, .42);
}

html.guide-active {
    height: auto !important;
    min-height: 100%;
    overflow-y: auto !important;
}

body.core-mode.guide-active {
    height: auto !important;
    min-height: 100dvh;
    overflow-y: auto !important;
    padding-bottom: calc(var(--guide-dock-height, 0px) + env(safe-area-inset-bottom, 0px) + 24px);
    scroll-padding-top: 16px;
    scroll-padding-bottom: calc(var(--guide-dock-height, 0px) + env(safe-area-inset-bottom, 0px) + 28px);
}

.guide-feedback-suppressed {
    visibility: hidden !important;
    pointer-events: none !important;
}

.guide-coach {
    position: fixed;
    z-index: 720;
    right: 12px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    width: auto;
    max-height: min(48dvh, 520px);
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 15px;
    border: 1px solid rgba(133, 207, 232, .38);
    border-radius: 14px;
    color: #edf9fd;
    background: rgba(7, 27, 40, .985);
    box-shadow: 0 18px 58px rgba(0, 0, 0, .5), 0 0 0 1px rgba(117, 202, 229, .06) inset;
}

.guide-coach-head,
.guide-navigation,
.guide-primary-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.guide-coach-head {
    justify-content: space-between;
    margin-bottom: 7px;
}

.guide-progress {
    color: #8fc9da;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.guide-coach .guide-exit,
.guide-coach .guide-back {
    color: #a9c1cc;
    background: transparent;
}

.guide-coach h2 {
    margin: 0 0 8px;
    color: #f5fcff;
    font-size: 20px;
    line-height: 1.2;
}

.guide-copy p,
.guide-action-status {
    margin: 0 0 8px;
    color: #c6dbe3;
    font-size: 15px;
    line-height: 1.48;
}

.guide-action-status:empty {
    display: none;
}

.guide-action-status {
    padding: 8px 9px;
    border-left: 3px solid rgba(115, 214, 244, .6);
    background: rgba(27, 65, 80, .5);
}

.guide-primary-actions {
    flex-direction: column;
    align-items: stretch;
    margin-top: 10px;
}

.guide-primary-actions button {
    width: 100%;
    text-align: left;
}

.guide-edge-action[aria-pressed="true"]::after {
    margin-left: 7px;
    content: "Viewed";
    color: #9fe6c2;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.guide-navigation {
    justify-content: flex-end;
    margin-top: 11px;
    padding-top: 10px;
    border-top: 1px solid rgba(144, 200, 217, .14);
}

.guide-navigation .guide-back {
    margin-right: auto;
}

.guide-spotlight-target {
    outline: 3px solid rgba(144, 220, 247, .95) !important;
    outline-offset: 4px !important;
    border-radius: 9px;
    box-shadow: 0 0 0 8px rgba(7, 28, 41, .86), 0 0 30px rgba(92, 200, 237, .34) !important;
    scroll-margin-top: 16px;
    scroll-margin-bottom: calc(var(--guide-dock-height, 0px) + 28px);
}

.body-stage.guide-held-emphasis .guide-held-target.destination-card {
    opacity: 1 !important;
    filter: brightness(1.22) saturate(1.06) !important;
    outline: 2px solid rgba(157, 225, 245, .72);
    outline-offset: 2px;
}

.body-stage.guide-held-emphasis .guide-held-target.route-channel {
    opacity: 1 !important;
    filter: brightness(1.25) drop-shadow(0 0 4px currentColor);
}

.guide-announcer {
    position: fixed;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

@media (max-width: 720px) {
    .topbar {
        flex-wrap: wrap;
        gap: 6px 12px;
    }

    .guide-replay {
        margin-left: auto;
    }

    .guide-invitation {
        top: auto;
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .guide-coach {
        max-height: min(52dvh, 460px);
        border-radius: 14px 14px 10px 10px;
    }

    .guide-spotlight-target {
        scroll-margin-top: 16px;
        scroll-margin-bottom: calc(var(--guide-dock-height, 0px) + 28px);
    }
}

@media (min-width: 901px) and (min-aspect-ratio: 4 / 3) {
    .guide-coach {
        display: grid;
        grid-template-columns: 132px minmax(310px, 1fr) minmax(220px, 290px);
        grid-template-areas:
            "head title actions"
            "head copy actions"
            "head status nav";
        column-gap: 16px;
        row-gap: 4px;
        align-items: start;
        width: min(980px, calc(100vw - 32px));
        max-height: min(38dvh, 330px);
        margin-inline: auto;
        padding: 13px 15px;
    }

    .guide-coach-head {
        grid-area: head;
        align-self: stretch;
        align-content: space-between;
        flex-direction: column;
        align-items: stretch;
        margin: 0;
    }

    .guide-coach h2 {
        grid-area: title;
        margin-bottom: 4px;
    }

    .guide-copy {
        grid-area: copy;
    }

    .guide-action-status {
        grid-area: status;
        margin-bottom: 0;
    }

    .guide-primary-actions {
        grid-area: actions;
        align-self: stretch;
        margin-top: 0;
    }

    .guide-navigation {
        grid-area: nav;
        align-self: end;
        margin-top: 3px;
        padding-top: 7px;
    }
}

@media (max-width: 420px) {
    .guide-replay {
        width: 100%;
    }

    .guide-coach {
        padding: 13px;
    }

    .guide-coach h2 {
        font-size: 18px;
    }

    .guide-copy p,
    .guide-action-status {
        font-size: 14px;
    }
}

/* At strong text/zoom pressure, protect the teaching target and let the dock scroll. */
@media (max-width: 900px) and (max-height: 700px) {
    .guide-coach {
        max-height: 25dvh;
    }
}

@media (prefers-reduced-motion: reduce) {
    .guide-coach,
    .guide-spotlight-target,
    .body-stage.guide-held-emphasis .guide-held-target {
        transition: none !important;
        animation: none !important;
    }

    .body-stage.guide-held-emphasis .guide-held-target.route-channel {
        filter: brightness(1.25);
    }
}

/* Learning center: keep the explanatory path visible as a purposeful queue. */
.learning-queue {
    display: flex;
    align-items: stretch;
    gap: 3px;
    padding: 4px;
    border: 1px solid rgba(96, 202, 237, .38);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(16, 52, 68, .82), rgba(6, 25, 37, .88));
    box-shadow: 0 8px 25px rgba(0, 0, 0, .22), 0 0 22px rgba(65, 185, 226, .08);
}

.learning-queue-label {
    display: grid;
    place-items: center;
    padding: 0 10px;
    border-radius: 8px;
    color: #052331;
    background: linear-gradient(180deg, #75d9f6, #4db6db);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.learning-queue .learning-link,
.learning-queue .learning-show-me {
    position: relative;
    min-height: 38px;
    margin: 0;
    padding: 7px 11px;
    border: 0;
    border-radius: 8px;
    color: #c8e0e9;
    background: transparent;
    font: 760 12px/1.2 inherit;
    cursor: pointer;
}

.learning-queue .learning-link::before,
.learning-queue .learning-show-me::before {
    margin-right: 6px;
    color: #67d0ef;
    content: "Learn ·";
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.learning-queue .learning-show-me {
    border: 1px solid rgba(103, 208, 239, .3);
    color: #f3fbfe;
    background: rgba(31, 100, 126, .42);
}

.learning-queue .learning-link:hover,
.learning-queue .learning-show-me:hover {
    color: #fff;
    background: rgba(56, 145, 176, .26);
}

.learning-queue .learning-link:focus-visible,
.learning-queue .learning-show-me:focus-visible,
.food-flow-intro button:focus-visible {
    outline: 3px solid #90dcf7;
    outline-offset: 2px;
}

/* My Foods overview: a second learning wrapper using the established visual language. */
.food-flow-intro {
    background:
        radial-gradient(circle at 28% 8%, rgba(65, 204, 190, .13), transparent 32%),
        radial-gradient(circle at 78% 18%, rgba(63, 173, 218, .12), transparent 34%),
        linear-gradient(145deg, rgba(11, 40, 52, .99), rgba(4, 18, 29, .995));
}

.food-flow-path {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    margin: -8px 0 20px;
}

.food-flow-path span {
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid rgba(94, 207, 223, .25);
    border-radius: 999px;
    color: #dff8fb;
    background: rgba(15, 63, 76, .62);
    font-size: 13px;
    font-weight: 820;
    text-align: center;
}

.food-flow-path b {
    color: #5ed1e7;
    font-size: 18px;
}

.food-flow-sections {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.food-flow-sections .explorer-intro-card:last-child {
    grid-column: auto;
}

.food-flow-closeout {
    border-color: rgba(78, 207, 199, .25);
}

.food-flow-intro-actions {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 9px;
}

.food-flow-return {
    min-height: 50px;
    padding: 12px 18px;
    border: 1px solid rgba(145, 201, 218, .26);
    border-radius: 10px;
    color: #c4d9e1;
    background: rgba(8, 31, 43, .7);
    font: 760 15px/1.2 inherit;
    cursor: pointer;
}

.food-flow-return:hover {
    border-color: rgba(145, 220, 238, .46);
    color: #f3fcff;
}

.food-flow-guide-coach {
    border-color: rgba(77, 210, 199, .46);
    box-shadow: 0 18px 58px rgba(0, 0, 0, .5), 0 0 32px rgba(64, 205, 197, .09);
}

.food-flow-guide-coach .guide-progress {
    color: #79ded3;
}

.food-flow-guide-coach .guide-action-status {
    border-left-color: #61d4c9;
    background: rgba(20, 76, 74, .44);
}

@media (max-width: 960px) {
    .learning-queue .learning-link,
    .learning-queue .learning-show-me {
        padding-inline: 8px;
        font-size: 11px;
    }

    .learning-queue .learning-link::before,
    .learning-queue .learning-show-me::before {
        display: none;
    }

    .food-flow-sections {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .learning-queue {
        display: grid;
        grid-template-columns: auto repeat(3, minmax(0, 1fr));
        width: 100%;
    }

    .learning-queue .learning-link,
    .learning-queue .learning-show-me {
        width: auto;
        min-width: 0;
        min-height: 44px;
        padding-inline: 6px;
        white-space: normal;
    }

    .food-flow-path {
        grid-template-columns: 1fr auto 1fr;
    }

    .food-flow-path b:nth-of-type(2),
    .food-flow-path b:nth-of-type(3) {
        display: none;
    }

    .food-flow-path span:nth-of-type(3),
    .food-flow-path span:nth-of-type(4) {
        grid-column: auto;
    }

    .food-flow-path span {
        min-height: 44px;
    }

    .food-flow-sections {
        grid-template-columns: 1fr;
    }

    .food-flow-intro-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .food-flow-intro-actions button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .learning-queue {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .learning-queue-label {
        grid-column: 1 / -1;
        min-height: 24px;
    }

    .food-flow-path {
        grid-template-columns: 1fr;
    }

    .food-flow-path b {
        display: none;
    }
}
