/* =========================================
   遊戲三：字爬梯樣式（覆蓋全畫面）
   - 全獨立樣式表，供 game3.js 相關功能使用
   ========================================= */

.game3-overlay {
    position: fixed;
    top: 0;
    left: 0;
    margin: 0;
    background: radial-gradient(circle at center, hsl(210, 30%, 25%) 0%, hsl(0, 0%, 10%) 100%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: hsl(40, 50%, 80%);
    font-family: 'Noto Serif TC', serif;
    position: relative;
    /* 確保絕對定位的子元素（如歷程顯示）能正確定位 */

    /* 防止瀏覽器縮放影響版面配置 */
    zoom: 1;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* 使用由 JS 針對特定卡片動態產生的變數，body 本身維持靜態 */
}

/* 顯示／隱藏控制 */
.hidden {
    display: none !important;
}

/* 遊戲頂部資訊列（分數與控制） */
.game3-header {
    padding: 2px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10;
    width: 100%;
    height: 50px;
}



.game3-score-board {
    color: hsl(50, 70%, 60%);
    font-size: 24px;
    font-weight: bold;
    padding-left: 50px;
}


/* 控制按鈕（重來／開新局） */
.game3-controls .nav-btn {
    padding: 0px 10px;
    background: hsl(0, 60%, 25%);
    border: 0.6px solid hsla(40, 100%, 80%, 0.3);
    color: hsl(45, 80%, 70%);
    border-radius: 12px;
    font-size: 20px;
    cursor: pointer;
}

.game3-controls .nav-btn:hover {
    background: hsl(0, 60%, 50%);
    color: hsl(45, 80%, 90%);
}

.game3-controls .nav-btn:disabled {
    background: hsl(0, 0%, 50%);
    color: hsl(45, 0%, 90%);
}

.game3-sub-header {
    display: flex;
    justify-content: center;
    align-items: center;
    /* 垂直居中 */
    background: rgba(0, 0, 0, 0.4);
    z-index: 9;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    height: 40px;
}

.hearts {
    display: flex;
    gap: 2px;
    justify-content: center;
    flex-wrap: wrap;
}

.heart {
    color: #f44336;
    font-size: 32px;
}

.heart.empty {
    opacity: 0.5;
}

/* 遊戲主區域（字行往上移動） */
.game3-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

/* 難度標籤 */
.game3-difficulty-tag {
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 20px;
    color: hsl(45, 30%, 85%);
    border: 0.6px solid hsla(40, 100%, 80%, 0.1);
    z-index: 100;
    cursor: pointer;
    transition: all 0.2s;
}

.game3-difficulty-tag[data-level="小學"] {
    background: linear-gradient(135deg, hsl(100, 40%, 40%) 0%, hsl(120, 40%, 30%) 100%);
}

.game3-difficulty-tag[data-level="中學"] {
    background: linear-gradient(135deg, hsl(210, 40%, 50%) 0%, hsl(230, 40%, 40%) 100%);
}

.game3-difficulty-tag[data-level="高中"] {
    background: linear-gradient(135deg, hsl(0, 50%, 50%) 0%, hsl(0, 50%, 35%) 100%);
}

.game3-difficulty-tag[data-level="大學"] {
    background: linear-gradient(135deg, hsl(290, 50%, 50%) 0%, hsl(270, 50%, 35%) 100%);
}

.game3-difficulty-tag[data-level="研究所"] {
    background: linear-gradient(135deg, hsl(50, 80%, 50%) 0%, hsl(40, 80%, 35%) 100%);
}

.game3-difficulty-tag:hover {
    box-shadow: 0 0px 8px rgba(255, 255, 255, 0.9);
    filter: brightness(1.5);
}

/* 遊戲歷程顯示 (最左側直排) */
.game3-history {
    position: absolute;
    left: 10px;
    top: 18%;
    height: 80%;
    width: 40px;
    background: rgba(0, 0, 0, 0.33);
    padding: 6px;
    border-radius: 12px;
    display: flex;
    /*排列方式*/
    flex-direction: row;
    /*水平排列*/
    justify-content: flex-end;
    /*位置靠向文字的末端*/
    align-items: center;
    /*左右或上下居中排列*/
    flex-wrap: nowrap;
    /*不換行*/
    writing-mode: vertical-lr;
    /*垂直排列*/
    overflow: hidden;
    /*字數過多就不顯示*/
    font-size: 22px;
    line-height: 1.2;
    font-family: 'Noto Serif TC', 'SimSun', serif;
    pointer-events: none;
    z-index: 100;
    gap: 2px;
}

.history-char {
    display: inline-block;
}

.history-char.correct {
    color: hsl(120, 40%, 68%);
    /* 答對：綠色 */
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

.history-char.wrong,
.history-char.wrong-attempt {
    color: hsl(0, 80%, 75%);
    /* 答錯、錯過、或是選錯：紅色 */
    font-weight: bold;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

.history-char.waiting {
    color: rgba(255, 255, 255, 0.9);
    /* 等待中：白色方框 */
}

.history-separator {
    color: rgba(255, 255, 255, 0.5);
    margin: 2px 0;
}

/* 每一行按鍵的容器 */
.ladder-row {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 10px;
    will-change: transform;
}

/* 按鍵樣式（字按鈕） */
.ladder-btn {
    width: 90px;
    height: 90px;
    border-radius: 15%;
    background: hsl(40, 50%, 80%);
    border: none;
    font-size: 60px;
    line-height: 1;
    font-family: 'Noto Serif TC', serif;
    color: #333;
    cursor: pointer;
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    backface-visibility: hidden;
}

.ladder-btn:active {
    transform: scale(0.95);
}

/* 答對的視覺效果 */
.ladder-btn.correct {
    background: hsl(120, 40%, 68%);
    color: white;
    transform: scale(1.1);
}

/* 答錯的視覺效果 */
.ladder-btn.wrong {
    background: hsl(0, 80%, 75%);
    color: white;
    animation: shake 0.5s;
}

/* 錯過的視覺效果 (自動標示正確答案) */
.ladder-btn.missed {
    background: hsl(210, 80%, 68%);
    color: white;
}

/* 已完成行的透明度處理 */
.ladder-row.completed .ladder-btn {
    opacity: 0.5;
}

.ladder-row.completed .ladder-btn.correct,
.ladder-row.completed .ladder-btn.missed,
.ladder-row.completed .ladder-btn.wrong {
    opacity: 1;
}

/* 文字透明度處理 */
.ladder-row.completed .ladder-btn.wrong {
    color: rgba(255, 255, 255, 0.66) !important;
}

.ladder-row.completed .ladder-btn:not(.correct):not(.missed):not(.wrong) {
    color: rgba(24, 23, 0, 0.66) !important;
}

/* .game3-message 相關樣式已移除，改用統一的 GameMessage 元件 */


/* 錯誤搖晃動畫 */
@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    50% {
        transform: translateX(6px);
    }

    75% {
        transform: translateX(-6px);
    }

    100% {
        transform: translateX(0);
    }
}