/* ========================================================================
   ✨ 遊戲介面組件 (遊戲容器、資訊列、畫布、控制按鈕等)
   ======================================================================== */

/* --- 遊戲主容器 --- */
#game-container {
    width: 100%;
    max-width: 800px;
    /* 在大螢幕上的最大寬度 */
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    /* 為了定位虛擬按鈕 */
}

/* --- 頂部資訊列 --- */
#info-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-lg);
    box-sizing: border-box;
    font-size: var(--font-size-lg);
    font-weight: bold;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    position: relative;
    padding-right: 60px;
    gap: var(--spacing-sm);
    overflow: hidden;
    /* 確保進度條不溢出圓角 */
}

/* ✨ 新增：Fever Time 倒數計時條 */
#fever-timer-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    /* 初始寬度為 0 */
    background-color: rgba(255, 215, 0, 0.6);
    /* 金黃色半透明 */
    z-index: 0;
    /* 在文字下方 */
    transition: width 0.1s linear;
    /* 平滑過渡 */
}

/* 確保資訊列中的文字在進度條上方 */
#info-bar>span {
    position: relative;
    z-index: 1;
}

/* 確保靜音按鈕在最上層且維持絕對定位 */
#mute-button {
    z-index: 2;
}

@media (max-width: 767px) {
    #info-bar {
        padding: var(--spacing-xs) var(--spacing-md);
        font-size: var(--font-size-base);
        padding-right: 50px;
        flex-wrap: wrap;
    }

    #info-bar .info-group {
        font-size: var(--font-size-sm);
    }
}

/* --- 遊戲畫布 --- */
#game-canvas {
    width: 100%;
    height: auto;
    background-color: rgba(0, 0, 0, 0.6);
    /* 60% 透明度的黑色遮罩 */
    border-radius: 0 0 10px 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

/* --- ✨ 靜音按鈕樣式 --- */
#mute-button {
    background: none;
    border: none;
    font-size: 1.5em;
    /* 放大圖示 */
    cursor: pointer;
    padding: 0 5px;
    color: white;
    /* 放在最右邊 */
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

#mute-button.muted {
    opacity: 0.5;
    /* 靜音時變暗 */
}

/* --- ✨ 分數變化顯示 --- */
#score-change {
    position: absolute;
    left: calc(100% + 5px);
    /* Position it 5px to the right of the parent's (score-info) right edge */
    top: 0;
    /* Align with the top of score-info */
    font-size: 1.2em;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.5s ease-out;
    text-shadow: none !important;
    white-space: nowrap;
    /* Prevent text from wrapping */
}

#score-change.show {
    opacity: 1;
}

#score-change.positive {
    color: var(--color-accent-green);
}

#score-change.negative {
    color: var(--color-accent-red);
}

/* --- ✨ 設定按鈕樣式 --- */
.settings-button {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5em;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background-color 0.2s;
    padding: 0;
    /* Reset padding */
}

.settings-button:hover {
    transform: rotate(90deg);
    background-color: rgba(0, 0, 0, 0.6);
}

/* Settings specific overrides */
#settings-modal {
    z-index: 1100;
    /* Ensure it's above other modals if needed, or use var(--z-index-modal-high) */
}

#settings-modal .modal-content {
    max-width: 300px;
    /* Keep it small as per original design */
    padding: 25px;
}

.settings-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--color-primary-dark);
    font-size: 1.5em;
}

.settings-option-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: none;
    border-radius: 10px;
    background-color: var(--color-primary);
    color: white;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.1s, background-color 0.2s;
    box-shadow: 0 4px 0 var(--color-primary-dark);
}

.settings-option-btn:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* 關閉/返回按鈕的樣式已移至 modals.css 統一管理 */

#user-id-display {
    font-family: monospace;
    font-size: var(--font-size-md);
    color: var(--color-accent-yellow);
    margin: 0 var(--spacing-xs);
    text-shadow: none !important;
}

#copy-id-button {
    font-size: var(--font-size-xs);
    padding: 4px 8px;
    margin: 0;
    margin-left: var(--spacing-xs);
    background-color: var(--color-accent-cyan);
}



/* ========================================================================
   ✨ 行動裝置控制按鈕
   ======================================================================== */
#mobile-controls {
    display: flex;
    justify-content: space-between;
    width: 100%;
    position: absolute;
    bottom: calc(20px + env(safe-area-inset-bottom));
    /* ✨ Fix: Move up to avoid address bar */
    left: 0;
    padding: 0 20px;
    box-sizing: border-box;
    z-index: 20;
    pointer-events: none;
    gap: var(--spacing-md);
}

.control-button {
    width: 90px;
    height: 90px;
    border-radius: var(--border-radius-full);
    border: 3px solid rgba(255, 255, 255, 0.8);
    background-color: rgba(255, 255, 255, 0.3);
    color: var(--color-text-primary);
    font-size: 2.5em;
    font-weight: bold;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto;
    transition: all var(--transition-fast) ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-button:active {
    transform: scale(0.9);
    background-color: rgba(255, 255, 255, 0.5);
}

/* 響應式設計：當螢幕寬度大於 768px (平板/電腦) */
@media (min-width: 768px) {
    #mobile-controls {
        display: none;
    }
}

/* ✨ Fix: 針對 iPad/平板等大螢幕觸控裝置，強制顯示虛擬按鈕 */
@media (min-width: 768px) and (pointer: coarse) {
    #mobile-controls {
        display: flex;
        justify-content: space-between;
        width: 100%;
    }
}

/* 小螢幕優化 */
@media (max-width: 480px) {
    .control-button {
        width: 60px;
        height: 60px;
        font-size: 1.8em;
    }

    #mobile-controls {
        bottom: var(--spacing-md);
        padding: 0 var(--spacing-md);
    }
}