/* =========================================
   遊戲十二：疏影橫斜樣式
   - 結合遊戲四的詩詞展示與遊戲十一的網格記憶
   ========================================= */

/* ⚠️ 介面「上半部」（overlay 背景、頂列、分數、控制鈕、難度標籤、
   紅心副標、詩詞出處連結）之樣式已抽至 theme_xuanzhi.css 的 .fm-* 共用區塊。
   本檔僅保留 .game12-area 及以下的遊戲區私有樣式。 */

.hidden {
    display: none !important;
}

/* 遊戲主區域 */
.game12-area {
    display: flex;
    flex: 1;
    flex-direction: column;
    position: relative;
    padding: 10px;
    width: 100%;
}

/* 問題展示區 */
.game12-question-area {
    text-align: center;
    width: 100%;
    margin-top: 10px;
    padding: 0px 20px;
    color: var(--fm-ink, #2e241b);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    min-height: 160px;
}

/* 題目展示（宣紙墨字） */
.game12-poem-lines {
    font-size: 50px;
    font-weight: bold;
    line-height: 1.2;
    margin-bottom: 6px;
    letter-spacing: 6px;
    color: var(--fm-ink, #2e241b);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
}

/* 隱藏字元 */
.game12-poem-lines span.hidden-char {
    color: var(--fm-cinnabar-bright, #c94f3d);
    border-radius: 2px;
    padding: 0 2px;
}

/* 正確字元 */
.game12-poem-lines span.correct-char {
    color: var(--fm-celadon, #3a7d5c);
    font-weight: bold;
}

/* 詩詞出處連結：樣式已上移至 theme_xuanzhi.css 的 .fm-poem-info（位於 fm-sub-header 右側）*/

/* 玩家操作的狀態提示 */
.game12-status-msg {
    color: var(--fm-gold, #8a6a1e);
    font-size: 30px;
    font-weight: bold;
    margin-top: 10px;
    margin-bottom: 10px;
    text-align: center;
    min-height: 30px;
}

/* 答案區 */
.game12-answer-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 20px;
    /* ⚠️ 水平置中保底：見 game1 同款修正說明 */
    align-self: center;
}

/* ⚠️ 三層同心圓結構（同 game1）：
   ① 最外圈：紅色 SVG timer path（10px stroke）
   ② 5px 間隔（由本層 padding 提供）
   ③ 中間圈：3px 邊框 + 徑向漸層底 + border-radius 20px（.game12-grid-inner-ring）
   ④ 20px 間隔（由中間圈 padding 提供）
   ⑤ 內圈：翻牌字塊（.game12-answer-grid） */
.game12-grid-container {
    position: relative;
    display: inline-block;
    padding: 15px;
    background: transparent;
    border-radius: 0;
}

.game12-grid-inner-ring {
    background: radial-gradient(hsla(0, 0%, 100%, 0.0) 60%, rgba(0, 0, 0, 0.1)) 100%;
    border: 3px solid var(--fm-border, #d8c193);
    border-radius: 20px;
    padding: 20px;
}

/* 計時器外環／計時框：主要樣式已移至 theme_xuanzhi.css 的 .fm-timer-ring / .fm-timer-path
   （紅→黃即時色由 game12.js updateTimerRing 逐格插值）。此處僅保留 game12 專屬的
   疊層順序與隱藏切換。*/
#game12-timer-ring {
    z-index: 5;
}

#game12-timer-ring.hidden {
    display: none !important;
}

.game12-answer-grid {
    display: grid;
    gap: 6px;
    /* Match Game 11 */
    /* ⚠️ 邊距改由 .game12-grid-inner-ring 統一提供 20px */
    padding: 0;
    justify-content: center;
    justify-items: center;
    align-items: center;
}

/* ⚠️ 字塊出場動畫：中心點整體 XY 放大（scale 0→1），每片 0.5s；
   延遲由 JS 依「所有字塊啟動時機壓進 0~0.5 秒」規則設定（同 game1/game2/game4）。
   作用於 .game12-tile（外層），與翻牌動畫（.game12-tile-inner 的 rotateY）不同元素，互不衝突。 */
.game12-tile.game12-tile-appear {
    transform-origin: center center;
    animation: game12-tile-grow 0.5s ease-out both;
}

@keyframes game12-tile-grow {
    from {
        filter: brightness(0.66);
        transform: scale(0);
    }

    to {
        filter: brightness(1);
        transform: scale(1);
    }
}

/* 翻轉字塊樣式 (完全依照 Game 11) */
/* 單張翻牌字塊容器：設定 3D 透視（perspective），實際翻轉效果在 .game12-tile-inner */
.game12-tile {
    width: 80px;
    height: 80px;
    perspective: 1000px;
    cursor: pointer;
    position: relative;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.game12-tile-inner {
    position: absolute;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.25s;
    transform-style: preserve-3d;
}

.game12-tile.flipped .game12-tile-inner {
    transform: rotateY(180deg);
}

.game12-tile-front,
.game12-tile-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 56px;
    /* Match Game 11 */
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* 正面 (關閉時，彩色 HSL，依照 Game 11) */
.game12-tile-front {
    border: 4px solid hsl(40, 40%, 33%);
}

.game12-answer-grid.is-player-phase .game12-tile-front {
    border: 2px solid hsl(51, 100%, 90%);
}

/* 背面 (打開時，宣紙色) */
.game12-tile-back {
    background: #fdfaf0;
    color: #111;
    transform: rotateY(180deg);
    border: 2px solid #bd9b70;
}

/* 已答對鎖定的字塊：不可再點擊 */
.game12-tile.disabled {
    cursor: default;
    pointer-events: none;
}

.game12-tile.correct .game12-tile-back {
    background: hsl(145, 60%, 50%) !important;
    /* 更鮮明的綠色 */
    color: white !important;
    border-color: #27ae60;
}

.game12-tile.wrong-reveal .game12-tile-back {
    background: hsl(6, 63%, 46%) !important;
    /* 暗紅色 */
    color: white !important;
    border-color: hsl(5, 63%, 35%);
}

.game12-tile.error .game12-tile-inner {
    animation: game12-shake 0.4s;
}

@keyframes game12-shake {

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

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

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

/* .game12-message Styles Removed - Using Unified GameMessage Component */

/* 飛行星星 .flying-star：樣式已移至 theme_xuanzhi.css（結算共用樣式）。*/