/* 根字体大小：基于视口宽度自适应，移动端缩小，桌面端正常 */
html {
    font-size: clamp(0.75rem, 4vw, 1rem);
}

body {
    overflow: hidden;
    margin: 0;
}

/* 图片弹窗遮罩层 */
#image-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    animation: fadeIn 0.3s ease;
}

#image-overlay.active {
    display: flex;
}

#image-overlay img {
    max-width: 80vw;
    max-height: 80vh;
    border-radius: 0.75rem;
    border: 0.1875rem solid rgba(255, 180, 210, 0.8);
    box-shadow: 0 0 2.5rem rgba(208, 96, 144, 0.6);
    animation: scaleIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* 流萤效果 */
.firefly {
    position: fixed;
    width: 0.25rem;
    height: 0.25rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,180,0.9), rgba(255,255,100,0.4), transparent);
    box-shadow: 0 0 0.375rem 0.125rem rgba(255,255,150,0.6), 0 0 0.75rem 0.25rem rgba(255,255,100,0.3);
    pointer-events: none;
    z-index: 500;
    animation: fireflyFloat linear infinite;
    opacity: 0;
    will-change: transform, opacity;
    transition: left 1.5s ease-out, top 1.5s ease-out;
}

@keyframes fireflyFloat {
    0% { opacity: 0; transform: translate(0, 0) scale(0.5); }
    10% { opacity: 1; }
    50% { opacity: 0.6; }
    90% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.2); }
}

/* 底部切换按钮 */
#scene-switch-btn {
    position: fixed;
    bottom: 1.875rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    padding: 0.75rem 2rem;
    border: 0.125rem solid rgba(255, 200, 220, 0.7);
    border-radius: 1.875rem;
    background: rgba(100, 30, 60, 0.5);
    color: rgba(255, 220, 240, 0.95);
    font-size: 1rem;
    font-family: sans-serif;
    cursor: pointer;
    backdrop-filter: blur(0.5rem);
    -webkit-backdrop-filter: blur(0.5rem);
    transition: all 0.3s ease;
    letter-spacing: 0.125rem;
    white-space: nowrap;
}

#scene-switch-btn:hover {
    background: rgba(180, 60, 100, 0.6);
    border-color: rgba(255, 180, 200, 1);
    box-shadow: 0 0 1.25rem rgba(255, 100, 150, 0.5);
}

/* kiss 弹窗 */
#kiss-dialog {
    display: none;
    position: fixed;
    z-index: 950;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 1.5rem 2.25rem;
    border: 0.125rem solid rgba(255, 180, 200, 0.8);
    border-radius: 1rem;
    background: rgba(60, 10, 40, 0.85);
    backdrop-filter: blur(0.75rem);
    -webkit-backdrop-filter: blur(0.75rem);
    text-align: center;
    box-shadow: 0 0 1.875rem rgba(255, 100, 160, 0.4);
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
}

#kiss-dialog.active {
    display: block;
}

#kiss-dialog .dialog-title {
    color: rgba(255, 200, 220, 0.95);
    font-size: 1.25rem;
    font-family: sans-serif;
    margin-bottom: 1.125rem;
    letter-spacing: 0.0625rem;
}

#kiss-dialog .dialog-btns {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

#kiss-dialog .dialog-btn {
    padding: 0.625rem 1.5rem;
    border-radius: 1.25rem;
    font-size: 0.9375rem;
    font-family: sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.0625rem;
}

#kiss-dialog .btn-kiss {
    border: 0.125rem solid rgba(255, 150, 180, 0.9);
    background: rgba(200, 60, 100, 0.6);
    color: #fff;
}

#kiss-dialog .btn-kiss:hover {
    background: rgba(255, 80, 130, 0.8);
    box-shadow: 0 0 0.9375rem rgba(255, 100, 150, 0.6);
}

#kiss-dialog .btn-no {
    border: 0.125rem solid rgba(200, 200, 220, 0.5);
    background: rgba(80, 80, 100, 0.4);
    color: rgba(255, 255, 255, 0.8);
}

#kiss-dialog .btn-no:hover {
    background: rgba(120, 120, 140, 0.5);
}

/* 背景音乐控制 */
#music-controls {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 900;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#music-controls .music-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 0.125rem solid rgba(255, 200, 220, 0.7);
    background: rgba(100, 30, 60, 0.5);
    color: rgba(255, 220, 240, 0.95);
    font-size: 1rem;
    cursor: pointer;
    backdrop-filter: blur(0.5rem);
    -webkit-backdrop-filter: blur(0.5rem);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#music-controls .music-btn:hover {
    background: rgba(180, 60, 100, 0.6);
    border-color: rgba(255, 180, 200, 1);
    box-shadow: 0 0 0.9375rem rgba(255, 100, 150, 0.5);
}

#music-controls .music-btn.active {
    background: rgba(200, 60, 100, 0.7);
    border-color: rgba(255, 150, 180, 1);
}

#music-controls .music-label {
    color: rgba(255, 220, 240, 0.8);
    font-size: 0.75rem;
    font-family: sans-serif;
    letter-spacing: 0.0625rem;
}

/* 场景过渡遮罩 */
#scene-transition {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(22, 0, 22, 0);
    z-index: 800;
    pointer-events: none;
    transition: background 1s ease;
}

#scene-transition.active {
    background: rgba(22, 0, 22, 1);
}

/* 移动端适配 */
@media (max-width: 48rem) {
    #scene-switch-btn {
        padding: 0.5rem 1.25rem;
        font-size: 0.875rem;
        bottom: 1.25rem;
    }

    #kiss-dialog {
        padding: 1rem 1.5rem;
    }

    #kiss-dialog .dialog-title {
        font-size: 1rem;
    }

    #kiss-dialog .dialog-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }

    #music-controls .music-btn {
        width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
    }

    #music-controls .music-label {
        display: none;
    }
}

/* ========== 抽奖场景 ========== */
#lottery-scene {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 860;
    background: transparent;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

#lottery-scene.active {
    display: flex;
}

#lottery-particles-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
}

.lottery-title {
    position: absolute;
    top: 16%;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 1.75rem;
    font-family: sans-serif;
    font-weight: bold;
    letter-spacing: 0.25rem;
    text-shadow: 0 0 1.25rem rgba(255, 100, 150, 0.6), 0 2px 4px rgba(100, 50, 80, 0.4);
    z-index: 1;
    text-align: center;
    white-space: nowrap;
}

#lottery-canvas {
    display: none;
}

.lottery-spin-btn {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem 2.5rem;
    border: 0.0625rem solid rgba(255, 255, 255, 0.5);
    border-radius: 1.875rem;
    background: linear-gradient(135deg, rgba(255, 100, 150, 0.7), rgba(200, 100, 180, 0.7));
    color: #fff;
    font-size: 1.125rem;
    font-family: sans-serif;
    cursor: pointer;
    letter-spacing: 0.25rem;
    transition: all 0.3s ease;
    box-shadow: 0 0 1.5rem rgba(255, 100, 150, 0.3);
    z-index: 1;
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.lottery-spin-btn:hover {
    background: linear-gradient(135deg, rgba(255, 130, 170, 0.85), rgba(220, 120, 200, 0.85));
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 2rem rgba(255, 100, 150, 0.5);
    transform: translateX(-50%) scale(1.05);
}

.lottery-spin-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: translateX(-50%);
}

.lottery-result {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 1.8rem;
    font-family: sans-serif;
    font-weight: bold;
    text-align: center;
    min-height: 2.5rem;
    letter-spacing: 0.125rem;
    text-shadow: 0 0 1rem rgba(255, 100, 150, 0.5), 0 2px 4px rgba(100, 50, 80, 0.3);
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 10;
    background: linear-gradient(135deg, rgba(255, 50, 100, 0.85), rgba(200, 50, 150, 0.85));
    padding: 1rem 2.5rem;
    border-radius: 1rem;
    border: 0.125rem solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 2rem rgba(255, 80, 130, 0.7), 0 0 4rem rgba(255, 50, 100, 0.3);
    backdrop-filter: blur(8px);
}

.lottery-result.show {
    opacity: 1;
    animation: resultBounce 0.6s ease;
}

@keyframes resultBounce {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* 移动端适配 - 新场景 */
@media (max-width: 48rem) {
    .lottery-title {
        font-size: 1.25rem;
    }

    .lottery-spin-btn {
        padding: 0.625rem 2rem;
        font-size: 1rem;
    }

    .lottery-result {
        font-size: 1.25rem;
    }
}
