/* 共通スタイル */
* {
    box-sizing: border-box;
}
body {
    margin: 0;
    font-family: 'Press Start 2P', sans-serif; /* 英字フォント */
    background-color: #ccd0af; /* ゲームボーイポケットの背景色 */
    color: #171715;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* ボタン */
.buttonArea {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.button {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 30%;
    height: 44px;
    box-sizing: border-box;
    padding: 8px;
    margin: 0 5%;
    background-color: #ccd0af;
    border: 2px solid #171715;
    color: #171715;
    font-size: 12px;
    font-weight: bold;
    font-family: 'Press Start 2P', sans-serif; /* 英字フォント */
    cursor: pointer;
    box-shadow: 2px 2px 0 #171715, -2px -2px 0 #ccd0af;
    transition: box-shadow 0.2s ease-in-out;
}
a.button {
    text-decoration: none;
}

.button:active {
    box-shadow: inset 2px 2px 0 #171715, inset -2px -2px 0 #ccd0af;
}

/* Screen styles */
.screen {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 16px;
    background-color: #ccd0af;
    overflow-y: auto;
    text-align: center;
}

@media screen and (max-height: 604px) {
    .screen {
        flex-direction:inherit;
        justify-content: center;
        align-items:flex-start;
        overflow-y: auto;
    }
}

.screen.active {
    display: flex;
}

.screen-inner {
    max-width: 375px;
    width: 100%;
    height: 572px;
    margin: 0 auto;
    padding: 20px;
    border: 2px solid #171715;
    box-sizing: border-box;
    position: relative;
}
@media screen and (max-height: 604px) {
    .screen-inner {
        max-width: 320px;
        height: 540px;
    }
}

.screen-title {
    margin: 0;
    margin-bottom: 16px;
}

/* ロゴ */
.logo {
    width: 100%;
    height: auto;
}

/* 副題 */
.subtitle {
    font-family: 'DotGothic16', sans-serif; /* 日本語フォント */
    font-size: 14px;
    color: #171715;
    margin-bottom: 24px;
    text-align: center;
}

/* トグルスイッチコンテナ */
.toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.toggle-label {
    font-family: 'DotGothic16', sans-serif; /* 日本語フォント */
    font-size: 12px;
    color: #171715;
    margin: 0 10px;
    width: 32px;
}

.toggle-switch {
    width: 60px;
    height: 30px;
    background: #ccd0af;
    border: 2px solid #171715;
    position: relative;
    cursor: pointer;
}

.toggle-thumb {
    width: 28px;
    height: 28px;
    background: #171715;
    position: absolute;
    top: 1px;
    left: 1px;
    transition: transform 0.3s ease;
}

.toggle-switch.active .toggle-thumb {
    transform: translateX(30px);
}

/* カウントダウン番号 */
.countdown-number {
     display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    text-align: center;
    font-family: 'Press Start 2P', sans-serif; /* 英字フォント */
    font-size: 144px;
    font-weight: bold;
    color: #171715;
}

/* プレイ画面のお題 */
#question-container {
    margin-bottom: 40px;
}

#question {
    font-family: 'DotGothic16', sans-serif; /* 日本語フォント */
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin: 0;
    color: #171715;
}

/* 入力フォーム */
.input {
    background-color: #ccd0af;
    border: 2px solid #171715;
    padding: 12px 8px;
    font-size: 14px;
    font-family: 'Press Start 2P', sans-serif; /* 英字フォント */
    color: #171715;
    outline: none;
    width: 100%;
    margin-bottom: 24px;
    box-sizing: border-box;
}



/* タイマー */
.timer-container {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 16px;
    font-family: 'Press Start 2P', sans-serif; /* 英字フォント */
    color: #171715;
}

.timer {
    font-size: 24px;
    font-weight: 700;
}

/* 結果画面 */

.rank-image {
    width: 100%;
    margin-bottom: 12px;
}
@media screen and (max-height: 604px) {
    .rank-image {
        margin-bottom: 8px;
    }
}

#result-screen .title {
    margin: 0 0 4px;
    font-size: 28px;
    font-weight: bold;
    color: #171715;
    text-align: center;
}

.caption {
    font-family: 'DotGothic16', sans-serif; /* 日本語フォント */
    font-size: 16px;
    font-weight: normal;
    color: #171715;
    text-align: center;
    margin: 0 0 8px;
}

.score-display {
    font-family: 'DotGothic16', sans-serif; /* 日本語フォント */
    font-size: 18px;
    font-weight: bold;
    color: #171715;
    margin: 0 0 4px;
}

.time-display {
    font-family: 'DotGothic16', sans-serif; /* 日本語フォント */
    font-size: 12px;
    color: #171715;
    margin: 0 0 4px;
}


/* 強調されたブルブルアニメーション */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10% {
        transform: translateX(-15px);
    }
    20% {
        transform: translateX(15px);
    }
    30% {
        transform: translateX(-10px);
    }
    40% {
        transform: translateX(10px);
    }
    50% {
        transform: translateX(-5px);
    }
    60% {
        transform: translateX(5px);
    }
    70% {
        transform: translateX(-3px);
    }
    80% {
        transform: translateX(3px);
    }
    90% {
        transform: translateX(-1px);
    }
}

/* アニメーション適用クラス */
.shake {
    animation: shake 0.3s cubic-bezier(0.4, 0.1, 0.6, 1);
}

/* Deleteキーの基本的なアニメーション */
.destroy {
    animation: none; /* JavaScriptで動的に適用 */
    will-change: transform; /* 性能向上 */
}

/* ドットの基本スタイル */
.dot {
    position: absolute;
    width: 5px; /* ドットサイズ */
    height: 5px;
    background-color: #171715; /* ゲームボーイ風の黒色 */
    animation: explode 0.8s ease-out forwards;
}

/* 砕け散るアニメーション */
@keyframes explode {
    0% {
        transform: translate(0, 0);
        opacity: 1;
    }
    100% {
        transform: translate(var(--dx), var(--dy));
        opacity: 0;
    }
}