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

body {
    font-family: 'DotGothic16', 'Arial', 'Microsoft YaHei', sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    background: #000;
    user-select: none;
    touch-action: none;
    /* 微信浏览器全屏优化 */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    -webkit-overflow-scrolling: touch;
}

/* 封面 */
.cover-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    background: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.5s ease;
}

.cover-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    /* 以高度铺满屏幕为主 */
}

.cover-hint {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 
        0 0 10px rgba(255, 51, 102, 0.8),
        0 0 20px rgba(255, 51, 102, 0.6),
        0 2px 4px rgba(0, 0, 0, 0.8);
    animation: hintBounce 1.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes hintBounce {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
    50% {
        transform: translateX(-50%) translateY(-10px);
        opacity: 0.7;
    }
}

#gameContainer {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* 开始提示弹框 */
.start-prompt {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    pointer-events: none;
}

.start-prompt.hidden {
    display: none;
}

.prompt-box {
    background: linear-gradient(135deg, #fff 0%, #ffe5e5 100%);
    border: 6px solid #ff3366;
    border-radius: 20px;
    padding: 25px 35px;
    text-align: center;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.5),
        inset 0 2px 5px rgba(255, 255, 255, 0.5);
    animation: promptPulse 2s ease-in-out infinite;
}

@keyframes promptPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.prompt-icon {
    font-size: 48px;
    margin-bottom: 10px;
    animation: carBounce 1s ease-in-out infinite;
}

@keyframes carBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.prompt-text {
    font-size: 28px;
    font-weight: bold;
    color: #ff3366;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.prompt-hint {
    font-size: 18px;
    color: #666;
    margin-bottom: 5px;
}

.prompt-arrow {
    font-size: 32px;
    animation: arrowBounce 1s ease-in-out infinite;
}

@keyframes arrowBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}

/* 道具收集提示弹窗 */
.item-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.item-modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.item-modal-card {
    background: linear-gradient(135deg, #ffe0e9 0%, #ffd4e5 50%, #ffc8e0 100%);
    border: 8px solid #ff3366;
    border-radius: 16px;
    padding: 35px 30px;
    max-width: 420px;
    width: 90%;
    box-shadow: 
        0 0 0 4px #fff,
        0 0 0 8px #ff69b4,
        0 0 20px rgba(255, 51, 102, 0.3),
        0 15px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.item-modal-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.1) 10px,
        rgba(255, 255, 255, 0.1) 20px
    );
    pointer-events: none;
}

.item-modal-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: iconPop 0.5s ease;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.item-modal-icon img {
    width: 95% !important;
    height: auto !important;
    max-width: 280px;
    object-fit: contain;
    image-rendering: pixelated;
}

@keyframes iconPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.item-modal-title {
    font-size: 22px;
    color: #d91b5c;
    font-weight: bold;
    margin-bottom: 15px;
    text-shadow: 
        2px 2px 0 rgba(255, 255, 255, 0.8),
        3px 3px 8px rgba(217, 27, 92, 0.4);
    position: relative;
    z-index: 1;
}

.item-modal-message {
    background: rgba(255, 255, 255, 0.9);
    border: 4px solid #ff69b4;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 25px;
    color: #333;
    font-size: 15px;
    line-height: 1.9;
    min-height: 110px;
    text-align: left;
    font-family: 'DotGothic16', monospace;
    box-shadow: 
        inset 0 2px 8px rgba(0, 0, 0, 0.1),
        0 2px 4px rgba(255, 105, 180, 0.2);
    position: relative;
    z-index: 1;
}

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

.pixel-btn {
    padding: 14px 24px;
    border: none;
    color: #fff;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'DotGothic16', monospace;
    border-radius: 25px;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.pixel-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.pixel-btn:hover::before {
    width: 300px;
    height: 300px;
}

.continue-btn {
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    box-shadow: 
        0 4px 15px rgba(255, 105, 180, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    flex: 1;
}

.continue-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(255, 105, 180, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.continue-btn:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 10px rgba(255, 105, 180, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.end-btn {
    background: linear-gradient(135deg, #888 0%, #666 100%);
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    flex: 1;
}

.end-btn:hover {
    background: linear-gradient(135deg, #999 0%, #777 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.end-btn:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 10px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* 花瓣收集特效 */
.collect-petal {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ff69b4;
    pointer-events: none;
    z-index: 1000;
    animation: petalFly 1s ease-out forwards;
}

@keyframes petalFly {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) rotate(720deg) scale(0);
        opacity: 0;
    }
}

/* 道具出现时的花瓣特效 */
.spawn-petal {
    position: absolute;
    background: #ff69b4;
    pointer-events: none;
    z-index: 999;
    animation: petalFall 2s ease-out forwards;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

@keyframes petalFall {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) rotate(var(--rotation)) scale(0.3);
        opacity: 0;
    }
}

/* 底部UI */
.bottom-ui {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    padding: 15px;
    z-index: 50;
}

.items-collected {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.item-slot {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    opacity: 0.4;
    filter: grayscale(100%);
    transition: all 0.3s ease;
}

.item-slot img {
    width: 80%;
    height: 80%;
    object-fit: contain;
}

.item-slot.collected {
    opacity: 1;
    filter: grayscale(0%);
    border-color: #ff3366;
    background: rgba(255, 51, 102, 0.2);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 51, 102, 0.8);
    animation: collectPulse 0.5s ease;
}

@keyframes collectPulse {
    0%, 100% { transform: scale(1.1); }
    50% { transform: scale(1.3); }
}

.progress-bar {
    position: relative;
    height: 25px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
}

.progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #ff3366, #ff6699, #ffccff);
    transition: width 0.5s ease;
    border-radius: 13px;
}

.progress-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    z-index: 1;
}

/* 邀请函弹窗 */
.invitation-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.invitation-modal.show {
    display: flex;
    animation: fadeIn 0.5s ease;
}

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

.invitation-card {
    background: linear-gradient(135deg, #fff 0%, #ffe5e5 100%);
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    position: relative;
    animation: slideIn 0.6s ease;
    border: 5px solid #ff3366;
    text-align: center;
}

@keyframes slideIn {
    from {
        transform: translateY(-100px) scale(0.8);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.invitation-card h2 {
    font-size: 28px;
    color: #ff3366;
    margin-bottom: 20px;
}

.couple-names {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #333;
}

.couple-names .heart {
    font-size: 28px;
    animation: heartbeat 1.5s ease infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.2); }
    50% { transform: scale(1); }
}

.invitation-details {
    background: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.invitation-details p {
    font-size: 18px;
    color: #333;
    margin-bottom: 15px;
    font-weight: bold;
}

.detail-line {
    font-size: 15px;
    color: #555;
    margin: 10px 0;
    text-align: left;
}

.blessing {
    border-top: 2px solid #ff3366;
    padding-top: 15px;
    margin-top: 15px;
    color: #666;
    font-size: 16px !important;
    line-height: 1.6;
}

.restart-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #ff3366, #ff6699);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 51, 102, 0.5);
    transition: all 0.3s ease;
}

.restart-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 8px rgba(255, 51, 102, 0.7);
}

.confetti {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    border-radius: 20px;
}

/* 响应式 */
@media (max-width: 600px) {
    .item-slot {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    
    .invitation-card {
        padding: 25px 20px;
    }
    
    .invitation-card h2 {
        font-size: 24px;
    }
    
    .couple-names {
        font-size: 20px;
    }
    
    .prompt-text {
        font-size: 24px;
    }
    
    .prompt-hint {
        font-size: 16px;
    }
}

/* 微信浏览器全屏优化 */
html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
    /* iOS 刘海屏适配 */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* 隐藏微信浏览器的工具栏和导航栏 */
#gameContainer {
    width: 100vw;
    height: 100vh;
    /* iOS 安全区域适配 */
    height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
}

/* 防止下拉刷新和上拉加载 */
body, html {
    overscroll-behavior: none;
    -webkit-overscroll-behavior: none;
    /* 防止iOS橡皮筋效果 */
    -webkit-overflow-scrolling: auto;
}

/* 针对微信内嵌浏览器 */
@supports (-webkit-overflow-scrolling: touch) {
    body {
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100);
    }
}

/* iOS Safari 兼容性 */
@supports (-webkit-touch-callout: none) {
    body {
        /* iOS specific height fix */
        min-height: -webkit-fill-available;
    }
    
    html {
        height: -webkit-fill-available;
    }
}
