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

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #fff5f5, #ffe4ec 25%, #fff0db 50%, #ffe4ec 75%, #fff5f5);
    background-size: 300% 300%;
    animation: bgFlow 15s ease infinite;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
    padding: 15px;
}

@keyframes bgFlow { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

.container { width: 100%; max-width: 600px; display: flex; flex-direction: column; align-items: center; position: relative; }

.header { text-align: center; margin-bottom: 20px; width: 100%; }

.title {
    font-size: 2rem;
    font-weight: 900;
    color: #ff7043;
    letter-spacing: 2px;
    text-shadow: 2px 2px 0 #fff;
}

.subtitle { color: #ff8a65; font-size: 1rem; margin-top: 6px; }

/* 外卖入口按钮 */
.flash-buy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 90%;
    max-width: 320px;
    padding: 16px 24px;
    background: linear-gradient(135deg, #ff4757, #ff6b81);
    color: #fff;
    text-decoration: none;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 2px;
    box-shadow: 0 8px 25px rgba(255, 71, 87, 0.4);
    margin-bottom: 25px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.flash-buy-btn:active {
    transform: scale(0.95);
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
}

.flash-icon { font-size: 1.5rem; }
.flash-text { text-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.flash-arrow { font-size: 1.3rem; }

/* 扭蛋机 */
.gacha-machine {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-left: -350px;
}

/* 右侧闪购入口 */
.flash-buy-right {
    display: none;
    flex-direction: column;
    align-items: center;
}

.flash-buy-right .flash-buy-btn {
    flex-direction: column;
    padding: 16px 24px;
    gap: 8px;
    font-size: 1rem;
    width: auto;
    min-width: 180px;
    border-radius: 16px;
}

.flash-buy-right .flash-icon { font-size: 1.6rem; }
.flash-buy-right .flash-text { font-size: 1rem; letter-spacing: 0; white-space: nowrap; }

.top-ball {
    width: 50px; height: 50px;
    background: linear-gradient(135deg, #ff7043, #ff5722);
    border-radius: 50%;
    position: relative; z-index: 15;
    box-shadow: 0 6px 20px rgba(255,87,34,0.4), inset 0 -6px 12px rgba(0,0,0,0.15), inset 0 6px 12px rgba(255,255,255,0.3);
    display: flex; justify-content: center; align-items: center;
    font-size: 1.5rem;
    margin-bottom: -8px;
    border: 3px solid rgba(255,255,255,0.4);
}

.top-ball::before {
    content: '';
    position: absolute;
    width: 20px; height: 10px;
    background: rgba(255,255,255,0.5);
    border-radius: 50%;
    top: 8px; left: 10px;
}

.machine-body {
    background: linear-gradient(180deg, #ffcc80, #ffb74d 30%, #ff9800 70%, #f57c00);
    border-radius: 25px 25px 20px 20px;
    padding: 12px;
    box-shadow: 0 15px 40px rgba(255,152,0,0.35), inset 0 2px 15px rgba(255,255,255,0.4);
    border: 3px solid rgba(255,255,255,0.5);
    position: relative;
}

.machine-label {
    position: absolute; top: 15px; left: 50%;
    transform: translateX(-50%);
    background: transparent;
    padding: 6px 30px; border-radius: 15px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    z-index: 10; white-space: nowrap;
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;
}

.machine-label::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    background: linear-gradient(135deg, #ffd1dc, #ffb6c1, #ff69b4, #ff1493, #ffd1dc);
    background-size: 200% 200%;
    animation: gradientMove 3s ease infinite;
    border-radius: 17px;
    z-index: -1;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.machine-label span { color: #fff; font-weight: 700; font-size: 0.75rem; letter-spacing: 1px; white-space: nowrap; }

.globe-container {
    margin-top: 38px;
    background: linear-gradient(180deg, #fff, #fff8f0);
    border-radius: 20px; padding: 10px;
    box-shadow: inset 0 2px 12px rgba(0,0,0,0.08);
}

.globe {
    width: 170px; height: 170px;
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.98), rgba(255,250,240,0.9) 20%, rgba(255,245,230,0.7) 40%, rgba(255,240,220,0.5) 60%, rgba(255,235,210,0.3));
    border-radius: 50%; position: relative; overflow: hidden;
    box-shadow: inset 0 0 50px rgba(255,255,255,0.9), inset 0 12px 30px rgba(255,200,150,0.15), 0 8px 25px rgba(0,0,0,0.15);
    border: 3px solid rgba(255,255,255,0.8);
}

.globe::before {
    content: '';
    position: absolute;
    width: 55px; height: 30px;
    background: linear-gradient(180deg, rgba(255,255,255,0.95), transparent);
    border-radius: 50%; top: 15px; left: 24px;
    transform: rotate(-20deg);
}

.globe::after {
    content: '';
    position: absolute;
    width: 24px; height: 12px;
    background: rgba(255,255,255,0.8);
    border-radius: 50%; top: 27px; left: 47px;
    transform: rotate(-20deg);
}

.balls-container { position: absolute; width: 100%; height: 100%; }

.mini-ball {
    position: absolute; border-radius: 50%;
    box-shadow: inset -2px -2px 5px rgba(0,0,0,0.12), inset 2px 2px 5px rgba(255,255,255,0.5), 0 2px 6px rgba(0,0,0,0.15);
}
.mini-ball:nth-child(1) { width: 30px; height: 30px; background: linear-gradient(135deg, #ff8a80, #ff5252); top: 78%; left: 12%; }
.mini-ball:nth-child(2) { width: 28px; height: 28px; background: linear-gradient(135deg, #ffcc80, #ffa726); top: 82%; left: 30%; }
.mini-ball:nth-child(3) { width: 32px; height: 32px; background: linear-gradient(135deg, #a5d6a7, #66bb6a); top: 80%; left: 50%; }
.mini-ball:nth-child(4) { width: 26px; height: 26px; background: linear-gradient(135deg, #90caf9, #42a5f5); top: 84%; left: 68%; }
.mini-ball:nth-child(5) { width: 25px; height: 25px; background: linear-gradient(135deg, #ce93d8, #ab47bc); top: 72%; left: 20%; }
.mini-ball:nth-child(6) { width: 30px; height: 30px; background: linear-gradient(135deg, #fff59d, #ffee58); top: 86%; left: 42%; }
.mini-ball:nth-child(7) { width: 23px; height: 23px; background: linear-gradient(135deg, #ffab91, #ff7043); top: 75%; left: 62%; }

.main-capsule { position: absolute; width: 75px; height: 75px; top: 42%; left: 50%; transform: translate(-50%, -50%); z-index: 20; }

.capsule-ball {
    width: 100%; height: 100%;
    background: linear-gradient(135deg, #ffab91, #ff7043 50%, #f4511e);
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    box-shadow: 0 8px 25px rgba(255,112,67,0.5), inset 0 -10px 20px rgba(0,0,0,0.15), inset 0 10px 15px rgba(255,255,255,0.4);
    border: 3px solid rgba(255,255,255,0.5); position: relative;
}

.capsule-ball::before {
    content: '';
    position: absolute;
    width: 40px; height: 20px;
    background: linear-gradient(180deg, rgba(255,255,255,0.65), transparent);
    border-radius: 50%; top: 10px; left: 12px;
}

.capsule-emoji { font-size: 2.6rem; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2)); }

.capsule-ball.spinning { animation: spinShake 0.1s linear infinite; }

@keyframes spinShake { 0%, 100% { transform: rotate(-6deg) scale(1); } 50% { transform: rotate(6deg) scale(1.05); } }

.machine-base {
    background: linear-gradient(180deg, #ff9800, #f57c00 50%, #ef6c00);
    margin: -6px 0 0; padding: 12px; border-radius: 0 0 20px 20px;
    box-shadow: 0 12px 30px rgba(239,108,0,0.3); position: relative;
}

.stripe-decoration {
    height: 6px;
    background: repeating-linear-gradient(90deg, #fff 0px, #fff 10px, transparent 10px, transparent 20px);
    margin-bottom: 12px; border-radius: 3px; opacity: 0.6;
}

.controls { display: flex; align-items: center; justify-content: center; gap: 12px; }

.output-hole {
    width: 55px; height: 38px;
    background: linear-gradient(180deg, #e65100, #bf360c);
    border-radius: 8px 8px 12px 12px;
    box-shadow: inset 0 4px 12px rgba(0,0,0,0.25);
}

.handle-area { display: flex; flex-direction: column; align-items: center; }

.handle-btn {
    width: 70px; height: 70px;
    background: linear-gradient(145deg, #ffd54f, #ffb300 50%, #ff8f00);
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(255,152,0,0.5), inset 0 4px 12px rgba(255,255,255,0.5);
    transition: all 0.2s ease;
    border: 3px solid rgba(255,255,255,0.4); position: relative;
}

.handle-btn::before {
    content: '';
    position: absolute;
    width: 38px; height: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.7), transparent);
    border-radius: 50%; top: 10px; left: 15px;
}

.handle-btn:active { transform: scale(0.92) rotate(180deg); }
.handle-btn.disabled { pointer-events: none; opacity: 0.6; }
.handle-icon { font-size: 2.2rem; }

.handle-hint {
    margin-top: 8px;
    padding: 5px 14px;
    background: linear-gradient(135deg, #ffd54f, #ffb300);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    letter-spacing: 1px;
    border-radius: 12px;
    box-shadow: 0 3px 8px rgba(255,152,0,0.3);
}

.machine-footer {
    width: 115%; height: 18px;
    background: linear-gradient(180deg, #f57c00, #e65100);
    margin-left: -7.5%; margin-top: -4px;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 6px 20px rgba(230,81,0,0.4);
}

/* 飞行扭蛋 */
.flying-capsule {
    position: absolute;
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, #ffab91, #ff7043 50%, #f4511e);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3.2rem;
    z-index: 100;
    box-shadow: 0 12px 35px rgba(0,0,0,0.3), inset 0 -10px 20px rgba(0,0,0,0.15), inset 0 10px 20px rgba(255,255,255,0.4);
    border: 3px solid rgba(255,255,255,0.5);
    opacity: 0;
    pointer-events: none;
}

.flying-capsule.animate {
    animation: flyOut 1.2s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

@keyframes flyOut {
    0% { opacity: 1; transform: scale(0.5) translate(-50%, -50%) translateX(0) translateY(0) rotate(0deg); }
    15% { opacity: 1; transform: scale(0.8) translate(-50%, -50%) translateX(45px) translateY(-75px) rotate(15deg); }
    30% { opacity: 1; transform: scale(1.0) translate(-50%, -50%) translateX(110px) translateY(-130px) rotate(-10deg); }
    50% { opacity: 1; transform: scale(1.1) translate(-50%, -50%) translateX(200px) translateY(-150px) rotate(20deg); }
    70% { opacity: 1; transform: scale(1.0) translate(-50%, -50%) translateX(300px) translateY(-95px) rotate(-8deg); }
    85% { opacity: 1; transform: scale(0.95) translate(-50%, -50%) translateX(360px) translateY(-55px) rotate(5deg); }
    100% { opacity: 1; transform: scale(0.9) translate(-50%, -50%) translateX(400px) translateY(-50px) rotate(0deg); }
}

.flying-capsule::before {
    content: '';
    position: absolute;
    width: 50px; height: 24px;
    background: linear-gradient(180deg, rgba(255,255,255,0.65), transparent);
    border-radius: 50%; top: 12px; left: 16px;
}

/* 结果区 */
.flash-buy-btn-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    position: relative;
    z-index: 10;
}

/* 结果区 - 固定在扭蛋机右侧 */
.result-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    position: absolute;
    left: 340px;
    top: 50%;
    transform: translateY(-50%);
}

.food-card {
    width: 90%; max-width: 370px;
    min-width: 265px;
    background: linear-gradient(135deg, #fff, #fff8e1);
    border-radius: 20px; padding: 20px 30px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08), 0 0 0 3px rgba(255,152,0,0.3);
    opacity: 0; transform: scale(0.5) translateY(20px);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative; overflow: hidden;
}

.food-card::before {
    content: '';
    position: absolute;
    width: 200%; height: 200%;
    background: linear-gradient(45deg, transparent 40%, rgba(255,193,7,0.15) 50%, transparent 60%);
    transform: rotate(45deg) translateX(-100%);
    animation: shineCard 4s ease-in-out infinite;
}

@keyframes shineCard { 0% { transform: rotate(45deg) translateX(-100%); } 100% { transform: rotate(45deg) translateX(100%); } }

.food-card.show { opacity: 1; transform: scale(1) translateY(0); }
.food-card.show .food-emoji { animation: popIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1); }

@keyframes popIn { 0% { transform: scale(0) rotate(-15deg); } 60% { transform: scale(1.3) rotate(8deg); } 100% { transform: scale(1) rotate(0deg); } }

.food-emoji { font-size: 4.5rem; display: block; margin-bottom: 10px; position: relative; z-index: 1; }
.food-label { color: #bf360c; font-size: 0.8rem; letter-spacing: 3px; margin-bottom: 6px; font-weight: 500; position: relative; z-index: 1; }
.food-name { font-size: 1.6rem; font-weight: 700; color: #e65100; position: relative; z-index: 1; white-space: nowrap; }

/* 用户反馈按钮 */
.feedback-section {
    margin-top: 15px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.feedback-hint {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 8px;
    display: block;
}

.feedback-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.feedback-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.feedback-btn.like-btn {
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
}

.feedback-btn.dislike-btn {
    background: linear-gradient(135deg, #9e9e9e, #757575);
    color: white;
}

.feedback-btn:active {
    transform: scale(0.95);
}

.feedback-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.feedback-btn.submitted {
    background: linear-gradient(135deg, #bdbdbd, #9e9e9e);
}

.blessing-card {
    width: 90%; max-width: 650px;
    min-width: 320px;
    background: linear-gradient(135deg, #ff7043, #ff5722);
    border-radius: 15px; padding: 12px 20px;
    text-align: center;
    box-shadow: 0 6px 18px rgba(255,87,34,0.3);
    opacity: 0; transform: translateY(15px);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.25s;
    position: relative; overflow: hidden;
}

.blessing-card.show { opacity: 1; transform: translateY(0); }

.blessing-card::before {
    content: '';
    position: absolute;
    width: 150%; height: 100%; top: 0; left: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transform: translateX(-100%);
    animation: shineBlessing 3s ease-in-out infinite 0.5s;
}

@keyframes shineBlessing { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.blessing-text { color: #fff; font-size: 1rem; font-weight: 500; line-height: 1.6; position: relative; z-index: 1; white-space: nowrap; }

.confetti-piece { position: fixed; pointer-events: none; z-index: 1000; animation: confettiFall 3s ease-out forwards; }
@keyframes confettiFall { 0% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); } 100% { opacity: 0; transform: translateY(100vh) rotate(720deg) scale(0.3); } }

/* 二维码区域 */
.qrcode-section {
    margin-top: 40px;
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.qrcode-title {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
}

#qrcode {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.share-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #ff7043, #ff5722);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.share-btn:active {
    transform: scale(0.95);
}

/* Toast 提示 */
.toast {
    position: fixed;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 0.9rem;
    z-index: 2000;
    transition: bottom 0.3s ease;
}

.toast.show {
    bottom: 30px;
}

/* 管理入口 */
.admin-link {
    position: fixed;
    bottom: 10px;
    right: 15px;
    font-size: 0.7rem;
    color: #ccc;
    cursor: pointer;
    transition: color 0.3s;
}

.admin-link:hover {
    color: #999;
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: white;
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    min-width: 280px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
}

.modal-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #eee;
    border-radius: 10px;
    font-size: 1rem;
    margin-bottom: 20px;
    outline: none;
    transition: border-color 0.3s;
}

.modal-input:focus {
    border-color: #ff7043;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 20px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-btn.cancel {
    background: #f5f5f5;
    color: #666;
}

.modal-btn.confirm {
    background: linear-gradient(135deg, #ff7043, #ff5722);
    color: white;
}

.modal-btn:active {
    transform: scale(0.95);
}

.toast-modal {
    padding: 25px 30px;
}

.toast-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.toast-message {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 20px;
}

/* 大屏幕适配 */
@media (min-width: 600px) {
    .container { max-width: 600px; }
    .title { font-size: 2.5rem; }
    .globe { width: 200px; height: 200px; }
    .main-capsule { width: 90px; height: 90px; }
    .capsule-emoji { font-size: 3.2rem; }
    .handle-btn { width: 85px; height: 85px; }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .gacha-machine {
        margin-left: 0;
    }

    .result-section {
        position: relative;
        left: 0;
        top: 0;
        transform: none;
        margin-top: 30px;
    }

    .food-card {
        min-width: auto;
        width: 100%;
    }

    .blessing-card {
        min-width: auto;
        width: 100%;
    }
}