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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #fff;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 15px;
}

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

.score-display .correct { color: #4ade80; }
.score-display .incorrect { color: #f87171; }
.score-display .streak { color: #fbbf24; }

.card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 25px;
    backdrop-filter: blur(10px);
    margin-bottom: 20px;
}

.card h2 {
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.language-selector label {
    font-weight: 600;
    color: #94a3b8;
}

.language-select {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.language-select:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

.language-select:focus {
    outline: none;
    border-color: #60a5fa;
}

.hint {
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

textarea {
    width: 100%;
    height: 200px;
    padding: 15px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 15px;
}

textarea:focus {
    outline: none;
    border-color: #60a5fa;
}

.button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 15px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.btn.primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.25);
}

.hidden { display: none !important; }

/* Quiz Section */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.quiz-options label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.9rem;
}

.question-area {
    text-align: center;
    margin-bottom: 25px;
}

.question-area .label {
    color: #94a3b8;
    margin-bottom: 10px;
}

.word-display {
    font-size: 2.5rem;
    color: #fbbf24;
    margin: 15px 0;
}

.hint-area {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 8px;
    padding: 10px 15px;
    margin-top: 15px;
}

.hint-area p {
    color: #fbbf24;
    font-size: 0.95rem;
}

.answer-area {
    margin-bottom: 15px;
}

#answer-input {
    width: 100%;
    padding: 15px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 1.3rem;
    text-align: center;
    cursor: text;
}

#answer-input:focus {
    outline: none;
    border-color: #60a5fa;
}

#answer-input[readonly] {
    cursor: text;
    opacity: 1;
}

.feedback {
    margin-top: 15px;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-size: 1.1rem;
}

.feedback.correct {
    background: rgba(74, 222, 128, 0.2);
    border: 1px solid #4ade80;
    color: #4ade80;
}

.feedback.incorrect {
    background: rgba(248, 113, 113, 0.2);
    border: 1px solid #f87171;
    color: #f87171;
}


/* Keyboard */
.keyboard {
    margin: 20px 0;
    user-select: none;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 5px;
}

.key {
    min-width: 40px;
    height: 50px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.1s;
    text-transform: lowercase;
}

.key:hover {
    background: rgba(255, 255, 255, 0.25);
}

.key:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.35);
}

.key.special {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    font-weight: bold;
    min-width: 50px;
}

.key.special:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.key.shift {
    min-width: 60px;
    background: rgba(96, 165, 250, 0.3);
}

.key.shift.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.key.backspace {
    min-width: 60px;
    background: rgba(248, 113, 113, 0.3);
}

.key.space {
    flex: 1;
    max-width: 250px;
}

/* Stats Section */
#stats-list {
    max-height: 400px;
    overflow-y: auto;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin-bottom: 8px;
}

.stat-item .words {
    flex: 1;
}

.stat-item .english {
    color: #94a3b8;
    font-size: 0.9rem;
}

.stat-item .german {
    color: #fff;
    font-weight: 600;
}

.stat-item .stats {
    display: flex;
    gap: 15px;
    align-items: center;
}

.stat-item .correct-stat { color: #4ade80; }
.stat-item .incorrect-stat { color: #f87171; }

.stat-item .accuracy {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.stat-item .accuracy.high { background: rgba(74, 222, 128, 0.3); color: #4ade80; }
.stat-item .accuracy.medium { background: rgba(251, 191, 36, 0.3); color: #fbbf24; }
.stat-item .accuracy.low { background: rgba(248, 113, 113, 0.3); color: #f87171; }

/* Results */
.results-summary {
    text-align: center;
    font-size: 1.3rem;
    margin: 20px 0;
}

.results-summary p {
    margin: 10px 0;
}

/* Responsive */
@media (max-width: 600px) {
    .container { padding: 10px; }
    header h1 { font-size: 1.4rem; }
    .word-display { font-size: 2rem; }
    .key { min-width: 30px; height: 45px; font-size: 1rem; }
    .key.special { min-width: 40px; }
    .key.shift, .key.backspace { min-width: 45px; }
}


/* Testle Mode */
.testle-btn {
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
}

.testle-btn:hover {
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4) !important;
}

.testle-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 20px 0;
}

.testle-row {
    display: flex;
    gap: 6px;
}

.testle-cell {
    width: 48px;
    height: 52px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.testle-cell.filled {
    border-color: rgba(255, 255, 255, 0.5);
    animation: pop 0.1s ease;
}

.testle-cell.correct {
    background: #22c55e;
    border-color: #22c55e;
    color: #fff;
}

.testle-cell.present {
    background: #eab308;
    border-color: #eab308;
    color: #fff;
}

.testle-cell.absent {
    background: #52525b;
    border-color: #52525b;
    color: #fff;
}

.testle-cell.reveal {
    animation: flip 0.5s ease forwards;
}

@keyframes pop {
    50% { transform: scale(1.1); }
}

@keyframes flip {
    0% { transform: rotateX(0); }
    50% { transform: rotateX(90deg); }
    100% { transform: rotateX(0); }
}

.testle-message {
    text-align: center;
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.testle-message.win {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid #22c55e;
    color: #22c55e;
}

.testle-message.lose {
    background: rgba(248, 113, 113, 0.2);
    border: 1px solid #f87171;
    color: #f87171;
}

/* Testle keyboard colors */
#testle-keyboard .key.correct-key {
    background: #22c55e !important;
}

#testle-keyboard .key.present-key {
    background: #eab308 !important;
}

#testle-keyboard .key.absent-key {
    background: #52525b !important;
}

#testle-keyboard .key.enter {
    min-width: 70px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

#quiz-keyboard .key.enter {
    min-width: 70px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

/* Responsive testle */
@media (max-width: 600px) {
    .testle-cell {
        width: 38px;
        height: 42px;
        font-size: 1.2rem;
    }
}

@media (max-width: 400px) {
    .testle-cell {
        width: 32px;
        height: 36px;
        font-size: 1rem;
    }
}


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


.key.hyphen {
    background: rgba(148, 163, 184, 0.3);
    font-weight: bold;
}

/* Dialog Overlay */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.dialog {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dialog-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.btn-close {
    background: rgba(248, 113, 113, 0.2);
    border: none;
    color: #f87171;
    font-size: 1.5rem;
    width: 35px;
    height: 35px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    background: rgba(248, 113, 113, 0.3);
}

.dialog-body {
    padding: 20px 25px;
    overflow-y: auto;
    flex: 1;
}

.dialog-footer {
    padding: 15px 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.dialog-footer-buttons {
    justify-content: center;
}

.dialog-small {
    max-width: 500px;
}

.confirm-message {
    text-align: center;
    color: #e2e8f0;
    font-size: 1rem;
    line-height: 1.6;
}

.dialog-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.storage-info {
    color: #94a3b8;
    font-size: 0.85rem;
    flex: 1;
}

/* Saved Test Items */
.saved-test-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.saved-test-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.test-info {
    flex: 1;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.2s;
}

.test-info:hover {
    background: rgba(255, 255, 255, 0.05);
}

.test-name {
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.test-meta {
    font-size: 0.85rem;
    color: #94a3b8;
}

.test-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-icon {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.1);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.btn-icon.delete-btn:hover {
    background: rgba(248, 113, 113, 0.3);
}

.btn-small {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.load-btn {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
}

.load-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.no-tests {
    text-align: center;
    color: #94a3b8;
    padding: 40px 20px;
    font-size: 1rem;
}

/* Export/Import Textarea */
.export-textarea {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
    resize: vertical;
    margin-top: 10px;
}

.export-textarea:focus {
    outline: none;
    border-color: #60a5fa;
}

.export-textarea::placeholder {
    color: #64748b;
}

/* Responsive Dialog */
@media (max-width: 600px) {
    .dialog {
        width: 95%;
        max-height: 90vh;
    }
    
    .dialog-header, .dialog-body, .dialog-footer {
        padding: 15px;
    }
    
    .dialog-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .dialog-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .dialog-actions button {
        flex: 1;
    }
    
    .storage-info {
        text-align: center;
        width: 100%;
    }
    
    /* Saved test items on mobile */
    .saved-test-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .test-info {
        width: 100%;
    }
    
    .test-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .btn-icon {
        flex: 0 0 auto;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .load-btn {
        flex: 1 1 100%;
        margin-top: 8px;
    }
}

/* Language Flag Indicator */
.language-flag {
    font-size: 1.3rem;
    margin-right: 8px;
    display: inline-block;
    vertical-align: middle;
}
