/* Global CSS Reset & Variables */
:root {
    --bg-dark: #0f0f16;
    --bg-card: rgba(22, 22, 33, 0.7);
    --bg-sidebar: #09090d;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f3f6;
    --text-secondary: #a0a0b0;
    --primary-color: #ff7e67;
    --primary-glow: rgba(255, 126, 103, 0.35);
    --secondary-color: #f7d070;
    --success-color: #2ed573;
    --warning-color: #ffa502;
    --danger-color: #ff4757;
    --font-heading: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', sans-serif;
    --font-body: system-ui, -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --shadow-3d: rgba(6, 6, 10, 0.8);
    --shadow-glow: rgba(255, 126, 103, 0.15);
    /* Soft elevation system (replaces the hard 3D offset shadows) */
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px rgba(0, 0, 0, 0.40);
    --shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.40), 0 16px 40px rgba(0, 0, 0, 0.50);
    --shadow-press: 0 1px 2px rgba(0, 0, 0, 0.40), 0 3px 10px rgba(0, 0, 0, 0.40);
    --shadow-primary: 0 2px 8px rgba(255, 126, 103, 0.28), 0 10px 24px rgba(255, 126, 103, 0.20);
    /* Radius scale */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
}

/* Light mode overrides (System & Manual class) */
@media (prefers-color-scheme: light) {
    :root:not(.theme-dark) {
        --bg-dark: #ffffff;
        --bg-card: #ffffff;
        --bg-sidebar: #ffffff;
        --border-color: rgba(0, 0, 0, 0.08);
        --text-primary: #151720;
        --text-secondary: #5a5f75;
        --primary-glow: rgba(255, 126, 103, 0.15);
        --shadow-3d: rgba(180, 185, 200, 0.7);
        --shadow-glow: rgba(255, 126, 103, 0.06);
        --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.03);
        --shadow-hover: 0 2px 6px rgba(21, 23, 32, 0.07), 0 16px 36px rgba(21, 23, 32, 0.11);
        --shadow-press: 0 1px 2px rgba(21, 23, 32, 0.06), 0 3px 10px rgba(21, 23, 32, 0.06);
        --shadow-primary: 0 2px 8px rgba(255, 126, 103, 0.22), 0 8px 20px rgba(255, 126, 103, 0.16);
    }
    
    :root:not(.theme-dark) .header-title h1 {
        background: none !important;
        -webkit-background-clip: unset !important;
        -webkit-text-fill-color: currentColor !important;
        color: var(--text-primary) !important;
    }

    /* Override sidebar menu active state for light mode */
    :root:not(.theme-dark) .menu-item.active {
        color: var(--primary-color) !important;
        background: linear-gradient(135deg, rgba(255, 126, 103, 0.1), rgba(247, 208, 112, 0.03)) !important;
        border: 1px solid rgba(255, 126, 103, 0.22) !important;
        box-shadow: 0 4px 14px rgba(255, 126, 103, 0.1) !important;
    }

    /* Recipe preview box background in light mode */
    :root:not(.theme-dark) .saved-recipe-preview {
        background-color: rgba(0, 0, 0, 0.04) !important;
        color: #151720 !important;
        border: 1px solid rgba(0, 0, 0, 0.05);
    }
    
    /* Light mode table & input overrides */
    
    :root:not(.theme-dark) .recipe-table-wrapper {
        background-color: rgba(255, 255, 255, 0.6) !important;
    }
    
    :root:not(.theme-dark) .scale-input-wrapper input {
        background-color: rgba(255, 255, 255, 0.8) !important;
        color: #151720 !important;
    }

    /* Light mode hover overrides to remove dark mode background jumps */
    :root:not(.theme-dark) .category-card:hover:not(:active):not(.card-press), 
    :root:not(.theme-dark) .template-card:hover:not(:active):not(.card-press),
    :root:not(.theme-dark) .preset-card:hover:not(.selected):not(:active):not(.card-press) {
        transform: translateY(-2px);
        background-color: rgba(255, 255, 255, 0.98) !important;
        box-shadow: var(--shadow-hover) !important;
        border-color: rgba(0, 0, 0, 0.15) !important;
    }

    :root:not(.theme-dark) .menu-item:hover {
        background-color: rgba(0, 0, 0, 0.03) !important;
        color: var(--text-primary) !important;
    }

    :root:not(.theme-dark) .checklist-card:hover {
        border-color: rgba(0, 0, 0, 0.15) !important;
        background-color: rgba(0, 0, 0, 0.01) !important;
    }
}

.theme-light {
    --bg-dark: #ffffff;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --border-color: rgba(0, 0, 0, 0.08);
    --text-primary: #151720;
    --text-secondary: #5a5f75;
    --primary-glow: rgba(255, 126, 103, 0.15);
    --shadow-3d: rgba(180, 185, 200, 0.7);
    --shadow-glow: rgba(255, 126, 103, 0.06);
    --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 2px 6px rgba(21, 23, 32, 0.07), 0 16px 36px rgba(21, 23, 32, 0.11);
    --shadow-press: 0 1px 2px rgba(21, 23, 32, 0.06), 0 3px 10px rgba(21, 23, 32, 0.06);
    --shadow-primary: 0 2px 8px rgba(255, 126, 103, 0.22), 0 8px 20px rgba(255, 126, 103, 0.16);
}

.theme-light .header-title h1 {
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: currentColor !important;
    color: var(--text-primary) !important;
}

.theme-light .menu-item.active {
    color: var(--primary-color) !important;
    background: linear-gradient(135deg, rgba(255, 126, 103, 0.1), rgba(247, 208, 112, 0.03)) !important;
    border: 1px solid rgba(255, 126, 103, 0.22) !important;
    box-shadow: 0 4px 14px rgba(255, 126, 103, 0.1) !important;
}
.theme-light .saved-recipe-preview {
    background-color: rgba(0, 0, 0, 0.04) !important;
    color: #151720 !important;
    border: 1px solid rgba(0, 0, 0, 0.05);
}
.theme-light .recipe-table-wrapper {
    background-color: rgba(255, 255, 255, 0.6) !important;
}
.theme-light .scale-input-wrapper input {
    background-color: rgba(255, 255, 255, 0.8) !important;
    color: #151720 !important;
}
.theme-light .category-card:hover:not(:active):not(.card-press), 
.theme-light .template-card:hover:not(:active):not(.card-press),
.theme-light .preset-card:hover:not(.selected):not(:active):not(.card-press) {
    transform: translateY(-2px);
    background-color: rgba(255, 255, 255, 0.98) !important;
    box-shadow: var(--shadow-hover) !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
}
.theme-light .menu-item:hover {
    background-color: rgba(0, 0, 0, 0.03) !important;
    color: var(--text-primary) !important;
}
.theme-light .checklist-card:hover {
    border-color: rgba(0, 0, 0, 0.15) !important;
    background-color: rgba(0, 0, 0, 0.01) !important;
}

.theme-dark {
    --bg-dark: #0f0f16;
    --bg-card: rgba(22, 22, 33, 0.7);
    --bg-sidebar: #09090d;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f3f6;
    --text-secondary: #a0a0b0;
    --primary-color: #ff7e67;
    --primary-glow: rgba(255, 126, 103, 0.35);
    --secondary-color: #f7d070;
    --success-color: #2ed573;
    --warning-color: #ffa502;
    --danger-color: #ff4757;
    --shadow-3d: rgba(6, 6, 10, 0.8);
    --shadow-glow: rgba(255, 126, 103, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(150, 150, 150, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(150, 150, 150, 0.5);
}

.theme-dark ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.theme-dark ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow-x: hidden;
    height: 100vh;
    overscroll-behavior: none;
    scrollbar-gutter: stable;
}

/* App Container (Flex Layout) */
.app-container {
    display: flex;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    height: 100vh;
    height: 100dvh;
    box-sizing: border-box;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 24px max(24px, env(safe-area-inset-bottom)) 24px;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
}

.sidebar-brand {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-top: -24px !important;
    margin-left: -24px !important;
    margin-right: -24px !important;
    width: calc(100% + 48px) !important;
    margin-bottom: 32px !important;
    background-color: #000000 !important; /* 浅色模式下的极致纯黑 (#000000) 顶部色块 */
    border: none !important;
    border-radius: 0 !important;
    padding: 22px 0 !important;
    cursor: default !important;
    text-align: center !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
    transition: none !important;
}

/* 深色模式下：背景色自动同化为侧边栏纯黑背景(var(--bg-sidebar))，100% 浑然一体不突兀 */
:root:not(.theme-light) .sidebar-brand,
.theme-dark .sidebar-brand {
    background-color: var(--bg-sidebar) !important;
    border: none !important;
    box-shadow: none !important;
}

.sidebar-brand:hover,
.sidebar-brand:active,
.sidebar-brand:focus {
    transform: none !important;
    box-shadow: none !important;
    opacity: 1 !important;
}

.brand-bowl-icon {
    height: 28px;
    width: auto;
    object-fit: contain;
    display: block;
}

.brand-text-logo {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
    display: inline-block;
    line-height: 1;
}

.splash-logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    animation: splashPulse 1.5s ease-in-out infinite alternate;
    will-change: transform;
}

.splash-logo-container .brand-bowl-icon {
    height: 48px;
}

.splash-logo-container .brand-text-logo {
    font-size: 42px;
}

.sidebar-brand:focus-visible {
    outline: 2px solid #B65A40;
    outline-offset: 4px;
}

.brand-logo-img {
    height: 38px !important;
    width: auto !important;
    max-width: 195px !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
    transform: translateX(-6px) !important; /* 视觉微调：向左微调 6px 实现光学视觉完美居中 */
}

.sidebar-brand:hover .brand-logo-img {
    transform: none;
}

.brand-logo-dark {
    display: block;
}

.brand-logo-light {
    display: none;
}

.theme-light .brand-logo-dark {
    display: none;
}

.theme-light .brand-logo-light {
    display: block;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-height: 0;
}

.sidebar-footer {
    margin-top: auto;
    position: relative;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.menu-item {
    background: transparent;
    border: 1px solid transparent;
    outline: none;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    border-radius: 14px;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1), 
                background-color 0.2s ease, 
                border-color 0.2s ease, 
                color 0.2s ease, 
                box-shadow 0.25s ease;
    user-select: none;
}

.menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1), color 0.2s ease;
}

.menu-label {
    transition: color 0.2s ease;
}

.menu-item:hover {
    color: var(--text-primary);
    background-color: rgba(255, 126, 103, 0.06);
    border-color: rgba(255, 126, 103, 0.12);
}

.menu-item:hover .menu-icon {
    transform: scale(1.15) translateX(2px);
    color: var(--primary-color);
}

.menu-item:active {
    transform: scale(0.96) !important;
    transition: transform 0.1s ease !important;
}

.menu-item.active {
    color: var(--primary-color);
    background: linear-gradient(135deg, rgba(255, 126, 103, 0.14), rgba(247, 208, 112, 0.04));
    border: 1px solid rgba(255, 126, 103, 0.25);
    box-shadow: 0 4px 16px rgba(255, 126, 103, 0.12);
    font-weight: 600;
}

.menu-item.active .menu-icon {
    color: var(--primary-color);
    transform: scale(1.08);
}

.menu-item.active:hover .menu-icon {
    transform: scale(1.15) translateX(2px);
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    flex-shrink: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    font-size: 24px;
    background-color: rgba(255, 255, 255, 0.05);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

.user-info h4 {
    font-size: 14px;
    font-weight: 600;
}

.user-info span {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 0;
    box-sizing: border-box;
    padding: 32px 40px 32px 40px;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

button, a, input, select, textarea, .category-card, .template-card, .preset-card, .mise-chip {
    touch-action: manipulation;
}

button, a, .category-card, .template-card, .preset-card, .mise-chip {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.header-title h1 {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.header-title p {
    font-size: 14px;
    color: var(--text-secondary);
}

.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    background-color: rgba(255, 255, 255, 0.03);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success-color);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 10px var(--success-color);
}

/* Page sections: no always-on animation — only .view-enter on navigation */
.hidden {
    display: none !important;
}

/* Unified page enter — one motion for every view switch (calm, unhurried) */
@keyframes viewEnter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-enter {
    /* Longer + softer ease so it doesn’t feel rushed */
    animation: viewEnter 0.48s cubic-bezier(0.33, 0.12, 0.25, 1) both !important;
}

/* Fast, zero-slide fade for snappy sub-category filtering */
@keyframes fastFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.view-fade-fast {
    animation: fastFade 0.15s ease-out both !important;
}

/* Wiggle animation for repeatedly clicking the active tab */
@keyframes wiggle {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}
.view-wiggle {
    animation: wiggle 0.2s ease-in-out !important;
}

/* Slide in from right */
@keyframes slideFromRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
.view-slide-right {
    animation: slideFromRight 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both !important;
}

/* Slide in from left */
@keyframes slideFromLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
.view-slide-left {
    animation: slideFromLeft 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both !important;
}

@media (prefers-reduced-motion: reduce) {
    .view-enter,
    .view-fade-fast,
    .view-wiggle,
    .view-slide-left,
    .view-slide-right {
        animation: none !important;
    }
    .page-section {
        animation: none !important;
    }
}

/* Category Grid & Cards — 4×2 full width of content (matching 8001 reference exactly) */
.category-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 28px;
    margin: 0 auto 40px auto;
    width: 100%;
    max-width: 1140px;
    box-sizing: border-box;
}

@media (max-width: 900px) {
    .category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .category-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.category-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    border-radius: 16px;
    padding: 0 0 10px 0;
    text-align: center;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.25s cubic-bezier(0.25, 0.8, 0.25, 1), border-color 0.15s ease, background-color 0.15s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden; /* Hide overflowing parts of the image */
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(255, 255, 255, 0.16);
}

:root .category-card:active,
:root .category-card.card-press-down,
:root .template-card:active,
:root .template-card.card-press-down,
.theme-light .category-card:active,
.theme-light .category-card.card-press-down,
.theme-light .template-card:active,
.theme-light .template-card.card-press-down,
.category-card:hover:active,
.category-card:active,
.category-card.card-press-down,
.template-card:hover:active,
.template-card:active,
.template-card.card-press-down {
    transform: translateY(1px) !important;
    box-shadow: var(--shadow-press) !important;
    transition: transform 0.04s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.04s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
}

:root .category-card.card-bounce-up,
:root .template-card.card-bounce-up,
.theme-light .category-card.card-bounce-up,
.theme-light .template-card.card-bounce-up,
.category-card.card-bounce-up,
.template-card.card-bounce-up {
    transform: translateY(-2px) !important;
    box-shadow: var(--shadow-hover) !important;
    transition: transform 0.09s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.09s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
}

.category-img-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    margin: 0 0 8px 0;
    border-radius: 0; /* Full bleed at top */
    background-color: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}

.category-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-smooth);
}

.category-card:hover img {
    transform: scale(1.03);
}
.category-card h3 {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    margin: 2px 0 1px 0;
    padding: 0 10px;
    color: var(--text-primary);
}

.category-card span {
    font-size: 10.5px;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0 10px;
    margin-bottom: 2px;
}

/* Template Cards Grid — cards sit directly on the page canvas,
   no nested panel (Airbnb-style grid) */
.section-card {
    background-color: transparent;
    backdrop-filter: none;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: 40px;
}

.section-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.section-card-header h3 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 600;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 24px;
}

.template-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    border-radius: 16px;
    padding: 0 0 16px 0; /* Full bleed padding */
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.25s cubic-bezier(0.25, 0.8, 0.25, 1), border-color 0.15s ease, background-color 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    overflow: hidden;
}

.template-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(255, 255, 255, 0.16);
}

.template-img-wrapper {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 0;
    background-color: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 12px;
}

.template-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-smooth);
}

.template-card:hover img {
    transform: scale(1.03);
}

.template-card h4 {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 6px;
    padding: 0 20px;
    color: var(--text-primary);
}

.template-card p {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
    font-weight: 400;
    padding: 0 20px;
}

/* Responsive adjustments for layouts and spacing */
@media (max-width: 1366px) {
    .sidebar {
        width: 210px;
    }
    .main-content {
        padding: 28px 24px 40px 24px;
    }
    .category-grid {
        gap: 20px;
    }
    .templates-grid {
        gap: 20px;
    }
}

@media (max-width: 1024px) {
    .main-content {
        padding: 30px 30px 60px 30px;
    }
    .category-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 24px;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 16px 16px 120px 16px; /* Reduced top padding since header is hidden */
    }
    
    .content-header {
        display: none !important;
    }
    .category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }
    
    .templates-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }
    
    /* Bottom Navigation Bar for Mobile */
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 80px;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        border-right: none;
        border-top: 1px solid var(--border-color);
        padding: 0 16px;
        z-index: 1000;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.04);
        background: var(--bg-sidebar);
    }
    
    .sidebar-brand {
        display: none !important;
    }
    
    .sidebar-menu {
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        flex: 3;
        gap: 0;
    }
    
    .sidebar-footer {
        display: flex;
        flex-direction: row;
        justify-content: center;
        flex: 1;
        border-top: none;
        padding-top: 0;
        margin-top: 0;
    }
    
    .menu-item {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 8px 0;
        width: 60px;
        height: 60px;
        border-radius: 12px;
        background: transparent !important;
    }
    
    .menu-item:hover {
        background: transparent !important;
    }
    
    .menu-item.active,
    .theme-light .menu-item.active,
    :root:not(.theme-dark) .menu-item.active {
        background: transparent !important;
        border-color: transparent !important;
        box-shadow: none !important;
    }
    
    .menu-item.active .menu-icon svg {
        stroke: var(--primary-color);
        fill: none;
    }
    
    .menu-item.active .menu-label {
        color: var(--primary-color);
    }
    
    .menu-icon {
        margin-right: 0;
    }
    
    .menu-icon svg {
        width: 28px !important;
        height: 28px !important;
    }
    
    .menu-label {
        display: none;
    }
}

/* Full Screen Focus Mode for Baking Tutorial Stage */
body.is-tutorial-focus .sidebar {
    display: none !important;
}

body.is-tutorial-focus .content-header {
    display: none !important;
}

body.is-tutorial-focus .main-content {
    width: 100vw;
    max-width: 100vw;
    padding: 42px clamp(16px, 3vw, 48px) 32px;
    overflow-x: hidden;
}

body.is-tutorial-focus .tutorial-shell {
    height: calc(100dvh - 90px);
    max-height: calc(100dvh - 90px);
}

@media (max-width: 768px) {
    body.is-tutorial-focus .main-content {
        padding: 16px 16px 16px 16px;
    }
    
    body.is-tutorial-focus .tutorial-shell {
        height: calc(100dvh - 32px);
        max-height: calc(100dvh - 32px);
    }
}

/* Mobile Splash Screen */

.brand-bowl-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.mobile-splash-screen {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background-color: #000000;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.splash-logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: splashPulse 1.5s ease-in-out infinite alternate;
    will-change: transform;
}

.splash-logo {
    display: block;
    width: 260px; /* Made slightly wider to ensure full display */
    max-width: 80vw;
    height: auto;
    max-height: 40vh;
    object-fit: contain;
    image-rendering: high-quality;
    -webkit-font-smoothing: antialiased;
    backface-visibility: hidden;
    transform: translateZ(0);
}

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

@keyframes splashPulse {
    0% { transform: scale(0.96) translateZ(0); opacity: 0.8; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.05)); }
    100% { transform: scale(1.02) translateZ(0); opacity: 1; filter: drop-shadow(0 8px 20px rgba(0,0,0,0.1)); }
}

@media (max-width: 768px) {
    .mobile-splash-screen:not(.hidden-permanently) {
        display: flex;
    }
}


