* {
    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;
    touch-action: manipulation; /* Paranna touch-kokemusta */
    -webkit-tap-highlight-color: transparent; /* Poista tap-highlight iOS:ssa */
}

.game-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 100%;
    min-height: 600px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.score-board {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 1.2em;
}

.score, .streak {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.score.updated {
    animation: levelUp 0.8s ease-out;
    background: linear-gradient(45deg, #4facfe, #00f2fe);
    box-shadow: 0 0 20px rgba(79, 172, 254, 0.5);
}

.streak.hot {
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    animation: pulse 1s infinite;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
}

.streak.hot::before {
    content: '🔥';
    margin-right: 5px;
}

.screen {
    display: none;
    padding: 30px;
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: block;
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

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

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(102, 126, 234, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(102, 126, 234, 0); }
}

@keyframes confetti {
    0% { transform: rotateZ(0deg) rotateY(0deg) rotateX(0deg); }
    100% { transform: rotateZ(360deg) rotateY(180deg) rotateX(180deg); }
}

@keyframes levelUp {
    0% { transform: scale(1) rotate(0deg); opacity: 1; }
    50% { transform: scale(1.2) rotate(180deg); opacity: 0.8; }
    100% { transform: scale(1) rotate(360deg); opacity: 1; }
}

h2 {
    color: #667eea;
    margin-bottom: 30px;
    text-align: center;
    font-size: 2em;
}

/* Oppimispolku */
.learning-path {
    margin: 20px 0;
}

.topic-tier {
    margin-bottom: 30px;
    padding: 20px;
    border-radius: 15px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px solid #dee2e6;
    position: relative;
}

.topic-tier.locked {
    opacity: 0.6;
    background: linear-gradient(135deg, #f1f3f4, #e8eaed);
}

.topic-tier h3 {
    margin: 0 0 10px 0;
    color: #343a40;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tier-requirement {
    color: #6c757d;
    font-style: italic;
    margin: 5px 0 15px 0;
    font-size: 0.9em;
}

/* Harjoituspolku */
.game-modes-path {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 20px 0;
}

.mode-step {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
}

.mode-step:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 20px;
    top: 100%;
    width: 2px;
    height: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    z-index: 1;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2em;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.mode-step.locked .step-number {
    background: #ccc;
}

.unlock-requirement {
    color: #6c757d;
    font-style: italic;
    font-size: 0.9em;
    margin: 10px 0;
}

.progress-indicator {
    margin: 10px 0;
}

.progress-indicator.hidden {
    display: none;
}

.progress-bar-mini {
    width: 100%;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-fill-mini {
    height: 100%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.8em;
    color: #6c757d;
}

.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.topic-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 20px;
    border-radius: 15px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topic-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.topic-icon {
    font-size: 2em;
    margin-bottom: 5px;
}

.topic-name {
    font-weight: bold;
    margin-bottom: 8px;
}

.topic-progress-bar {
    width: 80%;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 5px;
}

.topic-progress-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.topic-progress-text {
    font-size: 0.85em;
    font-weight: bold;
    opacity: 0.9;
}

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

.topic-btn:disabled {
    background: linear-gradient(135deg, #ccc, #999);
    cursor: not-allowed;
    opacity: 0.6;
}

.topic-btn:disabled:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.mode-card.locked {
    opacity: 0.6;
    background: #f8f9fa;
}

.mode-card.locked .mode-btn {
    background: #ccc;
    cursor: not-allowed;
}

.mode-card.available {
    opacity: 1;
}

.game-modes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.mode-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.mode-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
}

.learn-card {
    border-color: #4facfe;
}

.practice-card {
    border-color: #f093fb;
}

.choice-card {
    border-color: #4facfe;
}

.listen-card {
    border-color: #a8e6cf;
}

.mode-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.mode-card h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.4em;
    font-weight: bold;
}

.mode-card p {
    color: #666;
    margin-bottom: 20px;
    font-size: 1em;
    line-height: 1.4;
}

.features {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 25px;
}

.feature {
    background: #f8f9fa;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    color: #555;
}

.primary-btn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
    width: 100%;
}

.secondary-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
    width: 100%;
}

.third-btn {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(116, 185, 255, 0.3);
    width: 100%;
}

.fourth-btn {
    background: linear-gradient(135deg, #a8e6cf 0%, #00b894 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(168, 230, 207, 0.3);
    width: 100%;
}

.primary-btn:hover, .secondary-btn:hover, .third-btn:hover, .fourth-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.progress-info {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.progress-info h4 {
    color: #333;
    margin-bottom: 10px;
}

.progress-bar {
    background: #e9ecef;
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    width: 0;
    transition: width 0.8s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2s infinite;
}

.mastery-stats {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
}

.mastery-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
    text-align: center;
}

.mastery-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
    background: white;
    transition: all 0.3s ease;
    cursor: pointer;
}

.mastery-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.mastery-icon {
    font-size: 1.2em;
    margin-bottom: 4px;
}

.mastery-count {
    font-size: 1.1em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 2px;
}

.mastery-label {
    font-size: 0.75em;
    color: #666;
    font-weight: 500;
}

.word-mastery-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 10px;
    padding: 4px 8px;
    background: rgba(255,255,255,0.9);
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
}

.mastery-notification {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.mastery-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mastery-notification .mastery-icon {
    font-size: 2em;
}

.mastery-title {
    font-size: 1em;
    font-weight: bold;
    margin-bottom: 2px;
}

.mastery-word {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 2px;
}

.mastery-level {
    font-size: 0.9em;
    opacity: 0.9;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(79, 172, 254, 0.3); }
    50% { box-shadow: 0 0 30px rgba(79, 172, 254, 0.6); }
}

.game-area {
    text-align: center;
}

.word-display {
    margin-bottom: 40px;
}

.finnish-word {
    font-size: 2.5em;
    color: #333;
    margin-bottom: 20px;
    font-weight: bold;
}

.word-image {
    font-size: 5em;
    margin-bottom: 30px;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.word-image:hover {
    transform: scale(1.1) rotate(5deg);
}

.word-image.correct {
    animation: bounce 1s ease-out;
}

.word-image.incorrect {
    animation: shake 0.5s ease-out;
}

.input-area {
    margin-bottom: 30px;
}

.speak-btn {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
    border: none;
    padding: 20px 40px;
    border-radius: 50px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.speak-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.speak-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.speak-btn.listening {
    background: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
    animation: pulse 1s infinite;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
}

.speak-btn.processing {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: shimmer 1.5s infinite;
}

.speech-feedback {
    margin-top: 20px;
    font-size: 1.1em;
    color: #666;
    min-height: 30px;
    transition: all 0.3s ease;
}

.microphone-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    min-height: 80px;
}

.volume-bars {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 40px;
}

.volume-bar {
    width: 4px;
    height: 10px;
    background: #ddd;
    border-radius: 2px;
    transition: all 0.1s ease;
}

.volume-bar.active {
    background: linear-gradient(0deg, #4facfe 0%, #00f2fe 100%);
    animation: pulse-bar 0.3s ease-in-out infinite alternate;
}

@keyframes pulse-bar {
    0% { height: 10px; }
    100% { height: 30px; }
}

.microphone-icon {
    font-size: 2em;
    color: #667eea;
    animation: pulse 2s infinite;
}

.microphone-icon.listening {
    color: #ff6b6b;
    animation: pulse 0.5s infinite;
}

.speech-tip {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 8px;
    padding: 10px 15px;
    margin: 10px 0;
    font-size: 0.9em;
    color: #1976d2;
    text-align: center;
}

#answer-input {
    font-size: 1.5em;
    padding: 15px 25px;
    border: 3px solid #667eea;
    border-radius: 50px;
    width: 300px;
    max-width: 100%;
    margin-right: 10px;
    transition: all 0.3s ease;
}

#answer-input.correct {
    border-color: #28a745;
    background: #f8fff9;
    animation: pulse 0.6s ease-out;
}

#answer-input.incorrect {
    border-color: #dc3545;
    background: #fff8f8;
    animation: shake 0.5s ease-out;
}

#answer-input:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.submit-btn, .next-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.submit-btn:hover:not(:disabled), .next-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.feedback {
    font-size: 1.3em;
    margin: 20px 0;
    padding: 15px;
    border-radius: 10px;
    min-height: 60px;
}

.feedback.correct {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
    animation: bounce 0.6s ease-out;
}

.feedback.correct::before {
    content: '🎉';
    display: inline-block;
    margin-right: 10px;
    animation: confetti 1s ease-out;
}

.feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
    animation: shake 0.5s ease-out;
}

.feedback.incorrect::before {
    content: '💪';
    display: inline-block;
    margin-right: 10px;
}

/* Paranneltu opetusmoodi */
.learn-content {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.word-showcase {
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 40px;
    text-align: center;
    color: white;
}

.word-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 30px;
    backdrop-filter: blur(10px);
}

.english-word-large {
    font-size: 3em;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.pronunciation-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.listen-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.listen-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.phonetic {
    font-size: 1.3em;
    font-style: italic;
    opacity: 0.9;
}

.learning-activities {
    padding: 30px;
}

.activity-section {
    margin-bottom: 30px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 15px;
    border-left: 5px solid #667eea;
}

.activity-section h4 {
    margin: 0 0 15px 0;
    color: #343a40;
    font-size: 1.2em;
}

.example-sentence {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
}

.sentence-text {
    font-size: 1.1em;
    margin-bottom: 15px;
    font-style: italic;
    color: #495057;
}

.sentence-audio-btn, .practice-pronunciation-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
}

.sentence-audio-btn:hover, .practice-pronunciation-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.pronunciation-practice {
    text-align: center;
}

.pronunciation-feedback {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
}

.pronunciation-feedback.correct {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.pronunciation-feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.memory-aid {
    background: linear-gradient(135deg, #ffeaa7, #fab1a0);
    padding: 20px;
    border-radius: 10px;
    font-size: 1.1em;
    color: #2d3436;
    text-align: center;
}

.learn-actions {
    padding: 30px;
    display: flex;
    gap: 20px;
    justify-content: center;
    background: #f8f9fa;
}

.got-it-btn, .repeat-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.got-it-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.repeat-btn {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
}

.got-it-btn:hover, .repeat-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.pronunciation {
    margin-bottom: 30px;
}

.listen-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin-bottom: 15px;
}

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

.listen-btn.playing {
    animation: pulse 0.5s infinite alternate;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.listen-btn.playing::before {
    content: '🔊';
    display: inline-block;
    margin-right: 8px;
    animation: bounce 1s infinite;
}

.phonetic {
    font-size: 1.5em;
    color: #666;
    font-family: 'Courier New', monospace;
    margin-bottom: 10px;
}

.word-info {
    margin-bottom: 30px;
}

.english-word {
    font-size: 3em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.learn-tip {
    background: #e7f3ff;
    padding: 15px;
    border-radius: 10px;
    color: #0066cc;
    font-style: italic;
    margin-bottom: 20px;
}

.got-it-btn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.got-it-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.practice-mode-selector {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 30px;
    background: #f8f9fa;
    border-radius: 50px;
    padding: 5px;
    max-width: 300px;
    margin: 0 auto 30px;
}

.mode-toggle {
    background: transparent;
    color: #666;
    border: none;
    padding: 12px 25px;
    border-radius: 50px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.mode-toggle.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.practice-method {
    text-align: center;
}

.choices {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    max-width: 500px;
    margin: 0 auto;
}

.choice-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 20px;
    border-radius: 15px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.choice-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.choice-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.choice-btn.correct {
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    animation: bounce 0.6s ease-out;
}

.choice-btn.incorrect {
    background: linear-gradient(135deg, #e17055 0%, #d63031 100%);
    animation: shake 0.5s ease-out;
}

.listen-controls {
    text-align: center;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
}

.listen-word-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin-bottom: 15px;
}

.listen-word-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.listen-word-btn.playing {
    animation: pulse 0.5s infinite alternate;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.listen-hint {
    font-size: 0.95em;
    color: #666;
    font-style: italic;
    margin-top: 10px;
}

#choice-area .choices, #listen-area .choices {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    max-width: 600px;
    margin: 0 auto;
}

#choice-area .choice-btn, #listen-area .choice-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 20px 15px;
    border-radius: 15px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.3;
}

#choice-area .choice-btn:hover, #listen-area .choice-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.back-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.back-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.results {
    text-align: center;
    padding: 20px;
}

.final-score {
    font-size: 2em;
    color: #667eea;
    margin-bottom: 20px;
    font-weight: bold;
}

.message {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 20px;
}

.star-rating {
    font-size: 3em;
    margin-bottom: 30px;
}

.play-again-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 1.3em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin-bottom: 10px;
}

.play-again-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Tabletti-responsive (601px - 900px) */
@media (min-width: 601px) and (max-width: 900px) {
    .game-container {
        max-width: 700px;
        margin: 10px;
    }
    
    h1 {
        font-size: 2.2em;
    }
    
    .topic-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .topic-btn {
        padding: 15px;
        font-size: 1em;
    }
    
    .finnish-word {
        font-size: 2.2em;
    }
    
    .word-image {
        font-size: 4.5em;
    }
    
    .english-word {
        font-size: 2.8em;
    }
    
    .microphone-visual {
        padding: 15px;
        min-height: 70px;
    }
    
    .volume-bars {
        height: 35px;
    }
}

/* Mobiili-responsive (max-width: 600px) */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    
    .game-container {
        margin: 5px;
        min-height: auto;
        border-radius: 15px;
    }
    
    header {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.8em;
        margin-bottom: 8px;
    }
    
    .score-board {
        gap: 15px;
        font-size: 1em;
        flex-direction: row;
        justify-content: space-around;
    }
    
    .screen {
        padding: 20px;
    }
    
    h2 {
        font-size: 1.6em;
        margin-bottom: 20px;
    }
    
    .topic-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .topic-btn {
        padding: 15px 10px;
        font-size: 0.9em;
    }
    
    .game-modes {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .mode-card {
        padding: 20px 15px;
    }
    
    .mode-card h3 {
        font-size: 1.2em;
    }
    
    .mode-card p {
        font-size: 0.9em;
    }
    
    .features {
        gap: 6px;
    }
    
    .feature {
        font-size: 0.8em;
        padding: 6px 12px;
    }
    
    .finnish-word {
        font-size: 2em;
        margin-bottom: 15px;
    }
    
    .word-image {
        font-size: 4em;
        margin-bottom: 25px;
    }
    
    .english-word {
        font-size: 2.5em;
    }
    
    .choices {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .choice-btn {
        padding: 15px;
        font-size: 1.1em;
    }
    
    #answer-input {
        width: 100%;
        margin-right: 0;
        margin-bottom: 15px;
        font-size: 1.3em;
        padding: 12px 20px;
    }
    
    .submit-btn, .next-btn {
        width: 100%;
        padding: 12px 25px;
        font-size: 1.1em;
    }
    
    .practice-mode-selector {
        max-width: 250px;
        margin-bottom: 20px;
    }
    
    .mode-toggle {
        padding: 10px 20px;
        font-size: 0.9em;
    }
    
    .speak-btn {
        padding: 15px 30px;
        font-size: 1.1em;
        width: 100%;
        max-width: 300px;
    }
    
    .microphone-visual {
        padding: 15px;
        min-height: 60px;
        margin: 15px 0;
    }
    
    .volume-bars {
        height: 30px;
    }
    
    .microphone-icon {
        font-size: 1.5em;
    }
    
    .speech-feedback {
        font-size: 1em;
        margin-top: 15px;
    }
    
    .speech-tip {
        font-size: 0.85em;
        padding: 8px 12px;
        margin: 8px 0;
    }
    
    .feedback {
        font-size: 1.1em;
        padding: 12px;
        min-height: 50px;
        margin: 15px 0;
    }
    
    .learn-content {
        max-width: 100%;
    }
    
    .pronunciation {
        margin-bottom: 20px;
    }
    
    .listen-btn {
        padding: 12px 25px;
        font-size: 1.1em;
        margin-bottom: 12px;
    }
    
    .phonetic {
        font-size: 1.3em;
    }
    
    .learn-tip {
        font-size: 0.9em;
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .got-it-btn {
        padding: 12px 30px;
        font-size: 1.1em;
        width: 100%;
        max-width: 250px;
    }
    
    .back-btn {
        padding: 8px 15px;
        font-size: 0.9em;
        margin-top: 15px;
    }
    
    .progress-info {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .progress-info h4 {
        font-size: 1em;
        margin-bottom: 8px;
    }
    
    .progress-bar {
        height: 16px;
    }
    
    .results {
        padding: 15px;
    }
    
    .final-score {
        font-size: 1.6em;
        margin-bottom: 15px;
    }
    
    .message {
        font-size: 1.1em;
        margin-bottom: 15px;
        line-height: 1.4;
    }
    
    .star-rating {
        font-size: 2.5em;
        margin-bottom: 20px;
    }
    
    .play-again-btn {
        padding: 12px 30px;
        font-size: 1.2em;
        margin-bottom: 8px;
        width: 100%;
        max-width: 250px;
    }
}

/* Pienet näytöt (max-width: 400px) */
@media (max-width: 400px) {
    .game-container {
        margin: 2px;
        border-radius: 10px;
    }
    
    .screen {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.6em;
    }
    
    h2 {
        font-size: 1.4em;
    }
    
    .topic-btn {
        padding: 12px 8px;
        font-size: 0.85em;
    }
    
    .finnish-word {
        font-size: 1.8em;
    }
    
    .word-image {
        font-size: 3.5em;
    }
    
    .english-word {
        font-size: 2.2em;
    }
    
    #answer-input {
        font-size: 1.2em;
        padding: 10px 15px;
    }
    
    .feedback {
        font-size: 1em;
        padding: 10px;
    }
    
    .mode-card {
        padding: 15px 12px;
    }
    
    .speak-btn {
        padding: 12px 20px;
        font-size: 1em;
    }
}

/* Landscape-mobiili */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
    body {
        padding: 5px;
    }
    
    .game-container {
        min-height: auto;
        max-height: 95vh;
        overflow-y: auto;
    }
    
    header {
        padding: 10px 20px;
    }
    
    h1 {
        font-size: 1.5em;
        margin-bottom: 5px;
    }
    
    .score-board {
        font-size: 0.9em;
    }
    
    .screen {
        padding: 15px 20px;
    }
    
    h2 {
        font-size: 1.4em;
        margin-bottom: 15px;
    }
    
    .finnish-word {
        font-size: 1.8em;
        margin-bottom: 10px;
    }
    
    .word-image {
        font-size: 3em;
        margin-bottom: 20px;
    }
    
    .topic-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    
    .topic-btn {
        padding: 10px;
        font-size: 0.85em;
    }
    
    .game-modes {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .mode-card {
        padding: 15px;
    }
    
    .microphone-visual {
        min-height: 50px;
        padding: 10px;
    }
    
    .feedback {
        min-height: 40px;
        font-size: 1em;
        margin: 10px 0;
    }
    
    /* Breadcrumb mobile adjustments */
    .breadcrumb {
        font-size: 12px;
        padding: 10px 15px;
        margin-bottom: 15px;
        flex-wrap: wrap;
    }
    
    .breadcrumb-separator {
        margin: 0 6px;
    }
    
    .game-navigation {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .results-navigation {
        gap: 12px;
    }
    
    .home-btn, .back-btn {
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* Exam creation styles */
.custom-exam-section {
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    text-align: center;
    color: white;
}

.exam-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.exam-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.exam-description {
    margin: 15px 0 0 0;
    font-size: 14px;
    opacity: 0.9;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #eee;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 20px 20px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.close {
    color: rgba(255, 255, 255, 0.8);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: white;
}

.modal-body {
    padding: 30px;
}

.exam-step {
    text-align: center;
}

.exam-step h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 18px;
}

.exam-step p {
    color: #666;
    margin-bottom: 25px;
    line-height: 1.6;
}

.camera-container {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

.camera-btn, .upload-btn, .analyze-btn, .create-exam-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.camera-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.upload-btn {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.analyze-btn {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
    margin-top: 15px;
}

.create-exam-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    width: 100%;
    margin-top: 20px;
}

.camera-btn:hover, .upload-btn:hover, .analyze-btn:hover, .create-exam-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.image-preview {
    margin-top: 20px;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.words-list {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
    max-height: 300px;
    overflow-y: auto;
}

.word-pair {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.word-pair:last-child {
    margin-bottom: 0;
}

.word-english {
    font-weight: 600;
    color: #333;
}

.word-finnish {
    color: #666;
}

.word-pair .remove-word {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.word-pair .remove-word:hover {
    background: #c0392b;
}

.exam-options {
    text-align: left;
}

.exam-options label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.exam-options input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 15px;
    box-sizing: border-box;
}

.exam-options input:focus {
    border-color: #667eea;
    outline: none;
}

/* Manual input fallback */
.manual-input-section {
    text-align: center;
    padding: 20px;
}

.manual-input-section h4 {
    color: #e67e22;
    margin-bottom: 15px;
}

.manual-input-section p {
    color: #666;
    margin-bottom: 20px;
}

.manual-input-section textarea {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.manual-input-section textarea:focus {
    border-color: #667eea;
    outline: none;
}

.manual-input-section .analyze-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.manual-input-section .analyze-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

/* Breadcrumb navigation */
.breadcrumb {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    font-size: 14px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.breadcrumb-item {
    color: rgba(255, 255, 255, 0.8);
    transition: color 0.3s ease;
}

.breadcrumb-item.current {
    color: white;
    font-weight: 600;
}

.breadcrumb-item.clickable {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: all 0.3s ease;
}

.breadcrumb-item.clickable:hover {
    color: white;
    text-decoration-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
}

.breadcrumb-separator {
    margin: 0 12px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 300;
}

/* Enhanced navigation */
.game-navigation {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.results-navigation {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
    align-items: center;
}

.home-btn {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.home-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.4);
}

.try-different-btn {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
    justify-content: center;
}

.try-different-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.4);
}

/* Enhanced back button */
.back-btn {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(149, 165, 166, 0.4);
    background: linear-gradient(135deg, #7f8c8d, #95a5a6);
}