* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #FFB6C1, #FFC0CB, #FFE4E1);  /* 從淺粉紅到粉紅再到淺粉紅白 */
    width: 100%;
    height: 100vh;
    overflow: hidden;
    position: fixed;
    animation: backgroundShift 15s ease infinite;
    background-size: 200% 200%;
}

body.non-mobile::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 9999;
}

.container {
    width: 100%;
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(255, 182, 193, 0.3), rgba(255, 192, 203, 0.5));  /* 添加放射狀漸層 */
}

.slot-machine {
    width: 1176px;
    height: 1176px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% + 300px));  /* 往下移動 300px */
    transform-origin: center center;
}

/* 添加偽元素作為框架 */
.slot-machine::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('images/frame.png');
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    z-index: 10;  /* 確保框架在最上層 */
    pointer-events: none;  /* 允許點擊穿透到下層元素 */
}

.screen {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, calc(-50% - 10px));
    width: 45%;
    height: 30%;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding: 5px;
    gap: -100px;
    overflow: hidden;
    z-index: 1;
}

.gift-container {
    width: 85%;
    height: 300%;
    margin: 0 -150px;
    perspective: 999999px;
    transform-style: preserve-3d;
    position: relative;
    transform: translateY(-100%);
    z-index: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gift-container {
    transform: rotateX(var(--currentDeg));
}

.gift-container.autoTurn {
    transition: var(--duration) ease-in-out;
    transform: rotateX(var(--targetDeg));
}

.gift {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
}

.gift img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform-origin: center center;
}

/* 把手樣式 */
.handler {
    position: absolute;
    right: 22%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 11;  /* 確保在框架上層 */
}

.handler.active .ball {
    top: 0px;
}

.handler.active .stick {
    top: -10px;
    height: 20px;
}

.stick {
    position: absolute;
    top: -90px;
    right: -40px;
    width: 20px;
    height: 100px;
    border: var(--border-size) solid var(--blue);
    border-radius: 20px;
    background-color: var(--red);
    transition: 350ms;
}

.stick2 {
    position: absolute;
    top: -10px;
    right: -45px;
    width: 80px;
    height: 20px;
    border: var(--border-size) solid var(--blue);
    border-radius: 0 20px 20px 0;
    background-color: var(--red);
}

.ball {
    position: absolute;
    top: -155px;
    right: -65px;
    width: 70px;
    height: 70px;
    border: var(--border-size) solid var(--blue);
    border-radius: 50%;
    background-color: var(--red);
    cursor: pointer;
    transition: 500ms;
}

/* 手機端適配 */
@media screen and (max-width: 768px) {
    .container {
        padding-top: 200px;
    }
    .slot-machine {
        width: 98vw;
        height: 98vw;
        margin-top: -80px;
        transform-origin: center center !important;
        top: 200px;
    }
    .screen {
        width: 50%;
        height: 70%;
        gap: 30px;
    }
    .gift-container {
        width: 101%;
        height: 100%;
    }
    .gift img {
        transform-origin: center center !important;
    }
    .start-button {
        bottom: 25%;
    }
}

/* 更小螢幕的適配 */
@media screen and (max-width: 480px) {
    .container {
        padding-bottom: 60px;
    }
    .slot-machine {
        width: 98vw;
        height: 98vw;
        margin-top: -60px;
    }
    .screen {
        width: 50%;
        height: 70%;
        gap: 30px;
    }
    .gift-container {
        width: 101%;
        height: 100%;
    }
}

/* 添加遮罩樣式 */
.screen-overlay,
.overlay-top,
.overlay-bottom {
    display: none;
}

/* 開始按鈕樣式 */
.start-button {
    position: absolute;
    left: 50%;
    bottom: 15%;
    transform: translateX(-50%);
    padding: 15px 45px;
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(45deg, #ff6b9c, #ff4081);
    border: none;
    border-radius: 60px;
    box-shadow: 0 4px 15px rgba(255, 64, 129, 0.4);
    cursor: pointer;
    transition: background 0.15s ease;  /* 只對背景色應用過渡效果 */
    font-family: 'Arial', sans-serif;
    z-index: 11;
    white-space: nowrap;
    user-select: none;  /* 防止文字被選中 */
    -webkit-tap-highlight-color: transparent;  /* 移除移動設備上的點擊高亮 */
}

.start-button:hover {
    background: linear-gradient(45deg, #ff4081, #ff6b9c);
}

.start-button:active {
    box-shadow: 0 2px 10px rgba(255, 64, 129, 0.4);
}

.handle-container {
    position: absolute;
    right: calc(5% + 30px);
    top: 30%;
    width: 700px;
    height: 700px;
    z-index: 11;
    cursor: pointer;
    transform-origin: left center;
    transform: rotate(-15deg);
}

.handle-gif {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation-iteration-count: 1;  /* 只播放一次 */
}

.handle-gif.playing {
    opacity: 0;
}

/* 添加一個新的 gif 元素用於播放動畫 */
.handle-container.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('images/handle.gif');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
}

.handle-container.active::after {
    opacity: 1;
}

.handle-static {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.handle-gif {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.handle-container.active .handle-static {
    opacity: 0;
}

.handle-container.active .handle-gif {
    opacity: 1;
}

/* 漢堡菜單樣式 */
.hamburger-menu {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
}

.hamburger-icon {
    width: 35px;
    height: 30px;
    cursor: pointer;
    padding: 10px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.hamburger-icon span {
    display: block;
    width: 100%;
    height: 3px;
    background: #333;
    margin: 5px 0;
    transition: 0.3s;
}

.hamburger-menu.active .hamburger-icon span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-menu.active .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active .hamburger-icon span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.menu-content {
    position: fixed;
    top: 70px;
    left: -300px;
    width: 280px;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: 0.3s;
}

.hamburger-menu.active .menu-content {
    left: 20px;
}

.scale-control {
    margin: 15px 0;
}

.scale-control label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.scale-control input[type="range"] {
    width: 100%;
    margin: 5px 0;
}

.scale-value {
    display: inline-block;
    min-width: 40px;
    text-align: right;
    color: #666;
}

/* 彈窗樣式 */
.win-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.win-popup.active {
    display: flex !important;
}

.win-content {
    background: linear-gradient(135deg, #fff6e6, #ffe4e1);
    padding: 50px;  /* 增加內邊距 */
    border-radius: 30px;  /* 增加圓角 */
    text-align: center;
    max-width: 800px;  /* 增加最大寬度 */
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);  /* 增強陰影效果 */
    transform: scale(0.7);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.win-header {
    margin-bottom: 30px;
}

.win-header h2 {
    color: #ff4081;
    font-size: 42px;  /* 增加標題字體大小 */
    margin: 0;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.15);
    font-weight: bold;
}

.win-body {
    margin: 40px 0;
}

.prize-image {
    width: 300px;  /* 增加獎品圖片容器大小 */
    height: 300px;
    margin: 0 auto 30px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.winning-prize {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scale(1.2);  /* 稍微放大獎品圖片 */
    transition: transform 0.3s ease;
}

.win-message {
    font-size: 28px;  /* 增加訊息字體大小 */
    color: #333;
    margin: 20px 0;
    font-weight: bold;
}

/* 關閉按鈕樣式 */
.close-popup {
    background: linear-gradient(45deg, #ff6b9c, #ff4081);
    color: white;
    border: none;
    padding: 15px 60px;
    border-radius: 40px;
    font-size: 24px;
    cursor: pointer;
    transition: background 0.15s ease;  /* 只對背景色應用過渡效果 */
    box-shadow: 0 8px 25px rgba(255, 64, 129, 0.4);
    font-weight: bold;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.close-popup:hover {
    background: linear-gradient(45deg, #ff4081, #ff6b9c);
}

.close-popup:active {
    box-shadow: 0 4px 15px rgba(255, 64, 129, 0.4);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popIn {
    from { 
        transform: scale(0.5);
        opacity: 0;
    }
    to { 
        transform: scale(1);
        opacity: 1;
    }
}

/* 添加響應式設計 */
@media screen and (max-width: 768px) {
    .win-content {
        padding: 30px;
        max-width: 90%;
    }
    
    .win-header h2 {
        font-size: 32px;
    }
    
    .prize-image {
        width: 200px;
        height: 200px;
    }
    
    .win-message {
        font-size: 24px;
    }
    
    .close-popup {
        padding: 12px 40px;
        font-size: 20px;
    }
}

/* 序號容器樣式 */
.cdkey-container {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 240, 245, 0.95));
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(255, 64, 129, 0.15);
    border: 2px solid rgba(255, 64, 129, 0.1);
}

/* 序號標籤樣式 */
.cdkey-label {
    font-size: 24px;
    color: #666;
    margin-bottom: 15px;
    font-weight: bold;
}

/* 序號值樣式 */
.cdkey-value {
    font-size: 36px;
    color: #ff4081;
    font-weight: bold;
    letter-spacing: 3px;
    font-family: 'Courier New', monospace;
    background: #fff;
    padding: 15px 30px;
    border-radius: 15px;
    display: inline-block;
    box-shadow: 0 5px 15px rgba(255, 64, 129, 0.2);
    border: 2px solid rgba(255, 64, 129, 0.1);
    text-shadow: 1px 1px 2px rgba(255, 64, 129, 0.1);
}

/* 手機端適配 */
@media screen and (max-width: 768px) {
    .cdkey-label {
        font-size: 20px;
    }
    
    .cdkey-value {
        font-size: 28px;
        padding: 12px 24px;
    }
}

/* 會員資訊樣式 */
.member-info {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2001;
    width: calc(100% - 10px);
    max-width: 1200px;
    text-align: center;
    padding-bottom: 5px;
    margin-top: 100px;
}

.info-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 240, 245, 0.98));
    padding: 35px 50px;
    border-radius: 25px;
    box-shadow: 0 -5px 40px rgba(255, 64, 129, 0.2);
    display: flex;
    justify-content: space-between;
    gap: 60px;
    border: 3px solid rgba(255, 64, 129, 0.15);
    margin: 0;
}

.info-item {
    flex: 1;
}

.info-item label {
    display: block;
    font-size: 28px;  /* 增加標籤字體大小 */
    color: #666;
    margin-bottom: 15px;
    font-weight: bold;
}

.info-item input {
    width: 100%;
    padding: 20px 25px;  /* 增加輸入框內邊距 */
    border: 3px solid rgba(255, 64, 129, 0.15);
    border-radius: 20px;
    background: #fff;
    color: #ff4081;
    font-size: 32px;  /* 增加輸入框字體大小 */
    font-weight: bold;
    text-align: center;
    cursor: default;
    outline: none;
    box-shadow: 0 12px 30px rgba(255, 64, 129, 0.15);
}

/* 手機端適配 */
@media screen and (max-width: 768px) {
    .member-info {
        padding-bottom: 2px;
    }
    
    .start-button {
        bottom: 35%;
    }
    
    .info-card {
        padding: 25px;
        gap: 25px;
    }
    
    .info-item label {
        font-size: 22px;
    }
    
    .info-item input {
        font-size: 24px;
        padding: 15px 20px;
    }
}

/* 可選：添加一個微妙的動畫效果 */
@keyframes backgroundShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 公告彈窗樣式 */
.announcement-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2002;
    justify-content: center;
    align-items: center;
    padding: 0;
}

.announcement-content {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.announcement-image {
    width: 100%;
    height: auto;
    max-height: 100vh;
    object-fit: contain;
    border-radius: 0;
    transform: scale(1.5);
    margin-top: -20vh;
    position: relative;
}

@media (max-width: 768px) {
    .announcement-content {
        width: 100%;
        margin: 0;
        height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        position: relative;
    }
    
    .announcement-image {
        width: 100%;
        max-width: none;
        max-height: 100vh;
        height: auto;
        border-radius: 0;
        object-fit: contain;
        transform: scale(2);
        margin-top: -30vh;
    }
}

/* 針對較小的手機屏幕 */
@media (max-width: 375px) {
    .announcement-image {
        transform: scale(1.8);
    }
}

/* 確保 SweetAlert 顯示在遮罩層之上 */
.swal2-container {
    z-index: 10000 !important;
}