@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,700&family=Fraunces:opsz,wght@9..144,600;9..144,700&display=swap');

/* =========================================================================
   NutriLife design system
   1. Tokens          6. Header / nav        11. Nutrition
   2. Base            7. Footer              12. Planner
   3. Typography      8. Login               13. Tips
   4. Layout          9. Home                14. Game
   5. Controls       10. Calculator          15. Motion / responsive
   ========================================================================= */

/* -- 1. TOKENS ---------------------------------------------------------- */

:root {
    /* Brand */
    --green: #87a987;
    --green-deep: #5a785a;
    --green-ink: #2c3e2b;
    --lime: #e3eee0;
    --mango: #87a987;
    --berry: #5a785a;
    --violet: #788275;
    --cyan: #adc5ad;

    /* Surfaces */
    --bg: #faf8f5;
    --bg-tint: #f1eee8;
    --card: #ffffff;
    --surface: #f0eee9;
    --raised: #ffffff;

    /* Ink */
    --text: #2d2d2d;
    --muted: #62645f;
    --faint: #8b8d86;
    --line: #deddd5;
    --line-strong: #c4c8bc;

    /* Feedback */
    --danger: #e0453c;
    --danger-soft: #fdeeec;
    --warn: #d98a06;
    --ok: var(--green-deep);

    /* Signature gradients */
    --grad-brand: #5a785a;
    --grad-warm: #87a987;
    --grad-fresh: #e3eee0;
    --grad-ink: #2c3e2b;

    /* Elevation — tinted, not grey, so cards feel lit rather than dirty */
    --shadow-sm: 0 2px 6px rgba(9, 47, 28, 0.06);
    --shadow: 0 14px 34px -12px rgba(9, 47, 28, 0.18);
    --shadow-lg: 0 34px 70px -24px rgba(9, 47, 28, 0.28);
    --glow-green: 0 12px 34px -10px rgba(0, 184, 98, 0.55);
    --glow-warm: 0 12px 34px -10px rgba(255, 61, 127, 0.45);

    /* Geometry */
    --r-sm: 4px;
    --r-md: 8px;
    --r-lg: 12px;
    --r-xl: 16px;
    --r-pill: 999px;

    --shell: 1180px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'DM Sans', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #faf8f5;
        --bg-tint: #f1eee8;
        --card: #ffffff;
        --surface: #f0eee9;
        --raised: #ffffff;

        --text: #2d2d2d;
        --muted: #62645f;
        --faint: #8b8d86;
        --line: #deddd5;
        --line-strong: #c4c8bc;

        --danger: #ff7b71;
        --danger-soft: #3a1613;

        --shadow-sm: 0 2px 6px rgba(44, 62, 43, 0.06);
        --shadow: 0 14px 34px -12px rgba(44, 62, 43, 0.18);
        --shadow-lg: 0 34px 70px -24px rgba(44, 62, 43, 0.28);
    }
}

/* -- 2. BASE ------------------------------------------------------------ */

*,
*::before,
*::after { box-sizing: border-box; }

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

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Ambient colour wash. Fixed + non-interactive so it never intercepts
   clicks or scrolls with the page content. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(48rem 30rem at 8% -8%, rgba(0, 184, 98, 0.16), transparent 65%),
        radial-gradient(38rem 26rem at 96% 4%, rgba(123, 92, 255, 0.13), transparent 62%),
        radial-gradient(42rem 28rem at 50% 108%, rgba(255, 138, 43, 0.12), transparent 62%);
}

img { max-width: 100%; display: block; }
svg { flex-shrink: 0; }

:focus-visible {
    outline: 3px solid var(--green);
    outline-offset: 2px;
    border-radius: 4px;
}

::selection {
    background: var(--lime);
    color: var(--green-ink);
}

/* -- 3. TYPOGRAPHY ------------------------------------------------------ */

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.04;
    margin: 0 0 0.5em;
    text-wrap: balance;
}

h1 { font-size: clamp(2.75rem, 7vw, 5.25rem); font-weight: 900; }
h2 { font-size: clamp(1.9rem, 3.6vw, 3rem); }
h3 { font-size: clamp(1.15rem, 1.8vw, 1.45rem); letter-spacing: -0.02em; }
h4 { font-size: 1rem; letter-spacing: -0.01em; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--green-deep); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--green); }

/* Gradient headline accent. -webkit-* pair is required for Chromium and
   WebKit; the standard properties alone are not honoured there yet. */
h1 span,
h2 span,
.grad-text {
    background: var(--grad-brand);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--green-deep);
    background: linear-gradient(120deg, rgba(0, 184, 98, 0.14), rgba(123, 92, 255, 0.14));
    border: 1px solid var(--line-strong);
    border-radius: var(--r-pill);
    padding: 7px 15px;
    margin-bottom: 22px;
}

@media (prefers-color-scheme: dark) {
    .eyebrow { color: var(--lime); }
}

.lead,
.intro p,
.panel-copy {
    color: var(--muted);
    font-size: clamp(1.02rem, 1.3vw, 1.19rem);
    line-height: 1.65;
    max-width: 62ch;
}

.number {
    font-family: var(--font-display);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
}

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* -- 4. LAYOUT ---------------------------------------------------------- */

.container,
.calculator-shell,
.game-shell,
.planner-container,
.nutrition,
.tips {
    width: 100%;
    max-width: var(--shell);
    margin-inline: auto;
    padding-inline: clamp(18px, 4vw, 32px);
}

.calculator-shell,
.planner-container,
.nutrition,
.tips { padding-block: clamp(48px, 7vw, 84px) clamp(70px, 9vw, 120px); }

.game-shell { padding-block: clamp(40px, 6vw, 68px) clamp(60px, 8vw, 96px); max-width: 1040px; }

.intro { margin-bottom: clamp(34px, 5vw, 54px); }
.intro h1 { margin-bottom: 20px; }

.section-title {
    text-align: center;
    max-width: 46rem;
    margin: 0 auto clamp(36px, 5vw, 58px);
}

.section-title p {
    color: var(--muted);
    font-size: clamp(1rem, 1.3vw, 1.15rem);
    margin: 0;
}

.page-hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--r-xl);
    padding: clamp(34px, 5vw, 56px);
    margin-bottom: clamp(30px, 4vw, 44px);
    background: var(--grad-ink);
    color: #eafaf0;
    box-shadow: var(--shadow-lg);
}

.page-hero::after {
    content: "";
    position: absolute;
    inset: -40% -10% auto auto;
    width: 30rem; height: 30rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 184, 98, 0.4), transparent 68%);
    pointer-events: none;
}

.page-hero > * { position: relative; }
.page-hero h1 { color: #fff; font-size: clamp(2.3rem, 5vw, 3.9rem); }
.page-hero p { color: #b9dcc7; max-width: 56ch; margin: 0; }
.page-hero .eyebrow { color: var(--lime); background: rgba(198, 242, 78, 0.12); border-color: rgba(198, 242, 78, 0.3); }

.page-icon { font-size: 2.5rem; line-height: 1; margin-bottom: 14px; }

/* -- 5. CONTROLS -------------------------------------------------------- */

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }

.btn,
.calculate-btn,
.add-btn,
.tool-small,
.game-start,
.newsletter-form button,
.login-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-radius: var(--r-pill);
    padding: 14px 28px;
    font-family: var(--font-display);
    font-size: 0.97rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-decoration: none;
    color: #fff;
    background: var(--grad-brand);
    background-size: 180% 100%;
    box-shadow: var(--glow-green);
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background-position 0.5s var(--ease);
}

.btn:hover,
.calculate-btn:hover,
.add-btn:hover,
.tool-small:hover,
.game-start:hover,
.newsletter-form button:hover,
.login-button:hover {
    transform: translateY(-2px);
    background-position: 100% 0;
    box-shadow: var(--shadow-lg), var(--glow-green);
}

.btn:active,
.calculate-btn:active,
.add-btn:active { transform: translateY(0); }

.btn-secondary,
.login-button.secondary {
    background: var(--card);
    color: var(--green-deep);
    border: 2px solid var(--line-strong);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover,
.login-button.secondary:hover {
    border-color: var(--green);
    color: var(--green);
    box-shadow: var(--glow-green);
}

.calculate-btn,
.login-button,
.newsletter-form button { width: 100%; padding: 16px 28px; }

.tool-small,
.dashboard-reset,
.history-delete,
.remove { padding: 10px 18px; font-size: 0.88rem; }

.dashboard-reset,
.history-delete,
.remove {
    border: 1px solid var(--line-strong);
    border-radius: var(--r-pill);
    background: transparent;
    color: var(--muted);
    font-family: var(--font-display);
    font-weight: 700;
    box-shadow: none;
    transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
}

.dashboard-reset:hover { border-color: var(--green); color: var(--green); }

.history-delete:hover,
.remove:hover {
    border-color: var(--danger);
    background: #fff;
    color: #fff;
}

/* Fields */

label { font-size: 0.83rem; font-weight: 700; letter-spacing: 0.01em; }

input, select, textarea {
    width: 100%;
    border: 2px solid var(--line);
    border-radius: var(--r-sm);
    padding: 12px 14px;
    background: var(--card);
    color: var(--text);
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

input::placeholder { color: var(--faint); }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 4px rgba(0, 184, 98, 0.16);
}

input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--green); }
input[type="range"] { width: 100%; border: 0; padding: 0; background: transparent; accent-color: var(--lime); }

.field { display: flex; flex-direction: column; gap: 8px; }
.field.full { grid-column: 1 / -1; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.hint { color: var(--faint); font-size: 0.78rem; }

/* Surfaces */

.card,
.form-panel,
.dashboard-panel,
.history-panel,
.chart-card,
.chart-panel,
.benefit-card,
.tip-card,
.nutrition-card,
.nutrition-info-card,
.grocery-card,
.score-panel,
.hydration-panel,
.profile-panel,
.reminder-panel,
.privacy-panel,
.retention-panel,
.unit-panel,
.budget-panel,
.rings-panel,
.tip-box {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: clamp(22px, 3vw, 30px);
    box-shadow: var(--shadow);
}

/* One shared hover treatment for the browsable card grids. */
.benefit-card,
.tip-card,
.nutrition-card,
.nutrition-info-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}

.benefit-card::before,
.tip-card::before,
.nutrition-card::before,
.nutrition-info-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: var(--grad-brand);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s var(--ease);
}

.benefit-card:hover,
.tip-card:hover,
.nutrition-card:hover,
.nutrition-info-card:hover {
    transform: translateY(-6px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-lg);
}

.benefit-card:hover::before,
.tip-card:hover::before,
.nutrition-card:hover::before,
.nutrition-info-card:hover::before { transform: scaleX(1); }

/* -- 6. HEADER / NAV ---------------------------------------------------- */

header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
}

.navbar {
    max-width: var(--shell);
    min-height: 76px;
    margin-inline: auto;
    padding: 12px clamp(18px, 4vw, 32px);
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}

.logo-image {
    display: block;
    width: 136px;
    height: 48px;
    object-fit: cover;
    object-position: center;
    border-radius: 6px;
}

.logo-mark {
    display: grid;
    place-items: center;
    width: 35px;
    height: 35px;
    flex: 0 0 35px;
    border-radius: 11px 11px 11px 4px;
    color: #fff;
    background: linear-gradient(135deg, #18a999 0%, #f4b942 48%, #ef6f61 100%);
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    box-shadow: 0 7px 16px rgba(90, 120, 90, 0.24);
    transform: rotate(-4deg);
}

.logo-name {
    display: inline-flex;
    align-items: baseline;
    gap: 0.27em;
    font-size: 1.22rem;
    font-weight: 800;
    letter-spacing: -0.035em;
    color: #ef6f61;
}

.logo-name span {
    background: linear-gradient(100deg, #159b89 0%, #2cae82 52%, #f4b942 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo:hover { color: var(--text); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0 0 0 auto;
    padding: 0;
}

.nav-links a {
    display: block;
    position: relative;
    padding: 9px 14px;
    border-radius: var(--r-pill);
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.nav-links a:hover { color: var(--text); background: var(--surface); }

.nav-links a.active {
    color: #fff;
    background: var(--grad-brand);
    box-shadow: var(--glow-green);
}

.menu-btn {
    display: none;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: var(--card);
    color: var(--text);
    padding: 9px 13px;
    font-size: 1.05rem;
    line-height: 1;
    box-shadow: var(--shadow-sm);
}

/* Account chip (injected by auth.js) */

.account { position: relative; flex-shrink: 0; }

.account-trigger {
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-pill);
    background: var(--card);
    padding: 5px 13px 5px 5px;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.account-trigger:hover { border-color: var(--green); box-shadow: var(--glow-green); }

.account-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface);
}

.account-avatar--initials {
    display: grid;
    place-items: center;
    background: var(--grad-brand);
    color: #fff;
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 800;
}

.account-name {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-caret { width: 10px; color: var(--faint); }
.account-trigger[aria-expanded="true"] .account-caret { transform: rotate(180deg); }

.account-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 60;
    width: max-content;
    min-width: 15rem;
    max-width: min(20rem, calc(100vw - 36px));
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--card);
    box-shadow: var(--shadow-lg);
    animation: pop 0.2s var(--ease);
}

.account-menu[hidden] { display: none; }

.account-menu-name {
    font-family: var(--font-display);
    font-weight: 700;
    margin: 0 0 2px;
    overflow-wrap: anywhere;
}

.account-menu-email {
    color: var(--muted);
    font-size: 0.83rem;
    margin: 0 0 16px;
    overflow-wrap: anywhere;
}

.account-signout {
    width: 100%;
    border: 0;
    border-radius: var(--r-sm);
    padding: 11px;
    background: var(--danger);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.account-signout:hover { background: var(--danger); color: #fff; }

/* Legacy hooks kept working: index.html ships a hard-coded #logoutBtn and
   older markup used .sign-out. Both fall back to a quiet text button. */
#logoutBtn,
.sign-out {
    border: 1px solid var(--line-strong);
    border-radius: var(--r-pill);
    background: transparent;
    color: var(--muted);
    padding: 9px 18px;
    font-family: var(--font-display);
    font-size: 0.88rem;
    font-weight: 700;
}

#logoutBtn:hover,
.sign-out:hover { border-color: var(--danger); color: var(--danger); }

/* auth.js renders the richer chip, so hide the static button once it exists. */
.navbar:has(.account) #logoutBtn { display: none; }

/* -- 7. FOOTER ---------------------------------------------------------- */

footer {
    margin-top: clamp(48px, 7vw, 90px);
    border-top: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
    padding: clamp(26px, 4vw, 40px) clamp(18px, 4vw, 32px);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
    gap: clamp(26px, 4vw, 48px);
    max-width: var(--shell);
    margin-inline: auto;
    text-align: left;
    padding-bottom: 32px;
}

.footer-grid h3 {
    font-size: 1.05rem;
    margin-bottom: 14px;
    color: var(--text);
}

.footer-grid p { color: var(--muted); margin: 0; max-width: 34ch; }

.footer-grid ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 9px;
}

.footer-grid a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s var(--ease);
}

.footer-grid a:hover { color: var(--green); }

.copyright {
    max-width: var(--shell);
    margin-inline: auto;
    padding-top: 22px;
    border-top: 1px solid var(--line);
    color: var(--faint);
    font-size: 0.83rem;
}

/* -- 8. LOGIN ----------------------------------------------------------- */

.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100svh;
    padding: clamp(20px, 5vw, 48px);
    background: var(--grad-ink);
    overflow-x: hidden;
    overflow-y: auto;
}

.login-page::before,
.login-page::after {
    content: "";
    position: fixed;
    z-index: 0;
    border-radius: 50%;
    filter: blur(10px);
    pointer-events: none;
    animation: drift 14s ease-in-out infinite;
}

.login-page::before {
    top: -22vmax; right: -14vmax;
    width: 52vmax; height: 52vmax;
    background: radial-gradient(circle, rgba(0, 184, 98, 0.45), transparent 66%);
}

.login-page::after {
    bottom: -26vmax; left: -16vmax;
    width: 48vmax; height: 48vmax;
    background: radial-gradient(circle, rgba(123, 92, 255, 0.4), transparent 66%);
    animation-direction: reverse;
    animation-duration: 18s;
}

.login-shell {
    position: relative;
    z-index: 1;
    width: min(100%, 30rem);
    animation: rise 0.7s var(--ease) both;
}

.login-card {
    position: relative;
    padding: clamp(30px, 5vw, 48px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--r-xl);
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(26px) saturate(180%);
    -webkit-backdrop-filter: blur(26px) saturate(180%);
    box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.22);
    color: #f2fdf6;
    text-align: center;
}

.login-card .logo {
    display: inline-block;
    font-size: 1.7rem;
    color: #fff;
    margin-bottom: 22px;
}

.login-card .logo-image {
    width: 270px;
    height: 150px;
    object-fit: contain;
    border-radius: 0;
}

.login-card .eyebrow {
    color: var(--lime);
    background: rgba(198, 242, 78, 0.12);
    border-color: rgba(198, 242, 78, 0.32);
    margin-bottom: 18px;
}

.login-card h1 {
    font-size: clamp(2.1rem, 6vw, 3rem);
    color: #fff;
    margin-bottom: 14px;
}

.login-card h1 span {
    background: var(--grad-fresh);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-card > p {
    color: #bfe0cd;
    font-size: 1rem;
    line-height: 1.65;
    margin-bottom: 30px;
}

.login-card small {
    display: block;
    color: #8fb9a1;
    font-size: 0.78rem;
    line-height: 1.55;
    margin-top: 22px;
}

/* Google Identity Services renders a fixed-width iframe button; centre it
   and let it shrink on narrow screens. */
#googleButton {
    display: flex;
    justify-content: center;
    min-height: 44px;
    margin-bottom: 16px;
}

#googleButton > div { max-width: 100%; }

.nutrition-ai-panel {
    margin-top: 22px;
    border-color: rgba(108, 188, 255, 0.32);
}

.ai-badge {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(108, 188, 255, 0.55);
    border-radius: 50%;
    color: #9bd5ff;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.nutrition-ai-answer {
    margin-top: 16px;
    padding: 15px 16px;
    border-left: 3px solid #6cbcff;
    background: rgba(108, 188, 255, 0.08);
    color: var(--text, #27352d);
    line-height: 1.6;
}

.nutrition-ai-note {
    display: block;
    margin-top: 10px;
    color: var(--muted, #718078);
    font-size: 0.76rem;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 26px 0;
    color: #7fa892;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.login-divider::before,
.login-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.16);
}

.login-error {
    min-height: 1.25rem;
    color: #ffb3ac;
    font-size: 0.87rem;
    line-height: 1.5;
    text-align: center;
}

.login-error:not(:empty) {
    padding: 12px 14px;
    border: 1px solid rgba(255, 123, 113, 0.35);
    border-radius: var(--r-sm);
    background: rgba(224, 69, 60, 0.14);
}

/* Setup diagnostic — shown only when sign-in fails for a configuration
   reason, because the fix is never guessable from Google's own message. */
.login-diagnostic {
    margin-top: 18px;
    padding: 18px;
    border: 1px solid rgba(255, 138, 43, 0.4);
    border-radius: var(--r-md);
    background: rgba(255, 138, 43, 0.12);
    color: #ffe0c4;
    font-size: 0.82rem;
    line-height: 1.6;
    text-align: left;
}

.login-diagnostic[hidden] { display: none; }

.login-diagnostic h2 {
    font-size: 0.93rem;
    color: #ffc78f;
    margin: 0 0 8px;
    letter-spacing: -0.01em;
}

.login-diagnostic ol { margin: 0; padding-left: 1.15rem; }
.login-diagnostic li { margin-bottom: 7px; }
.login-diagnostic li:last-child { margin-bottom: 0; }
.login-diagnostic a { color: var(--lime); }

.login-diagnostic code {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.9em;
    overflow-wrap: anywhere;
}

/* -- 9. HOME ------------------------------------------------------------ */

.hero {
    position: relative;
    overflow: hidden;
    display: grid;
    place-items: center;
    min-height: clamp(30rem, 74vh, 44rem);
    padding: clamp(60px, 9vw, 120px) clamp(18px, 4vw, 32px);
    text-align: center;
    isolation: isolate;
}

/* Layered gradient over the photo keeps headline contrast well above 4.5:1
   regardless of how the image crops. */
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background:
        linear-gradient(180deg, rgba(3, 20, 12, 0.82) 0%, rgba(3, 20, 12, 0.62) 45%, rgba(3, 20, 12, 0.9) 100%),
        url("https://images.unsplash.com/photo-1498837167922-ddd27525d352?auto=format&fit=crop&w=1800&q=80") center / cover no-repeat;
}

.hero::after {
    content: "";
    position: absolute;
    inset: auto -10% -45% auto;
    z-index: -1;
    width: 40rem; height: 40rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 184, 98, 0.42), transparent 66%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    max-width: 54rem;
    animation: rise 0.8s var(--ease) both;
}

.hero-logo {
    display: block;
    width: min(330px, 72vw);
    height: 150px;
    margin: 0 auto 18px;
    object-fit: contain;
    mix-blend-mode: multiply;
    opacity: 0.96;
}

.hero h1 {
    color: #fff;
    font-size: clamp(2.9rem, 8.5vw, 6rem);
    text-shadow: 0 4px 28px rgba(0, 0, 0, 0.4);
    margin-bottom: 22px;
}

.hero h1 span {
    background: var(--grad-fresh);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    color: #d5ebde;
    font-size: clamp(1.05rem, 1.7vw, 1.3rem);
    line-height: 1.65;
    max-width: 42rem;
    margin: 0 auto 34px;
}

.hero .eyebrow {
    color: var(--lime);
    background: rgba(198, 242, 78, 0.14);
    border-color: rgba(198, 242, 78, 0.32);
}

.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
}

.hero-buttons a { text-decoration: none; }

.benefits,
.newsletter { padding-block: clamp(56px, 8vw, 104px); }

/* Steps band. Sits between the benefit cards and the newsletter on the home
   page and reuses the shared shell gutter. */
.steps {
    padding-block: clamp(48px, 7vw, 92px);
    background: var(--surface);
    border-block: 1px solid var(--line);
}

.step-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
    gap: clamp(18px, 2.4vw, 28px);
    margin: clamp(20px, 2.6vw, 30px) 0 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.step {
    position: relative;
    padding: clamp(26px, 3vw, 34px);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: #fffdf7;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.step:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.step-number {
    display: block;
    margin-bottom: 14px;
    background: var(--grad-brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 4vw, 3.2rem);
    font-weight: 900;
    line-height: 0.9;
}

.step h3 { margin-bottom: 10px; }
.step p { color: var(--muted); margin-bottom: 16px; }

.step a {
    color: var(--green-deep);
    font-weight: 700;
    font-size: 0.92rem;
    text-decoration: none;
}

.step a:hover { text-decoration: underline; }

@media (prefers-color-scheme: dark) {
    .step a { color: var(--lime); }
}

.benefit-grid,
.tips-grid,
.nutrition-grid,
.nutrition-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
    gap: clamp(18px, 2.4vw, 26px);
}

.benefit-card { text-align: center; }

.benefit-icon,
.tip-icon,
.info-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 20px;
    background: var(--grad-fresh);
    font-size: 1.9rem;
    line-height: 1;
    box-shadow: var(--glow-green);
}

.tip-icon, .info-icon { margin-inline: 0; }
.benefit-card h3, .tip-card h3 { margin-bottom: 10px; }
.benefit-card p, .tip-card p { color: var(--muted); margin: 0; }

.newsletter-box {
    position: relative;
    overflow: hidden;
    max-width: var(--shell);
    margin-inline: auto;
    padding: clamp(36px, 6vw, 68px) clamp(24px, 5vw, 60px);
    border-radius: var(--r-xl);
    background: var(--grad-brand);
    color: #fff;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.newsletter-box::after {
    content: "";
    position: absolute;
    inset: -60% -20% auto auto;
    width: 28rem; height: 28rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 68%);
    pointer-events: none;
}

.newsletter-box > * { position: relative; }
.newsletter-box h2 { color: #fff; }
.newsletter-box p { color: rgba(255, 255, 255, 0.9); max-width: 40rem; margin: 0 auto 28px; }

.newsletter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-width: 32rem;
    margin-inline: auto;
}

.newsletter-form input {
    flex: 1 1 14rem;
    border: 0;
    border-radius: var(--r-pill);
    padding: 16px 22px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
}

/* -- 16. RECIPES -------------------------------------------------------- */

.recipes { padding: 0 0 clamp(70px, 9vw, 120px); }
.recipes-container { width: 100%; max-width: var(--shell); margin-inline: auto; padding-inline: clamp(18px, 4vw, 32px); }
.recipe-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.recipe-toolbar h2 { margin: 8px 0 0; }
.recipe-search input { width: min(320px, 100%); min-height: 48px; padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: var(--r-md); color: var(--text); background: var(--card); font: inherit; }
.recipe-search input:focus { outline: 3px solid var(--lime); border-color: var(--green); }
.recipe-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; }
.recipe-filter { padding: 10px 16px; border: 1px solid var(--line); border-radius: var(--r-pill); color: var(--muted); background: var(--card); cursor: pointer; font: inherit; font-weight: 700; }
.recipe-filter:hover, .recipe-filter.active { border-color: var(--green-deep); color: #fff; background: var(--green-deep); }
.recipe-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.recipe-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); box-shadow: var(--shadow-sm); transition: transform 180ms var(--ease), box-shadow 180ms var(--ease); }
.recipe-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.recipe-card[hidden] { display: none; }
.recipe-art { display: grid; min-height: 150px; place-items: center; font-size: 4.3rem; background: var(--lime); }
.recipe-art-berry { background: #eadff0; }.recipe-art-lemon { background: #f5edbf; }.recipe-art-tomato { background: #f5d8c9; }.recipe-art-apple { background: #dcebd8; }
.recipe-card-body { padding: 20px; }
.recipe-card-top, .recipe-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--faint); font-size: 0.78rem; font-weight: 700; }
.recipe-category { color: var(--green-deep); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.recipe-card h3 { margin: 14px 0 8px; font-size: 1.35rem; }
.recipe-card p { min-height: 77px; color: var(--muted); font-size: 0.92rem; }
.recipe-meta { flex-wrap: wrap; justify-content: flex-start; padding-top: 15px; border-top: 1px solid var(--line); }
.recipe-meta span { padding-right: 9px; border-right: 1px solid var(--line); }
.recipe-link { margin-left: auto; padding: 0; border: 0; color: var(--green-deep); background: none; cursor: pointer; font: inherit; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.recipe-empty { padding: 28px; border: 1px dashed var(--line-strong); color: var(--muted); text-align: center; }
.recipe-dialog { width: min(680px, calc(100% - 32px)); padding: clamp(24px, 5vw, 42px); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--text); background: var(--card); box-shadow: var(--shadow-lg); }
.online-recipe-status { min-height: 1.6em; margin: 22px 0 14px; color: var(--muted); font-weight: 700; }
.online-recipe-image { width: 100%; height: 170px; object-fit: cover; }
.online-recipe-card .recipe-card-body { min-height: 225px; }
.recipe-dialog::backdrop { background: rgba(44, 62, 43, 0.48); }
.recipe-dialog h2 { margin: 10px 0; }
.recipe-dialog > p { color: var(--muted); }
.dialog-close { position: absolute; top: 15px; right: 18px; border: 0; color: var(--muted); background: none; cursor: pointer; font-size: 1.8rem; line-height: 1; }
.dialog-columns { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 28px; margin-top: 26px; }
.dialog-columns h3 { margin-bottom: 10px; font-size: 1.1rem; }
.dialog-columns ul, .dialog-columns ol { margin: 0; padding-left: 20px; color: var(--muted); }
.dialog-columns li + li { margin-top: 7px; }

@media (max-width: 980px) {
    .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
    .recipe-toolbar { display: block; }
    .recipe-search { display: block; margin-top: 20px; }
    .recipe-search input { width: 100%; }
    .recipe-grid { grid-template-columns: 1fr; }
    .recipe-card p { min-height: 0; }
    .dialog-columns { grid-template-columns: 1fr; gap: 18px; }
}

.newsletter-form input:focus { box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.45); }

.newsletter-form button {
    width: auto;
    flex: 0 0 auto;
    background: var(--green-ink);
    box-shadow: var(--shadow);
}

.newsletter-form button:hover { background: #011c10; box-shadow: var(--shadow-lg); }

/* -- 10. CALCULATOR ----------------------------------------------------- */

.calculator-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(20rem, 0.95fr);
    gap: clamp(20px, 2.6vw, 28px);
    align-items: start;
}

.form-panel h2,
.result-panel h2 { font-size: clamp(1.4rem, 2vw, 1.75rem); margin-bottom: 8px; }
.panel-copy { font-size: 0.95rem; margin-bottom: 26px; }

.result-panel {
    position: sticky;
    top: 96px;
    overflow: hidden;
    padding: clamp(24px, 3vw, 32px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--r-lg);
    background: var(--grad-ink);
    color: #eafaf0;
    box-shadow: var(--shadow-lg);
}

.result-panel::before {
    content: "";
    position: absolute;
    inset: -50% -30% auto auto;
    width: 22rem; height: 22rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 184, 98, 0.34), transparent 68%);
    pointer-events: none;
}

.result-panel > * { position: relative; }

.result-panel:not(.is-visible) {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 24rem;
}

.result-panel h2 { color: #fff; }
.result-empty { color: #a8cdb7; line-height: 1.65; margin: 0; }
.result-content { display: none; }
.is-visible .result-empty { display: none; }
.is-visible .result-content { display: block; }

.result-label {
    display: block;
    color: var(--lime);
    font-family: var(--font-display);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.target {
    font-family: var(--font-display);
    font-size: clamp(3rem, 7vw, 4.5rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1;
    margin: 10px 0 8px;
    background: var(--grad-fresh);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.result-note { color: #a8cdb7; font-size: 0.92rem; line-height: 1.55; margin-bottom: 26px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: 12px; }

.stat {
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--r-sm);
    background: rgba(255, 255, 255, 0.06);
}

.stat strong {
    display: block;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
}

.stat span { color: #96bfa6; font-size: 0.74rem; }

.macro-title {
    margin: 30px 0 12px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--lime);
}

.macro {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    color: #d6ecdd;
    font-size: 0.94rem;
}

.macro strong { color: var(--lime); font-family: var(--font-display); }

.diet-plan { margin-top: 30px; }
.diet-intro { color: #a8cdb7; font-size: 0.86rem; line-height: 1.55; margin-bottom: 14px; }

.serving-control {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin: 18px 0;
    color: #a8cdb7;
    font-size: 0.86rem;
}

.serving-control output { color: var(--lime); font-family: var(--font-display); font-weight: 700; }
.serving-control input { grid-column: 1 / -1; }

.meal-plan { display: grid; gap: 4px; }

.meal-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.meal-card p { color: #d6ecdd; font-size: 0.86rem; line-height: 1.45; margin: 4px 0 0; }
.meal-card strong { color: var(--lime); font-family: var(--font-display); font-size: 0.92rem; white-space: nowrap; }

.meal-label {
    color: var(--lime);
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.shopping-list { display: grid; gap: 9px; }

.shopping-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d6ecdd;
    font-size: 0.88rem;
}

.shopping-item input { accent-color: var(--lime); }

/* -- 11. NUTRITION ------------------------------------------------------ */

.nutrition-dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: clamp(20px, 2.6vw, 26px);
    margin-top: clamp(26px, 4vw, 36px);
}

.dashboard-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.dashboard-label {
    color: var(--mango);
    font-family: var(--font-display);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.dashboard-heading h2 { margin: 6px 0 0; font-size: clamp(1.3rem, 2vw, 1.6rem); }
.dashboard-copy { color: var(--muted); font-size: 0.92rem; margin: 12px 0 20px; }

.intake-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}

.intake-form label { display: grid; gap: 7px; font-size: 0.78rem; }
.intake-form .btn { grid-column: 1 / -1; width: 100%; }

.intake-status {
    color: var(--green-deep);
    font-size: 0.86rem;
    font-weight: 700;
    margin-top: 16px;
    min-height: 1.2em;
}

@media (prefers-color-scheme: dark) {
    .intake-status { color: var(--lime); }
}

.water-percent {
    color: var(--cyan);
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 800;
}

.water-progress {
    height: 12px;
    margin: 20px 0;
    border-radius: var(--r-pill);
    background: var(--surface);
    border: 1px solid var(--line);
    overflow: hidden;
}

.water-progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--cyan), var(--green));
    transition: width 0.35s var(--ease);
}

.water-glasses {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(2rem, 1fr));
    gap: 8px;
}

.water-glass {
    height: 40px;
    border: 2px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: transparent;
    font-size: 0.85rem;
    font-weight: 700;
    transition: transform 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.water-glass:hover { transform: translateY(-2px); border-color: var(--cyan); }

.water-glass.filled {
    border-color: transparent;
    background: linear-gradient(160deg, var(--cyan), var(--green));
    color: #fff;
}

.profile-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.profile-form label { display: grid; gap: 7px; font-size: 0.78rem; }
.profile-form .btn { grid-column: 1 / -1; width: 100%; }
.quick-status { color: var(--muted); font-size: 0.8rem; line-height: 1.5; margin-top: 14px; }

.smart-tools,
.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
    gap: clamp(20px, 2.6vw, 26px);
    margin-top: clamp(20px, 2.6vw, 26px);
}

.smart-tools .unit-panel { grid-column: 1 / -1; }

.tool-row {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.tool-row input,
.tool-row select { flex: 1 1 7rem; min-width: 0; }
.tool-small { flex: 0 0 auto; }

/* Progress rings — conic-gradient driven, --ring-progress set from JS */
.rings {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 18px;
    margin: 24px 0 12px;
}

.ring {
    --ring-progress: 0deg;
    position: relative;
    display: grid;
    place-content: center;
    width: 98px;
    height: 98px;
    border-radius: 50%;
    text-align: center;
    background: conic-gradient(var(--mango) var(--ring-progress), var(--surface) 0);
    transition: background 0.4s var(--ease);
}

.ring::before {
    content: "";
    position: absolute;
    inset: 9px;
    border-radius: 50%;
    background: var(--card);
}

.ring span,
.ring small { position: relative; z-index: 1; }

.ring span {
    display: block;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 800;
}

.ring small { color: var(--muted); font-size: 0.64rem; }

.weekly-total {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 2.6rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    margin-top: 20px;
    background: var(--grad-brand);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.week-bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 84px;
    margin-top: 20px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--line);
}

.week-bars span {
    flex: 1;
    min-height: 5px;
    border-radius: 6px 6px 0 0;
    background: var(--grad-warm);
    transition: height 0.4s var(--ease);
}

.density-grade {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 4.5vw, 3rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    background: var(--grad-fresh);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.density-meter {
    height: 14px;
    margin-top: 22px;
    border-radius: var(--r-pill);
    background: var(--surface);
    border: 1px solid var(--line);
    overflow: hidden;
}

.density-meter div {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--mango), var(--lime));
    transition: width 0.4s var(--ease);
}

.badges { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }

.badges span {
    padding: 9px 15px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-pill);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 500;
}

.badges span.unlocked {
    border-color: transparent;
    background: var(--grad-fresh);
    color: var(--green-ink);
    font-weight: 700;
    box-shadow: var(--glow-green);
}

.export-buttons,
.grocery-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 18px;
}

.reminder-panel { margin-top: clamp(20px, 2.6vw, 26px); }

.reminder-controls {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.reminder-controls label { display: grid; gap: 7px; font-size: 0.78rem; }

.history-panel { margin-top: clamp(20px, 2.6vw, 26px); }
.history-list { display: grid; }

.history-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    padding: 13px 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.86rem;
}

.history-row:first-child { border-top: 0; }
.history-row strong { color: var(--text); font-family: var(--font-display); margin-right: auto; }

/* Charts */

.chart-card { margin-top: clamp(20px, 2.6vw, 26px); }
.chart-header { margin-bottom: 20px; }
.chart-header h3 { margin: 8px 0 0; font-size: clamp(1.3rem, 2vw, 1.7rem); }

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
    gap: 20px;
}

.chart-panel {
    padding: 16px;
    border-radius: var(--r-md);
    background: var(--surface);
    box-shadow: none;
}

.chart-wrap { position: relative; height: 20rem; }
.chart-card canvas { width: 100% !important; }

/* Nutrition content cards */

.nutrition-card h3,
.nutrition-info-card h3 { margin-bottom: 10px; }
.nutrition-card p,
.nutrition-info-card p { color: var(--muted); font-size: 0.94rem; margin: 0; }

.nutrition-card img {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    object-fit: cover;
    margin-bottom: 16px;
}

.nutrition-info-grid,
.insights-grid { margin-top: clamp(20px, 2.6vw, 26px); }

/* -- 12. PLANNER -------------------------------------------------------- */

.planner { padding-block: clamp(30px, 4vw, 44px) clamp(60px, 8vw, 100px); }

/* .planner already supplies the page gutter, so the inner container must
   not add a second one. */
.planner .planner-container {
    max-width: none;
    padding-inline: 0;
    padding-block: 0;
    margin-top: clamp(20px, 2.6vw, 26px);
}

.grocery-card { margin-top: clamp(22px, 3vw, 32px); }
.grocery-card h3 { margin: 6px 0 8px; }
.grocery-card > p { color: var(--muted); font-size: 0.94rem; }

.grocery-card ul {
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.grocery-card li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 0.92rem;
}

.grocery-card label { font-weight: 500; }
.grocery-card input[type="checkbox"] { accent-color: var(--green); width: 1.05rem; height: 1.05rem; }
.grocery-card li:has(input:checked) label { color: var(--faint); text-decoration: line-through; }
.grocery-empty { color: var(--faint); font-style: italic; }

.day-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    background: var(--card);
    box-shadow: var(--shadow-sm);
}

.day-tab {
    flex: 1 1 4rem;
    border: 0;
    border-radius: var(--r-pill);
    padding: 11px 8px;
    background: transparent;
    color: var(--muted);
    font-family: var(--font-display);
    font-size: 0.88rem;
    font-weight: 700;
    transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.day-tab:hover { background: var(--surface); color: var(--text); }

.day-tab.active {
    background: var(--grad-brand);
    color: #fff;
    box-shadow: var(--glow-green);
}

.planner-help { color: var(--muted); font-size: 0.95rem; margin: 0; }

.meal-input {
    display: grid;
    grid-template-columns: minmax(8rem, 0.7fr) minmax(0, 2fr) minmax(6rem, 0.6fr) auto;
    gap: 10px;
    align-items: center;
    padding: clamp(16px, 2vw, 20px);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--card);
    box-shadow: var(--shadow);
}

.meal-input select,
.meal-input input { min-width: 0; }
.meal-input .add-btn { white-space: nowrap; }

.planner-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
}

.planner-actions .add-btn {
    padding: 10px 20px;
    font-size: 0.88rem;
    background: var(--card);
    color: var(--green-deep);
    border: 2px solid var(--line-strong);
    box-shadow: var(--shadow-sm);
}

.planner-actions .add-btn:hover { border-color: var(--green); color: var(--green); }

.planner-actions span {
    margin-left: auto;
    padding: 9px 18px;
    border-radius: var(--r-pill);
    background: var(--grad-warm);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.88rem;
}

.planner-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0 22px;
    color: var(--muted);
    font-size: 0.9rem;
}

.planner-tools select {
    min-width: 130px;
    padding: 9px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: var(--card);
    color: var(--text);
    font: inherit;
}

.planner-status { color: var(--green-deep); font-weight: 700; }

.week-summary {
    margin: 28px 0 6px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
}

.week-summary h3 { margin: 5px 0 18px; }

.week-summary-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.week-summary-day {
    display: grid;
    gap: 3px;
    padding: 12px 8px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--card);
    text-align: center;
}

.week-summary-day.current { border-color: var(--green); box-shadow: inset 0 -3px var(--green); }
.week-summary-day strong { color: var(--green-deep); font-size: 0.78rem; }
.week-summary-day span,
.week-summary-day em { color: var(--muted); font-size: 0.72rem; font-style: normal; }

.meal-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }

.meal-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 15px 18px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--green);
    border-radius: var(--r-md);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    animation: pop 0.3s var(--ease);
}

.meal-list li span { font-size: 0.95rem; }
.meal-list li strong { color: var(--green-deep); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; }

.meal-kcal {
    display: inline-block;
    margin-left: 4px;
    padding: 2px 9px;
    border-radius: var(--r-pill);
    background: var(--surface);
    color: var(--muted);
    font-size: 0.74rem;
    font-style: normal;
    font-weight: 700;
    white-space: nowrap;
}

.meal-list .meal-empty {
    justify-content: center;
    border-left-color: var(--line);
    color: var(--faint);
    font-size: 0.93rem;
    text-align: center;
}

@media (prefers-color-scheme: dark) {
    .meal-list li strong { color: var(--lime); }
}

/* -- 13. TIPS ----------------------------------------------------------- */

.tips-grid { margin-top: clamp(20px, 2.6vw, 26px); }

.tip-box {
    margin-top: clamp(24px, 3vw, 34px);
    border-left: 4px solid var(--mango);
    background: linear-gradient(120deg, rgba(255, 138, 43, 0.1), rgba(255, 61, 127, 0.06));
    text-align: center;
}

.tip-box h3 { margin-bottom: 8px; }
.tip-box p { color: var(--muted); margin: 0; }

.tip-quote {
    font-family: var(--font-display);
    font-size: clamp(1.15rem, 2.4vw, 1.6rem);
    font-weight: 600;
    line-height: 1.45;
    color: var(--text) !important;
    max-width: 40ch;
    margin: 0 auto !important;
    text-wrap: balance;
}

.tip-counter {
    display: block;
    margin: 16px 0 22px;
    color: var(--faint);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* -- 14. GAME ----------------------------------------------------------- */

.game-page {
    color: #eafaf0;
    background: #04140c;
}

.game-page::before {
    background:
        radial-gradient(46rem 30rem at 12% -6%, rgba(0, 184, 98, 0.22), transparent 62%),
        radial-gradient(38rem 26rem at 90% 8%, rgba(123, 92, 255, 0.2), transparent 60%);
}

.game-page header {
    background: rgba(4, 20, 12, 0.78);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.game-page .logo { color: #fff; }
.game-page .nav-links a { color: #9dc4ad; }
.game-page .nav-links a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.game-page .menu-btn { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.2); color: #fff; }
.game-page .account-trigger { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.18); }
.game-page .account-menu { background: #0e2418; border-color: rgba(255, 255, 255, 0.14); }
.game-page footer { background: rgba(0, 0, 0, 0.3); border-top-color: rgba(255, 255, 255, 0.1); color: #9dc4ad; }
.game-page .footer-grid h3 { color: #fff; }
.game-page .footer-grid p, .game-page .footer-grid a { color: #9dc4ad; }
.game-page .copyright { border-top-color: rgba(255, 255, 255, 0.1); color: #7ba58c; }

.game-intro { max-width: 44rem; margin-bottom: clamp(26px, 3.5vw, 38px); }
.game-intro h1 { color: #fff; font-size: clamp(2.8rem, 8vw, 5.5rem); }

.game-intro h1 span {
    background: var(--grad-fresh);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.game-intro p { color: #9dc4ad; font-size: clamp(1.02rem, 1.5vw, 1.2rem); margin: 0; }
.game-intro .eyebrow { color: var(--lime); background: rgba(198, 242, 78, 0.12); border-color: rgba(198, 242, 78, 0.3); }

.game-panel {
    padding: clamp(16px, 2.4vw, 26px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--r-xl);
    background: rgba(255, 255, 255, 0.045);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow-lg);
}

.game-topbar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.game-topbar > div {
    padding: 14px 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--r-md);
    background: rgba(255, 255, 255, 0.06);
}

.game-stat-label {
    display: block;
    color: #9dc4ad;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.game-topbar strong {
    display: block;
    margin-top: 4px;
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 3vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--lime);
    font-variant-numeric: tabular-nums;
}

.game-stage {
    position: relative;
    height: clamp(24rem, 56vh, 30rem);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--r-lg);
    background:
        radial-gradient(circle at 50% -10%, rgba(0, 184, 98, 0.35), transparent 60%),
        linear-gradient(180deg, #0c2c1c 0%, #061a10 100%);
    outline: none;
}

.game-stage:focus-visible { box-shadow: 0 0 0 4px rgba(198, 242, 78, 0.5); }

/* Ground line the basket sits on. */
.game-stage::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 54px;
    background: rgba(0, 0, 0, 0.45);
    border-top: 2px solid rgba(198, 242, 78, 0.28);
}

.game-message {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: grid;
    place-content: center;
    padding: 24px;
    text-align: center;
    background: rgba(4, 20, 12, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.game-message[hidden] { display: none; }
.game-message h2 { color: #fff; font-size: clamp(1.5rem, 4vw, 2.1rem); margin-bottom: 8px; }
.game-message p { color: #b9dcc7; margin-bottom: 22px; }

.game-start { background: var(--grad-fresh); color: var(--green-ink); }

.basket {
    position: absolute;
    z-index: 2;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(2.2rem, 6vw, 2.9rem);
    line-height: 1;
    transition: left 0.12s var(--ease);
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
}

.falling-food {
    position: absolute;
    z-index: 1;
    top: -50px;
    font-size: clamp(1.7rem, 4.5vw, 2.2rem);
    animation: foodFall linear forwards;
}

@keyframes foodFall {
    to { top: calc(100% + 40px); transform: rotate(360deg); }
}

.game-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.game-controls button {
    min-width: 62px;
    height: 48px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--r-md);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.game-controls button:hover {
    background: rgba(0, 184, 98, 0.28);
    border-color: var(--lime);
    transform: translateY(-2px);
}

.game-controls .game-end {
    min-width: auto;
    padding-inline: 20px;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    background: rgba(224, 69, 60, 0.22);
    border-color: rgba(255, 123, 113, 0.35);
}

.game-controls .game-end:hover { background: rgba(224, 69, 60, 0.42); border-color: #ff7b71; }

.game-status { color: #9dc4ad; text-align: center; font-size: 0.86rem; margin: 16px 0 0; }

/* -- 15. MOTION / RESPONSIVE ------------------------------------------- */

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

@keyframes pop {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to { opacity: 1; transform: none; }
}

@keyframes drift {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(0, 4vmax, 0) scale(1.08); }
}

/* Page hero is a direct child of <body> on the inner pages, so it needs its
   own gutter to line up with the shell below it. */
.page-hero {
    max-width: var(--shell);
    margin-inline: auto;
    margin-top: clamp(24px, 4vw, 40px);
}

.progress {
    height: 12px;
    border-radius: var(--r-pill);
    background: var(--surface);
    border: 1px solid var(--line);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: inherit;
    background: var(--grad-brand);
    transition: width 0.35s var(--ease);
}

@media (max-width: 900px) {
    .calculator-grid,
    .nutrition-dashboard { grid-template-columns: 1fr; }
    .result-panel { position: static; }
    .meal-input { grid-template-columns: 1fr 1fr; }
    .meal-input input[type="text"],
    .meal-input .add-btn { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
    .week-summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        margin: 0;
        padding: 14px clamp(18px, 4vw, 32px) 20px;
        background: var(--bg);
        border-bottom: 1px solid var(--line);
        box-shadow: var(--shadow);
    }

    .nav-links.show { display: flex; }
    .nav-links a { padding: 13px 16px; text-align: center; }
    .menu-btn { display: block; order: 3; }
    .navbar { position: relative; flex-wrap: wrap; }
    .account { margin-left: auto; }
    .game-page .nav-links { background: #04140c; }
}

@media (max-width: 620px) {
    .field-grid,
    .intake-form,
    .profile-form,
    .stats { grid-template-columns: 1fr; }

    .field.full,
    .intake-form .btn,
    .profile-form .btn { grid-column: auto; }

    .meal-input { grid-template-columns: 1fr; }
    .week-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .game-topbar { grid-template-columns: 1fr; }
    .planner-actions span { margin-left: 0; width: 100%; text-align: center; }
    .account-name { display: none; }
    .account-trigger { padding: 5px; }
    .newsletter-form button { width: 100%; }
    .hero { min-height: 26rem; }
}

@media print {
    body::before,
    header,
    footer,
    .day-tabs,
    .meal-input,
    .planner-actions,
    .grocery-actions,
    .planner-tools,
    .week-summary,
    .hero { display: none !important; }

    body { background: #fff; color: #000; }
    .card, .grocery-card { box-shadow: none; border: 1px solid #ccc; }
}

/* Scroll reveal. The `js-reveal` class is set by site.js, so without
   JavaScript nothing is ever hidden. */
.js-reveal .benefit-card,
.js-reveal .tip-card,
.js-reveal .nutrition-card,
.js-reveal .nutrition-info-card,
.js-reveal .dashboard-panel,
.js-reveal .history-panel,
.js-reveal .chart-card,
.js-reveal .grocery-card,
.js-reveal .section-title,
.js-reveal .newsletter-box,
.js-reveal .step {
    opacity: 0;
    transform: translateY(22px);
    transition:
        opacity 0.6s var(--ease) var(--reveal-delay, 0ms),
        transform 0.6s var(--ease) var(--reveal-delay, 0ms);
}

.js-reveal .revealed {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .js-reveal .benefit-card,
    .js-reveal .tip-card,
    .js-reveal .nutrition-card,
    .js-reveal .nutrition-info-card,
    .js-reveal .dashboard-panel,
    .js-reveal .history-panel,
    .js-reveal .chart-card,
    .js-reveal .grocery-card,
    .js-reveal .section-title,
    .js-reveal .newsletter-box,
    .js-reveal .step {
        opacity: 1;
        transform: none;
    }
}

/* Editorial finish: a restrained paper palette and firmer edges keep the
   public-facing pages feeling like a considered food journal, not a template. */
body::before {
    background:
        linear-gradient(rgba(44, 62, 43, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(44, 62, 43, 0.035) 1px, transparent 1px);
    background-size: 28px 28px;
}

.logo span { color: var(--mango); background: none; -webkit-text-fill-color: currentColor; }
.nav-links a.active { color: #fff; background: var(--green-deep); box-shadow: none; }
.nav-links a { border-radius: 4px; }
.btn, .calculate-btn, .add-btn, .tool-small, .game-start,
.newsletter-form button, .login-button {
    border-radius: 4px;
    background: var(--green-deep);
    box-shadow: none;
}
.btn:hover, .calculate-btn:hover, .add-btn:hover, .tool-small:hover,
.game-start:hover, .newsletter-form button:hover, .login-button:hover {
    background: var(--green);
    box-shadow: 0 8px 18px rgba(30, 75, 56, 0.18);
}
.btn-secondary, .login-button.secondary { border-radius: 4px; }
.eyebrow { border-radius: 4px; background: var(--lime); border-color: transparent; }
.benefit-card, .tip-card, .nutrition-card, .nutrition-info-card,
.step, .newsletter-box { border-radius: 8px; }
.benefit-card::before, .tip-card::before, .nutrition-card::before,
.nutrition-info-card::before { background: var(--mango); }
.benefit-icon, .tip-icon, .info-icon {
    width: 52px; height: 52px; border-radius: 50%;
    background: var(--lime); color: var(--green-ink);
    box-shadow: none; font-family: var(--font-display); font-weight: 700;
}
.step-number { background: none; color: var(--mango); -webkit-text-fill-color: currentColor; }
.newsletter-box { background: var(--green-deep); box-shadow: none; }
.newsletter-box::after { display: none; }

.login-page {
    background: #faf8f5;
    color: #2d2d2d;
}
.login-page::before, .login-page::after { display: none; }
.login-card {
    padding: clamp(28px, 5vw, 48px);
    border: 1px solid #c4c8bc;
    border-radius: 8px;
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 18px 45px rgba(36, 43, 37, 0.12);
    color: var(--text);
}
.login-card .logo { color: #2d2d2d; }
.login-card .eyebrow { color: var(--green-ink); background: var(--lime); border-color: transparent; }
.login-card h1 { color: #2d2d2d; }
.login-card h1 span { color: #2c3e2b; background: none; -webkit-text-fill-color: currentColor; }
.login-card > p { color: #62645f; }
.login-card small { color: #8b8d86; }

.food-analyzer { margin-bottom: clamp(28px, 4vw, 42px); }
.food-analyzer-form { display: flex; align-items: end; gap: 14px; margin: 22px 0 16px; }
.food-analyzer-form label { flex: 1; color: var(--muted); font-size: 0.86rem; font-weight: 700; }
.food-analyzer-form input { display: block; width: 100%; margin-top: 7px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-md); color: var(--text); background: var(--card); font: inherit; }
.food-analyzer-form input:focus { outline: 3px solid var(--lime); border-color: var(--green); }
.nutrition-result-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.nutrition-result-grid span { display: flex; flex-direction: column; gap: 3px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.nutrition-result-grid small { color: var(--muted); font-size: 0.75rem; }
.nutrition-result-grid b { color: var(--green-ink); font-family: var(--font-display); font-size: 1.15rem; }

@media (max-width: 620px) {
    .food-analyzer-form { align-items: stretch; flex-direction: column; }
    .nutrition-result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Keep the interactive game in the same light visual language as the rest
   of the site instead of switching to a separate dark theme. */
.game-page header,
.game-page footer,
.game-page .game-panel,
.game-page .game-stage {
    background: #ffffff;
    color: #2d2d2d;
}
.game-page header { border-bottom-color: #d9dce1; }
.game-page .logo { color: #2d2d2d; }
.game-page .nav-links a:hover { color: #2d2d2d; background: #f1eee8; }
.game-page .nav-links a.active { color: #ffffff; background: #5a785a; }
.game-page .menu-btn { background: #ffffff; border-color: #c4c8bc; color: #2d2d2d; }
.game-page .account-menu { background: #ffffff; border-color: #d9dce1; }
.game-page footer { border-top-color: #d9dce1; color: #555b66; }
.game-page .footer-grid h3 { color: #2d2d2d; }
.game-page .footer-grid p, .game-page .footer-grid a { color: #555b66; }
.game-intro h1, .game-message h2, .game-stage, .game-status { color: #2d2d2d; }
.game-intro p, .game-status { color: #62645f; }
.game-panel { border-color: #deddd5; box-shadow: 0 14px 34px -12px rgba(44, 62, 43, 0.12); }
.game-stage { border-color: #c4c8bc; }
.game-page { background: #faf8f5; color: #2d2d2d; }
.page-hero, .result-panel {
    background: #ffffff;
    color: #2d2d2d;
    box-shadow: 0 14px 34px -12px rgba(20, 23, 28, 0.12);
}
.page-hero h1, .result-panel h2 { color: #2d2d2d; }
.page-hero p { color: #62645f; }
.page-hero::after, .result-panel::before { display: none; }

/* The interface uses blue for surfaces and controls; all site-owned copy is
   intentionally black for a consistent monochrome reading layer. */
body,
body * {
    color: #2d2d2d !important;
    -webkit-text-fill-color: #2d2d2d !important;
}

/* White type keeps the photo-backed home hero readable. */
.hero,
.hero * {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* Final polish for the entry screen: quiet structure, one confident blue
   accent, and enough breathing room for the sign-in content to scan quickly. */
.login-page {
    position: relative;
    background:
        linear-gradient(135deg, transparent 0 58%, rgba(135, 169, 135, 0.12) 58% 72%, transparent 72%),
        #f1eee8;
}
.login-shell { width: min(100%, 32rem); }
.login-card {
    overflow: hidden;
    border-top: 5px solid #87a987;
    padding: clamp(30px, 5vw, 46px);
    box-shadow: 0 22px 55px rgba(20, 23, 28, 0.14);
}
.login-card .logo {
    margin-bottom: 16px;
    font-size: 1.85rem;
}
.login-card .eyebrow { margin-bottom: 22px; }
.login-card h1 { margin-bottom: 16px; }
.login-card h1 span {
    color: #2c3e2b !important;
    -webkit-text-fill-color: #2c3e2b !important;
}

/* User-selected theme overrides the legacy light defaults above. */
.theme-toggle {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    color: var(--text) !important;
    background: var(--card);
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
}
.theme-toggle:hover { background: var(--surface); }

html[data-theme="dark"] {
    --bg: #18201a;
    --bg-tint: #202b22;
    --card: #243126;
    --surface: #2c3a2e;
    --raised: #314033;
    --text: #edf3eb;
    --muted: #c0cdbd;
    --faint: #9dad9b;
    --line: #435444;
    --line-strong: #607460;
    --lime: #354b38;
    --green: #a9c9a7;
    --green-deep: #8fb58e;
    --green-ink: #e7f1e5;
    --grad-brand: #a9c9a7;
    --grad-fresh: #354b38;
    --grad-ink: #e7f1e5;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow: 0 14px 34px -12px rgba(0, 0, 0, 0.38);
    --shadow-lg: 0 34px 70px -24px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] body,
html[data-theme="dark"] body * {
    color: var(--text) !important;
    -webkit-text-fill-color: var(--text) !important;
}
html[data-theme="dark"] body { background: var(--bg); }
html[data-theme="dark"] body::before {
    background:
        radial-gradient(48rem 30rem at 8% -8%, rgba(100, 154, 105, 0.16), transparent 65%),
        radial-gradient(38rem 26rem at 96% 4%, rgba(159, 184, 134, 0.1), transparent 62%);
}
html[data-theme="dark"] header,
html[data-theme="dark"] footer,
html[data-theme="dark"] .card,
html[data-theme="dark"] .dashboard-panel,
html[data-theme="dark"] .form-panel,
html[data-theme="dark"] .result-panel,
html[data-theme="dark"] .page-hero,
html[data-theme="dark"] .recipe-card,
html[data-theme="dark"] .recipe-dialog,
html[data-theme="dark"] .step,
html[data-theme="dark"] .benefit-card,
html[data-theme="dark"] .tip-card,
html[data-theme="dark"] .nutrition-card,
html[data-theme="dark"] .nutrition-info-card {
    color: var(--text);
    background: var(--card);
    border-color: var(--line);
}
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea { color: var(--text); background: var(--surface); border-color: var(--line-strong); }
html[data-theme="dark"] .hero,
html[data-theme="dark"] .hero * { color: #fff !important; -webkit-text-fill-color: #fff !important; }
html[data-theme="dark"] .game-page,
html[data-theme="dark"] .game-page header,
html[data-theme="dark"] .game-page footer,
html[data-theme="dark"] .game-page .game-panel,
html[data-theme="dark"] .game-page .game-stage { color: var(--text); background: var(--bg); }
.login-card > p { max-width: 27rem; margin-inline: auto; }
#googleButton { margin-top: 8px; margin-bottom: 20px; }
.login-card small {
    max-width: 26rem;
    margin-inline: auto;
    padding-top: 18px;
    border-top: 1px solid #d9dce1;
}

@media (max-width: 480px) {
    .login-page { display: block; padding: 16px 12px 28px; }
    .login-shell { width: 100%; margin: 0 auto; }
    .login-card { padding: 26px 18px 24px; }
    .login-card .logo-image { width: min(270px, 100%); height: auto; aspect-ratio: 16 / 9; }
    .login-card h1 { font-size: 2rem; }
    .login-card > p { font-size: 0.92rem; }
    #googleButton { width: 100%; overflow: hidden; }
    #googleButton > div { width: 100%; }
}

/* -- SUBSCRIPTION ------------------------------------------------------- */

.back-link {
    margin-left: auto;
    margin-right: 18px;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
}

.subscription-page {
    width: min(100% - 40px, var(--shell));
    margin: 0 auto;
    padding: clamp(60px, 9vw, 110px) 0 90px;
}

.subscription-heading {
    max-width: 650px;
    margin: 0 auto 48px;
    text-align: center;
}

.subscription-heading h1 { margin: 18px 0 14px; }
.subscription-heading p { color: var(--muted); font-size: 1.08rem; }

.plan-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    align-items: stretch;
}

.plan-card {
    display: flex;
    flex-direction: column;
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--card);
    box-shadow: var(--shadow-sm);
}

.plan-card-featured {
    border-color: var(--green);
    box-shadow: var(--shadow);
    transform: translateY(-10px);
}

.plan-card.is-current { outline: 3px solid var(--lime); outline-offset: -3px; }
.plan-label { color: var(--green-deep); font-size: 0.74rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.plan-card h2 { margin: 16px 0 10px; font-size: 2.1rem; }
.plan-price { margin-bottom: 12px; color: var(--green-deep); font-size: 1.7rem; font-weight: 800; }
.plan-price small { color: var(--muted); font-size: 0.8rem; font-weight: 500; }
.plan-card > p:not(.plan-price) { min-height: 52px; color: var(--muted); }
.plan-card ul { display: grid; gap: 10px; min-height: 120px; margin: 20px 0 28px; padding: 0; list-style: none; }
.plan-card li::before { content: "✓"; margin-right: 9px; color: var(--green-deep); font-weight: 800; }
.plan-button { width: 100%; margin-top: auto; }
.plan-button:disabled { cursor: wait; opacity: 0.65; }

.subscription-status,
.subscription-note {
    margin: 24px auto 0;
    color: var(--muted);
    text-align: center;
}

.subscription-note { font-size: 0.8rem; }

.payment-instructions {
    max-width: 650px;
    margin: 30px auto 0;
    padding: 26px;
    border: 1px solid var(--green);
    border-radius: var(--r-lg);
    background: var(--card);
    box-shadow: var(--shadow-sm);
}

.payment-instructions[hidden] { display: none; }
.payment-instructions h2 { margin: 10px 0 8px; font-size: 1.65rem; }
.payment-instructions p { color: var(--muted); }
.payment-account {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding: 16px;
    border-radius: var(--r-md);
    background: var(--surface);
}
.payment-account span { width: 100%; color: var(--muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; }
.payment-account strong { flex: 1; min-width: 220px; font-size: 1.1rem; letter-spacing: 0.08em; }

@media (max-width: 760px) {
    .plan-grid { grid-template-columns: 1fr; }
    .plan-card-featured { transform: none; }
    .plan-card ul { min-height: 0; }
}

