/* ===========================================
   SOUS - Design System
   A warm, intuitive recipe companion
   =========================================== */

/* --- CSS Variables --- */
:root {
    /* Colors */
    --c-cream: #FDF8F3;
    --c-cream-dark: #F5EDE4;
    --c-terracotta: #C75B39;
    --c-terracotta-dark: #A64B2E;
    --c-terracotta-light: #E8A090;
    --c-sage: #6B9B76;
    --c-sage-dark: #4A7A54;
    --c-sage-light: #D4E8D7;
    --c-gold: #D4A853;
    --c-text: #2D2A26;
    --c-text-secondary: #6B635A;
    --c-text-muted: #9B958E;
    --c-border: #E5DED5;
    --c-white: #FFFFFF;

    /* Typography */
    --f-logo: 'Lobster', cursive;
    --f-display: 'Playfair Display', serif;
    --f-body: 'Inter', -apple-system, sans-serif;

    /* Spacing */
    --s-xs: 4px;
    --s-sm: 8px;
    --s-md: 16px;
    --s-lg: 24px;
    --s-xl: 32px;
    --s-xxl: 48px;

    /* Radii */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 24px;
    --r-full: 9999px;

    /* Shadows — chunky toy-block elevation system */
    --shadow-flat: 0 2px 0 rgba(139, 79, 51, 0.12);
    --shadow-sm: 0 3px 0 rgba(139, 79, 51, 0.15), 0 2px 8px rgba(139, 79, 51, 0.08);
    --shadow-md: 0 5px 0 rgba(139, 79, 51, 0.14), 0 4px 12px rgba(139, 79, 51, 0.1), 0 8px 24px rgba(139, 79, 51, 0.06);
    --shadow-lg: 0 8px 0 rgba(139, 79, 51, 0.12), 0 8px 20px rgba(139, 79, 51, 0.12), 0 20px 40px rgba(139, 79, 51, 0.08);
    --shadow-pressed: 0 1px 0 rgba(139, 79, 51, 0.15), inset 0 2px 6px rgba(139, 79, 51, 0.15);
    --shadow-glow: 0 0 20px rgba(199, 91, 57, 0.3);
    --shadow-glow-warm: 0 6px 0 rgba(139, 60, 30, 0.2), 0 0 30px rgba(199, 91, 57, 0.4);

    /* Transitions */
    --t-fast: 150ms ease;
    --t-normal: 250ms ease;
    --t-slow: 400ms ease;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--f-body);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--c-text);
    background: radial-gradient(ellipse at 50% 0%, #FDF8F3 0%, #F5EDE4 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 600'%3E%3Cfilter id='a'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23a)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 182px;
    opacity: 0.07;
    pointer-events: none;
    z-index: 9999;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input {
    font-family: inherit;
}

/* --- Utilities --- */
.hidden { display: none !important; }
.collapsed { max-height: 0; overflow: hidden; }

/* --- Scroll Reveal Animations --- */
.step.visible {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
}

/* Playful entry — each card comes from a slightly different angle */
#stepMeal { transform: translateY(30px) rotate(-1deg); }
#stepPhoto { transform: translateY(30px) rotate(0.7deg); }
#stepPrefs { transform: translateY(30px) rotate(-0.5deg); }

/* Staggered meal cards */
.step.visible .meal-card {
    opacity: 1;
    transform: translateY(0);
}

.step.visible .meal-card:nth-child(1) { transition-delay: 0ms; }
.step.visible .meal-card:nth-child(2) { transition-delay: 80ms; }
.step.visible .meal-card:nth-child(3) { transition-delay: 160ms; }
.step.visible .meal-card:nth-child(4) { transition-delay: 240ms; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-sm);
    padding: var(--s-md) var(--s-lg);
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--r-full);
    transition: all var(--t-normal);
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--c-terracotta);
    color: var(--c-white);
}

.btn-primary:hover {
    background: var(--c-terracotta-dark);
}

.btn-secondary {
    background: var(--c-white);
    color: var(--c-terracotta);
    border: 2px solid var(--c-terracotta);
}

.btn-secondary:hover {
    background: var(--c-terracotta);
    color: var(--c-white);
}

.btn-ghost {
    color: var(--c-text-muted);
}

.btn-ghost:hover {
    color: var(--c-terracotta);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: var(--s-sm) var(--s-md);
    font-size: 0.875rem;
}

/* --- Auth Screen --- */
.auth-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--c-terracotta) 0%, var(--c-terracotta-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--s-md);
    z-index: 1000;
}

.auth-container {
    width: 100%;
    max-width: 380px;
}

.auth-brand {
    text-align: center;
    margin-bottom: var(--s-xl);
}

.auth-logo {
    width: 80px;
    margin: 0 auto var(--s-md);
    filter: brightness(0) invert(1);
}

.auth-brand h1 {
    font-family: var(--f-logo);
    font-size: 3rem;
    color: var(--c-white);
    line-height: 1;
}

.auth-brand p {
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    margin-top: var(--s-xs);
}

.auth-form {
    background: var(--c-white);
    padding: var(--s-xl);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
}

.auth-form h2 {
    font-family: var(--f-display);
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: var(--s-lg);
    color: var(--c-text);
}

.input-group {
    position: relative;
    margin-bottom: var(--s-md);
}

.input-group input {
    width: 100%;
    padding: var(--s-md);
    padding-top: var(--s-lg);
    font-size: 1rem;
    border: 2px solid var(--c-border);
    border-radius: var(--r-md);
    background: var(--c-white);
    transition: border-color var(--t-fast);
}

.input-group input:focus {
    outline: none;
    border-color: var(--c-terracotta);
}

.input-group label {
    position: absolute;
    left: var(--s-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--c-text-muted);
    font-size: 1rem;
    pointer-events: none;
    transition: all var(--t-fast);
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
    top: var(--s-sm);
    transform: translateY(0);
    font-size: 0.75rem;
    color: var(--c-terracotta);
}

.auth-alt {
    text-align: center;
    margin-top: var(--s-lg);
    font-size: 0.9rem;
    color: var(--c-text-secondary);
}

.auth-alt a {
    color: var(--c-terracotta);
    text-decoration: none;
    font-weight: 600;
}

/* Auth Error Messages */
.auth-error {
    background: #FEF2F2;
    color: #DC2626;
    border: 1px solid #FECACA;
    border-radius: var(--r-sm);
    padding: var(--s-sm) var(--s-md);
    font-size: 0.85rem;
    margin-bottom: var(--s-md);
    text-align: center;
}

/* Google Sign-In Button */
.google-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--c-white);
    color: var(--c-text);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    padding: 10px 16px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--t-fast);
    width: 100%;
}

.google-signin-btn:hover {
    border-color: var(--c-terracotta-light);
    box-shadow: var(--shadow-sm);
}

/* Remember Me Checkbox */
.remember-me {
    margin: var(--s-md) 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--c-text-secondary);
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--c-border);
    border-radius: 4px;
    background: var(--c-white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--t-fast);
}

.checkbox-label input:checked + .checkmark {
    background: var(--c-terracotta);
    border-color: var(--c-terracotta);
}

.checkbox-label input:checked + .checkmark::after {
    content: '';
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.checkbox-label:hover .checkmark {
    border-color: var(--c-terracotta-light);
}

.auth-legal {
    text-align: center;
    margin-top: var(--s-md);
    font-size: 0.75rem;
    color: var(--c-text-muted);
}

.auth-legal a {
    color: var(--c-text-secondary);
    text-decoration: underline;
}

/* --- App Footer --- */
.app-footer {
    text-align: center;
    padding: var(--s-xl) var(--s-md);
    margin-top: var(--s-lg);
}

.footer-links {
    font-size: 0.8rem;
    margin-bottom: var(--s-sm);
}

.footer-links a {
    color: var(--c-text-muted);
    text-decoration: none;
    transition: color var(--t-fast);
}

.footer-links a:hover {
    color: var(--c-terracotta);
}

.footer-sep {
    color: var(--c-border);
    margin: 0 var(--s-sm);
}

.footer-copy {
    font-size: 0.7rem;
    color: var(--c-text-muted);
    opacity: 0.7;
}

/* --- Loading Overlay --- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(253, 248, 243, 0.97);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    backdrop-filter: blur(4px);
}

.loading-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 320px;
}

#loadingMessage {
    font-family: var(--f-body);
    font-size: 1.1rem;
    color: var(--c-text-secondary);
    margin-top: var(--s-xl);
    animation: pulse-text 2s ease-in-out infinite;
    min-height: 28px;
}

@keyframes pulse-text {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Loading cancel — always reserves space, button fades in */
.loading-cancel-section {
    margin-top: var(--s-md);
    height: 36px;
}

.loading-cancel-btn {
    font-family: var(--f-body);
    font-size: 0.85rem;
    color: var(--c-text-muted);
    background: none;
    border: none;
    padding: var(--s-xs) var(--s-md);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.loading-cancel-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.loading-cancel-btn:hover {
    color: var(--c-terracotta);
}

/* Pending Recipes Banner */
.pending-recipes-banner {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    background: var(--c-sage);
    color: var(--c-white);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-md);
    border-radius: var(--r-full);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: toastUp 0.4s ease-out;
    max-width: calc(100% - 32px);
    width: auto;
}

@keyframes toastUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.pending-recipes-banner p {
    margin: 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    flex: 1;
}

.pending-recipes-banner i {
    font-size: 1.25rem;
}

.btn-view-recipes {
    font-family: var(--f-body);
    font-size: 0.9rem;
    font-weight: 600;
    background: var(--c-white);
    color: var(--c-sage);
    border: none;
    padding: var(--s-sm) var(--s-md);
    border-radius: var(--r-full);
    cursor: pointer;
    transition: all var(--t-fast);
    flex-shrink: 0;
}

.btn-view-recipes:hover {
    background: var(--c-cream);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-view-recipes:active {
    transform: translateY(1px);
}

.btn-dismiss-banner {
    font-family: var(--f-body);
    font-size: 1.5rem;
    background: none;
    border: none;
    color: var(--c-white);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--t-fast);
    flex-shrink: 0;
}

.btn-dismiss-banner:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-dismiss-banner:active {
    background: rgba(255, 255, 255, 0.3);
}

/* Cooking Pot Animation */
.cooking-pot {
    position: relative;
    width: 180px;
    height: 160px;
    margin: 0 auto;
}

.pot-body {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 126px;
    height: 90px;
    background: linear-gradient(145deg, var(--c-terracotta) 0%, var(--c-terracotta-dark) 100%);
    border-radius: 0 0 35px 35px;
    overflow: hidden;
    box-shadow:
        inset 0 -8px 12px rgba(0, 0, 0, 0.15),
        0 4px 12px rgba(199, 91, 57, 0.3);
}

.pot-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(145deg, var(--c-terracotta-dark) 0%, #8B3D25 100%);
    border-radius: 2px 2px 0 0;
}

/* Pot rim highlight */
.pot-body::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 8px;
    right: 60%;
    height: 3px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
}

.pot-handle-left,
.pot-handle-right {
    position: absolute;
    bottom: 54px;
    width: 22px;
    height: 16px;
    background: linear-gradient(145deg, var(--c-terracotta-dark) 0%, #8B3D25 100%);
    border-radius: 4px;
}

.pot-handle-left {
    left: 8px;
    transform: rotate(-10deg);
}

.pot-handle-right {
    right: 8px;
    transform: rotate(10deg);
}

/* Bubbles inside pot */
.bubble {
    position: absolute;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: bubble-rise 1.5s ease-in-out infinite;
}

.bubble-1 {
    width: 14px;
    height: 14px;
    left: 20%;
    bottom: 12px;
    animation-delay: 0s;
}

.bubble-2 {
    width: 10px;
    height: 10px;
    left: 50%;
    bottom: 10px;
    animation-delay: 0.4s;
}

.bubble-3 {
    width: 12px;
    height: 12px;
    left: 70%;
    bottom: 14px;
    animation-delay: 0.8s;
}

@keyframes bubble-rise {
    0% {
        transform: translateY(0) scale(0.8);
        opacity: 0;
    }
    20% {
        opacity: 0.8;
    }
    80% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-50px) scale(1);
        opacity: 0;
    }
}

/* Steam wisps */
.steam {
    position: absolute;
    bottom: 100px;
    width: 14px;
    height: 36px;
    background: linear-gradient(to top, rgba(199, 91, 57, 0.15), transparent);
    border-radius: 50%;
    filter: blur(3px);
    animation: steam-rise 2s ease-out infinite;
}

.steam-1 {
    left: 30%;
    animation-delay: 0s;
}

.steam-2 {
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 0.6s;
    height: 25px;
}

.steam-3 {
    left: 65%;
    animation-delay: 1.2s;
}

@keyframes steam-rise {
    0% {
        transform: translateY(0) scaleX(1);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    50% {
        opacity: 0.4;
    }
    100% {
        transform: translateY(-35px) scaleX(1.5);
        opacity: 0;
    }
}

/* --- App Layout --- */
.app {
    max-width: 480px;
    margin: 0 auto;
    padding: var(--s-md);
    padding-bottom: 120px;
}

/* --- Header --- */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--s-md) 0;
    margin-bottom: var(--s-md);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
}

.brand img {
    width: 48px;
    height: 48px;
}

.brand h1 {
    font-family: var(--f-logo);
    font-size: 1.75rem;
    color: var(--c-terracotta);
    line-height: 1;
}

.brand span {
    font-size: 0.7rem;
    color: var(--c-text-muted);
    display: block;
}

/* --- Header Actions & User Dropdown --- */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
}

.header-icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--c-text-secondary);
    text-decoration: none;
    transition: all var(--t-fast);
}

.header-icon-btn:hover {
    background: var(--c-cream-dark);
    color: var(--c-terracotta);
}

.user-dropdown {
    position: relative;
}

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: var(--s-xs);
    padding: var(--s-xs);
    border-radius: var(--r-full);
    background: var(--c-cream-dark);
    cursor: pointer;
    transition: background var(--t-fast);
}

.user-dropdown-toggle:hover {
    background: var(--c-border);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--c-terracotta);
    color: var(--c-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-dropdown-toggle i {
    font-size: 0.6rem;
    color: var(--c-text-muted);
    margin-right: var(--s-xs);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + var(--s-xs));
    right: 0;
    background: var(--c-white);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 100;
    overflow: hidden;
}

.user-dropdown-menu.hidden {
    display: none;
}

.dropdown-header {
    padding: var(--s-md);
    background: var(--c-cream);
}

.dropdown-greeting {
    display: block;
    font-weight: 600;
    color: var(--c-text);
    font-size: 0.95rem;
}

.dropdown-username {
    display: block;
    font-size: 0.75rem;
    color: var(--c-text-muted);
    margin-top: 2px;
}

.dropdown-divider {
    height: 1px;
    background: var(--c-border);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    padding: var(--s-sm) var(--s-md);
    color: var(--c-text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background var(--t-fast);
}

.dropdown-item:hover {
    background: var(--c-cream);
    color: var(--c-text);
}

.dropdown-item i {
    width: 16px;
    text-align: center;
    font-size: 0.85rem;
}

/* --- Steps --- */
.step {
    position: relative;
    background: var(--c-white);
    border: 2px solid rgba(139, 79, 51, 0.08);
    border-bottom: 4px solid rgba(139, 79, 51, 0.13);
    border-radius: var(--r-xl);
    padding: var(--s-lg);
    margin-bottom: var(--s-lg);
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-bottom-width 0.15s ease;
    will-change: transform, opacity;
}

/* Paper grain overlay on step cards */
.step::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 150px;
    opacity: 0.04;
    pointer-events: none;
    z-index: 0;
    mix-blend-mode: multiply;
}

/* Content above texture */
.step > * {
    position: relative;
    z-index: 1;
}

/* Hover lift — card lifts off the surface */
.step:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

/* Active press — card pushes into surface like a button */
.step:active {
    box-shadow: var(--shadow-sm);
    border-bottom-width: 2px;
    transform: translateY(1px);
}

.step-header {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    margin-bottom: var(--s-md);
}

.step-number {
    width: 34px;
    height: 34px;
    background: linear-gradient(145deg, var(--c-terracotta), var(--c-gold), var(--c-terracotta));
    background-size: 200% 200%;
    animation: gradient-shift 3s ease-in-out infinite;
    color: var(--c-white);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
    flex-shrink: 0;
    transform: scale(0) rotate(-10deg);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 3px 0 rgba(139, 60, 30, 0.3), 0 3px 8px rgba(139, 79, 51, 0.2);
    border-bottom: 2px solid rgba(139, 60, 30, 0.2);
}

.step.visible .step-number {
    transform: scale(1) rotate(0deg);
    transition-delay: 0.2s;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.step-header h2 {
    font-family: var(--f-display);
    font-size: 1.1rem;
    color: var(--c-text);
    flex: 1;
}

/* --- Meal Selection --- */
.meal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s-sm);
}

.meal-card {
    position: relative;
    aspect-ratio: 1;
    background-color: var(--c-cream);
    background-image: var(--meal-img);
    background-size: 65%;
    background-position: center;
    background-repeat: no-repeat;
    border: 2px solid rgba(139, 79, 51, 0.06);
    border-bottom: 5px solid rgba(139, 79, 51, 0.12);
    border-radius: var(--r-xl);
    padding: var(--s-sm);
    text-align: center;
    transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    opacity: 0;
    transform: translateY(15px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    box-shadow: 0 4px 0 rgba(139, 79, 51, 0.1), 0 4px 12px rgba(139, 79, 51, 0.08);
}

.meal-card span {
    position: relative;
    z-index: 1;
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--c-text);
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.9);
}

.meal-card:hover {
    border-color: var(--c-terracotta-light);
    transform: translateY(-4px);
    box-shadow: 0 8px 0 rgba(139, 79, 51, 0.1), 0 8px 24px rgba(139, 79, 51, 0.12);
}

.meal-card:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
    box-shadow: 0 1px 0 rgba(139, 79, 51, 0.15), inset 0 1px 3px rgba(139, 79, 51, 0.1);
    transition-duration: 0.08s;
}

/* Selected State — image fills entire card, raised + glow */
.meal-card.selected {
    background-size: cover;
    background-position: center;
    border-color: var(--c-terracotta);
    border-bottom: 5px solid rgba(100, 40, 20, 0.35);
    box-shadow: 0 5px 0 rgba(100, 40, 20, 0.25), 0 0 25px rgba(199, 91, 57, 0.35), 0 8px 20px rgba(139, 79, 51, 0.15);
}

/* Styled label when selected */
.meal-card.selected span {
    color: var(--c-terracotta-dark);
    font-family: var(--f-display);
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    background: rgba(255, 255, 255, 0.88);
    padding: 3px 14px;
    border-radius: var(--r-full);
    text-shadow: none;
}

.meal-check {
    position: absolute;
    top: var(--s-sm);
    right: var(--s-sm);
    width: 24px;
    height: 24px;
    background: var(--c-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--c-terracotta);
    opacity: 0;
    transform: scale(0);
    transition: all var(--t-normal);
}

.meal-card.selected .meal-check {
    opacity: 1;
    transform: scale(1);
}

/* --- Photo Upload --- */
.photo-zone {
    border: 3px dashed var(--c-border);
    border-radius: var(--r-xl);
    padding: var(--s-xl);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: var(--c-cream);
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 3px 8px rgba(139, 79, 51, 0.06);
}

.photo-zone:not(.has-photos) {
    animation: border-breathe 3s ease-in-out infinite;
}

@keyframes border-breathe {
    0%, 100% { border-color: var(--c-border); box-shadow: inset 0 3px 8px rgba(139, 79, 51, 0.06); }
    50% { border-color: var(--c-terracotta-light); box-shadow: inset 0 3px 12px rgba(199, 91, 57, 0.1); }
}

.photo-zone:hover {
    border-color: var(--c-terracotta);
    background: var(--c-white);
    animation: none;
    box-shadow: inset 0 2px 6px rgba(199, 91, 57, 0.08), 0 0 0 4px rgba(199, 91, 57, 0.06);
}

.photo-zone:active {
    transform: scale(0.98);
    box-shadow: inset 0 4px 12px rgba(139, 79, 51, 0.12);
}

.photo-zone.has-photos {
    border-style: solid;
    border-color: var(--c-sage);
    background: var(--c-white);
    padding: var(--s-md);
}

.photo-empty {
    width: 100%;
}

.photo-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--s-md);
    opacity: 0.85;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 4px 6px rgba(139, 79, 51, 0.15));
    animation: icon-float 4s ease-in-out infinite;
}

@keyframes icon-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-4px) rotate(1deg); }
    75% { transform: translateY(2px) rotate(-1deg); }
}

.photo-zone:hover .photo-icon {
    opacity: 1;
    transform: scale(1.1) rotate(-3deg);
    animation: none;
}

.photo-cta {
    font-weight: 600;
    color: var(--c-terracotta);
    margin-bottom: var(--s-xs);
}

.photo-hint {
    font-size: 0.85rem;
    color: var(--c-text-muted);
}

.photo-preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-sm);
    justify-content: center;
    width: 100%;
}

.photo-thumb {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--r-sm);
    overflow: hidden;
    animation: fadeIn var(--t-normal);
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-thumb-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: var(--c-terracotta);
    color: var(--c-white);
    border-radius: 50%;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.photo-actions {
    display: flex;
    gap: var(--s-sm);
    justify-content: center;
    margin-top: var(--s-md);
}

.previous-photo {
    margin-top: var(--s-md);
    padding-top: var(--s-md);
    border-top: 1px solid var(--c-border);
}

.previous-photo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--s-xs);
}

.previous-photo-header p {
    font-size: 0.85rem;
    color: var(--c-text-muted);
    margin: 0;
}

.previous-manage-btn {
    font-size: 0.8rem;
    color: var(--c-terracotta);
    background: none;
    border: none;
    padding: var(--s-xs) var(--s-sm);
    cursor: pointer;
    font-weight: 500;
    border-radius: var(--r-sm);
    transition: background var(--t-fast);
}

.previous-manage-btn:hover {
    background: rgba(199, 91, 57, 0.1);
}

.previous-manage-btn.active {
    background: var(--c-terracotta);
    color: white;
}

.previous-hint {
    font-size: 0.75rem;
    color: var(--c-text-muted);
    text-align: center;
    margin-bottom: var(--s-sm);
}

.previous-hint.manage-mode {
    color: var(--c-terracotta);
}

.previous-thumb {
    display: flex;
    gap: var(--s-md);
    justify-content: center;
    flex-wrap: wrap;
}

.prev-photo-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: all var(--t-fast);
    -webkit-tap-highlight-color: transparent;
}

.prev-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--r-md);
    border: 3px solid var(--c-border);
    opacity: 0.7;
    transition: all var(--t-fast);
}

.prev-photo-item:active img {
    transform: scale(0.95);
}

.prev-photo-item.selected img {
    opacity: 1;
    border-color: var(--c-terracotta);
    box-shadow: 0 2px 12px rgba(199, 91, 57, 0.3);
}

.prev-photo-check {
    position: absolute;
    bottom: -6px;
    right: -6px;
    width: 26px;
    height: 26px;
    background: var(--c-terracotta);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--c-cream);
}

/* Delete button - only visible in manage mode */
.prev-photo-delete {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 36px;
    height: 36px;
    background: rgba(220, 53, 69, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: all var(--t-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.prev-photo-item.manage-mode .prev-photo-delete {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.prev-photo-item.manage-mode img {
    opacity: 0.5;
}

.prev-photo-delete:active {
    transform: translate(-50%, -50%) scale(0.9);
    background: #c82333;
}

/* Delete confirmation overlay */
.delete-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--s-md);
}

.delete-confirm-dialog {
    background: var(--c-white);
    border-radius: var(--r-lg);
    padding: var(--s-lg);
    max-width: 300px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.delete-confirm-dialog h4 {
    margin-bottom: var(--s-sm);
    color: var(--c-text);
}

.delete-confirm-dialog p {
    font-size: 0.9rem;
    color: var(--c-text-secondary);
    margin-bottom: var(--s-lg);
}

.delete-confirm-actions {
    display: flex;
    gap: var(--s-sm);
}

.delete-confirm-actions button {
    flex: 1;
    padding: var(--s-sm) var(--s-md);
    border-radius: var(--r-sm);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background var(--t-fast);
}

.delete-confirm-cancel {
    background: var(--c-cream-dark);
    border: 1px solid var(--c-border);
    color: var(--c-text);
}

.delete-confirm-cancel:hover {
    background: var(--c-border);
}

.delete-confirm-delete {
    background: #dc3545;
    border: none;
    color: white;
}

.delete-confirm-delete:hover {
    background: #c82333;
}

/* Photo thumb in preview when using previous photos */
.photo-thumb-previous {
    border: 2px solid var(--c-terracotta);
}

/* --- Collapsible Prefs --- */
.step-collapsible .step-header {
    margin-bottom: 0;
}

.step-toggle {
    width: 112%;
    padding: var(--s-lg);
    margin: calc(-1 * var(--s-lg));
    background: transparent;
    cursor: pointer;
}

.step-toggle h2 {
    text-align: left;
}

.toggle-icon {
    width: 30px;
    height: 30px;
    border: 2px solid var(--c-terracotta);
    border-bottom: 4px solid rgba(139, 60, 30, 0.25);
    border-radius: 50%;
    transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 2px 0 rgba(139, 79, 51, 0.1);
}

/* CSS chevron arrow - centered precisely */
.toggle-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    border-right: 2px solid var(--c-terracotta);
    border-bottom: 2px solid var(--c-terracotta);
    transform: translate(-50%, -65%) rotate(45deg);
    transition: all var(--t-normal);
}

.step-toggle:hover .toggle-icon {
    background: var(--c-terracotta);
    transform: scale(1.1);
}

.step-toggle:hover .toggle-icon::before {
    border-color: var(--c-white);
}

.step-toggle[aria-expanded="true"] .toggle-icon {
    background: var(--c-terracotta);
}

.step-toggle[aria-expanded="true"] .toggle-icon::before {
    border-color: var(--c-white);
    transform: translate(-50%, -35%) rotate(-135deg);
}

.step-content {
    transition: max-height var(--t-slow), opacity var(--t-normal);
    opacity: 1;
    overflow: hidden;
}

.step-content.collapsed {
    opacity: 0;
}

.step-content:not(.collapsed) {
    max-height: 2000px;
    padding-top: var(--s-lg);
}

/* --- Preferences --- */

/* Servings + Spice side by side */
.pref-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-md);
    margin-bottom: var(--s-lg);
    padding-bottom: var(--s-lg);
    border-bottom: 1px solid var(--c-border);
}

.pref-row .pref-group {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* Card-within-card for sub-groups */
.pref-subcard {
    background: var(--c-cream);
    border: 1.5px solid rgba(139, 79, 51, 0.06);
    border-bottom: 3px solid rgba(139, 79, 51, 0.08);
    border-radius: var(--r-lg);
    padding: var(--s-md);
    margin-bottom: var(--s-md);
    box-shadow: 0 2px 0 rgba(139, 79, 51, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.pref-subcard:last-child {
    margin-bottom: 0;
}

.pref-subcard .pref-label {
    font-size: 0.9rem;
    margin-bottom: var(--s-sm);
}

/* Advanced toggle */
.advanced-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-sm);
    width: 100%;
    padding: 10px var(--s-md);
    margin-top: var(--s-md);
    background: var(--c-white);
    border: 2px solid var(--c-border);
    border-bottom: 4px solid rgba(139, 79, 51, 0.1);
    border-radius: var(--r-full);
    color: var(--c-text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 2px 0 rgba(139, 79, 51, 0.06);
}

.advanced-toggle:hover {
    border-color: var(--c-terracotta-light);
    color: var(--c-terracotta);
    transform: translateY(-1px);
    box-shadow: 0 3px 0 rgba(139, 79, 51, 0.08);
}

.advanced-toggle:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
    box-shadow: none;
}

.advanced-toggle .toggle-chevron {
    transition: transform var(--t-normal);
    font-size: 0.7rem;
}

.advanced-toggle[aria-expanded="true"] .toggle-chevron {
    transform: rotate(180deg);
}

.advanced-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease;
}

.advanced-content.expanded {
    max-height: 1200px;
    opacity: 1;
    padding-top: var(--s-md);
}

@media (max-width: 374px) {
    .pref-row {
        grid-template-columns: 1fr;
    }
}

.pref-group {
    margin-bottom: var(--s-lg);
    padding-bottom: var(--s-lg);
    border-bottom: 1px solid var(--c-border);
}

.pref-group:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.pref-label {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: var(--s-sm);
    color: var(--c-text);
}

.pref-icon {
    width: 28px;
    height: 28px;
    border-radius: 4px;
}

.pref-hint {
    font-size: 0.8rem;
    color: var(--c-text-muted);
    margin-bottom: var(--s-sm);
}

/* Servings */
.servings-control {
    display: flex;
    align-items: center;
    gap: var(--s-md);
}

.serving-btn {
    width: 46px;
    height: 46px;
    border: 2px solid var(--c-border);
    border-bottom: 4px solid rgba(139, 79, 51, 0.12);
    border-radius: 50%;
    font-size: 1.5rem;
    color: var(--c-text);
    background: var(--c-white);
    transition: all 0.15s ease;
    box-shadow: 0 2px 0 rgba(139, 79, 51, 0.08);
}

.serving-btn:hover {
    border-color: var(--c-terracotta);
    color: var(--c-terracotta);
    transform: translateY(-1px);
    box-shadow: 0 4px 0 rgba(139, 79, 51, 0.1);
}

.serving-btn:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
    background: var(--c-terracotta);
    border-color: var(--c-terracotta);
    color: var(--c-white);
    box-shadow: none;
}

.serving-value {
    font-size: 1.8rem;
    font-weight: 700;
    min-width: 40px;
    text-align: center;
    color: var(--c-terracotta);
}

/* Spice Slider */
.spice-control {
    padding: 0 var(--s-sm);
}

.spice-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right,
        #8BC34A 0%,
        #FFEB3B 33%,
        #FF5722 66%,
        #1A1A1A 100%
    );
    outline: none;
    margin-bottom: var(--s-sm);
}

.spice-slider {
    --spice-color: #8BC34A;
}

.spice-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    background: var(--c-white);
    border: 3px solid var(--spice-color);
    border-bottom: 4px solid var(--spice-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 3px 0 rgba(139, 79, 51, 0.15), 0 3px 8px rgba(139, 79, 51, 0.12);
    transition: all 0.15s ease;
}

.spice-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 0 rgba(139, 79, 51, 0.15), 0 4px 12px rgba(139, 79, 51, 0.15);
}

.spice-slider::-webkit-slider-thumb:active {
    transform: scale(0.95);
    box-shadow: 0 1px 0 rgba(139, 79, 51, 0.15);
}

.spice-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--c-text-muted);
}

/* Spice fire emoji micro-interaction */
.spice-fire {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center bottom;
}

.spice-fire.medium {
    transform: scale(1.2);
}

.spice-fire.hot {
    transform: scale(1.4);
    animation: fire-shake 0.3s ease-in-out infinite alternate;
}

@keyframes fire-shake {
    0% { transform: scale(1.4) rotate(-3deg); }
    100% { transform: scale(1.4) rotate(3deg); }
}

/* Cuisines */
.cuisine-wrap {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-sm);
}

.cuisine-chip {
    position: relative;
    aspect-ratio: 1;
    padding: var(--s-sm);
    border: 2px solid var(--c-border);
    border-bottom: 4px solid rgba(139, 79, 51, 0.1);
    border-radius: var(--r-lg);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--c-text);
    background-color: var(--c-white);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    box-shadow: 0 2px 0 rgba(139, 79, 51, 0.06);
    overflow: hidden;
}

/* Flag background from data attribute — always visible regardless of selected state */
.cuisine-chip[data-flag] {
    background: var(--flag-url) center / cover no-repeat var(--c-cream);
}

.cuisine-chip[data-flag="us"] { --flag-url: url('https://flagcdn.com/w320/us.png'); }
.cuisine-chip[data-flag="it"] { --flag-url: url('https://flagcdn.com/w320/it.png'); }
.cuisine-chip[data-flag="mx"] { --flag-url: url('https://flagcdn.com/w320/mx.png'); }
.cuisine-chip[data-flag="in"] { --flag-url: url('https://flagcdn.com/w320/in.png'); }
.cuisine-chip[data-flag="th"] { --flag-url: url('https://flagcdn.com/w320/th.png'); }
.cuisine-chip[data-flag="jp"] { --flag-url: url('https://flagcdn.com/w320/jp.png'); }
.cuisine-chip[data-flag="fr"] { --flag-url: url('https://flagcdn.com/w320/fr.png'); }
.cuisine-chip[data-flag="et"] { --flag-url: url('https://flagcdn.com/w320/et.png'); }
.cuisine-chip[data-flag="de"] { --flag-url: url('https://flagcdn.com/w320/de.png'); }

/* Overlay — OFF state: washed out and desaturated */
.cuisine-chip::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: rgba(253, 248, 243, 0.8);
    transition: background 0.25s ease;
    z-index: 0;
}

/* OFF state: pressed into surface, flat, muted */
.cuisine-chip:not(.selected) {
    transform: translateY(2px);
    border-bottom-width: 2px;
    box-shadow: none;
    filter: grayscale(0.3) brightness(0.95);
}

.cuisine-chip span {
    position: relative;
    z-index: 1;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.9);
}

.cuisine-chip:hover {
    border-color: var(--c-terracotta-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 0 rgba(139, 79, 51, 0.1), 0 4px 12px rgba(139, 79, 51, 0.1);
}

.cuisine-chip:hover::before {
    background: rgba(255, 255, 255, 0.35);
}

.cuisine-chip:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
    box-shadow: none;
}

/* Selected (ON): true flag colors, no overlay, no filter */
.cuisine-chip.selected {
    border-color: var(--c-terracotta);
    border-bottom: 4px solid rgba(100, 40, 20, 0.3);
    box-shadow: 0 3px 0 rgba(100, 40, 20, 0.2), 0 2px 10px rgba(199, 91, 57, 0.25);
    filter: none;
}

.cuisine-chip.selected::before {
    background: transparent;
}

.cuisine-chip.selected span {
    color: var(--c-white);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 8px rgba(0, 0, 0, 0.2);
    font-weight: 700;
}

/* Dietary Preferences */
.dietary-wrap {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s-sm);
}

.dietary-chip {
    padding: var(--s-sm) var(--s-md);
    border: 2px solid var(--c-border);
    border-bottom: 4px solid rgba(107, 155, 118, 0.1);
    border-radius: var(--r-full);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--c-text-secondary);
    background: var(--c-white);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
    justify-content: center;
    display: flex;
    box-shadow: 0 2px 0 rgba(107, 155, 118, 0.06);
}

.dietary-chip:hover {
    border-color: var(--c-sage-light);
    transform: translateY(-1px);
}

.dietary-chip:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
    box-shadow: none;
}

.dietary-chip.selected {
    background: linear-gradient(145deg, var(--c-sage) 0%, var(--c-sage-dark) 100%);
    border-color: rgba(60, 100, 70, 0.25);
    border-bottom: 4px solid rgba(50, 80, 55, 0.3);
    color: var(--c-white);
    box-shadow: 0 3px 0 rgba(50, 80, 55, 0.2), 0 2px 10px rgba(107, 155, 118, 0.25);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

/* Pantry Tags */
.pantry-input-wrap {
    background: var(--c-cream);
    border-radius: var(--r-md);
    padding: var(--s-sm);
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-sm);
    align-items: center;
    min-height: 48px;
}

.pantry-tags {
    display: contents;
}

.pantry-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--s-xs);
    padding: var(--s-xs) var(--s-sm);
    background: var(--c-white);
    border: 1.5px solid var(--c-border);
    border-bottom: 3px solid rgba(139, 79, 51, 0.1);
    border-radius: var(--r-full);
    font-size: 0.85rem;
    font-weight: 500;
    animation: tagPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 0 rgba(139, 79, 51, 0.05);
}

@keyframes tagPop {
    0% { transform: scale(0) rotate(-15deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.pantry-tag-remove {
    color: var(--c-text-muted);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px;
}

.pantry-tag-remove:hover {
    color: var(--c-terracotta);
}

.pantry-input {
    flex: 1;
    min-width: 80px;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    padding: var(--s-xs);
    outline: none;
}

/* Custom Instructions */
.custom-instructions-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: var(--s-md);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    font-family: var(--f-body);
    font-size: 16px; /* Prevents iOS zoom on focus */
    line-height: 1.5;
    resize: vertical;
    min-height: 80px;
    background: var(--c-cream);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
    -webkit-appearance: none; /* Remove iOS styling */
}

.custom-instructions-input:focus {
    outline: none;
    border-color: var(--c-terracotta);
    box-shadow: 0 0 0 3px rgba(199, 91, 57, 0.1);
}

.custom-instructions-input::placeholder {
    color: var(--c-text-muted);
    font-style: italic;
}

.custom-instructions-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--s-xs);
}

.remember-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.remember-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--c-sage);
    cursor: pointer;
    margin: 0;
}

.remember-toggle-label {
    font-size: 0.75rem;
    color: var(--c-text-muted);
}

/* --- Recipes Modal --- */

.recipes-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
    -webkit-overflow-scrolling: touch;
}

.recipes-modal-overlay.hidden { display: none; }

body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

.recipes-modal {
    background: var(--c-cream);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 65vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.recipes-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 12px;
    border-bottom: 1px solid var(--c-cream-dark);
}

.recipes-modal-header h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    color: var(--c-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recipes-modal-header h3 i {
    color: var(--c-terracotta);
}

.recipes-modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--c-text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}

.recipes-modal-close:hover {
    background: var(--c-cream-dark);
    color: var(--c-text);
}

.recipes-modal-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 20px 0;
}

.recipes-modal-tab {
    background: none;
    border: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--c-text-muted);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.recipes-modal-tab.active {
    background: var(--c-terracotta);
    color: white;
}

.recipes-modal-tab:not(.active):hover {
    background: var(--c-cream-dark);
}

.recipes-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px 20px;
}

.recipes-modal-loading,
.recipes-modal-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--c-text-muted);
    font-size: 0.9rem;
}

.recipes-modal-empty i {
    font-size: 2rem;
    display: block;
    margin-bottom: 12px;
    color: var(--c-sage-light);
}

.recipes-modal-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.recipes-modal-item:hover {
    background: var(--c-cream-dark);
}

.recipes-modal-item-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.recipes-modal-meal {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.recipes-modal-item-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.recipes-modal-item-title {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--c-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recipes-modal-item-date {
    font-size: 0.75rem;
    color: var(--c-text-muted);
}

.recipes-modal-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.recipes-modal-fav,
.recipes-modal-delete {
    background: none;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s, transform 0.2s;
}

.recipes-modal-fav {
    color: var(--c-cream-dark);
}

.recipes-modal-fav.is-fav {
    color: var(--c-terracotta);
}

.recipes-modal-fav:hover {
    transform: scale(1.2);
}

.recipes-modal-delete {
    color: var(--c-text-muted);
    opacity: 0.4;
}

.recipes-modal-delete:hover {
    color: var(--c-terracotta);
    opacity: 1;
    transform: scale(1.1);
}

/* Dropdown item as button (for modal triggers) */
button.dropdown-item {
    width: 100%;
    background: none;
    border: none;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    text-align: left;
}

.char-count {
    font-size: 0.75rem;
    color: var(--c-text-muted);
}

.char-count.near-limit {
    color: var(--c-gold);
}

.char-count.at-limit {
    color: var(--c-terracotta);
}

/* --- Generate Button --- */
.generate-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, var(--c-cream) 80%, transparent);
    padding: var(--s-md);
    padding-bottom: calc(var(--s-md) + env(safe-area-inset-bottom));
    z-index: 100;
}

/* --- Swipe Button (tap + slide to confirm) --- */
.swipe-btn {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    height: 72px;
    background: linear-gradient(145deg, #C0B8B0 0%, #A8A098 50%, #9B958E 100%);
    border: 2px solid rgba(139, 79, 51, 0.05);
    border-bottom: 6px solid rgba(100, 90, 80, 0.25);
    border-radius: 36px;
    position: relative;
    box-shadow: 0 6px 0 rgba(100, 90, 80, 0.15), 0 6px 16px rgba(0, 0, 0, 0.08);
    cursor: not-allowed;
    overflow: hidden;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.swipe-btn.ready {
    background: linear-gradient(145deg, #D06A45 0%, var(--c-terracotta) 40%, var(--c-terracotta-dark) 100%);
    border-color: rgba(139, 60, 30, 0.15);
    border-bottom: 6px solid rgba(100, 35, 15, 0.35);
    box-shadow: 0 6px 0 rgba(100, 35, 15, 0.2), 0 0 30px rgba(199, 91, 57, 0.35), 0 8px 24px rgba(139, 79, 51, 0.15);
    cursor: pointer;
    animation: swipe-pulse 2s infinite;
}

.swipe-btn.ready:active:not(.swiping) {
    transform: translateY(3px);
    border-bottom-width: 2px;
    box-shadow: 0 1px 0 rgba(100, 35, 15, 0.2), 0 0 20px rgba(199, 91, 57, 0.3);
}

/* CTA shimmer when enabled */
.swipe-btn.ready::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(255, 255, 255, 0.25) 45%,
        rgba(255, 255, 255, 0.35) 50%,
        rgba(255, 255, 255, 0.25) 55%,
        transparent 60%
    );
    background-size: 250% 100%;
    animation: shimmer 2.5s ease-in-out infinite;
    z-index: 1;
    pointer-events: none;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes swipe-pulse {
    0%, 100% { box-shadow: var(--shadow-lg), var(--shadow-glow-warm); }
    50% { box-shadow: var(--shadow-lg), 0 0 35px rgba(199, 91, 57, 0.6); }
}

.swipe-track {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 20px 0 80px;
}

/* Draggable thumb */
.swipe-thumb {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 64px;
    height: 64px;
    background: linear-gradient(145deg, #E5E0DB 0%, #D5D0CB 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border: 3px solid #9B958E;
    z-index: 10;
    transition: transform 0.1s, left 0.1s, box-shadow 0.2s, background 0.3s, border-color 0.3s;
    cursor: grab;
}

.swipe-btn.ready .swipe-thumb {
    background: linear-gradient(145deg, #FDF8F3 0%, #F5EDE4 100%);
    border-color: var(--c-terracotta);
    cursor: grab;
}

.swipe-thumb.dragging {
    cursor: grabbing;
    transition: none;
    box-shadow: 0 8px 25px rgba(199, 91, 57, 0.4);
}

.swipe-thumb .generate-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    opacity: 0.5;
    filter: grayscale(60%);
    transition: opacity 0.3s, filter 0.3s, transform 0.2s;
}

.swipe-btn.ready .swipe-thumb .generate-icon {
    opacity: 1;
    filter: none;
}

.swipe-btn.ready:hover .swipe-thumb .generate-icon {
    transform: rotate(-10deg);
}

/* Text area */
.swipe-text-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.swipe-text {
    font-family: var(--f-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
    transition: color 0.3s;
}

.swipe-btn.ready .swipe-text {
    color: var(--c-white);
}

.swipe-hint-text {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
}

.swipe-btn.ready .swipe-hint-text {
    color: rgba(255, 255, 255, 0.7);
}

/* Animated arrows */
.swipe-arrows {
    display: flex;
    gap: 4px;
    margin-left: 10px;
    opacity: 0.4;
    transition: opacity 0.3s;
}

.swipe-btn.ready .swipe-arrows {
    opacity: 0.7;
}

.swipe-arrows i {
    font-size: 0.9rem;
    color: var(--c-white);
    animation: arrow-pulse 1.5s infinite;
}

.swipe-arrows i:nth-child(1) { animation-delay: 0s; }
.swipe-arrows i:nth-child(2) { animation-delay: 0.15s; }

@keyframes arrow-pulse {
    0%, 100% { opacity: 0.3; transform: translateX(0); }
    50% { opacity: 1; transform: translateX(3px); }
}

/* Progress fill when swiping */
.swipe-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.25) 100%);
    border-radius: 36px;
    pointer-events: none;
    transition: width 0.1s;
}

.swipe-progress.completing {
    transition: width 0.2s ease-out;
}

/* Sparkles when ready */
.swipe-btn.ready .swipe-thumb::before,
.swipe-btn.ready .swipe-thumb::after {
    content: '✨';
    position: absolute;
    font-size: 12px;
    animation: sparkle 1.5s infinite;
}

.swipe-btn.ready .swipe-thumb::before {
    top: -4px;
    right: -4px;
    animation-delay: 0s;
}

.swipe-btn.ready .swipe-thumb::after {
    bottom: -4px;
    left: -4px;
    animation-delay: 0.75s;
}

@keyframes sparkle {
    0%, 100% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1); }
}

/* Hover state for tap */
.swipe-btn.ready:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 40px rgba(199, 91, 57, 0.5);
}

.swipe-btn.ready:active:not(.swiping) {
    transform: scale(0.98);
}

/* Hide arrows while dragging */
.swipe-btn.swiping .swipe-arrows {
    opacity: 0;
}

.swipe-btn.swiping .swipe-text-area {
    opacity: 0.5;
}

.generate-hint {
    text-align: center;
    font-size: 0.85rem;
    color: var(--c-text-secondary);
    margin-top: var(--s-sm);
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    transition: opacity var(--t-fast);
    font-style: italic;
}

.generate-hint.hidden {
    opacity: 0;
}

/* --- Footer Art --- */
.footer-art {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: -1;
    opacity: 0.3;
}

.footer-art img {
    max-width: 200px;
}

/* --- Responsive --- */
@media (min-width: 768px) {
    .app {
        padding: var(--s-lg);
    }

    .generate-section {
        padding: var(--s-lg);
    }
}

/* ===========================================
   RESULT PAGE - Recipe Display
   =========================================== */

.result-page {
    max-width: 540px;
    margin: 0 auto;
    padding: var(--s-md);
    padding-bottom: var(--s-xxl);
}

/* Logo on result page */
.result-logo {
    display: flex;
    align-items: center;
    gap: var(--s-md);
    padding: var(--s-md) 0;
    margin-bottom: var(--s-lg);
}

.result-logo img {
    width: 48px;
    height: 48px;
}

.result-logo-text h1 {
    font-family: var(--f-logo);
    font-size: 1.75rem;
    color: var(--c-terracotta);
    line-height: 1;
    margin-bottom: 2px;
}

.result-logo-text p {
    font-size: 0.75rem;
    color: var(--c-text-muted);
    letter-spacing: 0.5px;
}

/* Recipe Hero */
.recipe-hero {
    background: linear-gradient(135deg, var(--c-terracotta) 0%, var(--c-terracotta-dark) 100%);
    border-radius: var(--r-xl);
    padding: var(--s-xl);
    margin-bottom: var(--s-lg);
    color: var(--c-white);
    box-shadow: var(--shadow-lg);
}

.recipe-title {
    font-family: var(--f-display);
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--s-sm);
}

.recipe-description {
    font-size: 1rem;
    opacity: 0.9;
    line-height: 1.5;
    margin-bottom: var(--s-md);
}

.recipe-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-sm);
    margin-top: var(--s-md);
}

.meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: var(--r-full);
    font-size: 0.85rem;
    backdrop-filter: blur(4px);
}

.meta-badge i {
    font-size: 0.8rem;
}

/* Nutrition Card */
.nutrition-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border-radius: var(--r-md);
    padding: var(--s-md);
    margin-top: var(--s-lg);
}

.nutrition-header {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--s-sm);
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nutrition-header i {
    font-size: 0.75rem;
}

.nutrition-per {
    font-weight: 400;
    text-transform: none;
    opacity: 0.8;
    font-size: 0.75rem;
}

.nutrition-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--s-sm);
}

.nutrition-item {
    text-align: center;
    padding: var(--s-sm);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--r-sm);
}

.nutrition-item.nutrition-calories {
    grid-column: span 3;
    background: rgba(255, 255, 255, 0.2);
}

.nutrition-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.2;
}

.nutrition-label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    opacity: 0.85;
    margin-top: 2px;
}

@media (max-width: 480px) {
    .nutrition-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .nutrition-item.nutrition-calories {
        grid-column: span 4;
    }

    .nutrition-value {
        font-size: 1rem;
    }
}

/* Recipe Sections */
.recipe-section {
    background: var(--c-white);
    border-radius: var(--r-lg);
    padding: var(--s-lg);
    margin-bottom: var(--s-md);
    box-shadow: var(--shadow-sm);
}

.recipe-section-title {
    font-family: var(--f-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--c-terracotta);
    margin-bottom: var(--s-md);
    display: flex;
    align-items: center;
    gap: var(--s-sm);
}

.recipe-section-title i {
    font-size: 1rem;
    opacity: 0.8;
}

/* Identified Ingredients */
.identified-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-sm);
}

.identified-item {
    display: inline-block;
    background: var(--c-cream);
    border: 1px solid var(--c-border);
    padding: 4px 12px;
    border-radius: var(--r-full);
    font-size: 0.85rem;
    color: var(--c-text-secondary);
}

/* Ingredient List */
.ingredient-list {
    list-style: none;
}

.ingredient-list li {
    position: relative;
    padding: var(--s-sm) 0;
    padding-left: var(--s-lg);
    border-bottom: 1px solid var(--c-border);
    font-size: 0.95rem;
}

.ingredient-list li:last-child {
    border-bottom: none;
}

.ingredient-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--c-terracotta-light);
    border-radius: 50%;
}

/* Recipe Steps (result page) */
.recipe-steps {
    display: flex;
    flex-direction: column;
    gap: var(--s-md);
}

.recipe-step {
    display: flex;
    gap: var(--s-md);
    align-items: flex-start;
}

.recipe-step-num {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--c-terracotta) 0%, var(--c-terracotta-dark) 100%);
    color: var(--c-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.recipe-step-text {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--c-text);
    padding-top: 4px;
}

/* Chef's Notes */
.chef-notes {
    background: linear-gradient(135deg, var(--c-gold) 0%, #C9973E 100%);
    border-radius: var(--r-lg);
    padding: var(--s-lg);
    margin-bottom: var(--s-lg);
    color: var(--c-white);
}

.chef-notes h5 {
    font-family: var(--f-display);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--s-sm);
    display: flex;
    align-items: center;
    gap: var(--s-sm);
}

.chef-notes p {
    font-size: 0.95rem;
    line-height: 1.6;
    opacity: 0.95;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--s-sm);
    margin-top: var(--s-lg);
}

.btn-primary-action,
.btn-secondary-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-sm);
    padding: var(--s-md) var(--s-lg);
    border-radius: var(--r-lg);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--t-fast);
    border: none;
    font-family: var(--f-body);
}

.btn-primary-action {
    background: linear-gradient(135deg, var(--c-terracotta) 0%, var(--c-terracotta-dark) 100%);
    color: var(--c-white);
    box-shadow: var(--shadow-md);
}

.btn-primary-action:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary-action:active {
    transform: translateY(0);
}

.btn-secondary-action {
    background: var(--c-white);
    color: var(--c-text-secondary);
    border: 1px solid var(--c-border);
}

.btn-secondary-action:hover {
    background: var(--c-cream);
    color: var(--c-terracotta);
    border-color: var(--c-terracotta-light);
}

/* Result page responsive */
@media (min-width: 480px) {
    .recipe-title {
        font-size: 2rem;
    }

    .action-buttons:not(.action-buttons-stacked) {
        flex-direction: row;
    }

    .action-buttons:not(.action-buttons-stacked) .btn-primary-action,
    .action-buttons:not(.action-buttons-stacked) .btn-secondary-action {
        flex: 1;
    }
}

/* ===========================================
   SELECT PAGE - Recipe Options
   =========================================== */

.select-page {
    min-height: 100vh;
    background: var(--c-cream);
    padding-bottom: var(--s-xxl);
}

/* Select Header */
.select-header {
    display: flex;
    align-items: center;
    gap: var(--s-md);
    padding: var(--s-md);
    background: var(--c-white);
    border-bottom: 1px solid var(--c-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.back-link {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-text-secondary);
    text-decoration: none;
    border-radius: var(--r-full);
    transition: all var(--t-fast);
}

.back-link:hover {
    background: var(--c-cream);
    color: var(--c-terracotta);
}

.select-brand {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
}

.select-brand img {
    width: 32px;
    height: 32px;
}

.select-brand span {
    font-family: var(--f-logo);
    font-size: 1.5rem;
    color: var(--c-terracotta);
}

/* Select Hero */
.select-hero {
    text-align: center;
    padding: var(--s-xl) var(--s-md) var(--s-lg);
}

.select-hero h1 {
    font-family: var(--f-display);
    font-size: 1.75rem;
    color: var(--c-text);
    margin-bottom: var(--s-sm);
}

.select-hero p {
    color: var(--c-text-secondary);
    font-size: 0.95rem;
}

/* Ingredients Found (collapsible) */
.ingredients-found {
    background: var(--c-white);
    margin: 0 var(--s-md) var(--s-md);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.ingredients-found summary {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    padding: var(--s-md);
    cursor: pointer;
    list-style: none;
    font-size: 0.9rem;
    color: var(--c-text-secondary);
}

.ingredients-found summary::-webkit-details-marker {
    display: none;
}

.ingredients-found summary i:first-child {
    color: var(--c-terracotta);
}

.ingredients-found summary .chevron {
    margin-left: auto;
    transition: transform var(--t-fast);
    font-size: 0.75rem;
}

.ingredients-found[open] summary .chevron {
    transform: rotate(180deg);
}

.ingredients-found-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-xs);
    padding: 0 var(--s-md) var(--s-md);
}

.found-item {
    background: var(--c-cream);
    padding: 4px 10px;
    border-radius: var(--r-full);
    font-size: 0.8rem;
    color: var(--c-text-secondary);
}

/* Options Grid */
.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--s-md);
    padding: 0 var(--s-md);
    max-width: 800px;
    margin: 0 auto;
}

@media (min-width: 600px) {
    .options-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Option Card */
.option-card-form {
    display: contents;
}

.option-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    background: var(--c-white);
    border: 2px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: var(--s-lg);
    cursor: pointer;
    transition: all var(--t-fast);
    width: 100%;
    font-family: var(--f-body);
}

.option-card:hover {
    border-color: var(--c-terracotta-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.option-card:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--s-sm);
}

.option-cuisine {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--c-terracotta);
    font-weight: 600;
}

.option-difficulty {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: var(--r-full);
    font-weight: 500;
}

.option-difficulty.easy {
    background: var(--c-sage-light);
    color: var(--c-sage-dark);
}

.option-difficulty.medium {
    background: #FEF3C7;
    color: #92400E;
}

.option-difficulty.challenging {
    background: var(--c-terracotta-light);
    color: var(--c-terracotta-dark);
}

.option-title {
    font-family: var(--f-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: var(--s-xs);
    line-height: 1.3;
}

.option-tagline {
    font-size: 0.85rem;
    color: var(--c-text-secondary);
    margin-bottom: var(--s-md);
    line-height: 1.4;
    flex-grow: 1;
}

.option-meta {
    display: flex;
    gap: var(--s-md);
    font-size: 0.8rem;
    color: var(--c-text-muted);
    margin-bottom: var(--s-md);
}

.option-meta i {
    margin-right: 4px;
    color: var(--c-terracotta-light);
}

.option-select-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-sm);
    padding-top: var(--s-sm);
    border-top: 1px solid var(--c-border);
    font-size: 0.85rem;
    color: var(--c-terracotta);
    font-weight: 500;
    opacity: 0;
    transition: opacity var(--t-fast);
}

.option-card:hover .option-select-hint {
    opacity: 1;
}

/* Select Actions */
.select-actions {
    display: flex;
    justify-content: center;
    padding: var(--s-xl) var(--s-md);
}

.btn-back-kitchen {
    display: inline-flex;
    align-items: center;
    gap: var(--s-sm);
    padding: var(--s-sm) var(--s-lg);
    color: var(--c-text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: var(--r-lg);
    transition: all var(--t-fast);
}

.btn-back-kitchen:hover {
    background: var(--c-white);
    color: var(--c-terracotta);
}

/* ===========================================
   RESULT PAGE - Interactive Features
   =========================================== */

/* Section Header with Scaler */
.recipe-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--s-md);
}

.recipe-section-header .recipe-section-title {
    margin-bottom: 0;
}

/* Serving Scaler */
.serving-scaler {
    display: flex;
    align-items: center;
    gap: var(--s-xs);
    background: var(--c-cream);
    padding: 4px;
    border-radius: var(--r-full);
}

.serving-btn-sm {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--c-white);
    color: var(--c-terracotta);
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--t-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.serving-btn-sm:hover:not(:disabled) {
    background: var(--c-terracotta);
    color: var(--c-white);
    transform: scale(1.1);
}

.serving-btn-sm:active:not(:disabled) {
    transform: scale(0.95);
}

.serving-btn-sm:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.serving-display {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--c-terracotta);
    min-width: 32px;
    text-align: center;
}

/* Interactive Ingredient List */
.ingredient-list li {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    cursor: pointer;
    transition: all var(--t-fast);
    padding-left: 0;
}

.ingredient-list li::before {
    display: none;
}

.ingredient-check {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 2px solid var(--c-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t-fast);
}

.ingredient-check i {
    font-size: 0.65rem;
    color: transparent;
    transition: color var(--t-fast);
}

.ingredient-list li:hover .ingredient-check {
    border-color: var(--c-terracotta-light);
}

.ingredient-list li.checked .ingredient-check {
    background: var(--c-sage);
    border-color: var(--c-sage);
}

.ingredient-list li.checked .ingredient-check i {
    color: var(--c-white);
}

.ingredient-text {
    flex: 1;
    transition: all var(--t-fast);
}

.ingredient-list li.checked .ingredient-text {
    text-decoration: line-through;
    color: var(--c-text-muted);
}

/* Ingredients Progress */
.ingredients-progress {
    margin-top: var(--s-md);
    padding-top: var(--s-sm);
    border-top: 1px solid var(--c-border);
    font-size: 0.8rem;
    color: var(--c-text-muted);
    text-align: center;
}

/* Share Button */
.action-buttons-secondary {
    display: flex;
    justify-content: center;
    margin-top: var(--s-md);
}

.btn-share {
    display: inline-flex;
    align-items: center;
    gap: var(--s-sm);
    padding: var(--s-sm) var(--s-lg);
    background: transparent;
    border: 1px solid var(--c-border);
    border-radius: var(--r-full);
    color: var(--c-text-secondary);
    font-size: 0.9rem;
    font-family: var(--f-body);
    cursor: pointer;
    transition: all var(--t-fast);
}

.btn-share:hover {
    background: var(--c-white);
    border-color: var(--c-terracotta-light);
    color: var(--c-terracotta);
}

.btn-share i {
    font-size: 0.85rem;
}

/* ===========================================
   HISTORY PAGE - Recipe History
   =========================================== */

.history-page {
    min-height: 100vh;
    background: var(--c-cream);
    padding-bottom: var(--s-xxl);
}

.history-hero {
    text-align: center;
    padding: var(--s-xl) var(--s-md) var(--s-lg);
}

.history-hero h1 {
    font-family: var(--f-display);
    font-size: 1.75rem;
    color: var(--c-text);
    margin-bottom: var(--s-xs);
}

.history-hero p {
    color: var(--c-text-secondary);
    font-size: 0.9rem;
}

/* Empty State */
.history-empty {
    text-align: center;
    padding: var(--s-xxl) var(--s-md);
}

.empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--s-lg);
    background: var(--c-cream-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-icon i {
    font-size: 2rem;
    color: var(--c-text-muted);
}

.history-empty h3 {
    font-family: var(--f-display);
    font-size: 1.25rem;
    color: var(--c-text);
    margin-bottom: var(--s-sm);
}

.history-empty p {
    color: var(--c-text-secondary);
    margin-bottom: var(--s-lg);
}

/* Recipe List */
.history-list {
    padding: 0 var(--s-md);
    max-width: 600px;
    margin: 0 auto;
}

.history-date-group {
    margin-bottom: var(--s-lg);
}

.history-date {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--s-sm);
    padding-left: var(--s-sm);
}

.history-card {
    display: flex;
    align-items: center;
    background: var(--c-white);
    border-radius: var(--r-md);
    margin-bottom: var(--s-sm);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all var(--t-fast);
}

.history-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.history-card-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--s-md);
    padding: var(--s-md);
    text-decoration: none;
    color: inherit;
}

.history-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.history-card-icon.meal-breakfast {
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    color: #92400E;
}

.history-card-icon.meal-lunch {
    background: linear-gradient(135deg, #D1FAE5, #A7F3D0);
    color: #065F46;
}

.history-card-icon.meal-dinner {
    background: linear-gradient(135deg, #DBEAFE, #BFDBFE);
    color: #1E40AF;
}

.history-card-icon.meal-dessert {
    background: linear-gradient(135deg, #FCE7F3, #FBCFE8);
    color: #9D174D;
}

.history-card-content {
    flex: 1;
    min-width: 0;
}

.history-card-title {
    font-family: var(--f-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-card-meta {
    font-size: 0.8rem;
    color: var(--c-text-muted);
}

.history-card-favorite {
    padding: var(--s-md);
    background: none;
    border: none;
    color: var(--c-text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all var(--t-fast);
}

.history-card-favorite:hover {
    color: var(--c-terracotta-light);
    transform: scale(1.1);
}

.history-card-favorite.active {
    color: var(--c-terracotta);
}

/* Full-width button variant */
.btn-full-width {
    width: 100%;
}

/* ===========================================
   STEP TIMERS
   =========================================== */

.recipe-step-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--s-xs);
}

.step-timer-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--s-xs);
    padding: 4px 10px;
    margin-top: var(--s-xs);
    background: var(--c-cream);
    border: 1px solid var(--c-border);
    border-radius: var(--r-full);
    font-size: 0.75rem;
    color: var(--c-terracotta);
    cursor: pointer;
    transition: all var(--t-fast);
    width: fit-content;
}

.step-timer-btn:hover {
    background: var(--c-terracotta);
    border-color: var(--c-terracotta);
    color: var(--c-white);
}

.step-timer-btn i {
    font-size: 0.7rem;
}

/* Technique Links */
.technique-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-xs);
    margin-top: var(--s-xs);
}

.technique-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: #FEE2E2;
    border: 1px solid #FECACA;
    border-radius: var(--r-full);
    font-size: 0.7rem;
    color: #DC2626;
    text-decoration: none;
    transition: all var(--t-fast);
}

.technique-link:hover {
    background: #DC2626;
    border-color: #DC2626;
    color: white;
}

.technique-link i {
    font-size: 0.75rem;
}

/* Multi-Timer Bar */
.timer-bar {
    position: fixed;
    bottom: var(--s-md);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-sm);
    justify-content: center;
    z-index: 999;
    max-width: calc(100vw - var(--s-lg));
}

.timer-bar.hidden {
    display: none;
}

.timer-pill {
    background: var(--c-terracotta);
    color: var(--c-white);
    padding: var(--s-sm) var(--s-md);
    border-radius: var(--r-full);
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    box-shadow: var(--shadow-lg);
    animation: pulse-glow 2s infinite;
    font-size: 0.9rem;
}

.timer-pill-paused {
    background: var(--c-text-secondary);
    animation: none;
}

.timer-pill-done {
    background: var(--c-sage);
    animation: timer-done-pulse 0.5s ease-in-out 3;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: var(--shadow-lg); }
    50% { box-shadow: var(--shadow-lg), 0 0 15px rgba(199, 91, 57, 0.5); }
}

@keyframes timer-done-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.timer-pill-label {
    font-weight: 500;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timer-pill-time {
    font-weight: 700;
    font-family: var(--f-body);
    letter-spacing: 0.5px;
    min-width: 45px;
    text-align: center;
}

.timer-pill-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--c-white);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: background var(--t-fast);
}

.timer-pill-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.timer-pill-stop:hover {
    background: rgba(0, 0, 0, 0.2);
}

@media (max-width: 480px) {
    .timer-bar {
        bottom: var(--s-sm);
        left: var(--s-sm);
        right: var(--s-sm);
        transform: none;
        max-width: none;
    }

    .timer-pill {
        font-size: 0.8rem;
        padding: 6px var(--s-sm);
    }

    .timer-pill-label {
        max-width: 70px;
    }
}

/* Delete Account Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--s-md);
    backdrop-filter: blur(4px);
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: var(--c-white);
    border-radius: var(--r-lg);
    padding: var(--s-xl);
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.modal-content h3 {
    font-family: var(--f-display);
    font-size: 1.25rem;
    color: var(--c-text);
    margin-bottom: var(--s-md);
    display: flex;
    align-items: center;
    gap: var(--s-sm);
}

.modal-danger h3 {
    color: #c53030;
}

.modal-danger h3 i {
    color: #c53030;
}

.modal-content p {
    font-size: 0.9rem;
    color: var(--c-text-secondary);
    margin-bottom: var(--s-sm);
    line-height: 1.5;
}

.modal-content ul {
    margin: var(--s-sm) 0 var(--s-md) var(--s-lg);
    font-size: 0.85rem;
    color: var(--c-text-secondary);
}

.modal-content ul li {
    margin-bottom: var(--s-xs);
}

.modal-confirm-field {
    margin: var(--s-lg) 0;
}

.modal-confirm-field label {
    display: block;
    font-size: 0.85rem;
    color: var(--c-text);
    margin-bottom: var(--s-sm);
}

.modal-confirm-field input {
    width: 100%;
    padding: var(--s-sm) var(--s-md);
    border: 2px solid var(--c-border);
    border-radius: var(--r-sm);
    font-size: 1rem;
    transition: border-color var(--t-fast);
}

.modal-confirm-field input:focus {
    outline: none;
    border-color: var(--c-terracotta);
}

.modal-actions {
    display: flex;
    gap: var(--s-sm);
    justify-content: flex-end;
    margin-top: var(--s-lg);
}

.btn-danger {
    background: #c53030;
    color: var(--c-white);
    padding: var(--s-sm) var(--s-lg);
    border-radius: var(--r-sm);
    font-weight: 500;
    transition: background var(--t-fast);
}

.btn-danger:hover:not(:disabled) {
    background: #9b2c2c;
}

.btn-danger:disabled {
    background: #e5a0a0;
    cursor: not-allowed;
}

/* ===========================================
   PWA Install Banner
   =========================================== */

.install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--c-white);
    padding: var(--s-md) var(--s-lg);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--s-md);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.install-banner.hidden {
    display: none;
}

.install-banner-content {
    display: flex;
    align-items: center;
    gap: var(--s-md);
}

.install-banner-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--r-md);
    flex-shrink: 0;
}

.install-banner-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.install-banner-text strong {
    font-family: var(--f-display);
    font-size: 1rem;
    color: var(--c-text);
}

.install-banner-text span {
    font-size: 0.85rem;
    color: var(--c-text-secondary);
}

.install-banner-actions {
    display: flex;
    gap: var(--s-sm);
    justify-content: flex-end;
}

.install-banner-dismiss {
    background: transparent;
    border: none;
    color: var(--c-text-secondary);
    font-size: 0.9rem;
    padding: var(--s-sm) var(--s-md);
    cursor: pointer;
    border-radius: var(--r-sm);
    transition: background var(--t-fast);
}

.install-banner-dismiss:hover {
    background: var(--c-cream);
}

.install-banner-install {
    background: var(--c-terracotta);
    color: var(--c-white);
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: var(--s-sm) var(--s-lg);
    border-radius: var(--r-pill);
    cursor: pointer;
    transition: background var(--t-fast), transform var(--t-fast);
}

.install-banner-install:hover {
    background: var(--c-terracotta-dark);
    transform: scale(1.02);
}

/* Tablet+ layout: horizontal banner */
@media (min-width: 600px) {
    .install-banner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}
