/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', 'SimSun', serif;
    line-height: 1.6;
    color: #2c3e50;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 25px 0;
    background: linear-gradient(135deg, #d4af37 0%, #ff6b6b 50%, #4ecdc4 100%);
    color: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(212, 175, 55, 0.3);
    border: 3px solid #d4af37;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y="50" font-size="20" fill="rgba(255,255,255,0.1)">龍</text></svg>') repeat;
    opacity: 0.1;
    pointer-events: none;
}

.restaurant-name {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 15px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 1;
    letter-spacing: 2px;
    font-family: 'PingFang SC', 'Microsoft YaHei', serif;
}

.language-toggle {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.lang-btn {
    padding: 8px 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.lang-btn.active {
    background: white;
    color: #667eea;
    font-weight: 600;
}

/* 订购说明样式 */
.order-instruction {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: 0 5px 20px rgba(33, 150, 243, 0.1);
    border: 2px solid #2196f3;
    border-top: 4px solid #1976d2;
}

.instruction-content {
    text-align: center;
}

.instruction-content p {
    font-size: 1.1rem;
    color: #1565c0;
    font-weight: 600;
    margin: 0;
    line-height: 1.5;
}

/* 过敏源说明样式 */
.allergen-info {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.1);
    border: 2px solid #d4af37;
    border-top: 4px solid #ff6b6b;
}

.allergen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 5px 0;
    border-radius: 5px;
    transition: background-color 0.2s ease;
}

.allergen-header:hover {
    background-color: #f8f9fa;
}

.allergen-title {
    font-size: 1.2rem;
    color: #d4af37;
    margin: 0;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.allergen-toggle {
    font-size: 1.2rem;
    color: #6c757d;
    transition: transform 0.3s ease;
    user-select: none;
}

.allergen-toggle.rotated {
    transform: rotate(180deg);
}

.allergen-content {
    margin-top: 15px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

.allergen-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    max-width: 100%;
}

.allergen-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 4px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
    min-height: 45px;
}

.allergen-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.allergen-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
}

.allergen-name {
    font-size: 0.6rem;
    font-weight: 500;
    color: #495057;
    text-align: center;
    line-height: 1.1;
    word-break: break-all;
}

/* 主内容区域样式 */
.menu-content {
    position: relative;
}

/* 侧边栏样式 */
.sidebar {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: fixed;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    z-index: 1000;
    width: 300px;
    transition: all 0.3s ease;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

/* 移动端侧边栏宽度 */
@media (max-width: 768px) {
    .sidebar {
        width: calc(100vw / 2.5);
        max-width: 150px;
        min-width: 120px;
    }
    
    .sidebar.collapsed {
        width: 50px;
        padding: 8px;
    }
    
    .sidebar.collapsed .sidebar-toggle {
        width: 34px;
        height: 34px;
        padding: 0;
        font-size: 1rem;
    }
    
    .sidebar.collapsed .sidebar-header {
        justify-content: center;
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
    }
}

.sidebar.collapsed {
    width: 60px;
    padding: 10px;
}

.sidebar.collapsed .category-nav {
    display: none;
}

.sidebar.collapsed .sidebar-toggle {
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0 auto;
    justify-content: center;
    font-size: 1.2rem;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.sidebar-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(212, 175, 55, 0.2);
}

.sidebar-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #d4af37;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.sidebar-toggle {
    background: linear-gradient(135deg, #d4af37 0%, #ff6b6b 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(212, 175, 55, 0.3);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.4);
}

/* 分类导航样式 */
.category-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-btn {
    padding: 12px 20px;
    border: 2px solid #d4af37;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    color: #d4af37;
    border-radius: 15px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-align: center;
    width: 100%;
}

.category-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.2), transparent);
    transition: left 0.5s ease;
}

.category-btn:hover::before {
    left: 100%;
}

.category-btn:hover {
    background: linear-gradient(135deg, #d4af37 0%, #ff6b6b 100%);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.category-btn.active {
    background: linear-gradient(135deg, #d4af37 0%, #ff6b6b 100%);
    color: white;
    box-shadow: 0 6px 25px rgba(212, 175, 55, 0.5);
    transform: translateY(-2px);
}


/* 菜品网格样式 */
.dishes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

/* 手机端优化：紧凑布局，一页显示更多菜品 */
@media (max-width: 768px) {
    .dishes-grid { grid-template-columns: 1fr; gap: 12px; }
    .dish-card { 
        display: grid; 
        grid-template-columns: 90px 1fr; 
        grid-template-rows: auto auto;
        padding: 12px; 
        border-radius: 12px; 
        align-items: start; 
    }
    
    .dish-image-wrapper { 
        grid-column: 1 / 2; 
        grid-row: 1 / 2; 
    }
    
    .dish-image { 
        width: 90px; 
        height: 90px; 
        border-radius: 8px; 
        margin-right: 0;
        object-fit: contain;
    }
    
    /* 移动端：过敏源紧贴在图片下方 */
    .dish-allergens-below-image {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
        display: flex;
        flex-wrap: wrap;
        gap: 3px;
        padding: 4px 0;
        background: transparent;
        border-bottom: none;
        justify-content: flex-start;
        align-items: center;
        max-width: 90px;
    }
    
    .dish-allergens-below-image .allergen-badge {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }
    
    .dish-content-grid { 
        grid-column: 2 / 3; 
        grid-row: 1 / 3; 
        padding: 0 0 0 12px; 
        grid-template-columns: 1fr auto; 
        grid-template-areas:
            'name number'
            'description price'
            'badges portions'
            'allergens allergens';
        column-gap: 8px; 
        row-gap: 6px; 
    }
    
    /* 移动端：价格和份量靠右对齐，紧贴序号下方 */
    .dish-area-price {
        grid-area: price;
        justify-self: end;
        align-self: start;
    }
    
    .dish-area-portions {
        grid-area: portions;
        justify-self: end;
        align-self: start;
    }

    .dish-number {
        background: #667eea;
        color: white;
        padding: 4px 8px;
        border-radius: 15px;
        font-size: 0.8rem;
        font-weight: 600;
        position: absolute;
        top: 8px;
        right: 8px;
        margin: 0;
        z-index: 2;
    }
    
    
    .dish-name { font-size: 1rem; margin-bottom: 2px; line-height: 1.2; word-break: break-word; hyphens: auto; }
    
    .dish-description { font-size: 0.8rem; margin-bottom: 4px; line-height: 1.25; word-break: break-word; hyphens: auto; }
    
    .dish-price { font-size: 1.05rem; font-weight: 700; color: #e74c3c; text-align: right; margin: 0; }
    
    .dish-portions {
        margin: 0;
    }
    
    .portion-item { padding: 2px 6px; margin-bottom: 1px; font-size: 0.8rem; display: flex; justify-content: space-between; align-items: center; min-width: 80px; }
    
    .portion-name { font-size: 0.75rem; margin-right: 4px; }
    
    .portion-price { font-size: 0.9rem; font-weight: 700; color: #e74c3c; }
    
    .dish-badges { 
        margin-top: 2px; 
        display: flex; 
        flex-wrap: wrap; 
        gap: 4px; 
        align-items: center;
    }
    
    .popular-badge,
    .new-badge,
    .vegan-badge,
    .surgelato-badge { 
        font-size: 0.65rem; 
        padding: 2px 6px; 
        margin: 0 !important; 
        display: inline-flex;
        align-items: center;
        white-space: nowrap;
    }
    
    .dish-allergens { margin-top: 2px; gap: 3px; grid-template-columns: repeat(4, 1fr); }
    
    .allergen-badge { width: clamp(16px, 7vw, 24px); height: clamp(16px, 7vw, 24px); border-radius: 3px; }
    
    /* 无图片时的样式调整 */
    .dish-image.no-image {
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        border: 1px dashed #dee2e6;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .no-image-icon {
        font-size: 1.5rem;
        margin-bottom: 2px;
    }
    
    .no-image-text {
        font-size: 0.7rem;
    }
}

.dish-card {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border-radius: 20px;
    overflow: hidden; /* 确保圆角正确显示 */
    box-shadow: 0 6px 25px rgba(212, 175, 55, 0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
}

.dish-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #d4af37, #ff6b6b, #4ecdc4);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dish-card:hover::before {
    opacity: 1;
}

.dish-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(212, 175, 55, 0.2);
    border-color: #d4af37;
}

.dish-image-wrapper {
    position: relative;
}

/* 辣度标识 - 竖向显示在图片右侧边缘 */
.spiciness-badge {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 4px;
    border-radius: 15px;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 107, 107, 0.3);
    animation: pulse-spicy 2s ease-in-out infinite;
}

/* 单个火焰图标 */
.fire-icon {
    display: block;
    line-height: 1;
    font-size: 1rem;
}

@keyframes pulse-spicy {
    0%, 100% {
        transform: translateY(-50%) scale(1);
    }
    50% {
        transform: translateY(-50%) scale(1.05);
    }
}

.dish-image {
    width: 100%;
    height: 200px;
    object-fit: contain;
    background: #f8f9fa;
    transition: opacity 0.3s ease, filter 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 2rem;
    border-radius: 20px 20px 0 0; /* 只保留上方圆角 */
}

/* 懒加载图片样式 */
.lazy-load {
    opacity: 0.7;
    filter: blur(2px);
}

.lazy-load.loaded {
    opacity: 1;
    filter: blur(0);
}

/* 加载状态样式 - 只对有图片的元素生效 */
.dish-image:not(.no-image)::before {
    content: '📷';
    font-size: 2rem;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #f8f9fa;
}

.dish-image.loaded::before {
    display: none;
}

/* 加载动画样式 */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #d4af37;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-text {
    color: #666;
    font-size: 1.1rem;
    margin: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 图片加载状态 - 只对有图片的元素生效 */
.dish-image:not(.no-image) {
    position: relative;
}

.dish-image:not(.no-image)::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 15px 15px 0 0;
}

.dish-image.loaded::after {
    display: none;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* 无图片时的样式 */
.dish-image.no-image {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.no-image-content {
    text-align: center;
    color: #6c757d;
}

.no-image-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    opacity: 0.7;
}

.no-image-text {
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.8;
}

/* 网格化内容区域：将各元素拆分为独立区域 */
.dish-content-grid {
    padding: 16px 16px 16px 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        'name number'
        'description price'
        'badges price'
        'allergens portions';
    column-gap: 12px;
    row-gap: 8px;
    align-items: start;
    position: relative;
}

.dish-area-number { grid-area: number; }
.dish-area-name { grid-area: name; }
.dish-area-description { grid-area: description; }
.dish-area-badges { grid-area: badges; }
.dish-area-price { grid-area: price; justify-self: end; }
.dish-area-portions { grid-area: portions; justify-self: end; }
.dish-area-allergens { grid-area: allergens; }

.dish-content {
    padding: 20px;
    position: relative;
    display: flex;               /* 使价格区参与高度计算 */
    justify-content: space-between;
    align-items: flex-start;
}

.dish-info {
    margin-right: 0; /* 去除绝对定位的占位hack */
    flex: 1; /* 让文本区域尽可能扩展 */
}

.dish-price-section {
    position: static;            /* 取消绝对定位，让其参与文档流 */
    top: auto;
    right: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 100px;
    margin-left: 20px;           /* 与文本区保持间距 */
}

.dish-number {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0;
    justify-self: end;
    align-self: start;
}

.dish-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: #e74c3c;
    margin: 0; /* 移除默认margin，因为现在在price-section中 */
}

/* 分量价格样式 */
.dish-portions {
    margin: 0; /* 移除默认margin，因为现在在price-section中 */
}

.portion-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap; /* 避免长文本挤出容器 */
    padding: 6px 10px;
    margin-bottom: 4px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.portion-item:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    transform: translateX(2px);
}

/* 移除默认分量的特殊样式，所有分量保持一致 */

.portion-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: inherit;
    flex: 1;             /* 占据剩余空间，避免挤出 */
    min-width: 0;        /* 允许在flex容器内正确换行 */
    word-break: break-word;
    overflow-wrap: anywhere;
}

.portion-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: inherit;
}

/* 人气菜标识样式 */
.popular-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 100%);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 10px;
    border: 1px solid #ff5252;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
    }
    50% {
        box-shadow: 0 4px 16px rgba(255, 107, 107, 0.5);
    }
    100% {
        box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
    }
}

/* 新菜标识样式 */
.new-badge {
    display: inline-block;
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 10px;
    border: 1px solid #26a69a;
    box-shadow: 0 2px 8px rgba(78, 205, 196, 0.3);
    animation: newPulse 2s infinite;
}

/* 纯素食标识样式 */
.vegan-badge {
    display: inline-block;
    background: linear-gradient(135deg, #a8e063 0%, #56ab2f 100%);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 10px;
    border: 1px solid #56ab2f;
    box-shadow: 0 2px 8px rgba(86, 171, 47, 0.3);
}

@keyframes newPulse {
    0% {
        box-shadow: 0 2px 8px rgba(78, 205, 196, 0.3);
    }
    50% {
        box-shadow: 0 4px 16px rgba(78, 205, 196, 0.5);
    }
    100% {
        box-shadow: 0 2px 8px rgba(78, 205, 196, 0.3);
    }
}

/* 移除默认标识样式 */

.dish-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    line-height: 1.3;
    /* 允许文本完整显示，不限制行数 */
    word-break: break-word;
    hyphens: auto;
}

.dish-description {
    color: #6c757d;
    font-size: 0.95rem;
    margin-bottom: 15px;
    line-height: 1.4;
    /* 允许文本完整显示，不限制行数 */
    word-break: break-word;
    hyphens: auto;
}

.surgelato-badge {
    display: inline-block;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1565c0;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 10px;
    border: 1px solid #2196f3;
}

/* 图片下方的过敏源显示 */
.dish-allergens-below-image {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-bottom: 1px solid #e9ecef;
    justify-content: flex-start;
    align-items: center;
}

/* 确保过敏源徽章在图片下方时保持合适的大小 */
.dish-allergens-below-image .allergen-badge {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.dish-allergens {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin-top: 10px;
    max-width: 100%; /* 确保过敏源区域能充分利用可用空间 */
}

.allergen-badge {
    width: clamp(18px, 6vw, 38px);
    height: clamp(18px, 6vw, 38px);
    border-radius: 6px;
    background: #f8f9fa;
    border: 2px solid #d4af37;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.2);
    position: relative;
    overflow: hidden;
    margin: 0 auto; /* 居中对齐 */
}

.allergen-badge img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.allergen-badge::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 8px;
    background: linear-gradient(45deg, #d4af37, #ff6b6b, #4ecdc4);
    z-index: -1;
    opacity: 0.3;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .sidebar {
        position: fixed;
        top: 50%;
        left: 10px;
        transform: translateY(-50%);
        max-height: calc(100vh - 20px);
    }
    
    .restaurant-name {
        font-size: 2rem;
    }
    
    .category-nav {
        flex-direction: column;
        gap: 8px;
    }
    
    .category-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        width: 100%;
        text-align: center;
        white-space: normal;
        word-wrap: break-word;
        line-height: 1.2;
        min-height: 2.4em;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .allergen-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }
    
    /* 平板设备辣度标识 - 竖向显示 */
    .spiciness-badge {
        right: 4px;
        padding: 5px 3px;
        border-radius: 12px;
        border-width: 1.5px;
        gap: 1px;
    }
    
    .fire-icon {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .restaurant-name {
        font-size: 1.8rem;
    }
    
    .sidebar {
        top: 50%;
        left: 5px;
        transform: translateY(-50%);
        padding: 15px;
        width: calc(100vw / 2.5);
        max-width: 130px;
        min-width: 100px;
    }
    
    .sidebar.collapsed {
        width: 45px;
        padding: 6px;
    }
    
    .sidebar.collapsed .sidebar-toggle {
        width: 33px;
        height: 33px;
        padding: 0;
        font-size: 0.9rem;
    }
    
    .sidebar.collapsed .sidebar-header {
        justify-content: center;
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
    }
    
    .allergen-grid {
        grid-template-columns: repeat(4, 1fr); /* 小屏幕也保持4列布局 */
        gap: 3px;
    }
    
    .allergen-item {
        min-height: 40px;
        padding: 4px 2px;
    }
    
    .allergen-icon {
        font-size: 0.7rem;
        min-width: 16px;
    }
    
    .allergen-name {
        font-size: 0.55rem;
    }
    
    /* 手机设备辣度标识 - 竖向紧凑显示 */
    .spiciness-badge {
        right: 3px;
        padding: 4px 2px;
        border-radius: 10px;
        border-width: 1px;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
        gap: 1px;
        animation: none; /* 移动端禁用动画以提升性能 */
    }
    
    .fire-icon {
        font-size: 0.7rem;
    }
    
    /* 进一步优化小屏幕的菜品布局 */
    .dish-card {
        padding: 8px;
        align-items: flex-start; /* 确保内容不被截断 */
        grid-template-columns: 70px 1fr;
    }
    
    .dish-image-wrapper {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
    }
    
    .dish-image {
        width: 70px;
        height: 70px;
        margin-right: 0;
        object-fit: contain;
    }
    
    .dish-allergens-below-image {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
        max-width: 70px;
        padding: 3px 0;
        gap: 2px;
    }
    
    .dish-allergens-below-image .allergen-badge {
        width: 18px;
        height: 18px;
    }
    
    .dish-content-grid {
        grid-column: 2 / 3;
        grid-row: 1 / 3;
        padding: 0 0 0 8px;
        grid-template-areas:
            'name number'
            'description price'
            'badges portions'
            'allergens allergens';
    }
    
    .dish-badges {
        gap: 3px;
    }
    
    .popular-badge,
    .new-badge,
    .vegan-badge,
    .surgelato-badge {
        font-size: 0.6rem;
        padding: 2px 4px;
    }
    
    .dish-content {
        align-items: flex-start; /* 确保内容不被截断 */
    }
    
    /* 移除 .dish-info 的最小高度限制，使用内容自适应高度 */
    
    .dish-name {
        font-size: 0.9rem;
        /* 允许文本完整显示，不限制行数 */
        word-break: break-word;
        hyphens: auto;
    }
    
    .dish-description {
        font-size: 0.75rem;
        /* 允许文本完整显示，不限制行数 */
        word-break: break-word;
        hyphens: auto;
    }
    
    .dish-price {
        font-size: 1rem;
    }
    
    .portion-price {
        font-size: 0.9rem;
    }
    
    .portion-item {
        min-width: 70px;
        padding: 1px 4px;
    }
    
    .portion-name {
        font-size: 0.7rem;
    }
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 50px;
    font-size: 1.2rem;
    color: #6c757d;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 隐藏元素 */
.hidden {
    display: none !important;
}

/* 取消卡片点击/悬停特效：保持卡片静止不抬升、不显示顶部渐变条 */
.dish-card:hover {
    transform: none;
    box-shadow: 0 6px 25px rgba(212, 175, 55, 0.1);
    border-color: transparent;
}

.dish-card::before,
.dish-card:hover::before {
    opacity: 0 !important;
}