:root {
    /* Premium Color Palette */
    --bg-dark: #020617;
    --card-bg: rgba(15, 23, 42, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    /* Vibrant Accents */
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary: #ec4899;
    --secondary-glow: rgba(236, 72, 153, 0.4);
    
    --success: #10b981;
    --error: #f43f5e;
    --warning: #f59e0b;
    
    --gradient-main: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
    --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    padding: 20px;
}

/* Dynamic Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: 
        radial-gradient(circle at 15% 20%, var(--primary-glow) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, var(--secondary-glow) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(168, 85, 247, 0.05) 0%, transparent 60%);
    z-index: -1;
    animation: bgPulse 15s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

.app-container {
    width: 100%;
    max-width: 650px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    z-index: 10;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 8px;
}

header h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px var(--primary-glow));
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
}

/* Glassmorphism Controls */
.controls {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 28px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: var(--glass-shadow);
}

select {
    width: 100%;
    padding: 14px 18px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    cursor: pointer;
    appearance: none;
    transition: all 0.3s;
}

select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.mode-selector {
    display: flex;
    background: rgba(2, 6, 23, 0.4);
    border-radius: 16px;
    padding: 6px;
    border: 1px solid var(--card-border);
}

.tab-btn {
    flex: 1;
    padding: 12px 0;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

/* Progress */
.progress-container {
    margin-top: 4px;
}

.progress-stats {
    display: flex;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--gradient-main);
    width: 0%;
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Views Transitions */
.view-section {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.view-section.active {
    display: flex;
    flex-direction: column;
    gap: 20px;
    opacity: 1;
    transform: translateY(0);
}

/* Flashcard 3D */
.flashcard-container {
    perspective: 2000px;
    min-height: 320px;
}

.flashcard {
    width: 100%;
    height: 320px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.flashcard.flipped { transform: rotateY(180deg); }

.flashcard-front, .flashcard-back {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    border-radius: 32px;
    background: var(--gradient-glass);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--card-border);
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
}

.flashcard-back {
    transform: rotateY(180deg);
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.98));
}

.category-badge {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.08);
    padding: 6px 16px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.word {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.1;
}

.translation {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--success), #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 30px;
}

.btn-icon {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.3);
    width: 56px;
    height: 56px;
    border-radius: 18px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 10px 20px var(--primary-glow);
}

.instruction {
    position: absolute;
    bottom: 24px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-style: italic;
    opacity: 0.6;
}

/* Buttons System */
.action-buttons {
    display: flex;
    gap: 16px;
    width: 100%;
}

.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 18px;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-warning { flex: 1; background: rgba(245, 158, 11, 0.1); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.btn-success { flex: 1; background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 8px 16px var(--primary-glow); }

.btn:hover {
    transform: translateY(-4px);
    filter: brightness(1.1);
}

.navigation-buttons {
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
}

.navigation-buttons button {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.3s;
}

.navigation-buttons button:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
}

.navigation-buttons button:disabled { opacity: 0.2; transform: none; cursor: not-allowed; }

/* Test Card */
.test-card {
    background: var(--card-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--card-border);
    border-radius: 32px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    box-shadow: var(--glass-shadow);
    min-height: 450px;
}

.btn-giant-icon {
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 6rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 0 15px var(--primary-glow));
}

.btn-giant-icon:hover { transform: scale(1.15) rotate(5deg); }

.hint-container {
    background: rgba(2, 6, 23, 0.4);
    padding: 20px;
    border-radius: 20px;
    width: 100%;
    border: 1px solid var(--card-border);
}

.test-meaning { font-size: 1.6rem; color: var(--success); font-weight: 700; text-align: center; }

/* Input Styling */
.modern-input {
    width: 100%;
    background: rgba(2, 6, 23, 0.6);
    border: 2px solid var(--card-border);
    border-radius: 18px;
    padding: 18px;
    font-size: 1.4rem;
    font-weight: 600;
    color: white;
    outline: none;
    transition: 0.3s;
    text-align: center;
}

.modern-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
}

/* MCQ Grid */
.mcq-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.mcq-btn {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 18px;
    border-radius: 18px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mcq-btn:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.mcq-btn.selected-success {
    background: var(--success);
    border-color: var(--success);
    color: white;
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.3);
}

.mcq-btn.selected-error {
    background: var(--error);
    border-color: var(--error);
    color: white;
    animation: shake 0.5s;
}

/* Celebration */
.celebration {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(2, 6, 23, 0.9);
    backdrop-filter: blur(15px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.trophy-icon {
    font-size: 8rem;
    background: linear-gradient(to bottom, #fde047, #eab308);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 20px rgba(234, 179, 8, 0.4));
    margin-bottom: 20px;
}

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

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 600px) {
    .word { font-size: 2.5rem; }
    header h1 { font-size: 2.2rem; }
    .mcq-grid { grid-template-columns: 1fr; }
    .flashcard { height: 280px; }
}
