* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial Rounded MT Bold', 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    padding: 20px;
}

.container {
    text-align: center;
    max-width: 800px;
    width: 100%;
}

/* 老虎机外壳 */
.slot-machine-cabinet {
    background: linear-gradient(145deg, #c70039, #900c3f);
    border-radius: 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    position: relative;
    border: 8px solid #f1c40f;
    border-bottom-width: 20px;
}

/* 添加金币计数器样式 */
.coin-counter {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 1.2rem;
    color: #f1c40f;
    display: flex;
    align-items: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    border: 2px solid #f1c40f;
    z-index: 10;
}

.coin-counter .emoji {
    margin-right: 8px;
    font-size: 1.4rem;
}

.coin-counter .count {
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.machine-top {
    background: linear-gradient(to bottom, #900c3f, #c70039);
    padding: 15px;
    border-bottom: 5px solid #f1c40f;
    position: relative;
}

.lights {
    display: flex;
    justify-content: space-around;
    margin-bottom: 10px;
}

.light {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background-color: #f1c40f;
    box-shadow: 0 0 10px #f1c40f;
    animation: blink 1s alternate infinite;
}

.light:nth-child(2n) {
    animation-delay: 0.5s;
}

@keyframes blink {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

h1 {
    margin: 0;
    font-family: 'Bungee', cursive;
    font-size: 2.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 255, 255, 0.3);
    color: #fff;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.slot-machine {
    background: #581845;
    padding: 30px;
    position: relative;
}

.slots-container {
    background: #000;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.slots {
    display: flex;
    justify-content: center; /* 改为居中对齐 */
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.jackpot-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 5px;
    background: rgba(255, 0, 0, 0.5);
    transform: translateY(-50%);
    z-index: 0;
}

.slot {
    width: 120px;
    height: 120px;
    background: #fff;
    border-radius: 0; /* 移除圆角 */
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    position: relative;
    border: 3px solid #f1c40f;
    margin: 0; /* 移除外边距 */
}

/* 为第一个和最后一个槽位添加圆角 */
.slot:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    border-right: none; /* 移除右边框 */
}

.slot:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    border-left: none; /* 移除左边框 */
}

/* 中间的槽位移除左右边框 */
.slot:nth-child(2) {
    border-left: none;
    border-right: none;
}

/* 移除分隔线代码 */
/* .slot:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 10%;
    height: 80%;
    width: 2px;
    background-color: #f1c40f;
    z-index: 2;
} */

/* 滚动动画样式 */
.slot-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(to bottom, #f5f5f5, #e0e0e0);
}

.slot-wrapper .emoji {
    font-size: 60px;
    line-height: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    text-align: center;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.slot-wrapper.spinning {
    overflow: hidden;
    background: linear-gradient(to bottom, #fff, #f5f5f5);
}

.emoji-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.slot-wrapper.spinning .emoji-container {
    animation: slotSpin 0.2s linear infinite;
    position: relative;
}

@keyframes slotSpin {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-100px);
    }
}

/* 控制区域 */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.lever-container {
    width: 60px;
    height: 150px;
    position: relative;
    z-index: 100; /* 增加z-index值 */
}

.lever-base {
    width: 30px;
    height: 30px;
    background: #f1c40f;
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 15px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.lever {
    width: 15px;
    height: 120px;
    background: linear-gradient(to bottom, #f1c40f, #e67e22);
    position: relative;
    top: 15px;
    left: 22.5px;
    border-radius: 10px;
    transform-origin: top center; /* 保持以顶部为旋转轴心 */
    transform: rotate(0deg);
    transition: transform 0.3s ease;
    cursor: pointer;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
    z-index: 101; /* 确保摇杆比容器的z-index更高 */
}

.lever:after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: -7.5px;
    width: 30px;
    height: 30px;
    background: #e74c3c;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.lever:hover {
    transform: rotate(5deg);
}

.lever.pulled {
    transform: rotate(60deg); /* 修改为正角度，表示向右下方旋转 */
    transform-origin: top center; /* 确保以顶部为旋转轴心 */
    transition: transform 0.2s ease;
}

.buttons-container {
    flex: 1;
    padding-left: 20px;
}

#spin-button {
    background: linear-gradient(45deg, #FF512F, #F09819);
    border: none;
    color: white;
    padding: 15px 40px;
    font-size: 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    outline: none;
    width: 100%;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#spin-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

#spin-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.win-button {
    background: linear-gradient(45deg, #ff0844, #ffb199);
    border: none;
    color: white;
    padding: 15px 40px;
    font-size: 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    outline: none;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.win-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    background: linear-gradient(45deg, #ff0844, #ff3366);
}

.win-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* 结果显示区域 */
.result-display {
    background: #000;
    border-radius: 10px;
    padding: 10px;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.2);
    border: 2px solid #f1c40f;
}

.result {
    font-size: 1.2rem;
    background: #333;
    padding: 15px;
    border-radius: 5px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    color: #f1c40f;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 5px rgba(241, 196, 15, 0.5);
}

/* 机器底部 */
.machine-bottom {
    background: linear-gradient(to top, #900c3f, #c70039);
    padding: 20px;
    display: flex;
    justify-content: center;
}

/* 投币口样式优化 */
.coin-slot {
    width: 100px;
    height: 40px;
    background: linear-gradient(to bottom, #333, #222);
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
    border: 2px solid #f1c40f;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.coin-slot:hover {
    background: linear-gradient(to bottom, #444, #333);
    transform: translateY(-2px);
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.8), 0 5px 10px rgba(0, 0, 0, 0.3);
}

.coin-slot:active {
    transform: translateY(1px);
}

.coin-slot-text {
    font-size: 0.8rem;
    color: #f1c40f;
    z-index: 1;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

/* 优化投币动画 */
.coin {
    position: absolute;
    width: 40px;  /* 增加金币宽度 */
    height: 40px;  /* 增加金币高度 */
    background: radial-gradient(circle at 30% 30%, #ffd700, #e6b800);
    border-radius: 50%;
    top: -50px;  /* 调整起始位置 */
    left: 50%;
    transform: translateX(-50%);
    animation: coinDrop 1s forwards;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);  /* 增强阴影效果 */
    z-index: 5;
    border: 3px solid #e6b800;  /* 加粗边框 */
    opacity: 1;
}

/* 添加金币内部纹理 */
.coin::before {
    content: '$';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #e6b800;
    font-weight: bold;
    font-size: 22px;  /* 增大字体大小 */
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
}

/* 调整金币下落动画 */
@keyframes coinDrop {
    0% {
        top: -50px;
        transform: translateX(-50%) rotateY(0deg);
        width: 40px;  /* 保持一致的宽度 */
        height: 40px;  /* 保持一致的高度 */
        opacity: 1;
    }
    30% {
        transform: translateX(-50%) rotateY(180deg);
        opacity: 1;
    }
    60% {
        top: 20px;
        transform: translateX(-50%) rotateY(360deg);
        width: 40px;
        height: 40px;
        opacity: 1;
    }
    80% {
        width: 45px;  /* 调整扁平效果 */
        height: 7px;  /* 调整扁平效果 */
        opacity: 1;
    }
    100% {
        top: 50px;
        opacity: 0;
        transform: translateX(-50%) rotateY(720deg);
        width: 45px;
        height: 7px;
    }
}

@keyframes coinShine {
    0% {
        background-position: -100px -100px;
    }
    100% {
        background-position: 100px 100px;
    }
}

/* 大奖特效样式 */
.jackpot-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    background-color: rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

.jackpot-effect.active {
    display: flex;
    animation: jackpotBackground 0.3s ease-in-out infinite alternate;
}

.jackpot-text {
    font-size: 5rem;
    color: gold;
    text-shadow: 0 0 10px #ff0, 0 0 20px #ff0, 0 0 30px #ff0, 0 0 40px #f00, 0 0 70px #f00;
    animation: jackpotText 0.5s ease-in-out infinite alternate, jackpotRotate 5s linear infinite, jackpotScale 2s ease-in-out infinite;
    z-index: 1001;
    font-family: 'Bungee', cursive;
    letter-spacing: 3px;
    font-weight: bold;
    transform-origin: center;
    position: relative;
}

.jackpot-text::before, .jackpot-text::after {
    content: '💰';
    position: absolute;
    font-size: 3rem;
    animation: coinSpin 1s linear infinite;
}

.jackpot-text::before {
    left: -60px;
}

.jackpot-text::after {
    right: -60px;
}

.confetti {
    position: absolute;
    width: 15px;
    height: 15px;
    background-color: #f00;
    animation: confettiFall linear forwards;
    opacity: 0.8;
}

/* 添加闪光效果 */
.jackpot-effect::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 20%, rgba(255, 215, 0, 0.3) 21%, transparent 22%);
    background-size: 100px 100px;
    animation: shiningBackground 4s linear infinite;
    opacity: 0.5;
}

/* 大奖时的槽位高亮效果 */
.slot.jackpot {
    box-shadow: 0 0 20px gold, 0 0 40px gold, 0 0 60px red;
    animation: jackpotSlotPulse 0.3s infinite alternate;
    z-index: 100;
    position: relative;
}

.slot.jackpot::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border: 3px solid gold;
    border-radius: inherit;
    animation: borderPulse 0.5s infinite alternate;
    z-index: -1;
}

.slot.jackpot .emoji {
    animation: emojiJump 0.5s infinite alternate;
}

/* 新增动画效果 */
@keyframes jackpotBackground {
    0% { background-color: rgba(0, 0, 0, 0.7); }
    50% { background-color: rgba(100, 50, 0, 0.7); }
    100% { background-color: rgba(150, 100, 0, 0.7); }
}

@keyframes jackpotText {
    0% { 
        text-shadow: 0 0 10px #ff0, 0 0 20px #ff0, 0 0 30px #ff0, 0 0 40px #f00, 0 0 70px #f00;
        color: gold;
    }
    100% { 
        text-shadow: 0 0 15px #ff0, 0 0 25px #ff0, 0 0 35px #ff0, 0 0 45px #f00, 0 0 80px #f00;
        color: #ffdf00;
    }
}

@keyframes jackpotRotate {
    0% { transform: rotate(-5deg); }
    25% { transform: rotate(0deg); }
    50% { transform: rotate(5deg); }
    75% { transform: rotate(0deg); }
    100% { transform: rotate(-5deg); }
}

@keyframes jackpotScale {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes confettiFall {
    0% { 
        transform: translateY(-100vh) rotate(0deg) scale(1); 
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
    100% { 
        transform: translateY(100vh) rotate(360deg) scale(0.5); 
        opacity: 0;
    }
}

@keyframes coinSpin {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

@keyframes shiningBackground {
    0% { background-position: 0 0; }
    100% { background-position: 100px 100px; }
}

@keyframes jackpotSlotPulse {
    0% { transform: scale(1); box-shadow: 0 0 20px gold, 0 0 40px gold, 0 0 60px red; }
    100% { transform: scale(1.15); box-shadow: 0 0 30px gold, 0 0 60px gold, 0 0 90px red; }
}

@keyframes borderPulse {
    0% { border-color: gold; opacity: 1; }
    100% { border-color: red; opacity: 0.7; }
}

@keyframes emojiJump {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-10px) scale(1.2); }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .slot-machine-cabinet {
        border-width: 5px;
        border-bottom-width: 10px;
    }
    
    .slots {
        flex-direction: row;
        flex-wrap: nowrap;
    }
    
    .slot {
        width: 80px;
        height: 80px;
        margin: 0; /* 移除外边距，确保无缝连接 */
    }
    
    /* 为第一个和最后一个槽位添加圆角 - 移动端 */
    .slot:first-child {
        border-top-left-radius: 8px;
        border-bottom-left-radius: 8px;
        border-right: none;
    }
    
    .slot:last-child {
        border-top-right-radius: 8px;
        border-bottom-right-radius: 8px;
        border-left: none;
    }
    
    /* 中间的槽位移除左右边框 - 移动端 */
    .slot:nth-child(2) {
        border-left: none;
        border-right: none;
    }
    
    .slot-wrapper .emoji {
        font-size: 40px;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .lever-container {
        display: none;
    }
    
    .buttons-container {
        width: 100%;
        padding-left: 0;
    }
    
    #spin-button, .win-button {
        padding: 10px 20px;
        font-size: 1rem;
    }
    
    .result {
        font-size: 1rem;
        padding: 10px;
    }
    
    .jackpot-text {
        font-size: 3rem;
    }
    
    @keyframes slotSpin {
        0% {
            transform: translateY(0);
        }
        100% {
            transform: translateY(-80px);
        }
    }
}

/* 添加到CSS文件末尾 */

/* 震动效果 */
.shake {
    animation: shake 0.1s linear infinite;
}

@keyframes shake {
    0% { transform: translate(0, 0) rotate(0); }
    25% { transform: translate(2px, 2px) rotate(0.5deg); }
    50% { transform: translate(0, -2px) rotate(0); }
    75% { transform: translate(-2px, 0) rotate(-0.5deg); }
    100% { transform: translate(0, 0) rotate(0); }
}

/* 闪光效果 */
.jackpot-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 999;
    pointer-events: none;
    animation: flash-fade 0.5s forwards;
}

@keyframes flash-fade {
    0% { opacity: 0.8; }
    100% { opacity: 0; }
}

/* 金币雨效果 */
.jackpot-coin {
    position: fixed;
    top: -50px;
    z-index: 998;
    animation: coin-fall linear forwards;
    filter: drop-shadow(0 0 5px gold);
}

@keyframes coin-fall {
    0% { 
        top: -50px; 
        transform: translateX(0) rotate(0);
    }
    100% { 
        top: 120vh; 
        transform: translateX(20px) rotate(360deg);
    }
}

/* 脉冲动画 */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* 中国国旗惩罚特效样式 */
.penalty-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    background-color: rgba(255, 0, 0, 0.7);
    overflow: hidden;
}

.penalty-effect.active {
    display: flex;
    animation: penaltyBackground 0.3s ease-in-out infinite alternate;
}

.penalty-text {
    font-size: 4rem;
    color: white;
    text-shadow: 0 0 10px #000, 0 0 20px #000;
    animation: penaltyText 0.5s ease-in-out infinite alternate;
    z-index: 1001;
    font-family: 'Bungee', cursive;
    letter-spacing: 3px;
    font-weight: bold;
}

@keyframes penaltyBackground {
    0% { background-color: rgba(255, 0, 0, 0.7); }
    100% { background-color: rgba(200, 0, 0, 0.8); }
}

@keyframes penaltyText {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}
