:root {
    --primary: #ff6b6b;
    --primary-dark: #e55353;
    --background: linear-gradient(135deg, #ffecd2, #fcb69f);
    --text: #222222;
    --muted: #555555;
    --border: rgba(0, 0, 0, 0.08);
    --success-bg: rgba(255, 255, 255, 0.85);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --radius: 18px;
    --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Noto Sans TC', "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--background);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

button, input { font: inherit; }
button { border: none; cursor: pointer; }

.container { width: 100%; max-width: 1200px; background: transparent; padding: 0; }

.header {
    text-align: center;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #f6d365, #fda085); 
    padding: 35px 24px;
    border-radius: 24px;
    box-shadow: 0 10px 25px rgba(229, 83, 83, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* 顶部 Logo 样式（#2A241E 深色背景框版本） */
.header-logo {
    display: block;           /* 独占一行 */
    margin: 0 auto 20px;      /* 居中对齐，并与下方标题留出 20px 间距 */
    max-width: 180px;         /* 控制 Logo 的最大宽度（包含内边距） */
    height: auto;             /* 高度等比例缩放 */
    
    /* 🎨 已经修改的背景框样式 */
    background-color: rgba(36, 30, 24, 0.85); /* 背景色改为深咖色 */
    padding: 0 12px;                          /* 内边距：上下 0px，左右 12px */
    border-radius: 16px;                         /* 柔和的圆角，与网页整体的 --radius 风格一致 */
    border: 1px solid rgba(255, 255, 255, 0.1);  /* 极淡的白色透明边框，用于在深色背景边缘提亮 */
    box-shadow: 0 8px 24px rgba(42, 36, 30, 0.15);/* 配合深色背景，使用同色系淡淡的阴影，让卡片有悬浮感 */
    
    /* 鼠标移上去时背景框的轻微互动效果 */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* 鼠标悬停在 Logo 上时的微动效 */
.header-logo:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(42, 36, 30, 0.25);
}

.header h1 {
    font-size: clamp(2rem, 5vw, 2.8rem);
    font-weight: 900;
    color: #1a1a1a;
    margin-bottom: 14px;
    text-shadow: 0 2px 4px rgba(255, 255, 255, 0.4);
}

.header p { color: #3d3d3d; font-size: 1.1rem; font-weight: 700; }

.section-title {
    font-size: 1.3rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.preset-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 28px; }

.preset-btn {
    color: white;
    padding: 12px 22px;
    border-radius: 999px;
    transition: var(--transition);
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.preset-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(0,0,0,0.1); }

.preset-btn:focus-visible, .draw-btn:focus-visible, .sound-btn:focus-visible {
    outline: 3px solid rgba(255, 107, 107, 0.4);
    outline-offset: 3px;
}

.breakfast { background: #e68a00; }
.lunch { background: #2e7d32; }
.dinner { background: #c62828; }
.supper { background: #4527a0; }

.restaurant-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.restaurant-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.5); 
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 6px 20px rgba(0,0,0,0.02);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
    cursor: pointer;
}

.restaurant-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.06);
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.8);
}

.restaurant-number {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    font-weight: bold;
    flex-shrink: 0;
}

.restaurant-input {
    flex: 1;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    padding: 12px 14px;
    border-radius: 12px;
    outline: none;
    font-size: 1rem;
    transition: background 0.2s;
    color: var(--text);
    width: 100%;
}

.restaurant-item:hover .restaurant-input { background: #ffffff; }

.preview-card {
    position: fixed;
    width: 320px;
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
    padding: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 9999;
    overflow: hidden;
}

.preview-card.active { opacity: 1; visibility: visible; }

.preview-image { width: 100%; height: 180px; object-fit: cover; display: block; }

.preview-content { padding: 18px; }

.preview-title { font-size: 1.15rem; font-weight: bold; color: #222; margin-bottom: 8px; }

.preview-desc { font-size: 0.95rem; color: #666; line-height: 1.5; margin-bottom: 14px; }

.preview-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary);
    color: white;
    padding: 10px 16px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
}

.preview-link:hover { background: var(--primary-dark); transform: scale(1.02); }
.preview-link svg { width: 16px; height: 16px; }

.draw-section { text-align: center; margin-top: 40px; }

.draw-btn {
    background: linear-gradient(135deg, #ff6b6b, #ff8e53);
    color: white;
    padding: 18px 54px;
    border-radius: 999px;
    font-size: 1.25rem;
    font-weight: bold;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 8px 24px rgba(255, 107, 107, 0.3);
}

.draw-btn:hover:not(:disabled) { transform: scale(1.04); box-shadow: 0 12px 30px rgba(255, 107, 107, 0.4); }
.draw-btn:disabled { background: #cccccc; cursor: not-allowed; box-shadow: none; transform: none; }

.result-area {
    min-height: 160px;
    margin-top: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.empty-tip {
    color: #444444;
    font-weight: 700;
    text-align: center;
    font-size: 1.1rem;
    text-shadow: 0 1px 1px rgba(255,255,255,0.5);
}

.shuffle-text {
    font-size: 2.2rem;
    color: var(--primary);
    font-weight: 900;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    animation: shake 0.12s infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.result-card {
    width: 100%;
    max-width: 580px;
    background: var(--success-bg);
    border: 3px dashed var(--primary);
    backdrop-filter: blur(10px);
    border-radius: 22px;
    padding: 32px 24px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

.result-label { color: #555; margin-bottom: 12px; font-size: 1rem; font-weight: 700; }

.result-name {
    font-size: clamp(2rem, 6vw, 2.8rem);
    color: var(--primary);
    font-weight: 900;
    word-break: break-word;
    margin-bottom: 14px;
}

.result-info { color: var(--primary); font-weight: 700; font-size: 1.1rem; }

.history {
    margin-top: 35px;
    border-top: 1px dashed rgba(0, 0, 0, 0.15);
    padding-top: 25px;
    padding-bottom: 76px;
}

.history h3 { margin-bottom: 15px; color: #333; font-size: 1.1rem; }

.history-tags { display: flex; flex-wrap: wrap; gap: 10px; }

.history-tag {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 0.9rem;
    color: #333;
    font-weight: 600;
}

.sound-btn {
    position: fixed;
    right: 25px;
    bottom: 25px;
    background: white;
    border: 1px solid rgba(0,0,0,0.1);
    padding: 12px 20px;
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
    z-index: 10000;
    font-weight: 700;
    transition: var(--transition), transform 0.15s ease;
}

.sound-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

@media (max-width: 992px) {
    .restaurant-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .restaurant-grid { grid-template-columns: 1fr; }
    .draw-btn { width: 100%; }
    .preset-buttons { justify-content: center; }
    
    .preview-card {
        position: fixed !important;
        left: 50% !important;
        top: 50% !important;
        right: auto !important;
        bottom: auto !important;
        transform: translate(-50%, -50%) !important; 
        width: calc(100% - 40px);
        max-width: 360px;
        z-index: 10001 !important; 
    }
}

/* ==========================================================================
   右下角悬浮导航按钮样式（高兼容性：完美容纳 7 字文本版本）
   ========================================================================== */
.float-nav-btn {
    position: fixed;
    right: 25px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 12px 22px;         /* 略微放宽内边距，让7个字有充足的舒展空间 */
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
    z-index: 10000;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
    text-decoration: none;       /* 彻底移除超链接的下划线 */
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;         /* 核心：强制单行显示，绝对不允许文字在按钮内换行 */
    transition: var(--transition), transform 0.15s ease; /* 完美沿用原网基础过渡 */
}

/* 垂直堆叠坐标精准计算（原音效按钮固定在 bottom: 25px） */
/* 倒数第二个按钮：返回三餐解忧铺 */
.sancan-btn {
    bottom: 85px;  /* 凌空跨越原音效按钮，保持 15px 的美观间距 */
}

/* 倒数第三个按钮：返回主页 */
.home-btn {
    bottom: 145px; /* 继续向上垂直堆叠，保持等距 */
}

/* 鼠标悬停时的优雅联动效果（变色为与你的 Logo 背景框一模一样的深色） */
.float-nav-btn:hover {
    background: #2A241E; 
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(42, 36, 30, 0.15);
}

/* 点击时的物理下沉反馈 */
.float-nav-btn:active {
    transform: translateY(-1px);
}

/* 📱 移动端（手机屏幕）完美适配特性 */
@media (max-width: 768px) {
    .float-nav-btn {
        right: 15px;             /* 靠右间距稍微收紧 */
        padding: 10px 16px;      /* 缩减气泡大小 */
        font-size: 0.85rem;      /* 字号微调，确保即使在小屏手机上“返回三餐解忧铺”也不会溢出 */
    }
    .sancan-btn { bottom: 75px; }
    .home-btn { bottom: 125px; }
}

/* =========================================
   📸 结果卡片“图文并茂”升级样式
   ========================================= */
.result-card-rich {
    padding: 0 !important;
    overflow: hidden;
    border: none !important;
    background: white !important;
    box-shadow: 0 15px 40px rgba(255, 107, 107, 0.25);
}
.result-card-rich .result-label {
    padding: 20px 20px 10px;
    margin: 0;
}
.result-image-wrapper {
    width: 100%;
    height: 260px;
    overflow: hidden;
    position: relative;
    background: #f8f8f8;
}
.result-food-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}
.result-card-rich:hover .result-food-img {
    transform: scale(1.05); /* 鼠标悬停时图片轻微放大 */
}
.result-card-rich .result-name {
    padding: 18px 20px 8px;
    margin: 0;
    text-align: center;
}
.result-card-rich .result-desc {
    padding: 0 24px 20px;
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
    text-align: center;
}
.result-map-link {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white !important;
    padding: 16px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    transition: background 0.2s;
    margin-top: 10px;
}
.result-map-link:hover {
    background: var(--primary-dark);
}

/* =========================================
   📱 悬浮按钮 (FAB) 收纳系统 (✅ 已修复桌面端坐标冲突)
   ========================================= */
.fab-container {
    position: fixed;
    right: 15px;
    bottom: 15px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.fab-main {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b, #ff8e53);
    color: white;
    border: none;
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2;
}
.fab-main:hover { transform: scale(1.05); }
.fab-main.active .fab-icon { transform: rotate(90deg); }
.fab-icon { transition: transform 0.3s ease; display: block; line-height: 1; }

.fab-sub-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-end;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.fab-container.expanded .fab-sub-buttons {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* 移动端子按钮基础样式 */
.fab-item {
    padding: 10px 16px !important;
    font-size: 0.85rem !important;
    background: white;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    transition: all 0.2s ease;
    margin: 0 !important; 
    position: relative !important; 
    right: auto !important;
    bottom: auto !important;
}
.fab-item:hover {
    background: #2A241E;
    color: white;
    transform: translateY(-2px);
}

/* 🖥️ 桌面端：恢复原有垂直排列，隐藏主按钮 */
@media (min-width: 769px) {
    .fab-main {
        display: none !important; 
    }
    
    /* 🌟 修复 1：容器退位，防止干扰子元素的 fixed 定位 */
    .fab-container {
        position: static !important; 
        right: auto !important;
        bottom: auto !important;
        display: block !important;
    }

    .fab-sub-buttons {
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        pointer-events: auto !important;
        display: block !important; /* 让子元素脱离 flex 流，各自独立 fixed */
    }

    /* 🌟 修复 2：强制覆盖基础样式，恢复 fixed 定位与右侧坐标 */
    .fab-item {
        position: fixed !important;
        right: 25px !important;
        padding: 12px 22px !important;
        font-size: 0.95rem !important;
    }
    
    /* 🌟 修复 3：为 bottom 坐标全部追加 !important，彻底压制基础样式的 auto */
    .fab-item.sound-btn { bottom: 25px !important; }
    .fab-item.sancan-btn { bottom: 85px !important; }
    .fab-item.home-btn { bottom: 145px !important; }
}

/* ==========================================================================
   📍 悬浮区域指示器（与 FAB 按钮联动）
   桌面端：固定在主页按钮之上
   移动端收起：在 FAB 主按钮之上
   移动端展开：自动移动到 3 个子按钮之上
   ========================================================================== */
.area-indicator {
    position: fixed;
    right: 25px;
    bottom: 205px;  /* 桌面端：在 home-btn (145px) 之上 */
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ff6b6b, #ff8e53);
    color: white;
    padding: 14px 24px;
    border-radius: 999px;
    box-shadow: 0 8px 28px rgba(255, 107, 107, 0.45);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    animation: areaSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), areaPulse 2s ease-in-out infinite 0.4s;
    cursor: default;
    user-select: none;
    transition: bottom 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.area-indicator:hover {
    transform: scale(1.03) translateY(-2px);
    box-shadow: 0 12px 35px rgba(255, 107, 107, 0.55);
}

@keyframes areaPulse {
    0%, 100% { box-shadow: 0 8px 28px rgba(255, 107, 107, 0.45); }
    50% { box-shadow: 0 8px 35px rgba(255, 107, 107, 0.65), 0 0 20px rgba(255, 107, 107, 0.2); }
}

@keyframes areaSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 移动端 */
@media (max-width: 768px) {
    .area-indicator {
        right: 15px;
        bottom: 72px;  /* 收起时：在 fab-main 之上 */
        padding: 11px 18px;
        font-size: 1rem;
        font-weight: 700;
    }
    
    /* FAB 展开时：区域指示器自动上移 */
    .fab-container.expanded ~ .area-indicator,
    .area-indicator.area-expanded {
        bottom: 235px;
    }
}

.area-indicator.hidden {
    display: none !important;
}
