* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "M PLUS Rounded 1c", sans-serif;
    background-color: #FCF9EA;
    color: #333333;
    min-height: 100vh;
    padding: 10px;
    overflow-x: hidden;
}

/* Screen management */
.screen {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen.hidden {
    display: none;
}

.container {
    max-width: 100%;
    width: 100%;
    text-align: center;
    position: relative;
    padding: 0 10px;
}

/* Back to menu button */
.btn-back-to-menu-bottom {
    margin-top: 2rem;
    padding: 0.8rem 2rem;
    font-size: 1rem;
    background-color: white;
    color: #666666;
    border: 2px solid #BADFDB;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    display: inline-block;
    font-family: "M PLUS Rounded 1c", sans-serif;
    font-weight: 500;
}

.btn-back-to-menu-bottom:hover {
    background-color: #BADFDB;
    border-color: #A0CFC9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(186, 223, 219, 0.4);
}

.btn-back-to-menu-bottom:active {
    transform: translateY(0);
}

/* Bear icon */
.bear-icon {
    width: 80px;
    height: auto;
    margin-bottom: 0.5rem;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

h1 {
    font-size: 1.8rem;
    margin-bottom: 0.8rem;
    color: #FFA4A4;
    font-weight: 600;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #FFA4A4;
    font-weight: 600;
}

/* Welcome text */
.welcome-text {
    font-size: 0.95rem;
    color: #666666;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Difficulty selection */
.difficulty-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
    background-color: white;
    border: none;
    border-radius: 15px;
    padding: 1rem;
    font-family: "M PLUS Rounded 1c", sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    display: inline-block;
    color: #333333;
}

.btn-difficulty {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1.2rem 1rem;
}

.btn-difficulty .btn-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333333;
}

.btn-difficulty .btn-desc {
    font-size: 0.8rem;
    color: #666666;
}

.btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(186, 223, 219, 0.4);
    background-color: #BADFDB;
}

.btn:active {
    transform: translateY(-2px);
}

/* Progress bar */
.progress-container {
    position: relative;
    width: 100%;
    height: 25px;
    background-color: white;
    border-radius: 15px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #BADFDB 0%, #A4D4CF 100%);
    border-radius: 15px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    color: #333333;
}

/* Question container */
.question-container {
    margin: 1.5rem 0 0.8rem 0;
}

.question-label {
    font-size: 1.1rem;
    color: #666666;
    margin-bottom: 0.8rem;
}

.hiragana-display {
    font-size: 4rem;
    font-weight: 600;
    color: #FFA4A4;
    margin: 0.8rem 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* Answer display */
.answer-display {
    min-height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
}

.answer-slot {
    width: 45px;
    height: 60px;
    border: 3px solid #BADFDB;
    border-radius: 10px;
    background-color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: 600;
    color: #333333;
    font-family: monospace;
    transition: all 0.3s;
}

.answer-slot.filled {
    background-color: #BADFDB;
    border-color: #A4D4CF;
    transform: scale(1.05);
}

.answer-slot.hint {
    color: #d0d0d0;
    opacity: 0.6;
    animation: hintPulse 2s ease-in-out infinite;
}

@keyframes hintPulse {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 0.7;
    }
}

/* Alphabet buttons */
.alphabet-buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    max-width: 450px;
    margin: 1.5rem auto;
}

.alphabet-btn {
    background-color: white;
    border: 2px solid #BADFDB;
    border-radius: 10px;
    padding: 1rem;
    font-family: "M PLUS Rounded 1c", sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    color: #333333;
    text-transform: uppercase;
}

.alphabet-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(186, 223, 219, 0.4);
    background-color: #BADFDB;
    border-color: #A4D4CF;
}

.alphabet-btn:active:not(:disabled) {
    transform: translateY(0);
}

.alphabet-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.alphabet-btn.selected {
    background-color: #BADFDB;
    border-color: #A4D4CF;
}

/* Reset button */
.btn-reset {
    margin: 0.8rem auto;
    padding: 0.6rem 1.5rem;
    background-color: #FFA4A4;
    color: white;
    font-size: 0.9rem;
}

.btn-reset:hover {
    background-color: #ff8888;
    transform: translateY(-3px);
}

/* Feedback */
.feedback {
    font-size: 1.5rem;
    font-weight: 600;
    padding: 1rem;
    border-radius: 10px;
    margin: 1rem 0;
    animation: fadeIn 0.3s;
}

.feedback.hidden {
    display: none;
}

.feedback.correct {
    background-color: #d4edda;
    color: #155724;
}

.feedback.wrong {
    background-color: #f8d7da;
    color: #721c24;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Score display */
.score-display {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.score-item {
    font-size: 1rem;
}

.score-label {
    color: #666666;
}

.score-value {
    font-weight: 600;
    font-size: 1.2rem;
}

.score-value.correct {
    color: #28a745;
}

.score-value.wrong {
    color: #dc3545;
}

/* Result screen */
.result-animation {
    margin: 1.5rem 0;
    min-height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.result-animation img {
    width: 100px;
    height: auto;
    animation: celebration 1s ease-in-out;
}

@keyframes celebration {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.1) rotate(-5deg);
    }
    75% {
        transform: scale(1.1) rotate(5deg);
    }
}

.result-title {
    margin-bottom: 1.5rem;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.result-item {
    background-color: white;
    padding: 1rem;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.result-label {
    font-size: 0.9rem;
    color: #666666;
    margin-bottom: 0.5rem;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 600;
}

.stamp-display {
    margin: 1.5rem 0;
    min-height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.stamp-display img {
    max-width: 200px;
    height: auto;
    animation: stampAppear 0.5s ease-out;
}

@keyframes stampAppear {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.result-buttons {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.btn-restart,
.btn-menu {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
}

.btn-restart {
    background-color: #BADFDB;
    color: #333333;
}

.btn-restart:hover {
    background-color: #A4D4CF;
}

.btn-menu {
    background-color: #FFA4A4;
    color: white;
}

.btn-menu:hover {
    background-color: #ff8888;
}

/* Daily stats */
.daily-stats {
    margin-top: 1rem;
    font-size: 0.75rem;
    color: #aaa;
    text-align: center;
}

/* Responsive design */
@media (max-width: 600px) {
    h1 {
        font-size: 2rem;
    }

    .hiragana-display {
        font-size: 4rem;
    }

    .answer-slot {
        width: 50px;
        height: 70px;
        font-size: 2rem;
    }

    .difficulty-selection {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .alphabet-buttons {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.5rem;
        max-width: 350px;
    }

    .alphabet-btn {
        padding: 1rem;
        font-size: 1.3rem;
    }

    .result-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .result-buttons {
        flex-direction: column;
    }

    .btn-restart,
    .btn-menu {
        width: 100%;
    }
}
