/* =========================================
   1. 全域設定與重置 (Global & Reset)
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    overflow: hidden;
    background: linear-gradient(180deg, #1e3c72, #2a5298);
    position: relative;
    width: 100vw;
    height: 100vh;
    padding-bottom: max(0px, env(safe-area-inset-bottom));
}

/* 標題與文字通用樣式 */
h1 {
    font-size: clamp(24px, 4vw, 32px);
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

h2 {
    font-size: 28px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

p {
    margin-bottom: 20px;
    font-size: 16px;
}

/* =========================================
   2. 主版面佈局 (Main Layout)
   ========================================= */
#mainContainer {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
}

/* 遊戲區域（上方） */
#gameArea {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#gameArea::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/images/game-background.png');
    background-size: 100% 100%;
    background-position: center center;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1;
    background: transparent;
}

/* 功能控制區域（下方） */
#controlArea {
    height: auto;
    background-image: url('../assets/images/background.png'), linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    background-size: 100% 100%, 100% 100%;
    background-position: center center;
    background-repeat: no-repeat;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    padding: 20px 20px;
    padding-bottom: calc(40px + max(0px, env(safe-area-inset-bottom)));
    border-top: 2px solid rgba(255, 255, 255, 0.2);
    z-index: 20;
    min-height: 120px;
}

/* 底部純色填充區 (for safe area) */
#bottomColorArea {
    background-color: #006036;
    height: 35px;
    width: 100%;
    z-index: 20;
}

/* =========================================
   3. 遊戲中介面 (In-Game UI / HUD)
   ========================================= */
.ui-element {
    position: absolute;
    background: transparent;
    padding: 10px 20px;
    border-radius: 15px;
    box-shadow: none;
    font-size: 18px;
    font-weight: bold;
    z-index: 15;
}

.top-left { top: 20px; left: 20px; }
.top-center { top: 20px; left: 50%; transform: translateX(-50%); }
.top-right { top: 20px; right: 20px; }
.bottom-right { bottom: 20px; right: 20px; }

/* 生命顯示 */
#lifeDisplay {
    display: flex;
    gap: 5px;
    background: transparent;
    padding: 0;
    align-items: center;
}

.life-icon {
    width: 40px;
    height: 40px;
    display: inline-block;
    transition: filter 0.3s;
    margin-right: 5px;
}

.life-icon.gray {
    filter: grayscale(100%) opacity(0.4);
}

/* 時間顯示 */
#timeDisplay { background: transparent; padding: 0; }

#time {
    font-size: 48px;
    color: white;
    font-weight: bold;
}

#time.red-time {
    color: #ff0000;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
}

/* 分數顯示 */
#scoreDisplay { background: transparent; padding: 0; }

#scoreText {
    font-size: 36px;
    color: white;
    font-weight: bold;
}

/* =========================================
   4. 彈窗與畫面系統 (Screens & Modals)
   ========================================= */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.screen-content {
    background: linear-gradient(135deg, #eb7680 0%, #EA5C67 100%);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    color: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    width: 400px;
}

/* --- 共用背景設定 (星星+橘色漸層) --- */
#startScreen,
#gameOverScreen,
#leaderboardScreen,
#howToPlayScreen,
#settingsScreen {
    background-image:
        url('../assets/images/star.png'),
        radial-gradient(ellipse at center top, 
            #FDEADF 0%,
            #FBDAC9 15%,
            #F9CFBA 30%,
            #F4A685 50%,
            #F0855E 70%,
            #EC6842 100%);
    background-size: 60px 60px, 100% 100%;
    background-repeat: repeat, no-repeat;
    background-position: center top;
}

/* =========================================
   5. 各別畫面樣式 (Specific Screens)
   ========================================= */

/* --- A. 開始畫面 (Start Screen) --- */
#startScreen .screen-content {
    background: transparent;
    box-shadow: none;
    padding: 1vh 20px 2vh 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;  /* 改回 flex-start */
    gap: 0;
    width: 90%;
    max-width: 500px;
    height: 90vh;
    max-height: 90vh;
    overflow: hidden;
}

#startScreen .main-visual {
    width: 90%;
    max-width: 300px;
    margin: 0 auto;
    margin-bottom: 2vh;  /* 明確的下邊距 */
    text-align: center;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}


#startScreen .main-visual img {
    max-width: 100%;
    max-height: min(32vh, 280px);  /* 從 35vh 減少到 32vh 或 280px */
    width: auto;
    height: auto;
    display: block;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.3));
    user-select: none;
    -webkit-user-drag: none;
}

#startScreen h1, #startScreen p { display: none; }

#startScreen .button-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1vh;
    flex: 0 0 auto;
    margin-bottom: 1.5vh;  /* 與社群區塊保持距離 */
}

#startScreen .screen-content button {
    width: 90%;
    max-width: 320px;
    padding: clamp(8px, 1.2vh, 14px) 30px;  /* 減少內邊距 */
    margin: 0;
    display: block;
    font-size: clamp(14px, 2vw, 18px);
}

/* 社群 Icon 區塊 */
.social-section {
    margin-top: auto;  /* 推到底部 */
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: clamp(4px, 0.6vh, 8px);
    align-items: center;
    width: 100%;
    max-width: clamp(320px, 90vw, 600px);
    flex: 0 0 auto;
}

.social-icons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(8px, 1.5vw, 15px);
    flex-wrap: wrap;
}

.social-icon {
    width: clamp(30px, 5vw, 60px);  /* 從 35px/70px 改為 30px/60px */
    height: clamp(30px, 5vw, 60px);
    background: transparent;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    text-decoration: none;
    flex-shrink: 0;
    color: white;
}

.social-icon img {
    width: clamp(30px, 5vw, 60px);
    height: clamp(30px, 5vw, 60px);
    display: block;
    object-fit: contain; 
}

.social-icon svg {
    width: clamp(22px, 2.8vw, 32px);
    height: clamp(22px, 2.8vw, 32px);
    display: block;
    fill: white; 
}

.social-icon:not(:has(svg)) {
    font-size: clamp(22px, 2.8vw, 32px);
    line-height: 1;
    color: white;
}

.social-icon:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    background: rgba(255,255,255,0.1);
}

.brand-row { display: flex; justify-content: center; }

.brand-badge {
    background-color: transparent;
    color: white;
    padding: 4px 0;  /* 減少內邊距 */
    border-radius: 20px;
    text-decoration: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    width: calc(5 * clamp(30px, 5vw, 60px) + 4 * clamp(8px, 1.5vw, 15px));
}

.brand-badge:hover { transform: translateY(-5px) scale(1.1); }
.brand-badge .icon-img { 
    width: calc(5 * clamp(30px, 5vw, 60px) + 4 * clamp(8px, 1.5vw, 15px)); 
    object-fit: cover; 
}
.brand-badge .icon { font-size: clamp(16px, 2vw, 24px); }
.brand-badge .text-badge { color: white; }

/* --- B. 加載畫面 (Loading Screen) --- */
.loading-content { width: 450px; max-width: 90%; }
.loading-text { font-size: 18px; font-weight: bold; color: #ffeb3b; margin: 0 !important; }
.loading-tip { font-size: 14px; color: rgba(255, 255, 255, 0.8); margin-top: 10px !important; }

.loading-bar-container {
    width: 100%;
    height: 25px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    overflow: hidden;
    margin: 30px 0 20px 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.loading-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A, #CDDC39);
    background-size: 200% 100%;
    animation: gradientFlow 2s infinite;
    transition: width 0.3s ease;
    border-radius: 13px;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

/* --- C. 遊戲結束畫面 (Game Over Screen) --- */
.final-score { margin: 20px 0; }
.score-big { font-size: 48px; color: #ffeb3b; text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5); }

.player-info-input {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

#playerName, #playerEmail {
    padding: 12px 20px;
    border: none;
    border-radius: 20px;
    font-size: 16px;
    width: 100%;
    max-width: 300px;
    text-align: center;
    background: white;
}

#playerName::placeholder, #playerEmail::placeholder { color: #999; }
#saveScoreBtn { width: 100%; max-width: 300px; margin-top: 5px; }

/* 優惠券區塊 */
.coupon-section {
    margin: 25px 0;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.9), rgba(255, 165, 0, 0.9));
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.4);
    animation: couponGlow 2s ease-in-out infinite;
}

.coupon-congratulations {
    font-size: 22px;
    font-weight: bold;
    color: #8b4513;
    margin-bottom: 15px;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
}

.coupon-code-container { margin: 15px 0; }
.coupon-label { font-size: 16px; color: #8b4513; font-weight: bold; margin-bottom: 8px; }

.coupon-code-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 12px 15px;
    border-radius: 10px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    justify-content: center;
}

.coupon-code {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    letter-spacing: 1px;
    user-select: text;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    flex: 1;
    min-width: 180px;
    text-align: center;
}

.copy-coupon-btn {
    background: linear-gradient(135deg, #52c8dd, #78ccdb);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.copy-coupon-btn:hover { background: linear-gradient(135deg, #69c9da, #8ccdd8); transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); }
.copy-coupon-btn:active { transform: translateY(0); }
.copy-coupon-btn.copied { background: linear-gradient(135deg, #4CAF50, #66BB6A); animation: copySuccess 0.6s ease; }
.coupon-hint { font-size: 14px; color: #8b4513; margin-top: 12px; font-weight: 500; }

/* --- D. 排行榜 (Leaderboard) --- */
.leaderboard-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    max-height: 600px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.leaderboard-container::-webkit-scrollbar { width: 8px; }
.leaderboard-container::-webkit-scrollbar-track { background: transparent; }
.leaderboard-container::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.3); border-radius: 4px; }

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    transition: all 0.3s;
}

.leaderboard-item:hover { background: rgba(255, 255, 255, 0.3); transform: translateX(5px); }
.rank { font-size: 20px; font-weight: bold; width: 30px; }
.rank-1 { color: #ffd700; }
.rank-2 { color: #c0c0c0; }
.rank-3 { color: #cd7f32; }
.player-name { flex: 1; text-align: left; margin: 0 20px; }
.player-score { font-size: 20px; font-weight: bold; color: #ffeb3b; }

/* --- E. 遊戲說明 (How to Play) --- */
.how-to-play-content { width: 650px; max-width: 95%; max-height: 90vh; overflow-y: auto; padding: 30px; }
.how-to-play-container { text-align: left; margin: 20px 0; }

.instruction-section {
    background: rgba(255, 255, 255, 0.15);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.instruction-section h3 { color: white; font-size: 20px; margin-bottom: 15px; text-align: center; }

.item-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    justify-items: center;
}

.item-card {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.item-card:hover { background: rgba(255, 255, 255, 0.3); transform: translateY(-5px); }
.item-card img { width: 60px; height: 60px; object-fit: contain; margin-bottom: 8px; }
.item-card p { color: white; font-size: 16px; font-weight: bold; margin: 0; }

.life-bonus-section { background: rgba(255, 192, 203, 0.2); }
.life-bonus-section p { color: white; font-size: 16px; text-align: center; margin-bottom: 15px; }
.life-bonus-list { display: flex; flex-direction: column; gap: 15px; }

.bonus-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.life-icons { display: flex; gap: 8px; }
.life-icons img { width: 30px; height: 30px; }
.bonus-item p { color: white; font-size: 18px; font-weight: bold; margin: 0; text-align: left; }

/* --- F. 設定畫面 (Settings) --- */
.settings-container { display: flex; flex-direction: column; gap: 25px; margin: 20px 0; }
.setting-item { background: rgba(255, 255, 255, 0.15); padding: 20px; border-radius: 15px; text-align: left; }
.setting-item label { display: block; font-size: 18px; font-weight: bold; margin-bottom: 12px; color: white; }
.setting-note { margin: 8px 0 0 0; font-size: 13px; color: rgba(255, 255, 255, 0.7); }

.volume-control { display: flex; align-items: center; gap: 15px; }
.volume-value { min-width: 60px; text-align: right; font-weight: bold; color: #ffeb3b; font-size: 16px; }

.volume-slider {
    flex: 1; height: 8px; border-radius: 5px;
    background: rgba(255, 255, 255, 0.3);
    outline: none; -webkit-appearance: none; appearance: none; cursor: pointer;
}

.volume-slider::-webkit-slider-thumb, 
.volume-slider::-moz-range-thumb {
    width: 20px; height: 20px; border-radius: 50%;
    background: #ffeb3b; cursor: pointer; border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); transition: all 0.3s;
}

.volume-slider::-webkit-slider-thumb:hover,
.volume-slider::-moz-range-thumb:hover { transform: scale(1.2); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4); }

.test-buttons { display: flex; flex-direction: column; gap: 10px; align-items: center; background: transparent; padding: 0; }
.test-buttons .btn-test { width: 100%; max-width: 250px; }

/* 操作模式按鈕 */
.mode-buttons { display: flex; gap: 10px; margin: 10px 0; flex-wrap: wrap; justify-content: center; }

.mode-btn {
    flex: 1; min-width: 120px; padding: 12px 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white; border-radius: 15px;
    font-size: 14px; font-weight: bold; cursor: pointer; transition: all 0.3s ease;
}

.mode-btn:not(.mode-btn-active):hover { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.5); }

.mode-btn-active {
    background: linear-gradient(135deg, #69c9da 0%, #8ccdd8 100%) !important;
    border-color: #f5576c !important;
    box-shadow: 0 0 15px rgba(245, 87, 108, 0.8), 0 4px 8px rgba(245, 87, 108, 0.4) !important;
    transform: scale(1.05) !important;
}

/* --- G. 操作模式說明彈窗 (Control Modal) --- */
.control-mode-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex; justify-content: center; align-items: center;
    z-index: 10000; animation: fadeIn 0.3s ease;
}

.modal-content {
    background: linear-gradient(135deg, #eb7680 0%, #EA5C67 100%);
    border-radius: 20px; width: 90%; max-width: 500px; max-height: 90vh;
    overflow-y: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

.modal-header { padding: 20px; text-align: center; border-bottom: 2px solid rgba(255, 255, 255, 0.3); }
.modal-header h3 { color: white; font-size: 24px; margin: 0; }
.modal-body { padding: 20px; }
.mode-demo { display: flex; flex-direction: column; gap: 20px; }

.demo-screen {
    background: #1e3c72; border-radius: 15px; overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.demo-game-area {
    height: 250px; position: relative;
    background: linear-gradient(180deg, #0a1929, #1e3c72);
    display: flex; justify-content: center; align-items: center;
}

.demo-player {
    width: 60px; height: 80px; position: absolute; bottom: 10px;
    left: 50%; transform: translateX(-50%);
    background-image: url('../assets/images/player.png');
    background-size: contain; background-repeat: no-repeat; background-position: center;
    animation: float 2s ease-in-out infinite;
}

.demo-gift {
    font-size: 40px; position: absolute; top: 20px;
    left: 50%; transform: translateX(-50%);
    animation: fall 3s linear infinite;
}

.demo-control-area { background: #006036; padding: 15px; display: flex; justify-content: center; align-items: center; }
.demo-control-buttons { display: flex; gap: 60px; align-items: center; }
.demo-btn { position: relative; width: 80px; height: 80px; display: flex; justify-content: center; align-items: center; }
.demo-btn img { width: 100%; height: 100%; object-fit: contain; }

.demo-circle-highlight {
    position: absolute; width: 100%; height: 100%;
    border: 3px solid #ffeb3b; border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

/* 觸控區塊樣式 */
.demo-game-area-fullscreen {
    height: 350px; position: relative;
    background: linear-gradient(180deg, #0a1929, #1e3c72); overflow: hidden;
}

.touch-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.1); display: flex;
}

.touch-left-zone, .touch-right-zone {
    flex: 1; display: flex; justify-content: center; align-items: center;
    position: relative; cursor: pointer;
}
.touch-left-zone { background: rgba(100, 150, 255, 0.15); }
.touch-right-zone { background: rgba(255, 100, 150, 0.15); }
.touch-divider { width: 3px; background: white; box-shadow: 0 0 10px rgba(255, 255, 255, 0.5); }
.zone-label { color: white; font-size: 20px; font-weight: bold; text-align: center; z-index: 2; text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); }

.ripple-effect {
    position: absolute; width: 100px; height: 100px;
    border: 3px solid white; border-radius: 50%;
    animation: ripple 2s ease-out infinite;
}
.touch-left-zone .ripple-effect { left: 30%; }
.touch-right-zone .ripple-effect { right: 30%; }

/* 說明文字 */
.demo-instructions { padding: 15px; background: rgba(255, 255, 255, 0.1); border-radius: 10px; }
.instruction-item { display: flex; align-items: center; gap: 15px; margin: 10px 0; color: white; }
.instruction-arrow { font-size: 32px; font-weight: bold; min-width: 40px; text-align: center; }
.instruction-item p { margin: 0; font-size: 16px; }
.center-instruction { text-align: center; color: white; font-size: 18px; margin: 0; }
.modal-footer { padding: 20px; text-align: center; border-top: 2px solid rgba(255, 255, 255, 0.3); }

.modal-btn {
    background: white; color: #667eea; border: none; border-radius: 25px;
    padding: 12px 40px; font-size: 18px; font-weight: bold;
    cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}
.modal-btn:hover { background: #f0f0f0; transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); }
.modal-btn:active { transform: translateY(0); }

/* =========================================
   6. 通用元件與按鈕 (Components & Buttons)
   ========================================= */

/* 按鈕基礎樣式 */
.btn-primary, .btn-secondary, .btn-settings, .btn-shop, .btn-info, .btn-ranking, .btn-test {
    padding: 12px 30px;
    margin: 10px;
    border: none;
    border-radius: 25px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

/* 各色按鈕變體 */
.btn-primary { background: linear-gradient(135deg, #e76a74 0%, #EA5C67 100%); color: white; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); }

.btn-secondary { background: white; color: #667eea; }
.btn-secondary:hover { background: #f0f0f0; transform: translateY(-2px); }

.btn-settings { background: linear-gradient(135deg, #e76a74 0%, #EA5C67 100%); color: white; }
.btn-settings:hover { transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); }

.btn-shop { background: linear-gradient(135deg, #e76a74 0%, #EA5C67 100%); color: white; }
.btn-shop:hover { transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); }

.btn-info { background: linear-gradient(135deg, #e76a74 0%, #EA5C67 100%); color: white; }
.btn-info:hover { background: linear-gradient(135deg, #e76a74 0%, #EA5C67 100%); transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); }

.btn-ranking { background: linear-gradient(135deg, #e76a74 0%, #EA5C67 100%); color: white; }
.btn-ranking:hover { transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); }

.btn-test { background: rgba(100, 200, 255, 0.8); color: white; padding: 10px 20px; font-size: 16px; margin: 5px; }
.btn-test:hover { background: rgba(100, 200, 255, 1); transform: translateY(-2px); }

/* 自訂提示彈窗 (Alert) */
.custom-alert {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); display: flex;
    justify-content: center; align-items: center; z-index: 9999;
    animation: fadeIn 0.3s ease;
}
.alert-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px 40px; border-radius: 20px; text-align: center; color: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); min-width: 300px; max-width: 90%;
    animation: slideIn 0.3s ease;
}
.alert-icon { font-size: 48px; margin-bottom: 15px; }
.alert-message { font-size: 18px; margin-bottom: 25px; line-height: 1.5; }
.alert-btn {
    background: white; color: #667eea; border: none; border-radius: 25px;
    padding: 12px 40px; font-size: 16px; font-weight: bold; cursor: pointer;
    transition: all 0.3s ease; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}
.alert-btn:hover { background: #f0f0f0; transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); }
.alert-btn:active { transform: translateY(0); }

/* 手機版專用控制按鈕 (隱藏/顯示邏輯在 Media Query) */
#mobileControls {
    display: none; gap: 80px; z-index: 20; align-items: center;
    justify-content: space-between; width: 100%; padding: 20px 30px;
    box-sizing: border-box;
}
.control-btn {
    width: clamp(60px, 15vw, 100px); height: clamp(60px, 15vw, 100px);
    background-size: contain; background-repeat: no-repeat; background-position: center;
    background-color: transparent; border: none; cursor: pointer;
    transition: all 0.2s; box-shadow: none; border-radius: 0px; flex-shrink: 0;
}
.control-btn:active { transform: scale(0.95); opacity: 0.8; }
#leftBtn { background-image: url('../assets/images/left-btn.png'); }
#rightBtn { background-image: url('../assets/images/right-btn.png'); }
.mobile-only { display: none; }

/* =========================================
   7. 動畫定義 (Animations)
   ========================================= */
@keyframes gradientFlow {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}
@keyframes fall {
    to { transform: translateY(100vh); }
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(200px); opacity: 0; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateY(-50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.2); opacity: 0.5; } }
@keyframes ripple { 0% { transform: scale(0.8); opacity: 1; } 100% { transform: scale(2); opacity: 0; } }
@keyframes couponGlow { 0%, 100% { box-shadow: 0 8px 20px rgba(255, 215, 0, 0.4); } 50% { box-shadow: 0 8px 30px rgba(255, 215, 0, 0.7); } }
@keyframes copySuccess { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.snowflake {
    position: fixed; top: -10px; color: white; font-size: 1em;
    animation: fall linear infinite; pointer-events: none; z-index: 1;
}

/* =========================================
   8. 響應式設計 (Responsive / Mobile)
   ========================================= */
@media (max-width: 768px) {
    /* 主結構調整 */
    #bottomColorArea { height: 72px; }
    #controlArea { min-height: 120px; }
    
    /* 顯示手機控制項 */
    .mobile-only { display: flex; }
    #mobileControls { display: flex; padding-bottom: max(0px, env(safe-area-inset-bottom)); }
    
    /* 字體與UI調整 */
    .ui-element { font-size: 16px; padding: 8px 15px; }
    #time { font-size: 36px; }
    #scoreText { font-size: 28px; }
    .life-icon { font-size: 24px; }
    h1 { font-size: 24px; }
    h2 { font-size: 20px; }
    
    /* 彈窗內容調整 */
    #startScreen .screen-content {
        height: 92vh;
        padding: 0.5vh 20px 1vh 20px;
        justify-content: space-between;
    }
    
    #startScreen .main-visual {
        max-width: 240px;
        margin-bottom: 0;
        flex: 0 0 auto;
    }
    
    #startScreen .main-visual img {
        max-height: min(30vh, 300px);
    }
    
    #startScreen .screen-content button {
        max-width: 280px;
        padding: clamp(10px, 1.5vh, 14px) 20px;
        font-size: clamp(14px, 2.5vw, 16px);
        margin: 0;
    }
    
    #startScreen .button-container {
        gap: clamp(8px, 1.2vh, 12px);
        margin-top: 0;
        margin-bottom: 0;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        width: 100%;
    }
    
    .social-section {
        margin-top: 0;
        margin-bottom: 0;
        flex: 0 0 auto;
        gap: clamp(3px, 0.4vh, 6px);
    }
    
    .loading-content { width: 90%; max-width: 350px; }
    
    /* 遊戲說明調整 */
    .how-to-play-content { width: 95%; padding: 20px; }
    .item-list { grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 10px; }
    .item-card img { width: 50px; height: 50px; }
    .item-card p { font-size: 14px; }
    .bonus-item { flex-direction: column; text-align: center; gap: 10px; }
    .bonus-item p { text-align: center; }
    
    /* Modal 調整 */
    .modal-content { width: 95%; max-width: 400px; }
    .demo-game-area { height: 200px; }
    .demo-game-area-fullscreen { height: 280px; }
    .demo-player { width: 50px; height: 65px; }
    .demo-gift { font-size: 35px; }
    .demo-btn { width: 60px; height: 60px; }
    .demo-control-buttons { gap: 40px; }
    .zone-label { font-size: 16px; }
    
    /* 優惠券調整 */
    .coupon-section { padding: 15px; }
    .coupon-congratulations { font-size: 18px; }
    .coupon-code { font-size: 14px; min-width: 140px; }
    .coupon-code-box { flex-direction: column; padding: 10px; }
    .copy-coupon-btn { width: 100%; padding: 10px; }
    .coupon-hint { font-size: 12px; }
}