body {
    color: #333;
    height: 100vh;
    margin: 0;
    background-color: #333;
    letter-spacing: 0.1em;
    position: relative;
    overflow-x: hidden;
    background-image: 
    radial-gradient(circle at 0% 0%, rgba(88, 128, 136, 0.5) 0%, transparent 70%),
    radial-gradient(circle at 100% 100%, rgba(170, 0, 55, 0.4) 0%, transparent 70%);
    background-size: 100% 100%;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

p {
    margin: 0 0 1em 0;
    font-size: 0.8em;
}

header {
    font-family: "DotGothic16", sans-serif;
    height: max-content;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1vh;
    background-color: #aa0037;
}

main {
    font-family: "DotGothic16", sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    /* background-color: #588088; */
    padding: 3%;
    height: 70vh;
    min-height: fit-content;
}

.container {
    background-color: #fff;
    padding: 3%;
    font-size: 1em;
    border-radius: 5px 30px 5px 30px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    /* border: solid 5px;
    border-color: #aa0037 #aa0037 #830b31 #830b31; */
    text-align: center;
    width: 90%;
    max-width: 800px;
    position: relative; /* home-buttonの基準位置にする */
}

footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1vh;
}

footer p {
    color: #fff;
    font-size: 0.7em;
}

footer a {
    color: #fff;
    background-color: #aa0037;
}

h1 {
    color: #fff;
    margin: 0;
    font-size: 1.5em;
    text-align: center;
}

.question-info {
    font-size: 1.1em;
    color: #588088;
    /* margin-bottom: 15px; */
    margin-top: 50px;
}

.question-word {
    font-size: 1.5em;
    font-weight: bold;
    color: #aa0037;
    margin: 0;
    /* min-height: 50px; */
}

/* .question-word-hint-description {
    margin-bottom: 0;
    color: #588088;
} */

.question-word-hint {
    color: #aa0037;
    width: max-content;
    margin: 0 auto;
    padding: 0.1em 1em;
    min-height: 1em;
    visibility: hidden;
}

#answer-input {
    width: 80%;
    padding: 12px;
    font-size: 1.2em;
    border: 2px solid #ccc;
    border-radius: 8px;
    margin: 10px 0 15px 0;
    text-align: center;
}

button {
    display: block;
    width: 85%;
    padding: 15px;
    font-size: 1.2em;
    font-weight: bold;
    color: #fff;
    background-color: #588088;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin: 0 auto;
    transition: background-color 0.3s;
    font-family: "DotGothic16", sans-serif;
    letter-spacing: 0.1em;
}

button:hover {
    background-color: #325860;
}

#feedback {
    min-height: 200px; /* 画像とテキストが入るように高さを確保 */
    margin-top: 15px;
    font-size: 1em;
    font-weight: bold;
    /* display: flex; */
    /* align-items: center; */
    /* justify-content: center; */
    /* gap: 10px; */
}

#feedback strong {
    color: #aa0037;
    font-size: 1.3em;
}

.correct {
    color: #28a745;
}

.incorrect {
    color: #dc3545;
}

.hidden {
    display: none !important; /* !importantで確実に非表示にする */
}

#result-container h2 {
    color: #aa0037;
    font-size: 2em;
    margin-top: 50px;
}

.score-text {
    font-size: 1.5em;
    margin: 20px 0;
    color: #588088;
}
.score-text #score {
    color: #aa0037;
}

#retry-button {
    background-color: #aa0037;
    margin-bottom: 20px;
}

#retry-button:hover {
    background-color: #830b31;
}

/* .thanks-message {
    font-size: 0.8em;
} */
.thanks-message span {
    color: #588088;
    font-size: 1.2em;
}
.thanks-message a {
    color: #aa0037;
}

p.start-description {
    color: #588088;
}

/* スタート画面のモード選択ボタン */
.mode-button {
    margin-top: 10px;
}
.can-play {
    background-color: #588088;
}
.can-play:hover {
    background-color: #325860;
}
.coming-soon {
    background-color: #8a8a8a;
    cursor: not-allowed;
}
.coming-soon:hover {
    pointer-events: none;
    background-color: #8a8a8a;
}
#mode-selection p {
    font-size: 1.5em;
    margin-bottom: 15px;
    font-weight: bold;
    color: #aa0037;
}


/* 「最初に戻る」ボタン */
.home-button {
    position: absolute;
    top: 15px;
    left: 15px;
    width: auto;
    padding: 8px 12px;
    font-size: 0.9em;
    background-color: #6c757d;
}
.home-button:hover {
    background-color: #5a6268;
}

.hint-toggle {
    display: flex;
    justify-content: end;
    align-items: center;
    position: absolute;
    top: 15px;
    right: 15px;
}
.hint-toggle-text {
    font-size: 0.9em;
    margin-right: 5px;
}
/* トグルボタン */
.toggle-button-4 {
    display: flex;
    align-items: center;
    position: relative;
    width: 70px;
    height: 37px;
    border-radius: 50px;
    box-sizing: content-box;
    background-color: #6c757d33;
    cursor: pointer;
    transition: background-color .4s;
}

.toggle-button-4:has(:checked) {
    background-color: #aa003733;
}

.toggle-button-4::before {
    position: absolute;
    left: 4px;
    width: 29px;
    height: 29px;
    border-radius: 50%;
    background-color: #6c757d;
    content: '';
    transition: left .4s;
}

.toggle-button-4:has(:checked)::before {
    left: 37px;
    background-color: #aa0037;
}

.toggle-button-4::after {
    position: absolute;
    left:19px;
    transform: translateX(-50%);
    color: #fff;
    font-weight: 600;
    font-size: 0.8em;
    content: 'OFF';
    transition: left .4s;
}

.toggle-button-4:has(:checked)::after {
    left: 52px;
    content: 'ON';
}

.toggle-button-4 input {
    display: none;
}

/* 特殊文字ボタン */
.keyboard-buttons {
    /* margin-top: 10px; */
    margin-bottom: 15px;
}

.keyboard-buttons button {
    display: inline-block;
    width: auto;
    font-size: 1.2em;
    padding: 5px 15px;
    cursor: pointer;
    background-color: #6c757d;
}
.keyboard-buttons button:hover {
    background-color: #5a6268;
}

/* 回答/次の問題 ボタンの位置固定用コンテナ */
.action-buttons-container {
    min-height: 60px; /* ボタンの高さを確保し、ガタつきを防ぐ */
    display: flex;
    justify-content: center;
    align-items: center;
}

#submit-button, #next-button {
    margin-top: 0;
}

#next-button {
    background-color: #aa0037;
}
#next-button:hover {
    background-color: #830b31;
}

/* ===== ここから末尾に追記 ===== */

/* ★★★ 10点（満点）の時の特別スタイル ★★★ */

/* body.perfect-score .container {
    border: 5px solid #ffd700;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.7);
    background: linear-gradient(135deg, #fff1b3, #ffe47a, #ffd700);
    animation: celebration 5s ease-in-out infinite;
}

body.perfect-score #result-container h2 {
    color: #b8860b;
    text-shadow: 1px 1px 2px #fff;
    font-size: 2.5em;
    animation: bounce 1s ease infinite;
} */

/* ★★★ 0点の時の特別スタイル ★★★ */
/* body.zero-score .container {
    background-color: #333;
    color: #fff;
} */

/* アニメーションの定義 */
/* @keyframes celebration {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
} */

@media screen and (max-width: 600px) {
    h1 {
        font-size: 1em;
    }
    button {
        font-size: 1em;
    }
    /* .start-description {
        font-size: 0.8em;
    } */
    #mode-selection p {
        font-size: 1.2em;
    }
    #result-container h2 {
        font-size: 1.5em;
    }
    .score-text {
        font-size: 1.2em;
    }
}