* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background: linear-gradient(-45deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3, #54a0ff, #5f27cd);
    background-size: 600% 600%;
    animation: gradientBG 12s ease infinite;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(255,107,107,0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(72,219,251,0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255,159,243,0.2) 0%, transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(254,202,87,0.3) 0%, transparent 50%);
    animation: floatBubbles 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    right: -50%;
    bottom: -50%;
    background:
        radial-gradient(2px 2px at 20px 30px, #fff, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(3px 3px at 50px 160px, #fff, transparent),
        radial-gradient(2px 2px at 90px 40px, rgba(255,255,255,0.9), transparent),
        radial-gradient(3px 3px at 130px 80px, #fff, transparent),
        radial-gradient(2px 2px at 160px 120px, rgba(255,255,255,0.7), transparent);
    background-size: 200px 200px;
    animation: sparkle 4s linear infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    25% { background-position: 50% 100%; }
    50% { background-position: 100% 50%; }
    75% { background-position: 50% 0%; }
    100% { background-position: 0% 50%; }
}

@keyframes floatBubbles {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.1); }
    50% { transform: translate(-20px, 20px) scale(0.9); }
    75% { transform: translate(20px, 10px) scale(1.05); }
}

@keyframes sparkle {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Logo */
.logo {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

.logo img {
    height: 50px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
    transition: transform 0.3s ease;
}

.logo img:hover {
    transform: scale(1.1);
}

/* 主容器 */
#wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
}

/* 食物显示 */
#what {
    font-size: clamp(60px, 18vw, 120px);
    font-weight: bold;
    color: #fff;
    text-shadow:
        0 0 10px rgba(255,255,255,0.8),
        0 0 20px rgba(255,255,255,0.6),
        0 0 40px rgba(255,255,255,0.4),
        4px 4px 0 rgba(0,0,0,0.2);
    margin-bottom: 40px;
    min-height: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

#what.spinning {
    animation: textGlow 0.3s ease-in-out infinite alternate;
}

#what.selected {
    animation: bounce 0.6s ease;
    color: #FFD700;
}

@keyframes textGlow {
    from { text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #e60073; }
    to { text-shadow: 0 0 20px #fff, 0 0 30px #ff4da6, 0 0 40px #ff4da6; }
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    30% { transform: scale(1.2); }
    50% { transform: scale(0.95); }
    70% { transform: scale(1.05); }
}

/* 主按钮 */
#start {
    padding: 18px 60px;
    font-size: 24px;
    font-weight: bold;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5);
    position: relative;
    overflow: hidden;
    -webkit-appearance: none;
}

#start::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

#start:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.6);
}

#start:hover::before {
    left: 100%;
}

#start:active {
    transform: translateY(0) scale(0.98);
}

#start.running {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 10px 30px rgba(245, 87, 108, 0.5);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 10px 30px rgba(245, 87, 108, 0.5); }
    50% { box-shadow: 0 10px 40px rgba(245, 87, 108, 0.8); }
}

/* 添加菜谱按钮 - 右下角固定 */
#addMenuBtn {
    position: fixed;
    right: 25px;
    bottom: 70px;
    padding: 15px 25px;
    font-size: 16px;
    font-family: inherit;
    color: #fff;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100;
    -webkit-appearance: none;
}

#addMenuBtn:hover {
    background: rgba(255,255,255,0.35);
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

/* 飘动文字 */
.temp {
    position: fixed;
    z-index: 5;
    font-weight: bold;
    pointer-events: none;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* 弹窗遮罩 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 弹窗 */
.modal {
    background: #fff;
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
    text-align: center;
}

.modal-input {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 2px solid #eee;
    border-radius: 12px;
    margin-bottom: 15px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.modal-input:focus {
    outline: none;
    border-color: #667eea;
}

.modal-btns {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-btn {
    flex: 1;
    padding: 15px;
    font-size: 16px;
    font-family: inherit;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.modal-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.modal-btn.secondary {
    background: #f0f0f0;
    color: #666;
}

.modal-btn.secondary:hover {
    background: #e0e0e0;
}

/* 菜单标签 */
.menu-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    background: #f8f8f8;
    border-radius: 12px;
    margin-bottom: 15px;
}

.menu-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 20px;
    font-size: 14px;
    animation: tagIn 0.3s ease;
}

@keyframes tagIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.menu-tag .delete {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.menu-tag .delete:hover {
    opacity: 1;
}

.menu-tag.user-added {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* 提示信息 */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 30px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    border-radius: 50px;
    font-size: 16px;
    z-index: 2000;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2s forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translate(-50%, -20px); }
}

/* 版权 */
.copyright {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 15px;
    background: rgba(0,0,0,0.2);
    color: rgba(255,255,255,0.8);
    text-align: center;
    font-size: 12px;
    z-index: 10;
}

.copyright p {
    margin: 0 0 5px 0;
}

.footer-beian {
    margin-top: 3px;
}

.icp-link {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: color 0.3s ease;
}

.icp-link:hover {
    color: #fff;
    text-decoration: underline;
}

/* 装饰粒子 */
.particle {
    position: fixed;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}

/* 漂浮食物装饰 */
.floating-foods {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.food-icon {
    position: absolute;
    font-size: 30px;
    opacity: 0;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    pointer-events: none;
}

.food-icon.food-text {
    font-weight: bold;
    text-shadow:
        0 0 10px currentColor,
        0 0 20px rgba(255,255,255,0.5),
        2px 2px 4px rgba(0,0,0,0.3);
    white-space: nowrap;
}

/* 随机出现并渐变消失 */
.food-icon.random-pop {
    animation: randomPop 4s ease-in-out forwards;
}

@keyframes randomPop {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(0deg);
    }
    20% {
        opacity: 0.8;
        transform: scale(1.1) rotate(20deg);
    }
    40% {
        transform: scale(0.95) rotate(-10deg);
    }
    60% {
        opacity: 0.7;
        transform: scale(1.05) rotate(15deg);
    }
    80% {
        opacity: 0.5;
        transform: scale(1) rotate(-5deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) rotate(0deg);
    }
}

/* 从底部升起 */
.food-icon.float-up {
    animation: floatUp 8s ease-out forwards;
}

@keyframes floatUp {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.5) rotate(0deg);
    }
    15% {
        opacity: 0.7;
        transform: translateY(-15vh) scale(1) rotate(30deg);
    }
    50% {
        opacity: 0.6;
        transform: translateY(-50vh) scale(1.1) rotate(-20deg);
    }
    85% {
        opacity: 0.4;
        transform: translateY(-85vh) scale(0.9) rotate(15deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-100vh) scale(0.7) rotate(0deg);
    }
}

/* 摇摆漂浮 */
.food-icon.wobble {
    animation: wobble 5s ease-in-out forwards;
}

@keyframes wobble {
    0% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    15% {
        opacity: 0.8;
        transform: scale(1.2) rotate(10deg);
    }
    30% {
        transform: scale(1) rotate(-15deg) translateX(20px);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1) rotate(20deg) translateX(-15px);
    }
    70% {
        transform: scale(0.95) rotate(-10deg) translateX(10px);
    }
    85% {
        opacity: 0.4;
        transform: scale(1) rotate(5deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.5) rotate(0deg);
    }
}

/* 放大缩小 */
.food-icon.pulse-pop {
    animation: pulsePop 3.5s ease-in-out forwards;
}

@keyframes pulsePop {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    20% {
        opacity: 0.9;
        transform: scale(1.3);
    }
    40% {
        transform: scale(0.8);
    }
    60% {
        opacity: 0.7;
        transform: scale(1.15);
    }
    80% {
        opacity: 0.4;
        transform: scale(0.9);
    }
    100% {
        opacity: 0;
        transform: scale(0);
    }
}

/* 旋转飞入 */
.food-icon.spin-in {
    animation: spinIn 4.5s ease-out forwards;
}

@keyframes spinIn {
    0% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    25% {
        opacity: 0.8;
        transform: scale(1.2) rotate(180deg);
    }
    50% {
        opacity: 0.7;
        transform: scale(1) rotate(360deg);
    }
    75% {
        opacity: 0.5;
        transform: scale(1.1) rotate(540deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.6) rotate(720deg);
    }
}

/* 响应式 */
@media (max-width: 600px) {
    #what {
        font-size: clamp(40px, 15vw, 80px);
    }

    #start {
        padding: 15px 40px;
        font-size: 20px;
    }

    #addMenuBtn {
        right: 15px;
        bottom: 60px;
        padding: 12px 20px;
        font-size: 14px;
    }

    .modal {
        padding: 20px;
        margin: 20px;
    }
}
