:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #ec4899;
    --bg-dark: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.15), transparent 25%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    overflow-x: hidden;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

header h1 {
    font-size: 1.8rem;
    background: linear-gradient(to right, #818cf8, #f472b6);
    -webkit-background-clip: text;
    color: transparent;
    font-weight: 800;
}

/* Buttons */
button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

button:disabled {
    background: #334155;
    color: #64748b;
    cursor: not-allowed;
}

input {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s;
}

input:focus {
    border-color: var(--primary);
}

/* Topic Plaza */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.topic-card {
    cursor: pointer;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.topic-card:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.2);
}

.topic-card.selected {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
}

.topic-card h3 {
    margin-bottom: 0.5rem;
    color: #f1f5f9;
}

.topic-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Video Section */
#learning-area {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.video-wrapper {
    flex: 2;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

video {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* Interactive Test Area */
.practice-section {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.mic-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    border: 2px solid var(--primary);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
    margin: 1rem auto;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.mic-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.5);
    transform: scale(1.05);
}

.mic-btn:active {
    transform: scale(0.95);
}

.mic-btn.recording {
    border-color: var(--secondary);
    background: rgba(236, 72, 153, 0.1);
    animation: pulseRecording 1.5s infinite;
}

@keyframes pulseRecording {
    0% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.6); }
    70% { box-shadow: 0 0 0 25px rgba(236, 72, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0); }
}

/* Dashboard */
.dashboard {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
}

.stat-card {
    flex: 1;
    padding: 1.5rem;
    text-align: center;
}

.stat-card h2 {
    font-size: 2.5rem;
    background: linear-gradient(to right, #34d399, #10b981);
    -webkit-background-clip: text;
    color: transparent;
    margin: 1rem 0;
}

.achievements {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    font-size: 0.9rem;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    cursor: default;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.badge::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    color: #f8fafc;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    border: 1px solid rgba(255,255,255,0.1);
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.badge:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.badge.unlocked {
    background: rgba(252, 211, 77, 0.2);
    border-color: #fbbf24;
    color: #fbbf24;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}