/* ==========================
   ミニゲーム
========================== */

.game-loading{
    position:fixed;
    inset:0;
    z-index:2000;
    display:none;
    align-items:center;
    justify-content:center;
    flex-direction:column;
    gap:12px;
    background:rgba(255,255,255,.82);
}

.game-loading.visible{display:flex}

.game-loading-spinner{
    width:34px;
    height:34px;
    border:4px solid #ffe1ed;
    border-top-color:#ff709f;
    border-radius:50%;
    animation:game-loading-spin .8s linear infinite;
}

.game-loading-text{
    color:#777;
    font-size:13px;
    font-weight:bold;
}

@keyframes game-loading-spin{
    to{transform:rotate(360deg)}
}

.game-ranking-button.primary{
    background:#fff0f6;
    color:#ff5f96;
}

.game-ranking-button.secondary{
    background:#f5f5f5;
    color:#666;
}

/* ==========================
   画面遷移
========================== */

.game-back-button{
    appearance:none;
    cursor:pointer;
    font:inherit;
    text-align:left;
    border:0;
    background:transparent;
}

.game-transition-modal{
    position:fixed;
    inset:0;
    z-index:2100;
    display:none;
    align-items:center;
    justify-content:center;
    padding:20px;
    box-sizing:border-box;
    background:rgba(0,0,0,.32);
}

.game-transition-modal.visible{
    display:flex;
}

.game-transition-dialog{
    width:100%;
    max-width:430px;
    padding:20px;
    box-sizing:border-box;
    border-radius:18px;
    background:#fff;
    box-shadow:0 8px 30px rgba(0,0,0,.18);
}

.game-transition-title{
    color:#333;
    font-size:17px;
    font-weight:bold;
}

.game-transition-description{
    margin-top:6px;
    color:#888;
    font-size:12px;
    line-height:1.6;
}

.game-transition-actions{
    display:flex;
    flex-direction:column;
    gap:10px;
    margin-top:16px;
}

.game-transition-button{
    display:flex;
    flex-direction:column;
    gap:4px;
    width:100%;
    padding:13px 14px;
    box-sizing:border-box;
    border:0;
    border-radius:12px;
    font:inherit;
    text-decoration:none;
    text-align:left;
    cursor:pointer;
}

.game-transition-button strong{
    font-size:13px;
}

.game-transition-button span{
    font-size:10px;
    line-height:1.5;
}

.game-transition-button.primary{
    background:#fff0f6;
    color:#ff5f96;
}

.game-transition-button.secondary{
    background:#f7f7f7;
    color:#555;
}

.game-transition-button:disabled{
    cursor:default;
    opacity:.55;
}

.game-transition-cancel{
    display:block;
    width:100%;
    margin-top:10px;
    padding:9px;
    border:0;
    background:transparent;
    color:#999;
    font:inherit;
    font-size:12px;
    cursor:pointer;
}

/* ==========================
   問題画面
========================== */

.game-streak{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px;
    margin-bottom:14px;
}

.streak-item{
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    min-height:80px;
    padding:10px;
    box-sizing:border-box;
    border-radius:16px;
    background:#fff;
    box-shadow:0 2px 6px rgba(0,0,0,.08);
}

.streak-label{
    color:#777;
    font-size:11px;
    font-weight:bold;
    text-align:center;
}

.streak-item strong{
    margin-top:3px;
    color:#ff5f96;
    font-size:25px;
    line-height:1.2;
}

.game-card{
    width:100%;
    box-sizing:border-box;
    padding:20px 16px;
    border-radius:18px;
    background:#fff;
    box-shadow:0 3px 8px rgba(0,0,0,.12);
}

.game-title{
    color:#777;
    font-size:13px;
    font-weight:bold;
}

.game-question{
    margin:18px 0;
    color:#333;
    font-size:17px;
    font-weight:bold;
    line-height:1.7;
}

.choice-list,
.tf-list{
    display:flex;
    flex-direction:column;
    gap:10px;
}

.choice-button,
.char-button{
    min-height:46px;
    padding:10px 12px;
    border:1px solid #eee;
    border-radius:12px;
    background:#fafafa;
    color:#333;
    font:inherit;
    cursor:pointer;
}

.choice-button:hover,
.char-button:hover{
    background:#fff5f8;
}

.choice-button:disabled,
.char-button:disabled{
    cursor:default;
    opacity:.55;
}

.anagram-chars{
    display:flex;
    flex-wrap:wrap;
    justify-content:center;
    gap:8px;
    margin-bottom:14px;
}

.char-button{
    min-width:44px;
    font-size:16px;
    font-weight:bold;
}

.anagram-answer{
    min-height:48px;
    padding:12px;
    box-sizing:border-box;
    border-radius:12px;
    background:#f8f8f8;
    color:#555;
    text-align:center;
    line-height:24px;
}

.anagram-controls{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
    margin-top:10px;
}

.anagram-control{
    min-height:46px;
    padding:10px 12px;
    border:0;
    border-radius:12px;
    font:inherit;
    font-size:13px;
    font-weight:bold;
    cursor:pointer;
}

.anagram-control.secondary{
    background:#f4f4f4;
    color:#666;
}

.anagram-control.primary{
    background:#fff0f6;
    color:#ff5f96;
}

.anagram-control:disabled{
    cursor:default;
    opacity:.55;
}

.game-result{
    min-height:30px;
    margin-top:16px;
    font-size:18px;
    font-weight:bold;
    text-align:center;
}

.game-result.correct{color:#2b9a62}

.game-result.incorrect{color:#d45d6f}

.game-explanation{
    display:none;
    margin-top:10px;
    padding:12px;
    border-radius:12px;
    background:#fff8fb;
    color:#555;
    font-size:13px;
    line-height:1.7;
}

.game-explanation.visible{
    display:block;
}

.game-explanation-link[hidden]{
    display:none;
}

.game-explanation-link{
    display:inline-flex;
    align-items:center;
    margin-top:8px;
    padding:8px 12px;
    border-radius:10px;
    background:#fff0f6;
    color:#ff5f96;
    font-weight:bold;
    text-decoration:none;
}

.game-explanation-link:hover{
    text-decoration:underline;
}

.next-button{
    display:none;
    align-items:center;
    justify-content:center;
    min-height:46px;
    margin-top:10px;
    border-radius:12px;
    background:#fff0f6;
    color:#ff5f96;
    font-weight:bold;
    text-decoration:none;
}

.next-button.visible{display:flex}

@media (min-width:601px){
.page-scroll .container{
        width:100%;
        max-width:none;
        margin:0;
        padding:20px 30px 40px;
    }
.game-top-intro,
    .game-type-list,
    .game-select-intro,
    .difficulty-select-list,
    .game-streak,
    .game-card{
        width:100%;
        max-width:none;
    }
}

@media(max-width:600px){
.game-streak{
        gap:8px;
    }
.streak-item{
        min-height:76px;
        padding:8px 6px;
    }
.streak-label{
        font-size:10px;
    }
.streak-item strong{
        font-size:23px;
    }
}

/* ==========================
   アナグラム ヒント・複数曲
========================== */

.anagram-item + .anagram-item{
    margin-top:18px;
    padding-top:18px;
    border-top:1px solid #eee;
}

.anagram-item-title{
    margin-bottom:10px;
    color:#7659b8;
    font-size:13px;
    font-weight:bold;
}

.anagram-item-controls{
    grid-template-columns:1fr 1fr;
}

.anagram-item-controls:has(> :only-child){
    grid-template-columns:1fr;
}

.anagram-hints{
    display:flex;
    flex-wrap:wrap;
    gap:7px;
    margin-top:10px;
}

.anagram-hint-button{
    min-height:34px;
    padding:7px 10px;
    border:1px solid #eadde4;
    border-radius:999px;
    background:#fff;
    color:#9a6380;
    font:inherit;
    font-size:10px;
    font-weight:bold;
    cursor:pointer;
}

.anagram-hint-button:disabled{
    cursor:default;
    opacity:.55;
}

.anagram-hint-result{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    min-height:18px;
    margin-top:8px;
}

.anagram-hint-result span{
    padding:4px 7px;
    border-radius:8px;
    background:#fff8fb;
    color:#777;
    font-size:10px;
}

.anagram-multi-actions{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    margin-top:12px;
}

.anagram-reveal-button{
    border-color:#ead6d6;
    color:#a85d5d;
    background:#fffafa;
}

.anagram-hint-modal,
.anagram-reveal-modal{
    position:fixed;
    inset:0;
    z-index:2300;
    display:none;
    align-items:center;
    justify-content:center;
    padding:20px;
    box-sizing:border-box;
    background:rgba(0,0,0,.32);
}

.anagram-hint-modal.visible,
.anagram-reveal-modal.visible{
    display:flex;
}

.anagram-hint-dialog,
.anagram-reveal-dialog{
    width:100%;
    max-width:430px;
    max-height:80vh;
    overflow:auto;
    padding:20px;
    box-sizing:border-box;
    border-radius:18px;
    background:#fff;
    box-shadow:0 8px 30px rgba(0,0,0,.18);
}

.anagram-hint-heading{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    color:#444;
    font-size:16px;
}

.anagram-hint-close{
    width:32px;
    height:32px;
    border:0;
    border-radius:50%;
    background:#f7f1f4;
    color:#666;
    font-size:22px;
    cursor:pointer;
}

.anagram-hint-batch{
    margin-top:14px;
    padding:12px;
    border-radius:12px;
    background:#fff8fb;
}

.anagram-hint-batch-title{
    color:#7659b8;
    font-size:12px;
    font-weight:bold;
}

.anagram-hint-entry{
    display:flex;
    gap:8px;
    margin-top:7px;
    color:#666;
    font-size:11px;
    line-height:1.5;
}

.anagram-hint-entry strong{
    flex:none;
    color:#7659b8;
}

.anagram-hint-empty{
    color:#999;
    font-size:12px;
    text-align:center;
}

.anagram-reveal-dialog > strong{
    display:block;
    color:#8f5555;
    font-size:16px;
}

.anagram-reveal-dialog > p{
    margin:10px 0 0;
    color:#666;
    font-size:12px;
    line-height:1.7;
}

.anagram-reveal-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
    margin-top:16px;
}

.anagram-reveal-actions button{
    min-height:44px;
    border-radius:11px;
    font:inherit;
    font-size:12px;
    font-weight:bold;
    cursor:pointer;
}

.anagram-reveal-cancel{
    border:1px solid #eee;
    background:#f7f7f7;
    color:#666;
}

.anagram-reveal-confirm{
    border:0;
    background:#f5e5e5;
    color:#9b4d4d;
}

.anagram-multi-pool{
    padding:14px;
    border:1px solid #eadde4;
    border-radius:14px;
    background:#fffafd;
}

.anagram-multi-pool .anagram-chars{
    margin-top:10px;
}

.anagram-multi-pool .char-button.char-used{
    background:#f3f3f3;
    border-color:#e1e1e1;
    color:#c8c8c8;
    cursor:default;
    opacity:1;
    text-decoration:none;
}

.anagram-multi-pool .char-button.char-used:hover{
    background:#f3f3f3;
}

.anagram-multi-answers{
    margin-top:16px;
}

.anagram-multi-answer-item.completed .anagram-answer-select strong{
    color:#2b9a62;
}

.anagram-item-result{
    min-height:18px;
    margin-top:8px;
    font-size:11px;
    font-weight:bold;
    text-align:center;
}

.anagram-item-result.correct{
    color:#2b9a62;
}

.anagram-item-result.incorrect{
    color:#d45d6f;
}

.anagram-answer-select{
    width:100%;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:9px 10px;
    border:0;
    background:transparent;
    color:#555;
    font:inherit;
    text-align:left;
    cursor:pointer;
}

.anagram-answer-select span{
    flex:none;
    color:#7659b8;
    font-size:12px;
    font-weight:bold;
}

.anagram-answer-select strong{
    flex:1;
    color:#555;
    font-size:13px;
    font-weight:bold;
    text-align:right;
    word-break:break-all;
}

.anagram-multi-guide{
    margin:12px 0 0;
    color:#888;
    font-size:11px;
    text-align:center;
}

.anagram-multi-answer-item .anagram-hint-result div{
    padding:4px 7px;
    border-radius:8px;
    background:#fff8fb;
    color:#777;
    font-size:10px;
}

/* ==========================
   鬼モード 回答フロー
========================== */

.anagram-item.answer-completed-summary{
    min-height: 0;
    padding: 10px 12px;
}

.anagram-item.answer-completed-summary [data-answer-select],
.anagram-item.answer-completed-summary .anagram-item-controls{
    display: none;
}

.anagram-item.answer-completed-summary::after{
    content: "✓ 回答済み";
    display: block;
    font-weight: 700;
    text-align: left;
}

.anagram-final-result{
    margin-top: 16px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color, #ddd);
    background: var(--card-background, #fff);
}

.anagram-final-result-title{
    font-weight: 700;
    margin-bottom: 10px;
}

.anagram-final-result-list{
    display: grid;
    gap: 8px;
}

.anagram-final-result-item{
    display: grid;
    grid-template-columns: 48px 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 9px 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.04);
}

.anagram-final-result-label,
.anagram-final-result-status{
    font-size: 0.85em;
}

.anagram-final-result-status{
    font-weight: 700;
}

.anagram-miss-modal{
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.45);
}

.anagram-miss-modal.visible{
    display: flex;
}

.anagram-miss-dialog{
    width: min(100%, 440px);
    padding: 22px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.anagram-miss-dialog > strong{
    display: block;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.anagram-miss-actions{
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.anagram-miss-actions button{
    min-height: 44px;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
}

.anagram-miss-continue{
    background: #eee;
}

.anagram-miss-next{
    background: #222;
    color: #fff;
}

@media (max-width: 600px){
.anagram-final-result-item{
        grid-template-columns: 42px 1fr;
    }
.anagram-final-result-status{
        grid-column: 2;
    }
}

/* 新しい問題への遷移中は現在の問題を描画したままにしない */
body.game-navigating .background{
    visibility: hidden;
}

/* ==========================
     刷新スタイル（Issue #288 A案）
     スコープは .game-play-container 配下に限定する
========================== */

.game-play-container{
    width:100%;
    max-width:760px;
    margin:0;
    padding:18px 14px 10px;
    box-sizing:border-box;
}

.game-band-heading h2{
    display:flex;
    align-items:center;
    gap:9px;
    margin:0 0 12px;
    color:var(--theme-heading, #8f0f31);
    font-size:20px;
    font-weight:bold;
    line-height:1.4;
}

.game-band-heading h2::before{
    content:"";
    flex:0 0 auto;
    width:5px;
    height:23px;
    border-radius:99px;
    background:linear-gradient(180deg, var(--theme-btn-from, #fb4d6d), var(--theme-primary, #e11d48));
}

/* 連続正解数・自己最高記録の2カード */
.game-play-container .game-streak{
    display:flex;
    gap:12px;
    margin:0 0 20px;
    padding:0;
    background:none;
    box-shadow:none;
}

.game-play-container .streak-item{
    flex:1;
    display:flex;
    flex-direction:column;
    gap:4px;
    padding:14px 16px;
    border:1px solid var(--theme-border-soft, #f6e3e6);
    border-radius:16px;
    background:#fff;
    box-shadow:0 2px 10px rgba(190, 18, 60, .05);
}

.game-play-container .streak-label{
    color:var(--theme-text-muted, #7a5c63);
    font-size:12px;
}

.game-play-container .streak-item strong{
    color:var(--theme-brand, #be123c);
    font-size:30px;
    line-height:1.1;
}

/* 問題カード */
.game-play-container .game-card{
    padding:20px 18px;
    border:1px solid var(--theme-border-soft, #f6e3e6);
    border-radius:18px;
    background:#fff;
    box-shadow:0 2px 10px rgba(190, 18, 60, .05);
}

.game-play-container .game-title{
    color:var(--theme-brand, #be123c);
    font-size:13px;
    font-weight:bold;
    letter-spacing:.04em;
}

.game-play-container .game-question{
    margin-top:10px;
    color:var(--theme-text, #3d2c2e);
    font-size:19px;
    font-weight:bold;
    line-height:1.7;
}

/* 選択肢（3択） */
.game-play-container .choice-list{
    display:flex;
    flex-direction:column;
    gap:10px;
    margin-top:18px;
}

.game-play-container .choice-button{
    position:relative;
    width:100%;
    min-height:56px;
    padding:14px 16px 14px 48px;
    border:1px solid var(--theme-border-soft, #f6e3e6);
    border-radius:14px;
    background:#fff;
    color:var(--theme-text, #3d2c2e);
    font-size:16px;
    font-weight:bold;
    text-align:left;
    box-shadow:0 2px 8px rgba(190, 18, 60, .04);
    cursor:pointer;
    -webkit-tap-highlight-color:transparent;
}

.game-play-container .choice-button::before{
    content:"";
    position:absolute;
    top:50%;
    left:16px;
    width:18px;
    height:18px;
    border:2px solid var(--theme-border, #f3c2cd);
    border-radius:50%;
    transform:translateY(-50%);
    box-sizing:border-box;
}

.game-play-container .choice-button:active{transform:scale(.99);}

.game-play-container .choice-button:disabled{
    cursor:default;
    opacity:.75;
}

/* 選択肢（○×） */
.game-play-container .tf-list{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:12px;
    margin-top:18px;
}

.game-play-container .tf-list .choice-button{
    padding:18px 12px;
    font-size:17px;
    text-align:center;
}

.game-play-container .tf-list .choice-button::before{display:none;}

/* アナグラム */
.game-play-container .anagram-chars{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
}

.game-play-container .char-button{
    min-width:44px;
    height:48px;
    padding:0 10px;
    border:1px solid var(--theme-border-soft, #f6e3e6);
    border-radius:12px;
    background:#fff;
    color:var(--theme-text, #3d2c2e);
    font-size:18px;
    font-weight:bold;
    box-shadow:0 2px 8px rgba(190, 18, 60, .04);
    cursor:pointer;
}

.game-play-container .char-button.char-used{
    background:var(--theme-blush, #fff1f2);
    color:var(--theme-text-muted, #7a5c63);
}

.game-play-container .anagram-hint-button{
    padding:8px 14px;
    border:1px solid var(--theme-border, #f3c2cd);
    border-radius:999px;
    background:#fff;
    color:var(--theme-brand, #be123c);
    font-size:13px;
    font-weight:bold;
    cursor:pointer;
}

.game-play-container .anagram-control{
    min-height:44px;
    padding:10px 18px;
    border-radius:999px;
    font-size:14px;
    font-weight:bold;
    cursor:pointer;
}

.game-play-container .anagram-control.primary{
    border:0;
    background:linear-gradient(135deg, var(--theme-btn-from, #fb4d6d), var(--theme-primary, #e11d48));
    color:#fff;
}

.game-play-container .anagram-control.secondary{
    border:1px solid var(--theme-border, #f3c2cd);
    background:#fff;
    color:var(--theme-text-sub, #57444a);
}

/* 結果・解説・次の問題 */
.game-play-container .game-result{
    font-size:21px;
    font-weight:bold;
    text-align:center;
}

.game-play-container .game-explanation{
    border-radius:12px;
    background:var(--theme-blush, #fff1f2);
    color:var(--theme-text-sub, #57444a);
    font-size:14.5px;
    line-height:1.7;
}

.game-play-container .next-button{
    border-radius:999px;
    background:linear-gradient(135deg, var(--theme-btn-from, #fb4d6d), var(--theme-primary, #e11d48));
    color:#fff;
    font-weight:bold;
    text-decoration:none;
}

/* 引き継ぎモーダル・ローディング（.page-scroll の外にある要素） */
.game-transition-dialog{border-radius:20px;}
.game-loading-spinner{border-top-color:var(--theme-primary, #e11d48);}

@media(min-width:768px){
    .game-play-container{padding:22px 22px 12px;}
    .game-band-heading h2{font-size:22px;}
    .game-play-container .game-question{font-size:20px;}
}
