#game-container {
    max-width: 500px;
    /* PC閲覧時の広がりすぎ防止 */
    margin: auto;
    padding: 20px;
    color: var(--text-main);
}



.make10-list {
    list-style: none;
    display: inline-block;
    margin: auto;
    padding: 0px;
    font-size: 25px;
    font-weight: 600;
}

/* --- 1. 情報表示（タイマー・カウント・スコア） --- */
.info {
    font-size: 20px;
    color: var(--text-sub);
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: bold;
}

/* --- 2. 不正解時の演出（解答文字） --- */
.text-error {
    color: #ff4444 !important;
    /* 文字を赤くする */
    display: inline-block;
    /* transform（揺れ）を有効にするために必要 */
    animation: shake 0.3s ease-in-out;
}

/* 文字が左右にガタガタ揺れる動き */
@keyframes shake {

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

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

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

/* --- 3. 不正解時の演出（画面フラッシュ） --- */
/* JSでゲームコンテナ等にこのクラスを一時的に付与して使用 */
.flash-error {
    animation: flash-red 0.3s ease-out;
}

/* 画面を一瞬赤暗くして元に戻す */
@keyframes flash-red {
    0% {
        background-color: rgba(100, 0, 0, 0.5);
    }

    100% {
        background-color: rgba(0, 0, 0, 0);
    }
}

/* 最低限のスタイル例 */
#answer-display {
    font-size: 2rem;
    letter-spacing: 0.2ch;
}

#answer-display .digit {
    display: inline-block;
    min-width: 1ch;
    text-align: center;
    color: #222;
    transition: color 0.12s, transform 0.12s;
}

#answer-display .digit.correct {
    color: #4caf50;
}

#answer-display .digit.wrong {
    color: #e53935;
    transform: translateY(-2px);
    font-weight: bold;
}

#answer-display.text-error {
    color: #e53935;
}

#timer,
.clear-count {
    color: var(--accent-danger);
    font-size: 28px;
}

#score-display,
#remain-count {
    color: var(--accent-info);
    font-size: 28px;
}

/* 問題・回答エリア */
#question {
    font-size: 70px;
    /* 10問アタック等の長文字考慮で少し調整 */
    font-weight: bold;
    color: var(--text-main);
    margin: 15px 0;
    min-height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#question-area {
    background: var(--bg-card);
    border: 3px solid var(--border-soft);
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--shadow-card);
    font-size: 3rem;
    text-align: center;
    padding: 20px;
    border-radius: 15px;
    border: 4px solid #ffeb3b;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#answer-display {
    font-size: 58px;
    color: var(--accent-main);
    height: 75px;
    line-height: 75px;
    border-bottom: 4px solid var(--border-light);
    margin: 0 20px;
    box-sizing: border-box;
    overflow: hidden;
    width: 100px;
    display: inline-block;
}

#target-num {
    font-size: 58px;
    color: var(--accent-main);
    height: 75px;
    line-height: 75px;
    margin: 0 20px;
    box-sizing: border-box;
    overflow: hidden;
    display: inline-block;
}

/* キーパッド */
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 30px;
}

.key {
    background: var(--bg-card);
    border: 3px solid var(--accent-main);
    border-radius: 15px;
    font-size: 30px;
    font-weight: bold;
    padding: 15px 0;
    cursor: pointer;
    touch-action: manipulation;
    transition: 0.1s;
    color: var(--text-main);
}

.key:active {
    background: var(--accent-main);
    color: #fff;
    transform: scale(0.95);
}

/* 特殊キーの制御 */
.key-0,
.key-zero {
    grid-column: span 2;
}

/* 統一のため1枠に */
.key-reset,
.key-finish {

    background: var(--accent-danger);
    border-color: #cc0000;
    color: #fff;
    font-size: 18px;
}

/* メッセージアニメーション */
#start-msg {
    color: var(--accent-danger);
    font-weight: bold;
    animation: blink 1s infinite;
    font-size: 18px;
    height: 24px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* 履歴セクション */





/* ドリル用プログレスバー */
#progress-bar {
    width: 100%;
    height: 10px;
    background: var(--border-soft);
    border-radius: 5px;
    margin-bottom: 20px;
    overflow: hidden;
}

#progress-fill {
    height: 100%;
    background: var(--accent-info);
    width: 0%;
    transition: width 0.3s;
}








.grade-title {
    font-size: 30px;
    text-align: center;
    margin-bottom: 8px;
    color: var(--text-main);
}

.grade-title::after {
    content: "✨";
    margin-left: 6px;
}

.grade-description {
    text-align: center;
    font-size: 16px;
    color: var(--text-sub);
    margin-bottom: 25px;
}

.game-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
}

.game-item {
    margin-bottom: 18px;
    width: 49%;

}

.game-link {
    display: block;
    padding: 18px 16px;
    border-radius: 20px;
    background: var(--bg-card);
    text-decoration: none;
    border: 3px solid var(--border-soft);
    box-shadow: var(--shadow-card);
    transition: transform 0.15s, box-shadow 0.15s;
}

ul .game-list::after {
    content: "";
    display: block;
    width: 30%;
    /* 子要素と同じ幅を指定 */
}



.math-grade-container .game-link--flash {
    background: var(--pastel-orange);
    box-shadow: 0 6px 0 var(--pastel-shadow-orange);
}

.math-grade-container .game-link--time {
    background: var(--pastel-blue);
    box-shadow: 0 6px 0 var(--pastel-shadow-blue);
}

.math-grade-container .game-link--drill {
    background: var(--pastel-green);
    box-shadow: 0 6px 0 var(--pastel-shadow-green);
}

.math-grade-container .game-link--survival {
    background: var(--pastel-pink);
    box-shadow: 0 6px 0 var(--pastel-shadow-pink);
}

.math-grade-container .game-link--make10 {
    background: var(--pastel-green);
    box-shadow: 0 6px 0 var(--pastel-shadow-green);
}


.game-link:hover {
    transform: translateY(4px);
    box-shadow: 0 0 0 var(--accent-info);
}

.game-link--flash {
    border-color: var(--color-orange);
}

.game-link--flash .game-title::before {
    content: "⚡ ";
}

.game-link--time {
    border-color: var(--color-blue);
}

.game-link--time .game-title::before {
    content: "⏱ ";
}

.game-link--survival {
    border-color: var(--color-pink);
}

.game-link--survival .game-title::before {
    content: "∞ ";
}


.game-link--drill {
    border-color: var(--color-green);
}

.game-link--drill .game-title::before {
    content: "📘 ";
}

.game-link--make10 {
    border-color: var(--color-green);
}

.game-link--make10 .game-title::before {
    content: "🔟 ";
}


/* 勉強リンク */
.math-grade-container .section-link {
    background: var(--pastel-purple);
    padding: 16px 28px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    margin: 10px;
    color: var(--text-main);
    box-shadow: 0 8px 0 #b07edb;
    transition: 0.2s;
}

.math-grade-container .section-link:hover {
    transform: scale(1.1);
}

/* PDF */
.math-grade-container .pdf-download-link {
    background: var(--bg-card);
    border: 3px dashed var(--pastel-blue);
    padding: 14px 24px;
    border-radius: 18px;
    text-decoration: none;
    font-weight: bold;
    transition: 0.2s;
}

.math-grade-container .pdf-download-link:hover {
    background: var(--pastel-blue);
}

/* 区切り */
.math-grade-container hr {
    border: none;
    border-top: 4px dotted rgba(0, 0, 0, 0.1);
    margin: 60px 0;
}