html {
    background: var(--bg);
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
}

.page {
    background: transparent;
}

.mobile-shell {
    position: relative;
}

.hero-card {
    min-height: 148px;
    border: 1px solid rgba(255,255,255,0.16);
    box-shadow: 0 18px 44px rgba(var(--accent-rgb),0.2);
    isolation: isolate;
}

/* text column must flex instead of being crushed by the logo on small screens */
.hero-card > div:first-child {
    flex: 1;
    min-width: 0;
}
.hero-card .eyebrow { white-space: nowrap; }
@media (max-width: 480px) {
    .hero-logo img { height: 92px; }
    .hero-card h1 { font-size: 18px; }
    .hero-card p { font-size: 12px; }
}

.hero-card::before {
    content: '';
    position: absolute;
    width: 210px;
    height: 210px;
    left: -92px;
    bottom: -132px;
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 50%;
    box-shadow: 0 0 0 26px rgba(255,255,255,0.04), 0 0 0 54px rgba(255,255,255,0.03);
    pointer-events: none;
}

.hero-card::after {
    z-index: -1;
    width: 190px;
    height: 190px;
    top: -104px;
    right: -68px;
    background: rgba(255,255,255,0.12);
}

.hero-icon {
    width: 68px !important;
    height: 68px !important;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 22px !important;
    background: rgba(255,255,255,0.14) !important;
    color: var(--on-accent);
    font-size: 34px !important;
    z-index: 1;
}

.section-card,
.stat-card,
.list-card,
.meal-card,
.login-card,
.auth-card,
.modal-card,
.shop-card,
.product-card {
    box-shadow: var(--shadow);
}

.section-card {
    background: linear-gradient(180deg, var(--card) 0%, var(--bg2) 180%);
}

.section-title {
    min-height: 30px;
}

.section-title h2 {
    letter-spacing: -0.2px;
}

.stat-card,
.admin-menu-item,
.shop-card,
.product-card {
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.stat-card:hover,
.admin-menu-item:hover,
.shop-card:hover,
.product-card:hover {
    transform: translateY(-3px);
    border-color: rgba(var(--accent-rgb),0.55);
    box-shadow: 0 14px 30px rgba(var(--accent-rgb),0.12);
}

.thumb-avatar,
.quick-stat-icon {
    font-size: 20px !important;
    background: var(--icon-bg) !important;
    border: 1px solid var(--line);
}

.bottom-nav {
    background: var(--card);
    background: color-mix(in srgb, var(--card) 88%, transparent);
    border-color: var(--line-strong);
    box-shadow: 0 16px 36px rgba(0,0,0,0.22);
    backdrop-filter: blur(22px) saturate(1.3);
}

.bottom-nav a {
    min-width: 56px;
    color: var(--muted);
}

.bottom-nav a.active,
.bottom-nav a:hover {
    color: var(--lime);
    background: rgba(var(--accent-rgb),0.12);
}

.theme-switcher {
    top: 16px;
    left: 14px;
    /* kill the leftover bottom/right from fitbody.css — with all four
       insets set the fixed wrapper stretches across the whole viewport
       and swallows taps on mobile */
    right: auto;
    bottom: auto;
    /* the wrapper itself must never intercept clicks; only the open panel
       becomes interactive (it already sets pointer-events: auto) */
    pointer-events: none;
}

.theme-btn {
    position: relative;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(var(--accent-rgb),0.35);
    background: linear-gradient(145deg, var(--card2), var(--card));
    color: var(--lime);
    box-shadow: 0 12px 28px rgba(0,0,0,0.2), 0 0 0 5px rgba(var(--accent-rgb),0.06);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.theme-btn svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.theme-btn-indicator {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 8px;
    height: 8px;
    border: 2px solid var(--card);
    border-radius: 50%;
    background: var(--lime);
}

.theme-btn-indicator[data-theme="lime"] { background: #c9f052; }
.theme-btn-indicator[data-theme="orange"] { background: #ff8a32; }
.theme-btn-indicator[data-theme="blue"] { background: #256fe8; }

.theme-btn:hover,
.theme-btn:focus-visible {
    border-color: var(--lime);
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(0,0,0,0.24), 0 0 0 6px rgba(var(--accent-rgb),0.1);
}

.theme-panel {
    display: flex;
    width: min(286px, calc(100vw - 28px));
    min-width: 0;
    padding: 14px;
    gap: 7px;
    border-color: var(--line-strong);
    background: var(--card);
    background: color-mix(in srgb, var(--card) 94%, transparent);
    box-shadow: 0 22px 54px rgba(0,0,0,0.26);
    backdrop-filter: blur(24px) saturate(1.25);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px) scale(0.97);
    transform-origin: top left;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.theme-panel.theme-panel-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.theme-panel-heading {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 2px 4px 9px;
    border-bottom: 1px solid var(--line);
}

.theme-panel-kicker {
    color: var(--lime);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.8px;
}

.theme-panel-heading strong {
    color: var(--text);
    font-size: 15px;
    font-weight: 800;
}

.theme-panel-heading small {
    color: var(--muted);
    font-size: 11px;
}

.theme-option {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 22px;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 7px 8px;
    border: 1px solid transparent;
    border-radius: 15px;
    text-align: right;
}

.theme-option:hover,
.theme-option:focus-visible {
    background: var(--card2);
    border-color: var(--line-strong);
    outline: none;
}

.theme-option.theme-option-active {
    background: rgba(var(--accent-rgb),0.1);
    border-color: rgba(var(--accent-rgb),0.36);
    color: var(--text);
}

.theme-preview {
    width: 42px;
    height: 34px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.theme-preview::before,
.theme-preview::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}

.theme-preview::before {
    width: 20px;
    height: 20px;
    top: -5px;
    right: -5px;
    background: rgba(255,255,255,0.14);
}

.theme-preview::after {
    width: 18px;
    height: 4px;
    right: 6px;
    bottom: 6px;
    background: rgba(255,255,255,0.35);
    border-radius: 6px;
}

.theme-preview-lime { background: linear-gradient(135deg, #101714 0 60%, #c9f052 60%); }
.theme-preview-orange { background: linear-gradient(135deg, #131316 0 60%, #ff8a32 60%); }
.theme-preview-blue { background: linear-gradient(135deg, #ffffff 0 60%, #256fe8 60%); }

.theme-option-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.theme-option-copy strong {
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.theme-option-copy small {
    color: var(--muted);
    font-size: 10px;
}

.theme-check {
    display: grid;
    place-items: center;
    width: 21px;
    height: 21px;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: transparent;
    font-size: 12px;
    font-weight: 900;
}

.theme-option-active .theme-check {
    border-color: var(--lime);
    background: var(--lime);
    color: var(--on-accent);
}

:where(button, a, input, select, textarea):focus-visible {
    outline: 3px solid rgba(var(--accent-rgb),0.32);
    outline-offset: 2px;
}

@media (min-width: 768px) {
    .mobile-shell {
        width: min(100%, 1000px);
        padding: 32px 28px 132px;
    }

    .hero-card {
        min-height: 166px;
        padding: 30px 28px;
    }

    .section-card {
        padding: 24px;
    }

    .admin-menu-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 14px;
    }

    .bottom-nav {
        bottom: 24px;
    }

    .theme-switcher {
        right: 24px;
        top: 16px;
        left: auto;
    }

    .theme-panel {
        right: 0;
        left: auto;
        transform-origin: top right;
    }

    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .shop-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1100px) {
    .admin-menu-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@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;
    }
}
