/* style.css */

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    min-height: 100%;
}

body {
    margin: 0;
    padding: 0;

    background: #FFF8DC;

    font-family:
        "Zen Maru Gothic",
        "Hiragino Maru Gothic ProN",
        "Hiragino Kaku Gothic ProN",
        "Yu Gothic",
        sans-serif;

    color: #4A4A4A;

    touch-action: manipulation;
}


/* =========================================
   アプリ全体
========================================= */

.app {
    width: 100%;
    min-height: 100vh;

    display: flex;
    justify-content: center;
}

.game-screen {
    width: 100%;
    max-width: 1100px;

    min-height: 100vh;

    margin: 0 auto;

    padding:
        clamp(8px, 1.5vh, 18px)
        clamp(8px, 2vw, 24px)
        20px;

    display: flex;
    flex-direction: column;
    align-items: center;
}


/* =========================================
   ヘッダー
========================================= */

.page-header {
    width: 100%;
    text-align: center;

    margin-bottom: clamp(6px, 1vh, 12px);
}

.app-title {
    margin: 0 0 2px;

    font-size: clamp(25px, 4vw, 40px);
    font-weight: 900;

    letter-spacing: 0.08em;

    color: #5C7CFA;

    line-height: 1.15;

    text-shadow:
        0 2px 0 #FFFFFF,
        0 4px 7px rgba(0, 0, 0, 0.08);
}

.app-subtitle {
    margin: 0;

    font-size: clamp(12px, 2vw, 17px);
    font-weight: 700;

    color: #777;
}


/* =========================================
   問題エリア
========================================= */

.question-area {
    width: 100%;

    display: flex;
    justify-content: center;
}

.question-card {
    width: min(100%, 430px);

    display: flex;
    flex-direction: column;
    align-items: center;

    background: #FFFFFF;

    border-radius: 22px;

    padding:
        clamp(7px, 1.2vw, 12px)
        clamp(9px, 1.5vw, 15px)
        clamp(9px, 1.5vw, 14px);

    box-shadow:
        0 5px 0 rgba(220, 210, 180, 0.55),
        0 8px 18px rgba(0, 0, 0, 0.07);
}

.question-text {
    margin:
        0
        0
        clamp(5px, 1vh, 9px);

    font-size: clamp(14px, 2.5vw, 20px);
    font-weight: 900;

    color: #666;

    line-height: 1.2;
}


/* =========================================
   問題画像
========================================= */

.image-container {
    width: min(100%, 350px);

    aspect-ratio: 1 / 1;

    display: flex;
    justify-content: center;
    align-items: center;

    overflow: hidden;

    border-radius: 17px;

    background: #FAFAFA;
}

.question-image {
    width: 100%;
    height: 100%;

    object-fit: contain;

    display: block;

    border-radius: 14px;

    animation: imageAppear 0.3s ease-out;
}

@keyframes imageAppear {

    0% {
        opacity: 0;
        transform: scale(0.82);
    }

    70% {
        opacity: 1;
        transform: scale(1.04);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }

}


/* =========================================
   べつのもんだい
========================================= */

.another-button {
    width: min(100%, 430px);

    margin:
        clamp(7px, 1.2vh, 12px)
        0
        clamp(7px, 1.2vh, 12px);

    padding:
        clamp(8px, 1.2vh, 12px)
        15px;

    border: none;
    border-radius: 15px;

    background: #FFFFFF;

    color: #666;

    font-family: inherit;

    font-size: clamp(15px, 2.8vw, 21px);
    font-weight: 900;

    cursor: pointer;

    box-shadow:
        0 4px 0 #D8D8D8,
        0 6px 11px rgba(0, 0, 0, 0.06);

    transition:
        transform 0.08s ease,
        box-shadow 0.08s ease;
}

.another-button:active {
    transform: translateY(4px) scale(0.98);

    box-shadow:
        0 1px 0 #D8D8D8,
        0 3px 5px rgba(0, 0, 0, 0.05);
}


/* =========================================
   五十音表
========================================= */

.answer-area {
    width: 100%;

    background: #FFFFFF;

    border-radius: 22px;

    padding:
        clamp(9px, 1.5vw, 15px)
        clamp(8px, 1.5vw, 16px)
        clamp(11px, 1.8vw, 18px);

    box-shadow:
        0 5px 0 rgba(220, 210, 180, 0.55),
        0 8px 18px rgba(0, 0, 0, 0.06);
}

.section-title {
    margin:
        0
        0
        clamp(7px, 1.2vh, 11px);

    text-align: center;

    font-size: clamp(16px, 2.7vw, 23px);
    font-weight: 900;

    color: #555;

    line-height: 1.2;
}


/* =========================================
   五十音表グリッド
========================================= */

.gojuon-table {
    width: 100%;

    display: grid;

    grid-template-columns:
        repeat(10, minmax(0, 1fr));

    grid-template-rows:
        repeat(5, minmax(0, 1fr));

    gap: clamp(4px, 0.8vw, 9px);
}


/* =========================================
   ひらがなボタン
========================================= */

.kana-button {
    width: 100%;

    aspect-ratio: 1 / 1;

    border: none;

    border-radius: clamp(9px, 1.4vw, 15px);

    background: #F4F7FF;

    color: #444;

    font-family: inherit;

    font-size: clamp(19px, 3.4vw, 34px);
    font-weight: 900;

    line-height: 1;

    cursor: pointer;

    box-shadow:
        0 4px 0 #D9E0F5,
        0 5px 9px rgba(0, 0, 0, 0.06);

    transition:
        transform 0.08s ease,
        box-shadow 0.08s ease,
        background 0.15s ease,
        opacity 0.15s ease;
}

.kana-button:not(:disabled):active {
    transform: translateY(4px) scale(0.96);

    box-shadow:
        0 1px 0 #D9E0F5,
        0 2px 5px rgba(0, 0, 0, 0.05);

    background: #E9EEFF;
}

@media (hover: hover) {

    .kana-button:not(:disabled):hover {
        background: #EAF0FF;

        transform: translateY(-2px);

        box-shadow:
            0 6px 0 #D9E0F5,
            0 8px 12px rgba(0, 0, 0, 0.07);
    }

}


/* =========================================
   間違えた選択肢
========================================= */

.kana-button.wrong-answer {
    background: #E8E8E8;

    color: #BDBDBD;

    cursor: default;

    opacity: 0.6;

    box-shadow:
        0 2px 0 #D5D5D5,
        0 3px 5px rgba(0, 0, 0, 0.03);

    transform: none;
}


/* =========================================
   正解
========================================= */

.kana-button.correct-answer {
    background: #E8F8E8;

    color: #4CAF50;

    box-shadow:
        0 4px 0 #B9DFB9,
        0 6px 9px rgba(0, 0, 0, 0.05);
}


/* =========================================
   空白マス
========================================= */

.kana-empty {
    width: 100%;
    aspect-ratio: 1 / 1;
}


/* =========================================
   「を」「ん」
========================================= */

.kana-disabled {
    background: #EEEEEE;

    color: #AAAAAA;

    cursor: default;

    box-shadow:
        0 3px 0 #DDDDDD,
        0 4px 6px rgba(0, 0, 0, 0.03);
}


/* =========================================
   結果メッセージ
========================================= */

.result-message {
    min-height: clamp(28px, 4vw, 42px);

    margin-top: 6px;

    display: flex;
    align-items: center;
    justify-content: center;

    text-align: center;

    font-size: clamp(16px, 3vw, 25px);
    font-weight: 900;

    line-height: 1.2;
}

.result-message.correct {
    color: #48A868;

    animation: resultPop 0.35s ease-out;
}

.result-message.wrong {
    color: #E88A8A;
}

@keyframes resultPop {

    0% {
        opacity: 0;
        transform: scale(0.75);
    }

    70% {
        opacity: 1;
        transform: scale(1.08);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }

}


/* =========================================
   つぎのもんだい
========================================= */

.next-button {
    width: min(100%, 430px);

    margin-top: 5px;

    padding:
        clamp(9px, 1.4vh, 13px)
        18px;

    border: none;
    border-radius: 16px;

    background: #69C36D;

    color: #FFFFFF;

    font-family: inherit;

    font-size: clamp(18px, 3.2vw, 25px);
    font-weight: 900;

    cursor: pointer;

    box-shadow:
        0 5px 0 #4E9F52,
        0 7px 12px rgba(0, 0, 0, 0.08);

    animation: buttonAppear 0.3s ease-out;
}

.next-button:active {
    transform: translateY(4px) scale(0.98);

    box-shadow:
        0 1px 0 #4E9F52,
        0 3px 5px rgba(0, 0, 0, 0.05);
}

@keyframes buttonAppear {

    0% {
        opacity: 0;
        transform: translateY(8px) scale(0.9);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

}

.hidden {
    display: none !important;
}


/* =========================================
   スマホ縦向き
========================================= */

@media (max-width: 600px) and (orientation: portrait) {

    .game-screen {
        padding-top: 9px;
    }

    .kana-button {
        font-size: clamp(18px, 5vw, 29px);
    }

}


/* =========================================
   スマホ横向き
========================================= */

@media (orientation: landscape) {

    .game-screen {
        padding-top: 5px;
        padding-bottom: 10px;
    }

    .page-header {
        margin-bottom: 4px;
    }

    .app-title {
        font-size: clamp(21px, 4vw, 30px);
    }

    .app-subtitle {
        font-size: clamp(10px, 1.8vw, 14px);
    }

    .question-card {
        width: min(100%, 320px);

        padding: 5px 8px 8px;
    }

    .question-text {
        margin-bottom: 4px;

        font-size: clamp(11px, 2vw, 15px);
    }

    .image-container {
        width: min(100%, 230px);
    }

    .another-button {
        margin-top: 5px;
        margin-bottom: 5px;

        padding: 6px 12px;

        font-size: clamp(13px, 2.5vw, 17px);
    }

    .answer-area {
        padding: 7px 10px 9px;
    }

    .section-title {
        margin-bottom: 5px;

        font-size: clamp(13px, 2.5vw, 18px);
    }

    .gojuon-table {
        gap: 4px;
    }

    .kana-button {
        font-size: clamp(15px, 3.3vw, 27px);

        border-radius: 9px;
    }

    .result-message {
        min-height: 23px;

        margin-top: 3px;

        font-size: clamp(13px, 2.5vw, 19px);
    }

    .next-button {
        margin-top: 3px;

        padding: 6px 14px;

        font-size: clamp(15px, 2.8vw, 20px);
    }

}


/* =========================================
   PC横画面
========================================= */

@media (min-width: 900px) and (orientation: landscape) {

    .game-screen {
        max-width: 1000px;
    }

    .question-card {
        width: 330px;
    }

    .image-container {
        width: 250px;
    }

    .another-button {
        width: 330px;
    }

    .kana-button {
        font-size: clamp(22px, 2.7vw, 31px);
    }

}