/* UniversalScoreboard.css - 通用遊戲計分板專屬樣式 */
/* 注意：禁止重新定義 .glass-card, .btn-custom, .form-input 等全域樣式 */

/* ========== 玩家卡片區域 ========== */
.scoreboard-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.player-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.85) 100%);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.player-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

/* 領先者高亮樣式 */
.player-card.leader {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25) 0%, rgba(255, 193, 7, 0.15) 100%);
    border: 2px solid rgba(255, 193, 7, 0.5);
    box-shadow: 0 4px 20px rgba(255, 193, 7, 0.3);
}

.player-card.leader::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ffd700, #ffb300, #ffd700);
}

/* 玩家顏色標記 */
.player-color {
    width: 8px;
    height: 60px;
    border-radius: 4px;
    flex-shrink: 0;
}

/* 玩家資訊 */
.player-info {
    flex: 1;
    min-width: 0;
}

.player-name-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.player-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 6px;
    transition: background-color 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.player-name:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

.player-name-input {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 2px 8px;
    border: 2px solid #667eea;
    border-radius: 6px;
    width: 120px;
    outline: none;
}

/* 皇冠圖示 */
.crown-icon {
    color: #ffd700;
    font-size: 1.2rem;
    animation: crownBounce 1s ease-in-out infinite;
}

@keyframes crownBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* 玩家分數 */
.player-score {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    min-width: 80px;
    text-align: center;
    font-family: 'Roboto Mono', monospace;
}

/* 刪除玩家按鈕 */
.btn-remove-player {
    background: transparent;
    border: none;
    color: #dc3545;
    font-size: 1rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    opacity: 0.6;
}

.btn-remove-player:hover {
    background-color: rgba(220, 53, 69, 0.1);
    opacity: 1;
}

/* ========== 分數控制按鈕（大觸控目標）========== */
.score-controls {
    display: flex;
    gap: 8px;
}

.btn-score {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.btn-score-minus {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(238, 90, 90, 0.3);
}

.btn-score-minus:hover {
    background: linear-gradient(135deg, #ff5252 0%, #e53935 100%);
    transform: scale(1.05);
}

.btn-score-minus:active {
    transform: scale(0.95);
}

.btn-score-plus {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.btn-score-plus:hover {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    transform: scale(1.05);
}

.btn-score-plus:active {
    transform: scale(0.95);
}

/* ========== 新增玩家按鈕 ========== */
.btn-add-player {
    width: 100%;
    padding: 16px;
    border: 2px dashed #667eea;
    border-radius: 16px;
    background: transparent;
    color: #667eea;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-add-player:hover {
    background: rgba(102, 126, 234, 0.1);
    border-style: solid;
}

.btn-add-player:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== 設定區塊 ========== */
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #555;
    font-weight: 500;
}

.settings-label i {
    color: #667eea;
    width: 20px;
}

/* ========== 歷史紀錄 ========== */
.history-container {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
}

.history-container::-webkit-scrollbar {
    width: 6px;
}

.history-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.history-container::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 3px;
}

.history-container::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-time {
    color: #888;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8rem;
    min-width: 50px;
}

.history-player {
    font-weight: 600;
    color: #333;
}

.history-action {
    font-weight: 700;
}

.history-action.positive {
    color: #48bb78;
}

.history-action.negative {
    color: #ee5a5a;
}

.history-score {
    color: #666;
    margin-left: auto;
}

.history-empty {
    text-align: center;
    color: #888;
    padding: 20px;
    font-style: italic;
}

/* ========== 新遊戲按鈕 ========== */
.btn-new-game {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-new-game:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* ========== 快捷鍵說明 ========== */
.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shortcuts-list div {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #555;
    font-size: 0.9rem;
}

.shortcuts-list code {
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.85rem;
    color: #667eea;
}

/* ========== 螢幕常亮開關 ========== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* ========== 分數條圖表 ========== */
.score-bar-container {
    margin-top: 16px;
}

.score-bar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.score-bar-name {
    width: 80px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score-bar-wrapper {
    flex: 1;
    height: 24px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.score-bar-fill {
    height: 100%;
    border-radius: 12px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
}

.score-bar-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ========== RWD 響應式設計 ========== */
@media (max-width: 768px) {
    .player-card {
        padding: 12px;
        gap: 8px;
    }

    .player-name {
        font-size: 1rem;
        max-width: 100px;
    }

    .player-score {
        font-size: 1.6rem;
        min-width: 60px;
    }

    /* 手機上按鈕更大（符合 Fact Check 建議） */
    .btn-score {
        width: 56px;
        height: 56px;
        font-size: 1.3rem;
    }

    .btn-add-player {
        padding: 14px;
    }

    .history-container {
        max-height: 200px;
    }

    .score-bar-name {
        width: 60px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .player-card {
        flex-wrap: wrap;
    }

    .player-info {
        order: 1;
        flex-basis: calc(100% - 60px);
    }

    .player-color {
        height: 40px;
    }

    .score-controls {
        order: 2;
        margin-top: 8px;
    }

    .player-score {
        order: 3;
        margin-left: auto;
    }

    .btn-remove-player {
        order: 4;
        position: absolute;
        top: 8px;
        right: 8px;
    }

    .btn-score {
        width: 52px;
        height: 52px;
        font-size: 1.2rem;
    }
}

/* ========== Toast 提示（補充） ========== */
.scoreboard-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 1000;
    animation: toastFadeIn 0.3s ease;
}

@keyframes toastFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ========== 勝利動畫 ========== */
.victory-effect {
    animation: victoryPulse 0.6s ease;
}

@keyframes victoryPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ========== 目標分數設定 ========== */
.target-score-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.target-score-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.target-score-input-wrapper {
    display: none;
    align-items: center;
    gap: 10px;
    padding-left: 28px;
}

.target-score-input-wrapper.visible {
    display: flex;
}

.target-score-input-wrapper input {
    width: 120px;
}

/* 目標進度條 */
.target-progress-container {
    display: none;
    margin-top: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border-radius: 12px;
}

.target-progress-container.visible {
    display: block;
}

.target-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #555;
}

.target-progress-header i {
    color: #667eea;
    margin-right: 6px;
}

.target-progress-bar {
    height: 10px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    overflow: hidden;
}

.target-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
    transition: width 0.5s ease;
}

.target-progress-fill.complete {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

/* 勝利慶祝效果 */
.winner-celebration {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: celebrationFadeIn 0.5s ease;
}

@keyframes celebrationFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.winner-celebration .trophy {
    font-size: 6rem;
    color: #ffd700;
    animation: trophyBounce 1s ease infinite;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

@keyframes trophyBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-15px) scale(1.1); }
}

.winner-celebration .winner-name {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    margin: 20px 0 10px;
    text-align: center;
}

.winner-celebration .winner-score {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.8);
}

.winner-celebration .continue-btn {
    margin-top: 30px;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.winner-celebration .continue-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* ========== 全螢幕模式 ========== */
/* 右上角全螢幕按鈕 */
.btn-fullscreen-corner {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-fullscreen-corner:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(26, 26, 46, 0.4);
}

.btn-fullscreen-corner:active {
    transform: scale(0.95);
}

/* 全螢幕容器 */
#scoreboardFullscreen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    z-index: 9999;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

#scoreboardFullscreen.active {
    display: flex;
}

/* 全螢幕退出按鈕 */
.fullscreen-exit-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.fullscreen-exit-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
    transform: scale(1.1);
}

/* 全螢幕目標進度 */
.fullscreen-target-progress {
    display: none;
    margin: 0 auto 20px;
    max-width: 500px;
    width: 100%;
    text-align: center;
}

.fullscreen-target-progress.visible {
    display: block;
}

.fullscreen-target-progress .target-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    margin-bottom: 8px;
}

.fullscreen-target-progress .target-label i {
    color: #a78bfa;
    margin-right: 6px;
}

.fullscreen-target-progress .progress-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.fullscreen-target-progress .progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #a78bfa 100%);
    border-radius: 6px;
    transition: width 0.5s ease;
}

/* 全螢幕玩家列表 */
.fullscreen-players {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    justify-content: center;
}

.fullscreen-player-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.fullscreen-player-card.leader {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 193, 7, 0.15) 100%);
    border-color: rgba(255, 193, 7, 0.4);
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.2);
}

.fullscreen-player-color {
    width: 6px;
    height: 50px;
    border-radius: 3px;
    flex-shrink: 0;
}

.fullscreen-player-info {
    flex: 1;
    min-width: 0;
}

.fullscreen-player-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 10px;
}

.fullscreen-player-name .crown-icon {
    color: #ffd700;
    font-size: 1.2rem;
}

.fullscreen-player-score {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    font-family: 'Roboto Mono', monospace;
    min-width: 100px;
    text-align: center;
}

.fullscreen-score-controls {
    display: flex;
    gap: 10px;
}

.fullscreen-score-controls .btn-score {
    width: 70px;
    height: 70px;
    font-size: 2rem;
}

/* 全螢幕控制區 */
.fullscreen-controls-bar {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    padding: 15px;
}

.fullscreen-controls-bar button {
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.fullscreen-controls-bar .btn-new-game-fs {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.fullscreen-controls-bar .btn-new-game-fs:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* 全螢幕 RWD */
@media (max-width: 768px) {
    #scoreboardFullscreen {
        padding: 15px;
    }

    .fullscreen-player-card {
        padding: 15px;
    }

    .fullscreen-player-name {
        font-size: 1.1rem;
    }

    .fullscreen-player-score {
        font-size: 2rem;
        min-width: 80px;
    }

    .fullscreen-score-controls .btn-score {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .fullscreen-controls-bar button {
        padding: 12px 20px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .fullscreen-player-card {
        flex-wrap: wrap;
        padding: 12px;
    }

    .fullscreen-player-info {
        flex-basis: calc(100% - 80px);
    }

    .fullscreen-player-score {
        order: 2;
        font-size: 1.8rem;
        min-width: 70px;
    }

    .fullscreen-score-controls {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }

    .fullscreen-score-controls .btn-score {
        width: 56px;
        height: 56px;
        font-size: 1.3rem;
    }

    .winner-celebration .trophy {
        font-size: 4rem;
    }

    .winner-celebration .winner-name {
        font-size: 1.8rem;
    }

    .winner-celebration .winner-score {
        font-size: 1.2rem;
    }
}
