:root {
    --primary: #C62828;
    --primary-dark: #B71C1C;
    --primary-light: #FFEBEE;
    --accent: #FF5252;
    --danger: #f44336;
    --bg: #f5f5f5;
    --surface: #ffffff;
    --text: #212121;
    --text-secondary: #757575;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --radius: 16px;
    --protein-color: #2196F3;
    --carbs-color: #FF9800;
    --fat-color: #f44336;
    --fiber-color: #8BC34A;
    --success: #4CAF50;
    --surface-alt: #f0f0f0;
    --nav-height: 64px;
    --header-height: 56px;
    /* Premium design tokens */
    --glass-bg: rgba(255,255,255,0.72);
    --glass-border: rgba(255,255,255,0.35);
    --glass-blur: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.05);
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] {
    --bg: #0a0a0f;
    --surface: #16161e;
    --surface-alt: #1e1e2a;
    --success: #66BB6A;
    --text: #eaeaf0;
    --text-secondary: #9898b0;
    --border: rgba(255,255,255,0.08);
    --shadow: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
    --primary-light: #3e1e10;
    --glass-bg: rgba(22,22,30,0.75);
    --glass-border: rgba(255,255,255,0.06);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0a0a0f;
        --surface: #16161e;
        --surface-alt: #1e1e2a;
        --success: #66BB6A;
        --text: #eaeaf0;
        --text-secondary: #9898b0;
        --border: rgba(255,255,255,0.08);
        --shadow: 0 2px 8px rgba(0,0,0,0.4);
        --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
        --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
        --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
        --primary-light: #3e1e10;
        --glass-bg: rgba(22,22,30,0.75);
        --glass-border: rgba(255,255,255,0.06);
        color-scheme: dark;
    }
}

/* Dark mode overrides for elements with hardcoded colors */
[data-theme="dark"] header,
:root:not([data-theme="light"]) header { background: linear-gradient(135deg, #B71C1C, #8B2500); }

[data-theme="dark"] nav,
:root:not([data-theme="light"]) nav { background: var(--surface); border-top-color: var(--border); }

[data-theme="dark"] .card,
[data-theme="dark"] .meal-card,
[data-theme="dark"] .profile-stat,
[data-theme="dark"] .shop-item,
[data-theme="dark"] .equip-slot,
[data-theme="dark"] .modal-content {
    background: var(--glass-bg);
    border-color: var(--glass-border);
}

[data-theme="dark"] .btn-outline { border-color: var(--border); color: var(--text); }
[data-theme="dark"] .btn-secondary { background: var(--surface-alt, #2a2a2a); color: var(--text); border-color: var(--border); }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea {
    background: var(--surface-alt, #2a2a2a); color: var(--text); border-color: var(--border);
}
[data-theme="dark"] .avatar-card { background: var(--surface); }
[data-theme="dark"] .cust-card { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .cust-card.sel { background: var(--primary-light); border-color: var(--primary); }

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

/* Accessibility: focus visible */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}
button:focus:not(:focus-visible) { outline: none; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    letter-spacing: -0.01em;
}

/* Animated premium background */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 20% 50%, rgba(230,74,25,0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 20%, rgba(255,193,7,0.05) 0%, transparent 50%),
                radial-gradient(ellipse at 50% 80%, rgba(33,150,243,0.04) 0%, transparent 50%);
    animation: meshFloat 20s ease-in-out infinite;
    z-index: -1;
    pointer-events: none;
    will-change: transform;
}

@keyframes meshFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(2%, -1%) rotate(1deg); }
    66% { transform: translate(-1%, 2%) rotate(-1deg); }
}

#app {
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
}

/* Header */
#app-header {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding-left: 16px;
    padding-right: 16px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 20px rgba(230,74,25,0.15);
}

#app-header h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.header-btn {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.header-btn:active {
    background: rgba(255,255,255,0.2);
}

/* Main content */
#page-content {
    padding-top: calc(var(--header-height) + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--nav-height) + 16px);
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100%;
}

/* Bottom Navigation */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    height: var(--nav-height);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    display: flex;
    align-items: center;
    justify-content: space-around;
    border-top: 1px solid var(--glass-border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 10px;
    cursor: pointer;
    padding: 8px 12px;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 1;
    min-width: 56px;
}

.nav-btn.active {
    color: var(--primary);
    font-weight: 600;
}

/* Nav indicator pill */
.nav-indicator {
    position: absolute;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
    height: 3px;
    width: 32px;
    background: var(--primary);
    border-radius: 3px;
    transition: left 0.35s var(--transition-smooth), width 0.2s var(--transition-smooth);
    box-shadow: 0 0 8px rgba(230,74,25,0.4);
}

.nav-btn span {
    font-weight: 500;
}

.fab-trigger {
    padding: 0 !important;
    z-index: 2;
    overflow: visible;
}

.fab-circle {
    width: 54px;
    height: 54px;
    background: linear-gradient(135deg, var(--primary), #EF5350);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -20px;
    box-shadow: 0 4px 18px rgba(230, 74, 25, 0.45);
    transition: transform 0.3s var(--transition-spring), background 0.3s;
    animation: fabBreathe 3s ease-in-out infinite;
}

@keyframes fabBreathe {
    0%, 100% { box-shadow: 0 4px 18px rgba(230, 74, 25, 0.35); }
    50% { box-shadow: 0 6px 28px rgba(230, 74, 25, 0.55); }
}

.fab-circle:active {
    transform: scale(0.9);
}

.fab-menu.open .fab-circle {
    transform: rotate(45deg);
    background: var(--danger);
}

/* FAB Menu */
.fab-menu {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    height: 100%;
    z-index: 99;
    pointer-events: none;
}

.fab-menu.open {
    pointer-events: auto;
}

.fab-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s;
}

.fab-menu.open .fab-overlay {
    opacity: 1;
}

.fab-options {
    position: absolute;
    bottom: calc(var(--nav-height) + 16px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    transform: translateX(-50%) translateY(20px);
}

.fab-menu.open .fab-options {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.fab-option {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 12px 24px;
    font-size: 15px;
    color: var(--text);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    white-space: nowrap;
    transition: transform 0.2s var(--transition-spring);
}

.fab-option:active {
    transform: scale(0.95);
}

.fab-icon {
    font-size: 22px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: calc(var(--nav-height) + 20px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30,30,40,0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: white;
    padding: 12px 24px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    z-index: 200;
    transition: opacity 0.3s var(--transition-smooth), transform 0.3s var(--transition-smooth);
    max-width: 90%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,0.08);
}

.toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    pointer-events: none;
}

/* Cards */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 16px;
    margin: 12px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 0 1px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:active {
    transform: scale(0.98);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

/* Circular Progress */
.circular-progress {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto;
}

.circular-progress.compact {
    width: 120px;
    height: 120px;
}

.circular-progress svg {
    transform: rotate(-90deg);
}

.circular-progress .progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.compact .calories-value {
    font-size: 22px !important;
}
.compact .calories-label {
    font-size: 11px !important;
}

.progress-text .calories-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

.progress-text .calories-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Macro Bars */
.macro-bars {
    display: flex;
    gap: 16px;
    justify-content: space-around;
    margin-top: 16px;
}

.macro-bars.compact {
    gap: 8px;
    margin-top: 8px;
}
.macro-bars.compact .macro-bar-label { font-size: 10px; }
.macro-bars.compact .macro-bar-value { font-size: 11px; }

.macro-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.macro-bar-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.macro-bar-track {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.macro-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.macro-bar-fill.protein { background: var(--protein-color); }
.macro-bar-fill.carbs { background: var(--carbs-color); }
.macro-bar-fill.fat { background: var(--fat-color); }

.macro-bar-value {
    font-size: 13px;
    font-weight: 600;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 12px;
    margin: 16px;
}

.quick-actions.compact {
    gap: 8px;
    margin: 8px 16px;
}

.quick-action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    transition: transform 0.25s var(--transition-spring), box-shadow 0.25s var(--transition-smooth);
}

.quick-action-btn:active {
    transform: scale(0.95);
}
.water-action-btn:active {
    transform: none !important;
}

.quick-action-btn .icon {
    font-size: 24px;
}

/* Date Selector */
.date-selector-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 16px;
    position: relative;
}

.date-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, opacity 0.2s;
}

.date-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.date-label-btn {
    border: none;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 8px 18px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.date-label-btn .date-chevron {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Meal Cards */
.meal-section {
    margin: 12px 16px;
}

.meal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.meal-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.meal-icon {
    font-size: 22px;
}

.meal-name {
    font-weight: 600;
    font-size: 15px;
}

.meal-calories {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.meal-add-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-light);
    border: none;
    color: var(--primary-dark);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.meal-chevron {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
    transform: rotate(90deg);
    display: inline-block;
    line-height: 1;
}

.meal-section.collapsed .meal-chevron {
    transform: rotate(0deg);
}

.meal-section.collapsed .meal-header {
    border-radius: var(--radius);
    border-bottom: 1px solid var(--glass-border);
}

.meal-item-count {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.meal-items {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.meal-section.collapsed .meal-items {
    display: none;
}

.food-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    gap: 12px;
    min-width: 0;
    overflow: hidden;
}

.food-item-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.food-item-name {
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.food-item-detail {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.food-item-calories {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.food-item-delete {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 4px;
    font-size: 18px;
    opacity: 0.6;
    flex-shrink: 0;
}

.food-item-delete:active {
    opacity: 1;
}

/* Search Page */
.search-container {
    padding: 16px;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 0 16px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
    transition: box-shadow 0.3s var(--transition-smooth), border-color 0.3s;
}

.search-bar:focus-within {
    box-shadow: var(--shadow-md), 0 0 0 2px rgba(230,74,25,0.15);
    border-color: rgba(230,74,25,0.3);
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    padding: 14px 8px;
    font-size: 15px;
    background: transparent;
    color: var(--text);
}

.search-bar svg {
    color: var(--text-secondary);
}

.search-clear-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    display: none;
}

/* Wheel Picker */
.wheel-picker-container {
    position: relative;
    height: 150px;
    overflow: hidden;
    border-radius: 12px;
    background: var(--bg);
    margin: 8px 0 12px;
}

.wheel-picker {
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 60px 0;
}

.wheel-picker::-webkit-scrollbar { display: none; }

.wheel-picker-item {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-secondary);
    scroll-snap-align: center;
    opacity: 0.4;
    transition: opacity 0.15s, transform 0.15s;
}

.wheel-picker-item.active {
    color: var(--text);
    opacity: 1;
    font-size: 28px;
}

.wheel-picker-mask {
    position: absolute;
    left: 0;
    right: 0;
    height: 55px;
    pointer-events: none;
    z-index: 1;
}

.wheel-picker-mask-top {
    top: 0;
    background: linear-gradient(to bottom, var(--bg), transparent);
}

.wheel-picker-mask-bottom {
    bottom: 0;
    background: linear-gradient(to top, var(--bg), transparent);
}

.wheel-picker-highlight {
    position: absolute;
    top: 50%;
    left: 16px;
    right: 16px;
    height: 42px;
    transform: translateY(-50%);
    border-top: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
    pointer-events: none;
    z-index: 1;
}

.wheel-picker-unit {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    z-index: 2;
    pointer-events: none;
}

/* Water Glasses — Foodvisor style */
.water-progress-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 10px;
}
.water-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4FC3F7, #0288D1);
    border-radius: 2px;
    transition: width 0.3s ease;
}
.water-glasses {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}
.water-glass {
    width: 22px;
    height: 28px;
    cursor: pointer;
    transition: transform 0.15s;
    user-select: none;
    border: none;
    background: none;
    padding: 0;
    flex-shrink: 0;
}
.water-glass:hover { transform: scale(1.15); }
.water-glass:active { transform: scale(1.25); }
.water-glass.just-filled { animation: glassPop 0.35s ease; }
@keyframes glassPop {
    0% { transform: scale(0.7); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}
.water-add-btn {
    width: 24px;
    height: 24px;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    transition: transform 0.15s;
    flex-shrink: 0;
    margin-left: 4px;
}
.water-add-btn:hover { transform: scale(1.15); }
.water-add-btn:active { transform: scale(1.25); }

.category-chips-wrapper {
    position: relative;
    max-width: 100%;
    overflow: hidden;
}

.category-chips-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 48px;
    height: calc(100% - 12px);
    background: linear-gradient(to right, transparent, var(--bg));
    pointer-events: none;
    z-index: 1;
}

.category-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.category-chips::-webkit-scrollbar { display: none; }

/* Desktop: show thin scrollbar + navigation arrows */
@media (min-width: 768px) {
    .category-chips {
        scrollbar-width: thin;
        scrollbar-color: var(--border) transparent;
    }
    .category-chips::-webkit-scrollbar { display: block; height: 4px; }
    .category-chips::-webkit-scrollbar-track { background: transparent; }
    .category-chips::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
    .category-chips::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

    .cat-scroll-btn {
        position: absolute;
        top: 0;
        width: 32px;
        height: calc(100% - 12px);
        border: none;
        background: linear-gradient(to right, var(--bg) 60%, transparent);
        color: var(--text);
        font-size: 18px;
        cursor: pointer;
        z-index: 2;
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0.8;
        transition: opacity 0.2s;
    }
    .cat-scroll-btn:hover { opacity: 1; }
    .cat-scroll-btn.right {
        right: 0;
        background: linear-gradient(to left, var(--bg) 60%, transparent);
    }
    .cat-scroll-btn.left { left: 0; }
}
@media (max-width: 767px) {
    .cat-scroll-btn { display: none; }
}

.category-chip {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    color: var(--text);
    transition: all 0.2s;
}

.category-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.search-results {
    margin-top: 8px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: var(--radius);
    margin-bottom: 8px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s;
}

.search-result-item:active {
    transform: scale(0.98);
}

/* Food category thumbnail */
.food-thumb {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.result-info {
    flex: 1;
    min-width: 0;
}

.result-name {
    font-size: 15px;
    font-weight: 500;
}

.result-detail {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.result-cal {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

.fav-star-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    opacity: 0.4;
    transition: opacity 0.2s, transform 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.fav-star-btn.active {
    opacity: 1;
}

.fav-star-btn:active {
    transform: scale(1.3);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal-overlay.show {
    opacity: 1;
}

.modal-content {
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 500px;
    padding: 24px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 80vh;
    overflow-y: auto;
}

/* Desktop: keep bottom-sheet style (same as mobile) within the 500px container */
@media (min-width: 768px) {
    .modal-content {
        max-width: 500px;
    }
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

.modal-handle {
    width: 48px;
    height: 5px;
    background: var(--text-secondary);
    border-radius: 3px;
    margin: 0 auto 12px;
    cursor: grab;
    opacity: 0.5;
    transition: opacity 0.2s, width 0.2s;
}

.modal-handle:active {
    cursor: grabbing;
    opacity: 0.8;
    width: 56px;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

/* Form Elements */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-size: 16px; /* 16px prevents iOS auto-zoom on focus */
    min-height: 48px;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230,74,25,0.12);
}

.form-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.form-input:focus {
    border-color: var(--primary);
}

.weight-input {
    font-size: 28px !important;
    text-align: center;
    font-weight: 700;
    padding: 14px 16px !important;
    border: 2px solid var(--primary-light) !important;
    border-radius: 12px;
    letter-spacing: 1px;
    width: 100% !important;
    box-sizing: border-box;
    min-width: 0;
    height: auto !important;
}

.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    background: var(--bg);
    color: var(--text);
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23757575' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #EF5350);
    color: white;
    width: 100%;
    box-shadow: 0 4px 16px rgba(230,74,25,0.3);
}

.btn-primary:active {
    background: var(--primary-dark);
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

/* Grammage input */
.grammage-input {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}

.grammage-input button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}

.grammage-input input {
    width: 80px;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--text);
    outline: none;
}

.grammage-unit {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Nutrition preview */
.nutrition-preview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 16px 0;
}

.nutrition-item {
    text-align: center;
    padding: 10px;
    background: var(--bg);
    border-radius: 10px;
}

.nutrition-item-value {
    font-size: 18px;
    font-weight: 700;
    display: block;
}

.nutrition-item-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.nutrition-item.cal .nutrition-item-value { color: var(--primary); }
.nutrition-item.prot .nutrition-item-value { color: var(--protein-color); }
.nutrition-item.carb .nutrition-item-value { color: var(--carbs-color); }
.nutrition-item.fat .nutrition-item-value { color: var(--fat-color); }

/* Camera Page */
.camera-container {
    padding: 16px;
    text-align: center;
}

.camera-preview {
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    margin-bottom: 16px;
}

.camera-preview video,
.camera-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-preview canvas {
    display: none;
}

.camera-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 16px 0;
}

.camera-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid var(--primary);
    background: white;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s;
}

.camera-btn:active {
    transform: scale(0.9);
}

.camera-btn-inner {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Voice Page */
.voice-container {
    padding: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: calc(100vh - var(--header-height) - var(--nav-height));
    justify-content: center;
    gap: 8px;
}

/* Wrapper for mic + animated rings */
.voice-btn-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px 0;
}

.voice-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 36px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(230,74,25,0.35);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.voice-btn:active {
    transform: scale(0.92);
}

.voice-btn.recording {
    background: var(--danger);
    box-shadow: 0 6px 24px rgba(244,67,54,0.5);
    transform: scale(1.05);
}

/* Expanding rings — Snap/WhatsApp style */
.voice-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid var(--primary);
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}
.voice-ring-1 { width: 80px; height: 80px; }
.voice-ring-2 { width: 80px; height: 80px; }
.voice-ring-3 { width: 80px; height: 80px; }

.voice-btn-wrapper.recording .voice-ring {
    border-color: var(--danger);
}
.voice-btn-wrapper.recording .voice-ring-1 {
    animation: voice-ripple 1.5s ease-out 0s infinite;
}
.voice-btn-wrapper.recording .voice-ring-2 {
    animation: voice-ripple 1.5s ease-out 0.4s infinite;
}
.voice-btn-wrapper.recording .voice-ring-3 {
    animation: voice-ripple 1.5s ease-out 0.8s infinite;
}

@keyframes voice-ripple {
    0% {
        width: 80px; height: 80px;
        opacity: 0.5;
    }
    100% {
        width: 160px; height: 160px;
        opacity: 0;
    }
}

.voice-text {
    font-size: 15px;
    color: var(--text-secondary);
    min-height: 24px;
    transition: all 0.2s;
    max-width: 300px;
    line-height: 1.4;
}

/* Timer bar */
.voice-timer-bar {
    width: 80%;
    max-width: 260px;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    display: flex;
    align-items: center;
    position: relative;
    margin-bottom: 8px;
}
.voice-timer-fill {
    height: 100%;
    background: var(--danger);
    border-radius: 3px;
    width: 0%;
    transition: width 0.5s linear;
}
.voice-timer-text {
    position: absolute;
    right: -36px;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

.voice-result {
    width: 100%;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-top: 12px;
    text-align: left;
}

/* Responsive: smaller devices */
@media (max-width: 360px) {
    .voice-btn { width: 70px; height: 70px; font-size: 30px; }
    .voice-ring-1, .voice-ring-2, .voice-ring-3 { width: 70px; height: 70px; }
    @keyframes voice-ripple {
        0% { width: 70px; height: 70px; opacity: 0.5; }
        100% { width: 140px; height: 140px; opacity: 0; }
    }
}

/* Profile Page */
.profile-container {
    padding: 16px;
}

.profile-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px auto;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 16px 0;
}

.profile-stat {
    text-align: center;
    padding: 12px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.profile-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.profile-stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--surface);
    border-radius: var(--radius);
    margin-bottom: 8px;
    box-shadow: var(--shadow);
    cursor: pointer;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 15px;
    color: var(--text);
}

.profile-menu-item svg {
    color: var(--text-secondary);
}

/* Legacy water tracker (unused — SVG-based glasses defined above at .water-glasses) */
.water-tracker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 16px 0;
    flex-wrap: nowrap;
}

/* History Page */
.history-container {
    padding: 16px;
}

.period-tabs {
    display: flex;
    background: var(--surface);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.period-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.period-tab.active {
    background: var(--primary);
    color: white;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-card-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.stat-card-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.chart-container {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.chart-container canvas {
    max-height: 200px;
}

/* Settings Page */
.settings-container {
    padding: 16px;
}

.settings-group {
    margin-bottom: 24px;
}

.settings-group-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 8px;
    padding-left: 4px;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--surface);
    margin-bottom: 2px;
    font-size: 15px;
    cursor: pointer;
    border: none;
    width: 100%;
    text-align: left;
    color: var(--text);
}

.settings-item:first-of-type {
    border-radius: var(--radius) var(--radius) 0 0;
}

.settings-item:last-of-type {
    border-radius: 0 0 var(--radius) var(--radius);
    margin-bottom: 0;
}

.settings-item:only-of-type {
    border-radius: var(--radius);
}

/* Toggle Switch */
.toggle {
    width: 48px;
    height: 28px;
    background: var(--border);
    border-radius: 14px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle.active {
    background: var(--primary);
}

.toggle::after {
    content: '';
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle.active::after {
    transform: translateX(20px);
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 24px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Barcode Page */
.barcode-container {
    padding: 8px 16px;
    text-align: center;
}

.barcode-scanner {
    width: 100%;
    aspect-ratio: 1/1;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    margin-bottom: 12px;
}

.barcode-scanner video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-line {
    position: absolute;
    top: 50%;
    left: 10%;
    width: 80%;
    height: 2px;
    background: var(--danger);
    animation: scanLine 2s ease-in-out infinite;
}

@keyframes scanLine {
    0%, 100% { top: 30%; }
    50% { top: 70%; }
}

/* AI Result Card */
.ai-result-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin: 16px 0;
    border-left: 4px solid var(--primary);
}

.ai-result-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.ai-result-weight {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* Streak badge */
.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #FF9800, #FF5722);
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state-text {
    font-size: 15px;
}

/* Scroll animation */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== MICRO-ANIMATIONS (Reco #4) ===== */

/* Success checkmark animation */
.success-check {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    animation: checkPop 0.6s ease forwards;
    pointer-events: none;
}

.success-check svg {
    width: 40px;
    height: 40px;
    stroke: white;
    stroke-width: 3;
    fill: none;
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: drawCheck 0.4s 0.2s ease forwards;
}

@keyframes checkPop {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    70% { transform: translate(-50%, -50%) scale(0.95); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

@keyframes drawCheck {
    to { stroke-dashoffset: 0; }
}

/* Food item add animation */
.food-item-added {
    animation: slideInRight 0.35s ease;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Food item remove animation */
.food-item-removing {
    animation: slideOutLeft 0.3s ease forwards;
}

@keyframes slideOutLeft {
    to { opacity: 0; transform: translateX(-30px); height: 0; padding: 0; margin: 0; overflow: hidden; }
}

/* Calorie counter bump */
.cal-bump {
    animation: calBump 0.4s ease;
}

@keyframes calBump {
    0% { transform: scale(1); }
    40% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* Button ripple */
.btn-primary:active, .quick-action-btn:active, .fab-option:active {
    transform: scale(0.95);
}

/* Toast slide-up improved */
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Streak badge entrance */
.streak-badge {
    animation: streakIn 0.5s ease;
}

@keyframes streakIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

/* ===== ONBOARDING ===== */
.onboarding-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: white;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 500px;
    margin: 0 auto;
}

[data-theme="dark"] .onboarding-overlay {
    background: #121212;
}

.onboarding-step {
    width: 100%;
    padding: 32px 24px;
    text-align: center;
    animation: fadeIn 0.4s ease;
}

.onboarding-step .ob-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.onboarding-step h2 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text);
}

.onboarding-step p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.onboarding-progress {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.onboarding-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.3s;
}

.onboarding-dot.active {
    background: var(--primary);
    width: 28px;
    border-radius: 5px;
}

/* ===== PROFILE GOALS PERCENTAGE ===== */
.macro-pct-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.macro-pct-row .form-group {
    flex: 1;
    margin: 0;
}

.macro-pct-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    color: white;
    min-width: 36px;
    text-align: center;
}

.macro-pct-badge.prot { background: var(--protein-color); }
.macro-pct-badge.carb { background: var(--carbs-color); }
.macro-pct-badge.fat { background: var(--fat-color); }

.macro-sync-info {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ========== QUANTITY INPUT ========== */
.quantity-input {
    margin-bottom: 12px;
}

.quantity-input .form-label {
    margin-bottom: 6px;
}

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

.qty-row button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    background: transparent;
    color: var(--primary);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.qty-row button:active {
    background: var(--primary);
    color: white;
}

.qty-row input {
    width: 50px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 4px;
    background: var(--surface);
    color: var(--text);
}

.qty-label {
    font-size: 14px;
    color: var(--text-secondary);
    flex: 1;
}

#qty-total {
    font-weight: 600;
    color: var(--primary);
}

/* ========== SECTION HEADERS ========== */
.section-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding-left: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ========== SUGGESTION CHIPS ========== */
.suggestion-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.suggestion-chips::-webkit-scrollbar {
    display: none;
}

.suggestion-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    background: var(--primary-light);
    color: var(--text);
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
}

.suggestion-chip:active {
    background: var(--primary);
    color: white;
}

[data-theme="dark"] .suggestion-chip {
    background: #3d2e25;
}

/* ========== ONLINE RESULTS ========== */
.online-badge {
    font-size: 10px;
    font-weight: 600;
    background: var(--primary);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.online-item {
    border-left: 3px solid var(--primary);
}

/* ========== CUSTOM FOOD BADGE ========== */
.custom-badge {
    font-size: 10px;
    font-weight: 600;
    background: var(--accent);
    color: white;
    padding: 1px 5px;
    border-radius: 4px;
    vertical-align: middle;
}

/* ========== CUSTOM FOOD PAGE ========== */
.custom-food-container {
    padding: 0;
}

.custom-food-photo {
    margin-bottom: 16px;
}

.photo-placeholder {
    width: 100%;
    height: 150px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    background: var(--bg);
}

.photo-placeholder:active {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* ========== BARCODE READER OVERRIDES ========== */
#barcode-reader {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
}

#barcode-reader video {
    border-radius: 12px;
    object-fit: cover;
}

#barcode-reader #qr-shaded-region {
    border-color: rgba(255,255,255,0.5) !important;
}

#barcode-reader img[alt="Info icon"] {
    display: none;
}

#barcode-reader__dashboard_section {
    display: none !important;
}

#barcode-reader__dashboard_section_csr {
    display: none !important;
}

#barcode-reader__dashboard_section_swaplink {
    display: none !important;
}

/* ===== RESPONSIVE TABLET & DESKTOP (Reco #3) ===== */

/* Desktop: render same as mobile (phone-like centered container) */
@media (min-width: 768px) {
    #app {
        max-width: 500px;
        margin: 0 auto;
        box-shadow: 0 0 40px rgba(0,0,0,0.08);
        min-height: 100vh;
        position: relative;
    }

    #app-header,
    #bottom-nav {
        max-width: 500px;
    }

    /* Profile stats centered */
    .profile-container {
        max-width: 100%;
        margin: 0 auto;
    }
}

/* =============================================
   Creature Card (Dashboard compact)
   ============================================= */
.creature-card {
    margin: 0 0 8px;
    padding: 10px 16px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s;
}
.creature-card:active { transform: scale(0.98); }

.creature-card-inner {
    display: flex;
    align-items: center;
    gap: 16px;
}

.creature-card-svg {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
}

/* Flash button for camera/barcode */
.flash-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    z-index: 5;
    transition: background 0.2s;
}
.flash-btn:active {
    background: rgba(0,0,0,0.7);
}

.creature-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.creature-card-info {
    flex: 1;
    min-width: 0;
}

.creature-speech-bubble {
    background: var(--card-bg, var(--surface));
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
    position: relative;
    display: inline-block;
}

.creature-speech-bubble::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: var(--border);
}

.creature-card-name {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.creature-card-name span:first-child {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
}

.creature-card-coins {
    font-size: 12px;
    color: var(--accent);
    font-weight: 700;
}

.creature-xp-mini {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.creature-xp-bar-mini {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.creature-xp-fill-mini {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.creature-card-next {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Creature animations */
@keyframes creature-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes creature-sway {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(2deg); }
    75% { transform: rotate(-2deg); }
}

.creature-bounce {
    animation: creature-bounce 1s ease-in-out infinite;
}

.creature-sway {
    animation: creature-sway 2s ease-in-out infinite;
}

/* ===== SHOP ===== */
.shop-container {
    padding: 0 16px 24px;
}

.shop-coins-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--accent);
    border-radius: 20px;
    padding: 4px 12px;
    font-weight: 700;
    font-size: 14px;
    color: var(--accent);
}

.shop-avatar-preview {
    margin-bottom: 16px;
}

.shop-avatar-preview .creature-card {
    cursor: default !important;
}

/* Shop item double buttons (preview + buy) */
.shop-item-btns {
    display: flex;
    gap: 4px;
    width: 100%;
}

.shop-item-btn.preview {
    width: 32px;
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 12px;
}

.shop-category {
    margin-bottom: 16px;
}

.shop-category-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.shop-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
}

.shop-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    transition: all 0.2s;
}

.shop-item.equipped {
    border-color: var(--primary);
    background: var(--primary-light);
}

.shop-item.owned {
    border-color: var(--accent);
}

.shop-item.locked {
    opacity: 0.85;
}

.shop-item-emoji {
    font-size: 28px;
    line-height: 1;
}

.shop-item-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
}

.shop-item-btn {
    width: 100%;
    border: none;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.shop-item-btn.buy {
    background: var(--accent);
    color: #333;
}

.shop-item-btn.owned {
    background: var(--primary-light);
    color: var(--primary);
}

.shop-item-btn.equipped {
    background: var(--primary);
    color: white;
}

.shop-item-btn.locked {
    background: var(--border);
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* Shop item tiers */
.shop-item.tier-1 { border-left: 3px solid #9E9E9E; }
.shop-item.tier-2 { border-left: 3px solid #4FC3F7; }
.shop-item.tier-3 { border-left: 3px solid #AB47BC; }
.shop-item.tier-4 { border-left: 3px solid #FFC107; }
.shop-item.tier-4 .shop-item-name { color: #FFC107; font-weight: 700; }

/* ===== CREATURE PAGE ===== */
.creature-page {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--header-height) - var(--nav-height));
}

.creature-scene {
    padding: 20px 16px 16px;
    position: relative;
    overflow: visible;
}

.creature-display {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
    /* NO filter here — filter on container div creates visible rect artifact on mobile */
    /* drop-shadow is applied on SVG child only (via .creature-display svg) */
    animation: creature-float 4s ease-in-out infinite;
    overflow: visible;
    background: none;
    border: none;
    outline: none;
}

@keyframes creature-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.creature-identity {
    text-align: center;
    margin-bottom: 12px;
}

.creature-player-name {
    font-size: 20px;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.creature-species {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    text-shadow: 0 1px 4px rgba(0,0,0,0.2);
    margin-top: 2px;
}

/* Creature stats */
.creature-stats {
    background: var(--surface);
    border-radius: 16px;
    padding: 12px 16px;
    margin: 0 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.creature-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.creature-stat {
    text-align: center;
}

.creature-stat-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.creature-stat-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.creature-xp-section {
    margin-top: 4px;
}

.creature-xp-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

.creature-xp-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.creature-xp-text {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    font-weight: 600;
}

/* Creature tabs */
.creature-tabs {
    display: flex;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: var(--header-height);
    z-index: 10;
}

.creature-tab {
    flex: 1;
    padding: 10px 8px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.creature-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.creature-tab-content {
    flex: 1;
    padding: 12px 16px 80px;
    background: var(--bg);
}

.creature-shop-embed {
    /* Shop content already styled */
}

/* ===== ONBOARDING STARTER CHOICE ===== */
.starter-choice-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.starter-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 6px;
    border: 2px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    cursor: pointer;
    transition: all 0.2s;
}

.starter-card:active { transform: scale(0.95); }

.starter-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(230, 74, 25, 0.2);
    transform: scale(1.03);
}

.starter-card svg {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.starter-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

.starter-type {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Equipment grid */
.equip-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.equip-slot {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
}

.equip-slot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.equip-remove-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}

.equip-remove-btn:hover {
    background: var(--danger);
    color: white;
}

.equip-slot-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 8px;
    min-height: 44px;
}

.equip-slot-content.filled {
    background: var(--primary-light);
    border: 1px solid var(--primary);
}

.equip-slot-content.empty {
    background: var(--bg);
    border: 1px dashed var(--border);
}

.equip-slot-emoji {
    font-size: 24px;
}

.equip-slot-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.equip-slot-empty {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

.equip-alternatives {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.equip-alt-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.equip-alt-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* ===== AUTH BUTTONS ===== */
.ob-auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.ob-auth-btn.google {
    background: white;
    color: #333;
}

[data-theme="dark"] .ob-auth-btn.google {
    background: #2a1f1a;
    color: var(--text);
}

.ob-auth-btn.apple {
    background: black;
    color: white;
    border-color: #333;
}

/* ===== AUTO DARK MODE (@media) ===== */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .creature-scene {
        /* Dark mode scene handled by inline gradient */
    }
    :root:not([data-theme="light"]) header {
        background: linear-gradient(135deg, #B71C1C, #8B2500);
    }
    :root:not([data-theme="light"]) nav {
        background: var(--surface);
        border-top-color: var(--border);
    }
    :root:not([data-theme="light"]) .card,
    :root:not([data-theme="light"]) .meal-card,
    :root:not([data-theme="light"]) .profile-stat,
    :root:not([data-theme="light"]) .shop-item,
    :root:not([data-theme="light"]) .equip-slot,
    :root:not([data-theme="light"]) .modal-content {
        background: var(--surface);
        border-color: var(--border);
    }
    :root:not([data-theme="light"]) .btn-outline { border-color: var(--border); color: var(--text); }
    :root:not([data-theme="light"]) .btn-secondary { background: var(--surface-alt, #2a2a2a); color: var(--text); border-color: var(--border); }
    :root:not([data-theme="light"]) input,
    :root:not([data-theme="light"]) select,
    :root:not([data-theme="light"]) textarea {
        background: var(--surface-alt, #2a2a2a); color: var(--text); border-color: var(--border);
    }
    :root:not([data-theme="light"]) .creature-card { background: var(--surface); }
    :root:not([data-theme="light"]) .creature-stats { background: var(--surface); }
    :root:not([data-theme="light"]) .starter-card { background: var(--surface); border-color: var(--border); }
    :root:not([data-theme="light"]) .starter-card.selected { background: var(--primary-light); border-color: var(--primary); }
    :root:not([data-theme="light"]) .ob-auth-btn { background: #2a2a2a; color: var(--text); border-color: var(--border); }
    :root:not([data-theme="light"]) .settings-item { border-color: var(--border); }
    :root:not([data-theme="light"]) .settings-group { background: var(--surface); }
}

/* ===== TRIAL BANNER ===== */
.trial-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: linear-gradient(135deg, #FFF3E0, #FFE0B2);
    color: #E65100;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.trial-banner:active { opacity: 0.8; }
.trial-cta { font-size: 12px; opacity: 0.7; }

[data-theme="dark"] .trial-banner {
    background: linear-gradient(135deg, #3e2500, #4a2c00);
    color: #FFB74D;
}

/* ===== PAYWALL ===== */
.paywall-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--header-height) - var(--nav-height));
    padding: 20px;
}
.paywall-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 32px 24px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow);
}
.paywall-icon { font-size: 48px; margin-bottom: 12px; }
.paywall-card h2 { font-size: 22px; margin-bottom: 8px; color: var(--text); }
.paywall-card p { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }
.paywall-price {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-light), #FFF3E0);
    border-radius: 12px;
}
.paywall-amount {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary);
}
.paywall-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.paywall-features {
    text-align: left;
    margin: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.paywall-feature {
    font-size: 13px;
    padding: 4px 0;
    color: var(--text);
}
.paywall-btn {
    width: 100%;
    font-size: 18px !important;
    font-weight: 700 !important;
    padding: 16px !important;
    margin-top: 8px;
}
.paywall-secure {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 12px;
}
.paywall-sub-info {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.paywall-no-commitment {
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
    margin-top: 12px;
    margin-bottom: 2px;
}
.paywall-promo-badge {
    display: inline-block;
    background: linear-gradient(135deg, #C62828, #E53935);
    color: white;
    font-size: 12px;
    font-weight: 800;
    padding: 6px 16px;
    border-radius: 20px;
    margin: 12px 0 4px;
    letter-spacing: 0.5px;
    animation: pulse-promo 2s ease-in-out infinite;
}
@keyframes pulse-promo {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
.paywall-price-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.paywall-original-price {
    font-size: 18px;
    color: var(--text-secondary);
    text-decoration: line-through;
    font-weight: 500;
}

[data-theme="dark"] .paywall-price {
    background: linear-gradient(135deg, #3e1e10, #2a1500);
}

/* Paywall plan cards */
.paywall-plans {
    display: flex;
    gap: 10px;
    margin: 16px 0;
}
.paywall-plan {
    flex: 1;
    padding: 14px 10px;
    border: 2px solid var(--border);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    background: var(--bg);
}
.paywall-plan.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}
.paywall-plan-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 10px;
    border-radius: 10px;
    white-space: nowrap;
    letter-spacing: 0.3px;
}
.paywall-plan-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.paywall-plan-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 2px;
}
.paywall-plan .paywall-amount {
    font-size: 24px;
}
.paywall-plan .paywall-period {
    font-size: 13px;
    color: var(--text-secondary);
}
.paywall-plan-detail {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.paywall-free-features {
    text-align: left;
    margin: 8px 0 16px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
.paywall-free-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
[data-theme="dark"] .paywall-plan {
    background: var(--surface);
}
[data-theme="dark"] .paywall-plan.selected {
    background: rgba(230, 74, 25, 0.15);
}

/* ===== LOGIN SCREEN ===== */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--bg);
}

.login-card {
    width: 100%;
    max-width: 380px;
    text-align: center;
    padding: 32px 24px;
}

.login-logo {
    margin-bottom: 16px;
}

.login-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.login-methods {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text);
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn.google {
    background: white;
    color: #333;
    border-color: #ddd;
}

.login-btn.apple {
    background: #000;
    color: white;
    border-color: #000;
}

.login-btn.email {
    background: var(--surface);
    color: var(--text);
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 4px 0;
}

.login-divider-line {
    flex: 1;
    height: 1px;
    background: var(--border);
}

.login-divider span {
    font-size: 12px;
    color: var(--text-secondary);
}

.login-email-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-email-form.hidden {
    display: none;
}

.login-btn-submit {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 13px;
    cursor: pointer;
    padding: 8px;
}

/* ===== R2: MICRO-ANIMATIONS FEEDBACK ===== */

/* Water drop fill animation */
.water-drop.just-filled {
    animation: waterDropPop 0.4s ease;
}
@keyframes waterDropPop {
    0% { transform: scale(1); }
    30% { transform: scale(1.4); }
    60% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* Water goal confetti burst */
.water-goal-reached {
    position: relative;
}
.water-goal-reached::after {
    content: '🎉';
    position: absolute;
    top: -20px;
    right: 10px;
    font-size: 24px;
    animation: confettiBurst 1s ease forwards;
    pointer-events: none;
}
@keyframes confettiBurst {
    0% { opacity: 0; transform: scale(0) translateY(0); }
    30% { opacity: 1; transform: scale(1.3) translateY(-10px); }
    100% { opacity: 0; transform: scale(1) translateY(-40px); }
}

/* Gym workout logged — confetti burst on today card (mirrors water-goal-reached) */
.gym-goal-reached {
    position: relative;
}
.gym-goal-reached::after {
    content: '💪';
    position: absolute;
    top: -20px;
    right: 10px;
    font-size: 24px;
    animation: confettiBurst 1s ease forwards;
    pointer-events: none;
}
/* Gym button pulse on log */
.gym-workout-logged {
    animation: gymBtnPulse 0.6s ease-out !important;
}
@keyframes gymBtnPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(76,175,80,0.5); }
    40% { transform: scale(1.1); box-shadow: 0 0 0 12px rgba(76,175,80,0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(76,175,80,0); }
}

/* Food item slide-in when added */
.food-item-added {
    animation: foodSlideIn 0.35s ease-out;
}
@keyframes foodSlideIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Calorie counter pulse on update */
.cal-pulse {
    animation: calPulse 0.5s ease;
}
@keyframes calPulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.12); color: var(--primary); }
    100% { transform: scale(1); }
}

/* Toast slide-in improved */
.toast.show {
    animation: toastIn 0.3s ease forwards;
}
@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ===== R3: ONBOARDING GUIDED TUTORIAL ===== */

.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.onboarding-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 32px 24px;
    max-width: 340px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    animation: onboardPop 0.4s ease;
}
@keyframes onboardPop {
    from { opacity: 0; transform: scale(0.8) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.onboarding-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.onboarding-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.onboarding-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.onboarding-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.3s;
}

.onboarding-dot.active {
    background: var(--primary);
    width: 24px;
    border-radius: 4px;
}

.onboarding-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
}

.onboarding-btn:active {
    transform: scale(0.97);
}

.onboarding-skip {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    margin-top: 12px;
    padding: 8px;
}

/* ===== R4: ACCESSIBILITY IMPROVEMENTS ===== */

/* Better contrast for secondary text in dark mode */
[data-theme="dark"] .macro-bar-label,
[data-theme="dark"] .score-label {
    color: #b0b0b0;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .macro-bar-label,
    :root:not([data-theme="light"]) .score-label {
        color: #b0b0b0;
    }
}

/* Larger touch targets for water drops on mobile */
@media (max-width: 480px) {
    .water-drop {
        min-width: 32px;
        min-height: 36px;
        font-size: 20px;
    }
}

/* ===== R5: SKELETON LOADERS & SPLASH ===== */

/* Splash screen */
.splash-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.4s ease;
}

.splash-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.splash-logo {
    width: 80px;
    height: 80px;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--primary), #EF5350);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 800;
    color: white;
    margin-bottom: 16px;
    animation: splashPulse 1.5s ease infinite;
    box-shadow: 0 8px 32px rgba(230,74,25,0.35);
}
@keyframes splashPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 8px 32px rgba(230,74,25,0.35); }
    50% { transform: scale(1.06); box-shadow: 0 12px 40px rgba(230,74,25,0.5); }
}

.splash-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: 1px;
}

.splash-loading {
    margin-top: 24px;
    width: 44px;
    height: 44px;
    border: 3px solid rgba(230,74,25,0.15);
    border-top-color: var(--primary);
    border-right-color: rgba(255,193,7,0.6);
    border-radius: 50%;
    animation: splashSpin 0.9s cubic-bezier(0.4,0,0.2,1) infinite;
}
@keyframes splashSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, var(--surface) 25%, var(--surface-alt, #2a2a2a) 50%, var(--surface) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: var(--radius);
}
@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 12px auto;
}

.skeleton-text {
    height: 14px;
    border-radius: 6px;
    margin: 8px 16px;
}

.skeleton-text.short {
    width: 40%;
}

.skeleton-text.medium {
    width: 65%;
}

.skeleton-bar {
    height: 32px;
    border-radius: 8px;
    margin: 8px 16px;
}

.skeleton-card {
    height: 56px;
    border-radius: var(--radius);
    margin: 8px 16px;
}

.btn-link:hover {
    text-decoration: underline;
}

.login-forgot {
    color: var(--text-secondary);
}

.login-back {
    color: var(--primary);
}

.login-legal {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 24px;
    line-height: 1.4;
}

/* Dark mode login */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .login-btn.google {
        background: var(--surface);
        color: var(--text);
        border-color: var(--border);
    }
    :root:not([data-theme="light"]) .login-btn.apple {
        background: #1a1a1a;
        border-color: #333;
    }
}

[data-theme="dark"] .login-btn.google {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

[data-theme="dark"] .login-btn.apple {
    background: #1a1a1a;
    border-color: #333;
}

/* ===== GYM CALENDAR ===== */
.gym-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.gym-cal-header {
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 4px 0;
    text-transform: uppercase;
}

.gym-cal-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.2s;
    gap: 1px;
}

.gym-cal-day:hover { background: var(--primary-light); }
.gym-cal-day.empty { pointer-events: none; }

.gym-cal-day.today {
    border-color: var(--primary);
    font-weight: 700;
}

.gym-cal-day.done {
    border-width: 2px;
}

.gym-cal-num {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    line-height: 1;
}

.gym-type-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow);
}

.gym-type-btn:active {
    transform: scale(0.95);
}

/* Weight mini card sparkline */
.weight-mini-card:hover {
    box-shadow: var(--shadow);
}

/* Gym: keep single column layout (same as mobile) */

/* ===== PREMIUM ANIMATIONS ===== */

/* Page transition */
.page-enter {
    animation: pageSlideIn 0.3s var(--transition-smooth) both;
}
@keyframes pageSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Stagger animation for children */
.stagger-in > * {
    opacity: 0;
    animation: staggerFadeUp 0.4s var(--transition-smooth) both;
}
.stagger-in > *:nth-child(1) { animation-delay: 0ms; }
.stagger-in > *:nth-child(2) { animation-delay: 60ms; }
.stagger-in > *:nth-child(3) { animation-delay: 120ms; }
.stagger-in > *:nth-child(4) { animation-delay: 180ms; }
.stagger-in > *:nth-child(5) { animation-delay: 240ms; }
.stagger-in > *:nth-child(6) { animation-delay: 300ms; }
.stagger-in > *:nth-child(7) { animation-delay: 360ms; }
.stagger-in > *:nth-child(8) { animation-delay: 420ms; }

@keyframes staggerFadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Calorie ring glow (canvas-based via Chart.js) */
.circular-progress canvas {
    filter: drop-shadow(0 0 8px rgba(230,74,25,0.3));
    transition: filter 0.5s var(--transition-smooth);
}
.circular-progress:hover canvas {
    filter: drop-shadow(0 0 14px rgba(230,74,25,0.5));
}

/* Macro bar animated fill */
.macro-bar-fill {
    position: relative;
    overflow: hidden;
    transition: width 0.6s var(--transition-smooth);
}
.macro-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmerSlide 2s ease-in-out infinite;
}
@keyframes shimmerSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Fiber bar color */
.macro-bar-fill.fiber {
    background: linear-gradient(90deg, #7CB342, #8BC34A);
}

/* Water progress enhanced */
.water-progress-fill {
    background: linear-gradient(90deg, #4FC3F7, #0288D1, #4FC3F7);
    background-size: 200% 100%;
    animation: waterShimmer 3s ease-in-out infinite;
    border-radius: 2px;
    position: relative;
}
@keyframes waterShimmer {
    0%, 100% { background-position: 100% 0; }
    50% { background-position: 0% 0; }
}

/* Meal section stagger */
.meal-section {
    animation: mealSlideIn 0.4s var(--transition-smooth) both;
}
.meal-section:nth-child(1) { animation-delay: 50ms; }
.meal-section:nth-child(2) { animation-delay: 120ms; }
.meal-section:nth-child(3) { animation-delay: 190ms; }
.meal-section:nth-child(4) { animation-delay: 260ms; }

@keyframes mealSlideIn {
    from { opacity: 0; transform: translateX(-12px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Material Ripple Effect */
.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.35);
    transform: scale(0);
    animation: rippleExpand 0.6s ease-out;
    pointer-events: none;
}
@keyframes rippleExpand {
    to { transform: scale(4); opacity: 0; }
}

/* Input focus glow */
input:focus, select:focus, textarea:focus {
    box-shadow: 0 0 0 3px rgba(230,74,25,0.12);
    border-color: rgba(230,74,25,0.4) !important;
    transition: box-shadow 0.25s var(--transition-smooth), border-color 0.25s;
}

/* Creature aura glow — applied ONLY on SVG child, never on container div */
/* Base shadow for all types + type-specific animation overrides below */
.creature-display svg {
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15)) drop-shadow(0 0 18px var(--aura-color, rgba(230,74,25,0.4)));
    animation: creatureAuraPulseFire 3s ease-in-out infinite;
    will-change: filter;
}
/* Type-specific default animations (desktop) */
.creature-display[data-type="fire"] svg {
    animation: creatureAuraPulseFire 3s ease-in-out infinite;
}
.creature-display[data-type="water"] svg {
    animation: creatureAuraPulseWater 3s ease-in-out infinite;
}
.creature-display[data-type="plant"] svg {
    animation: creatureAuraPulsePlant 3s ease-in-out infinite;
}
.creature-display:hover svg {
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15)) drop-shadow(0 0 30px var(--aura-color, rgba(230,74,25,0.6)));
}
/* When SVG contains internal aura elements, disable CSS drop-shadow glow to avoid rectangular artifact */
.creature-display.has-svg-aura svg {
    filter: none;
    animation: none;
}
.creature-display.has-svg-aura:hover svg {
    filter: none;
}

/* XP bar shimmer */
.xp-fill, .xp-bar-fill {
    position: relative;
    overflow: hidden;
}
.xp-fill::after, .xp-bar-fill::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: xpShimmer 2.5s ease-in-out infinite;
}
@keyframes xpShimmer {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* Shop item shine on hover */
.shop-item {
    position: relative;
    overflow: hidden;
    transition: transform 0.25s var(--transition-spring), box-shadow 0.25s;
}
.shop-item::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.08) 50%, transparent 60%);
    transform: translateX(-100%);
    transition: transform 0.6s;
}
.shop-item:hover::after {
    transform: translateX(100%);
}

/* Creature floating particles */
.creature-scene {
    position: relative;
    overflow: visible;
}
.creature-particles {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
    border: none; background: none;
}
.creature-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat 4s ease-in-out infinite;
}
@keyframes particleFloat {
    0% { opacity: 0; transform: translateY(0) scale(0.5); }
    20% { opacity: 0.7; }
    80% { opacity: 0.3; }
    100% { opacity: 0; transform: translateY(-80px) scale(1.2); }
}

/* Coin flip animation */
.coin-flip-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    animation: fadeIn 0.2s ease-out;
}
.coin-flip-coin {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFD700, #FFA000, #FFD700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    box-shadow: 0 0 30px rgba(255,215,0,0.5), 0 4px 20px rgba(0,0,0,0.3);
    animation: coinFlipAnim 0.8s ease-out;
}
@keyframes coinFlipAnim {
    0% { transform: rotateY(0deg) scale(0.3); opacity: 0; }
    30% { transform: rotateY(360deg) scale(1.3); opacity: 1; }
    50% { transform: rotateY(720deg) scale(1.1); }
    70% { transform: rotateY(1080deg) scale(1); }
    100% { transform: rotateY(1440deg) scale(0.8); opacity: 0; }
}
.coin-amount {
    position: absolute;
    font-size: 24px;
    font-weight: 800;
    color: #FFD700;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    animation: coinAmountPop 0.8s ease-out 0.3s both;
}
@keyframes coinAmountPop {
    0% { transform: translateY(20px) scale(0); opacity: 0; }
    50% { transform: translateY(-10px) scale(1.2); opacity: 1; }
    100% { transform: translateY(-30px) scale(1); opacity: 0; }
}

/* CTA button shimmer */
.btn-primary {
    position: relative;
    overflow: hidden;
}
.btn-primary::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: ctaShimmer 3s ease-in-out infinite;
}
@keyframes ctaShimmer {
    0%, 70%, 100% { left: -100%; }
    40% { left: 150%; }
}

/* Streak fire glow */
.streak-count, [class*="streak"] {
    text-shadow: 0 0 8px rgba(255,152,0,0.3);
}

/* Gradient borders for premium elements */
.premium-border {
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;
}
.premium-border::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    background: linear-gradient(135deg, var(--primary), var(--accent), var(--primary));
    border-radius: inherit;
    z-index: -1;
    background-size: 200% 200%;
    animation: gradientBorder 4s ease-in-out infinite;
}
@keyframes gradientBorder {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Empty meal button premium */
.empty-meal-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px dashed var(--glass-border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.25s var(--transition-smooth);
    position: relative;
    overflow: hidden;
}
.empty-meal-btn:hover, .empty-meal-btn:active {
    border-color: rgba(230,74,25,0.3);
    color: var(--primary);
    background: rgba(230,74,25,0.04);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.empty-meal-btn::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(230,74,25,0.04), transparent);
    transition: left 0.5s;
}
.empty-meal-btn:hover::after {
    left: 150%;
}

/* Skeleton loading enhanced */
.skeleton {
    background: linear-gradient(90deg, var(--surface) 25%, rgba(230,74,25,0.04) 50%, var(--surface) 75%);
    background-size: 200% 100%;
}

/* Smooth custom scrollbar */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.25);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

/* Modal glassmorphism */
.modal-content {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
}

/* ===== MOBILE — SIGNIFICANTLY boost all effects (small screens, lower contrast) ===== */
@media (max-width: 768px) {
    body::before {
        background: radial-gradient(ellipse at 20% 50%, rgba(230,74,25,0.22) 0%, transparent 50%),
                    radial-gradient(ellipse at 80% 20%, rgba(255,193,7,0.18) 0%, transparent 50%),
                    radial-gradient(ellipse at 50% 80%, rgba(33,150,243,0.15) 0%, transparent 50%);
    }
    .circular-progress canvas {
        filter: drop-shadow(0 0 18px rgba(230,74,25,0.65));
    }
    .macro-bar-fill::after {
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent);
    }
    .water-progress-fill {
        box-shadow: 0 0 12px rgba(79,195,247,0.6);
    }
    .creature-display svg {
        animation: creatureAuraPulseMobileFire 2.5s ease-in-out infinite !important;
        will-change: filter;
    }
    .creature-display[data-type="water"] svg {
        animation: creatureAuraPulseMobileWater 2.5s ease-in-out infinite !important;
    }
    .creature-display[data-type="plant"] svg {
        animation: creatureAuraPulseMobilePlant 2.5s ease-in-out infinite !important;
    }
    .creature-display.has-svg-aura svg {
        filter: none !important;
        animation: none !important;
    }
    .xp-fill::after, .xp-bar-fill::after {
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent);
    }
    .streak-badge {
        text-shadow: 0 0 12px rgba(230,74,25,0.5);
    }
}

/* Desktop creature aura pulse — includes base body shadow + type-colored glow */
@keyframes creatureAuraPulseFire {
    0%, 100% { filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15)) drop-shadow(0 0 18px rgba(230,74,25,0.45)); }
    50% { filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15)) drop-shadow(0 0 30px rgba(230,74,25,0.7)); }
}

/* Mobile creature aura pulse — MUCH stronger + includes body shadow to prevent artifact */
@keyframes creatureAuraPulseMobileFire {
    0%, 100% { filter: drop-shadow(0 4px 10px rgba(0,0,0,0.12)) drop-shadow(0 0 28px rgba(230,74,25,0.7)) drop-shadow(0 0 6px rgba(230,74,25,0.4)); }
    50% { filter: drop-shadow(0 4px 10px rgba(0,0,0,0.12)) drop-shadow(0 0 45px rgba(230,74,25,0.9)) drop-shadow(0 0 12px rgba(230,74,25,0.6)); }
}
@keyframes creatureAuraPulseMobileWater {
    0%, 100% { filter: drop-shadow(0 4px 10px rgba(0,0,0,0.12)) drop-shadow(0 0 28px rgba(33,150,243,0.7)) drop-shadow(0 0 6px rgba(33,150,243,0.4)); }
    50% { filter: drop-shadow(0 4px 10px rgba(0,0,0,0.12)) drop-shadow(0 0 45px rgba(33,150,243,0.9)) drop-shadow(0 0 12px rgba(33,150,243,0.6)); }
}
@keyframes creatureAuraPulseMobilePlant {
    0%, 100% { filter: drop-shadow(0 4px 10px rgba(0,0,0,0.12)) drop-shadow(0 0 28px rgba(76,175,80,0.7)) drop-shadow(0 0 6px rgba(76,175,80,0.4)); }
    50% { filter: drop-shadow(0 4px 10px rgba(0,0,0,0.12)) drop-shadow(0 0 45px rgba(76,175,80,0.9)) drop-shadow(0 0 12px rgba(76,175,80,0.6)); }
}

/* Creature type-specific aura color vars */
.creature-display[data-type="fire"] svg { --aura-color: rgba(230,74,25,0.6); }
.creature-display[data-type="water"] svg { --aura-color: rgba(33,150,243,0.6); }
.creature-display[data-type="plant"] svg { --aura-color: rgba(76,175,80,0.6); }

/* Desktop keyframes for water & plant (fire is defined above) */
@keyframes creatureAuraPulseWater {
    0%, 100% { filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15)) drop-shadow(0 0 22px rgba(33,150,243,0.5)) drop-shadow(0 0 6px rgba(33,150,243,0.3)); }
    50% { filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15)) drop-shadow(0 0 40px rgba(33,150,243,0.8)) drop-shadow(0 0 10px rgba(33,150,243,0.5)); }
}
@keyframes creatureAuraPulsePlant {
    0%, 100% { filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15)) drop-shadow(0 0 22px rgba(76,175,80,0.5)) drop-shadow(0 0 6px rgba(76,175,80,0.3)); }
    50% { filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15)) drop-shadow(0 0 40px rgba(76,175,80,0.8)) drop-shadow(0 0 10px rgba(76,175,80,0.5)); }
}

/* ===== REDUCED MOTION ACCESSIBILITY ===== */
/* Slow down looping animations instead of killing them — keeps the premium feel */
@media (prefers-reduced-motion: reduce) {
    body::before { animation-duration: 60s; }
    .fab-circle { animation-duration: 8s; }
    .macro-bar-fill::after { animation-duration: 6s; }
    .water-progress-fill { animation-duration: 6s; }
    .xp-fill::after, .xp-bar-fill::after { animation-duration: 6s; }
    .btn-primary::after { animation-duration: 8s; }
    .creature-particle { animation-duration: 12s; }
    .page-enter { animation-duration: 0.3s; }
    .stagger-in > * { animation-duration: 0.3s; }
    .ripple-effect { animation-duration: 0.4s; }
    .creature-display svg { animation-duration: 8s; }
    /* All glow, drop-shadow, backdrop-filter kept as-is */
}

/* ===== HOVER EFFECTS DESKTOP ===== */
@media (hover: hover) {
    .card {
        transition: transform 0.25s var(--transition-smooth), box-shadow 0.25s var(--transition-smooth);
    }
    .card:hover {
        transform: translateY(-2px) perspective(800px) rotateX(-0.5deg);
        box-shadow: var(--shadow-lg);
    }
    .gym-type-btn:hover {
        transform: scale(1.05);
        box-shadow: var(--shadow-md);
    }
    .quick-action-btn:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-md);
    }
    .nav-btn:hover {
        color: var(--primary);
    }
    .water-glass:hover svg {
        transform: scale(1.15);
        transition: transform 0.2s var(--transition-spring);
    }
    .meal-header:hover {
        background: var(--surface-alt, rgba(0,0,0,0.03));
    }
    .fab-option:hover {
        transform: scale(1.04);
        box-shadow: var(--shadow-lg);
    }
    .btn:hover {
        filter: brightness(1.08);
        transform: translateY(-1px);
    }
    .btn-outline:hover {
        background: var(--primary);
        color: white;
        border-color: var(--primary);
    }
    .shop-item:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }
}

/* Water tank animation */
@keyframes waveMove {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.water-tank:active {
    transform: scale(0.98);
}
