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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: background 0.5s ease;
}

/* Background colors for vowel groups */
body.bg-vowel-a {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
}

body.bg-vowel-i {
    background: linear-gradient(135deg, #4dabf7 0%, #339af0 100%);
}

body.bg-vowel-u {
    background: linear-gradient(135deg, #9775fa 0%, #845ef7 100%);
}

body.bg-vowel-e {
    background: linear-gradient(135deg, #51cf66 0%, #40c057 100%);
}

body.bg-vowel-o {
    background: linear-gradient(135deg, #ff922b 0%, #fd7e14 100%);
}

.container {
    max-width: 800px;
    width: 100%;
}

h1 {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.card-container {
    perspective: 1000px;
    margin-bottom: 30px;
}

.flash-card {
    width: 100%;
    height: 400px;
    cursor: pointer;
    position: relative;
}

.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flash-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card-front {
    background: white;
}

.card-back {
    background: #f8f9fa;
    transform: rotateY(180deg);
}

.hiragana {
    font-size: 8rem;
    font-weight: bold;
    color: #667eea;
    transition: color 0.3s ease;
}

/* Vowel group colors */
.vowel-a .hiragana {
    color: #ff6b6b;
}

.vowel-a .card-front {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe0e0 100%);
}

.vowel-a .card-back {
    background: linear-gradient(135deg, #fff0f0 0%, #ffd5d5 100%);
}

.vowel-i .hiragana {
    color: #4dabf7;
}

.vowel-i .card-front {
    background: linear-gradient(135deg, #f0f8ff 0%, #dceeff 100%);
}

.vowel-i .card-back {
    background: linear-gradient(135deg, #e7f5ff 0%, #d0ebff 100%);
}

.vowel-u .hiragana {
    color: #9775fa;
}

.vowel-u .card-front {
    background: linear-gradient(135deg, #f8f5ff 0%, #ebe0ff 100%);
}

.vowel-u .card-back {
    background: linear-gradient(135deg, #f3f0ff 0%, #e5dbff 100%);
}

.vowel-e .hiragana {
    color: #51cf66;
}

.vowel-e .card-front {
    background: linear-gradient(135deg, #f4fdf6 0%, #d3f9d8 100%);
}

.vowel-e .card-back {
    background: linear-gradient(135deg, #ebfbee 0%, #c3fac8 100%);
}

.vowel-o .hiragana {
    color: #ff922b;
}

.vowel-o .card-front {
    background: linear-gradient(135deg, #fff8f0 0%, #ffe8cc 100%);
}

.vowel-o .card-back {
    background: linear-gradient(135deg, #fff4e6 0%, #ffd8a8 100%);
}

.meaning {
    font-size: 1.5rem;
    color: #333;
    padding: 30px 40px;
    text-align: left;
    line-height: 1.8;
    overflow-y: auto;
    max-height: 100%;
}

.meaning-item {
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.meaning-item:last-child {
    border-bottom: none;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn {
    background: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.progress {
    background: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    color: #667eea;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.character-nav {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#characterButtons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 10px;
}

.char-btn {
    padding: 10px;
    border: 2px solid #667eea;
    background: white;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    color: #667eea;
}

.char-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.05);
}

.char-btn.active {
    background: #667eea;
    color: white;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .flash-card {
        height: 300px;
    }

    .hiragana {
        font-size: 5rem;
    }

    .meaning {
        font-size: 1rem;
        padding: 20px;
    }

    .meaning-item {
        font-size: 0.9rem;
    }

    #characterButtons {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    }
}
