:root {
    --bg: #0a0a0b;
    --surface: #141416;
    --surface-2: #1c1c1f;
    --border: #2a2a2e;
    --text: #f4f4f5;
    --muted: #a1a1aa;
    --accent: #f97316;
    --accent-dim: rgba(249, 115, 22, 0.15);
    --accent-glow: rgba(249, 115, 22, 0.35);
    --success: #22c55e;
    --focus: #fb923c;
    --nav-h: 4.25rem;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100dvh;
    padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 1rem);
    -webkit-font-smoothing: antialiased;
}

:focus { outline: none; }

:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.top-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: linear-gradient(180deg, var(--bg) 85%, transparent);
    padding: max(1rem, env(safe-area-inset-top)) 1rem 0.75rem;
}

.top-bar-inner {
    max-width: 32rem;
    margin: 0 auto;
}

.eyebrow {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.15rem;
}

.top-bar h1 {
    font-family: 'Oswald', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    margin-bottom: 0.65rem;
}

.macro-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.pill {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
}

.pill.accent {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.main {
    max-width: 32rem;
    margin: 0 auto;
    padding: 0 1rem 1rem;
}

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

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem 1.1rem;
    margin-bottom: 0.75rem;
}

.highlight-card {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--accent-dim), var(--surface));
    box-shadow: 0 0 0 1px var(--accent-glow);
}

.card-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.highlight-card .card-label { color: var(--accent); }

.card h2 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.card-body { font-size: 0.92rem; color: var(--muted); }

.mini-schedule {
    list-style: none;
    margin-top: 0.75rem;
}

.mini-schedule li {
    display: flex;
    gap: 0.75rem;
    padding: 0.45rem 0;
    border-top: 1px solid var(--border);
    font-size: 0.88rem;
}

.mini-schedule span {
    font-weight: 700;
    color: var(--accent);
    min-width: 2rem;
}

.bullet-list {
    list-style: none;
    font-size: 0.9rem;
    color: var(--muted);
}

.bullet-list li {
    padding: 0.35rem 0 0.35rem 1.1rem;
    position: relative;
}

.bullet-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.75rem;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
}

.tip-banner {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 0.5rem;
    padding: 0.75rem 0.9rem;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 0.85rem;
}

.tip-banner strong { color: var(--text); }

.workout-day {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    margin-bottom: 0.65rem;
    overflow: hidden;
}

.day-toggle {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.65rem;
    padding: 0.9rem 1rem;
    background: none;
    border: none;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.day-num {
    font-family: 'Oswald', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.05em;
}

.day-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.chevron {
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    transition: transform 0.25s var(--ease);
}

.day-toggle[aria-expanded="true"] .chevron {
    transform: rotate(-135deg) translateY(2px);
}

.day-content {
    display: none;
    border-top: 1px solid var(--border);
    padding: 0.5rem 0;
}

.day-content.open { display: block; }

.exercise-list { list-style: none; }

.exercise-list li {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.15rem 0.75rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}

.exercise-list li:last-child { border-bottom: none; }

.exercise-list li.warmup {
    grid-template-columns: 1fr;
    color: var(--muted);
    font-style: italic;
    font-size: 0.82rem;
    background: var(--surface-2);
}

.ex-name { font-weight: 500; }

.ex-sets {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    color: var(--accent);
    font-size: 0.85rem;
    white-space: nowrap;
}

.ex-note {
    grid-column: 1 / -1;
    font-size: 0.78rem;
    color: var(--muted);
}

.section-heading {
    font-family: 'Oswald', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    margin: 1rem 0 0.25rem;
}

.section-heading.flush { margin-top: 0; }

.section-sub {
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 0.75rem;
}

.meal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.9rem 1rem;
    margin-bottom: 0.6rem;
}

.meal-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.45rem;
}

.meal-num {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: var(--bg);
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 0.35rem;
}

.meal-time {
    font-weight: 600;
    font-size: 0.9rem;
}

.meal-card p {
    font-size: 0.88rem;
    color: var(--muted);
}

.meal-card em,
.bullet-list em,
.tip-banner em {
    color: var(--accent);
    font-style: normal;
    font-weight: 600;
}

.dinner-grid { display: flex; flex-direction: column; gap: 0.55rem; }

.dinner-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
    font-size: 0.88rem;
    color: var(--muted);
}

.dinner-card.today {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.dinner-card .day-label {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text);
    margin-bottom: 0.3rem;
}

.dinner-card.today .day-label { color: var(--accent); }

.dinner-card .today-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: var(--accent);
    color: var(--bg);
    padding: 0.15rem 0.45rem;
    border-radius: 0.25rem;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.grocery-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.btn-reset {
    flex-shrink: 0;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.45rem 0.75rem;
    border-radius: 0.4rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
}

.btn-reset:active { background: var(--surface-2); }

.grocery-category { margin-bottom: 1.25rem; }

.grocery-category h3 {
    font-family: 'Oswald', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
}

.grocery-list { list-style: none; }

.grocery-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.grocery-item:last-child { border-bottom: none; }

.grocery-item input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.check-box {
    flex-shrink: 0;
    width: 1.35rem;
    height: 1.35rem;
    border: 2px solid var(--border);
    border-radius: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.1rem;
    transition: background 0.15s, border-color 0.15s;
}

.grocery-item input:checked + .check-box {
    background: var(--success);
    border-color: var(--success);
}

.grocery-item input:checked + .check-box::after {
    content: '';
    width: 0.35rem;
    height: 0.6rem;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translateY(-1px);
}

.grocery-item input:checked ~ .item-text {
    color: var(--muted);
    text-decoration: line-through;
    opacity: 0.55;
}

.item-text {
    font-size: 0.92rem;
    line-height: 1.4;
}

.grocery-note {
    font-size: 0.8rem;
    color: var(--muted);
    font-style: italic;
    padding: 0.5rem 0;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: calc(var(--nav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(10, 10, 11, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    background: none;
    border: none;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0.5rem;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s;
}

.nav-btn .nav-icon {
    font-size: 1.05rem;
    line-height: 1;
    font-family: system-ui, sans-serif;
}

.nav-btn[aria-selected="true"],
.nav-btn.active { color: var(--accent); }

.nav-btn:active { opacity: 0.7; }

@media (min-width: 480px) {
    .top-bar h1 { font-size: 2.25rem; }
    .card, .meal-card, .workout-day { border-radius: 0.85rem; }
}

@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;
    }
}

@media print {
    .top-bar,
    .bottom-nav,
    .btn-reset { display: none !important; }

    body {
        background: #fff;
        color: #000;
        padding-bottom: 0;
    }

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

    #panel-grocery {
        display: block !important;
    }

    .grocery-item input:checked ~ .item-text {
        text-decoration: line-through;
        opacity: 0.5;
    }

    .check-box {
        border: 2px solid #000;
        print-color-adjust: exact;
    }
}
