:root {
    --bg-grad-1: #0f172a;
    --bg-grad-2: #1e1b4b;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --correct: #10b981;
    --incorrect: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: linear-gradient(135deg, var(--bg-grad-1), var(--bg-grad-2));
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    overflow-x: hidden;
}

/* Global Navigation Header */
.app-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 2.5rem;
    background: rgba(15, 23, 42, 0.4);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.logo {
    font-weight: 800;
    font-size: 1.8rem;
    letter-spacing: -0.05em;
    background: linear-gradient(to right, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.action-buttons-group {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

/* Page Containers */
.page-container {
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
    padding: 2.5rem 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.study-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.hidden {
    display: none !important;
}

.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--glass-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

main {
    width: 100%;
    max-width: 600px;
}

.icon-btn {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.icon-btn:hover { 
    background: rgba(255,255,255,0.2); 
    transform: translateY(-2px);
}

.progress {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.card-container {
    perspective: 1000px;
}

.card-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.infinitive-label {
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-align: center;
    font-weight: 600;
}

.infinitive-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

#infinitive-display {
    font-size: 3.5rem;
    font-weight: 800;
    text-align: center;
    color: #fff;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.btn-speak {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 3.5rem;
    height: 3.5rem;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.btn-speak:hover { 
    background: rgba(139, 92, 246, 0.3); 
    border-color: var(--accent);
    transform: scale(1.1);
}

.inputs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.full-width {
    grid-column: 1 / -1;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 1rem;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    color: white;
    font-size: 1.1rem;
    outline: none;
    transition: all 0.3s ease;
}

.input-group select {
    appearance: none;
    cursor: pointer;
}

.input-group select option {
    background: var(--bg-grad-1);
    color: white;
}

.input-group input:focus,
.input-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2);
}

.input-group input.valid,
.input-group select.valid {
    border-color: var(--correct) !important;
    background: rgba(16, 185, 129, 0.1) !important;
    color: var(--correct);
}

.input-group input.invalid,
.input-group select.invalid {
    border-color: var(--incorrect) !important;
    background: rgba(239, 68, 68, 0.1) !important;
    color: #fca5a5;
}

/* Meaning Highlight specific styles */
.meaning-highlight select {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2));
    border: 2px solid var(--accent);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
}
.meaning-highlight label {
    color: #f472b6;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.actions {
    display: flex;
    gap: 1rem;
}

.btn {
    flex: 1;
    padding: 1.2rem;
    border-radius: 14px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.btn.primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 10px 20px -10px var(--accent);
}

.btn.primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -10px var(--accent);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--glass-border);
}

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

/* Result Overlay */
.result-overlay {
    margin-top: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
    animation: fadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-header {
    font-size: 1.1rem;
    color: #fff;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
    text-align: center;
}

.reveal-badges-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.reveal-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0,0,0,0.25);
    padding: 1.2rem;
    border-radius: 18px;
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
}

.reveal-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.correct-badge {
    font-weight: 800;
    font-size: 1.3rem;
}

.meaning-highlight-reveal {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(236, 72, 153, 0.25));
    border: 2px solid var(--accent);
    padding: 1.8rem;
    box-shadow: 0 10px 30px -10px rgba(139, 92, 246, 0.5);
}

.meaning-highlight-reveal .reveal-label {
    color: #fbcfe8;
}

#correct-past { color: #818cf8; text-shadow: 0 0 10px rgba(129, 140, 248, 0.3); }
#correct-participle { color: #f472b6; text-shadow: 0 0 10px rgba(244, 114, 182, 0.3); }
#correct-meaning { 
    color: #fff; 
    font-size: 1.8rem;
    text-shadow: 0 2px 12px rgba(0,0,0,0.6);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}
.modal-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.modal-content {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    width: 90%;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.4s ease;
}

.modal-content h2 {
    color: white;
    margin-bottom: 0.5rem;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.group-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.chart-container {
    background: rgba(0,0,0,0.2);
    border-radius: 16px;
    padding: 1.5rem;
    height: 300px;
    display: flex;
    justify-content: center;
}

.add-input-group {
    text-align: left;
    margin-bottom: 1rem;
}
.add-input-group label {
    margin-bottom: 0.2rem;
}

.stats-table {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    background: rgba(255,255,255,0.05);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.05);
}

.stat-row-detailed {
    flex-direction: column;
    justify-content: flex-start;
}
.stat-main {
    display: flex;
    justify-content: space-between;
    width: 100%;
}
.error-breakdown {
    font-size: 0.85rem;
    color: #fca5a5;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed rgba(255,255,255,0.1);
    font-weight: 600;
}

.stat-row .word { font-weight: bold; color: white;}
.stat-row .hits { color: var(--correct); }
.stat-row .misses { color: var(--incorrect); }

.app-footer {
    width: 100%;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 1rem 1rem 2rem 1rem;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-top: auto;
}
.app-footer a {
    color: #e879f9;
    font-weight: 800;
    text-decoration: none;
    transition: color 0.2s;
}
.app-footer a:hover {
    color: #f472b6;
    text-decoration: underline;
}

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

@media (max-width: 600px) {
    .app-header {
        flex-direction: row; 
        justify-content: space-between;
        padding: 1rem;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    .action-buttons-group {
        justify-content: flex-end;
        gap: 0.4rem;
    }
    .btn-text {
        display: none;
    }
    .logo {
        font-size: 1.5rem;
    }
    .icon-btn {
        padding: 0.7rem;
        font-size: 1.2rem;
        border-radius: 12px;
    }
    
    .page-container {
        padding: 1.5rem 1rem;
        justify-content: flex-start;
    }
    
    #progress {
        padding-bottom: 0.5rem;
    }
    .card-glass {
        border-radius: 30px 30px 0 0;
        border-left: none; border-right: none; border-bottom: none;
        flex-grow: 1;
        padding: 2rem 1.5rem 8rem 1.5rem;
        display: flex;
        flex-direction: column;
    }
    .inputs-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
    .group-grid {
        grid-template-columns: 1fr;
    }
    #infinitive-display {
        font-size: 3rem;
    }
    .header-top {
        flex-direction: column;
        gap: 1rem;
    }
    .actions {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        padding: 1.5rem;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
        z-index: 50;
    }
    .result-overlay {
        margin-top: auto;
    }
    .modal-content {
        padding: 1.5rem;
        width: 95%;
    }
    .app-footer {
        padding-bottom: 8rem;
    }
}
