* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', 'Arial', sans-serif;
    background: url('https://www.transparenttextures.com/patterns/wood-pattern.png');
    background-color: #8B4513;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.game-container {
    width: 100%;
    max-width: 800px;
    position: relative;
}

.screen {
    background: rgba(255, 248, 220, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 
                inset 0 0 20px rgba(255, 255, 255, 0.3);
    border: 5px solid #654321;
    display: none;
    animation: slideIn 0.3s ease-out;
}

.screen.active {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Title Screen */
.game-title {
    font-size: 3.5rem;
    text-align: center;
    color: #8B0000;
    text-shadow: 3px 3px 0 #FFD700,
                 6px 6px 0 #FF8C00;
    margin-bottom: 10px;
    transform: rotate(-2deg);
    font-weight: bold;
}

.kanji-highlight {
    color: #FF6347;
    font-size: 4rem;
    display: inline-block;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.subtitle {
    text-align: center;
    font-size: 1.2rem;
    color: #654321;
    font-style: italic;
    margin-bottom: 30px;
}

.settings-container {
    background: rgba(255, 228, 196, 0.8);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    border: 3px dashed #CD853F;
}

.setting-group {
    margin-bottom: 15px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    font-size: 1.1rem;
    color: #654321;
    margin-bottom: 8px;
    font-weight: bold;
}

.setting-select {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 3px solid #CD853F;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    font-family: 'Comic Sans MS', 'Arial', sans-serif;
    transition: all 0.3s ease;
}

.setting-select:hover {
    border-color: #FF8C00;
    transform: scale(1.02);
}

.setting-select:focus {
    outline: none;
    border-color: #FF6347;
    box-shadow: 0 0 10px rgba(255, 99, 71, 0.5);
}

/* Buttons */
.main-btn {
    width: 100%;
    padding: 18px;
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(135deg, #FF6347, #FF8C00);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    font-family: 'Comic Sans MS', 'Arial', sans-serif;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.main-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.main-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    background: #FFD700;
    color: #654321;
    border: 3px solid #CD853F;
    border-radius: 15px;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s ease;
    font-family: 'Comic Sans MS', 'Arial', sans-serif;
    text-transform: uppercase;
}

.secondary-btn:hover {
    background: #FFA500;
    transform: scale(1.05);
}

/* How to Play */
.instructions {
    background: rgba(255, 228, 196, 0.8);
    border-radius: 15px;
    padding: 25px;
    margin: 20px 0;
    border: 3px solid #CD853F;
}

.instructions p {
    font-size: 1.1rem;
    color: #654321;
    margin-bottom: 12px;
    line-height: 1.6;
}

.instructions p:last-child {
    margin-bottom: 0;
}

/* Game Screen */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.score-board {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.score-item {
    background: rgba(255, 228, 196, 0.8);
    padding: 10px 20px;
    border-radius: 10px;
    border: 3px solid #CD853F;
}

.score-item.correct {
    border-color: #32CD32;
}

.score-item.wrong {
    border-color: #DC143C;
}

.score-label {
    font-size: 0.9rem;
    color: #654321;
    margin-right: 8px;
}

.score-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #8B0000;
}

.timer {
    font-size: 2.5rem;
    font-weight: bold;
    color: #FF6347;
    background: rgba(255, 228, 196, 0.9);
    padding: 10px 25px;
    border-radius: 50%;
    border: 4px solid #CD853F;
    min-width: 80px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.timer.warning {
    animation: pulse 0.5s infinite;
    color: #DC143C;
    border-color: #DC143C;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.reading-container {
    text-align: center;
    margin-bottom: 30px;
}

.reading-label {
    font-size: 1.2rem;
    color: #654321;
    margin-bottom: 15px;
    font-style: italic;
}

.current-reading {
    font-size: 4rem;
    font-weight: bold;
    color: #8B0000;
    background: rgba(255, 215, 0, 0.3);
    padding: 20px 40px;
    border-radius: 15px;
    border: 4px solid #FFD700;
    display: inline-block;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.kanji-choices {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-bottom: 30px;
    max-width: 100%;
}

.kanji-btn {
    font-size: 3rem;
    padding: 25px 15px;
    background: linear-gradient(135deg, #FFE4B5, #FFDEAD);
    border: 4px solid #CD853F;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'MS Mincho', serif;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kanji-btn:hover {
    transform: translateY(-5px) rotate(5deg);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    border-color: #FF8C00;
}

.kanji-btn:active {
    transform: translateY(0) rotate(0deg);
}

.kanji-btn.correct {
    background: linear-gradient(135deg, #90EE90, #32CD32);
    border-color: #228B22;
    animation: correctAnim 0.5s ease;
}

.kanji-btn.wrong {
    background: linear-gradient(135deg, #FFB6C1, #DC143C);
    border-color: #8B0000;
    animation: wrongAnim 0.5s ease;
}

.kanji-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

@keyframes correctAnim {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2) rotate(10deg); }
}

@keyframes wrongAnim {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.feedback {
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    min-height: 40px;
    margin-bottom: 20px;
}

.feedback.correct-msg {
    color: #32CD32;
    animation: fadeIn 0.5s ease;
}

.feedback.wrong-msg {
    color: #DC143C;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.cancel-btn {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    background: #DC143C;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Comic Sans MS', 'Arial', sans-serif;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.cancel-btn:hover {
    background: #8B0000;
    transform: scale(1.05);
}

/* Results Screen */
.results-title {
    font-size: 2.5rem;
    text-align: center;
    color: #8B0000;
    margin-bottom: 25px;
    text-shadow: 2px 2px 0 #FFD700;
}

.final-score {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.final-score-item {
    text-align: center;
    background: rgba(255, 228, 196, 0.8);
    padding: 20px;
    border-radius: 15px;
    border: 3px solid #CD853F;
    flex: 1;
    min-width: 150px;
}

.final-label {
    display: block;
    font-size: 1rem;
    color: #654321;
    margin-bottom: 10px;
}

.final-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
}

.correct-color {
    color: #32CD32;
}

.wrong-color {
    color: #DC143C;
}

.results-table-container {
    background: white;
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 25px;
    max-height: 400px;
    overflow-y: auto;
    border: 3px solid #CD853F;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1rem;
}

.results-table th {
    background: #FFD700;
    color: #654321;
    padding: 12px 8px;
    text-align: left;
    position: sticky;
    top: 0;
    font-weight: bold;
}

.results-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #DEB887;
}

.results-table tr:hover {
    background: rgba(255, 228, 196, 0.5);
}

.result-correct {
    color: #32CD32;
    font-weight: bold;
}

.result-wrong {
    color: #DC143C;
    font-weight: bold;
}

.wrong-kanji {
    color: #DC143C;
    font-weight: bold;
    font-size: 1.2em;
    text-decoration: underline;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: rgba(255, 248, 220, 0.98);
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    text-align: center;
    border: 5px solid #654321;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
    font-size: 2rem;
    color: #8B0000;
    margin-bottom: 15px;
}

.modal-content p {
    font-size: 1.2rem;
    color: #654321;
    margin-bottom: 25px;
}

.modal-buttons {
    display: flex;
    gap: 15px;
}

.modal-btn {
    flex: 1;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Comic Sans MS', 'Arial', sans-serif;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.modal-btn.confirm {
    background: #DC143C;
    color: white;
}

.modal-btn.confirm:hover {
    background: #8B0000;
    transform: scale(1.05);
}

.modal-btn.resume {
    background: #32CD32;
    color: white;
}

.modal-btn.resume:hover {
    background: #228B22;
    transform: scale(1.05);
}

/* Responsive */
@media (max-width: 600px) {
    .game-title {
        font-size: 2.5rem;
    }
    
    .kanji-highlight {
        font-size: 3rem;
    }
    
    .current-reading {
        font-size: 3rem;
        padding: 15px 30px;
    }
    
    .kanji-choices {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    /* Make the last 2 buttons span to be centered */
    .kanji-btn:nth-child(4) {
        grid-column: 1 / 2;
    }
    
    .kanji-btn:nth-child(5) {
        grid-column: 2 / 3;
    }
    
    .kanji-btn {
        font-size: 2.5rem;
        padding: 20px 10px;
        min-height: 80px;
    }
    
    .timer {
        font-size: 2rem;
        padding: 8px 20px;
        min-width: 60px;
    }
    
    .screen {
        padding: 25px;
    }
    
    .share-buttons {
        flex-direction: column;
    }
    
    .share-btn {
        width: 100%;
    }
}

/* Footer */
.game-footer {
    text-align: center;
    padding: 20px;
    margin-top: 30px;
    font-size: 1.1rem;
    color: #FFD700;
    font-family: 'Comic Sans MS', 'Arial', sans-serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    width: 100%;
    clear: both;
    display: block;
}

.game-footer .heart {
    color: #FF6347;
    display: inline-block;
    animation: heartbeat 1.5s infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    10%, 30% { transform: scale(1.2); }
    20%, 40% { transform: scale(1); }
}

.game-footer a {
    color: #FFD700;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
}

.game-footer a:hover {
    color: #FFA500;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

/* Share Buttons */
.share-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    justify-content: center;
    flex-wrap: wrap;
}

.share-btn {
    padding: 15px 25px;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-family: 'Comic Sans MS', 'Arial', sans-serif;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 200px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.whatsapp-btn {
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white;
}

.whatsapp-btn:hover {
    background: linear-gradient(135deg, #128C7E, #075E54);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.copy-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.copy-btn:hover {
    background: linear-gradient(135deg, #764ba2, #667eea);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.copy-btn.copied {
    background: linear-gradient(135deg, #32CD32, #228B22);
}

.share-btn:active {
    transform: translateY(0);
}
