/* ====== MODERN & LIVELY DESIGN ====== */
:root {
    --primary: #4361ee;
    --secondary: #3a0ca3;
    --accent: #f72585;
    --success: #4cc9f0;
    --warning: #f8961e;
    --danger: #e63946;
    --dark: #1a1a2e;
    --light: #f8f9fa;
    --math: #7209b7;
    --survey: #38b000;
    --transpo: #ff9e00;
    --construction: #3a86ff;
    --health: #06d6a0;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    color: var(--light);
    overflow-x: hidden;
    position: relative;
}

#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

#particles-js canvas {
    pointer-events: none;
}

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

/* ====== ANIMATIONS ====== */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ====== NAVIGATION ====== */
.navbar {
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    border-bottom: 2px solid rgba(67, 97, 238, 0.3);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.logo {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    color: var(--accent);
}

.logo span {
    color: var(--success);
    background: linear-gradient(45deg, var(--success), var(--primary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: rgba(67, 97, 238, 0.2);
    color: white;
    transform: translateY(-2px);
}

.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-login {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(67, 97, 238, 0.3);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--success);
}

.progress-ring {
    position: relative;
    width: 40px;
    height: 40px;
}

.progress-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7rem;
    font-weight: bold;
}

.menu-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* ====== HERO SECTION ====== */
.hero {
    padding: 10rem 0 6rem;
    position: relative;
    overflow: hidden;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.gradient-text {
    background: linear-gradient(45deg, var(--accent), var(--success), var(--primary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% 200%;
    animation: gradient 3s ease infinite;
}

.hero h1 {
    font-size: 3.5rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.tagline {
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 3rem;
}

.hero-stats {
    display: flex;
    gap: 3rem;
    margin-bottom: 3rem;
}

.stat {
    text-align: center;
}

.stat i {
    font-size: 2rem;
    color: var(--success);
    margin-bottom: 0.5rem;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(45deg, var(--accent), var(--primary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
}

.btn {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    padding: 0.9rem 1.25rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    line-height: 1;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    user-select: none;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.35);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #ff4081);
    color: white;
    padding: 0.95rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    text-decoration: none;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(247, 37, 133, 0.35);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    color: white;
    padding: 0.95rem 1.5rem;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: translateY(-2px);
}

.btn-danger {
    background: rgba(247, 37, 133, 0.15);
    color: white;
    border: 1px solid rgba(247, 37, 133, 0.35);
}

.btn-danger:hover {
    background: rgba(247, 37, 133, 0.22);
    transform: translateY(-2px);
}

.btn-hint,
.btn-skip,
.btn-submit,
.btn-next,
.btn-admin {
    appearance: none;
    -webkit-appearance: none;
    border-radius: 999px;
    padding: 0.85rem 1.1rem;
    font-weight: 800;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
    color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
}

.btn-hint:hover,
.btn-skip:hover,
.btn-submit:hover,
.btn-next:hover,
.btn-admin:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.14);
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.22);
}

.btn-submit {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-color: rgba(67, 97, 238, 0.35);
}

.btn-submit:hover {
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.95), rgba(247, 37, 133, 0.95));
}

.btn-hint {
    border-color: rgba(76, 201, 240, 0.28);
}

.btn-skip {
    border-color: rgba(248, 150, 30, 0.28);
}

.btn-next {
    background: linear-gradient(135deg, rgba(76, 201, 240, 0.22), rgba(67, 97, 238, 0.22));
    border-color: rgba(76, 201, 240, 0.28);
}

.btn-check {
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-check:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.28);
    filter: brightness(1.05);
}

.btn-action,
.btn-control {
    appearance: none;
    -webkit-appearance: none;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
    color: white;
    font-weight: 800;
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.btn-action:hover,
.btn-control:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.14);
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.18);
}

.hero-visual {
    animation: none;
    transform: none;
    transition: none;
}

.floating-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: none;
}

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

.difficulty-badges {
    display: flex;
    gap: 0.5rem;
}

.difficulty-badges .badge.active {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35) inset;
}

.badge {
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge.easy {
    background: rgba(76, 201, 240, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.badge.medium {
    background: rgba(248, 150, 30, 0.2);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.badge.hard {
    background: rgba(247, 37, 133, 0.2);
    color: var(--accent);
    border: 1px solid var(--accent);
}

.quick-problem {
    background: rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 1rem;
    min-height: 170px;
}

.problem-preview {
    min-height: 3.6em;
}

.quick-options {
    display: grid;
    gap: 6px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.quick-options .quick-opt {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.15);
    font-size: 0.9rem;
    line-height: 1.3;
}

.answer-input {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.answer-input input {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 2px solid rgba(67, 97, 238, 0.3);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
}

.btn-check {
    background: var(--success);
    color: white;
    border: none;
    padding: 0 1.5rem;
    border-radius: 10px;
    cursor: pointer;
}

/* ====== FEATURES ====== */
.features {
    padding: 6rem 0;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.title-decoration {
    color: var(--accent);
    animation: pulse 2s infinite;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
    box-shadow: 0 20px 40px rgba(67, 97, 238, 0.2);
}

.feature-icon {
    font-size: 3rem;
    background: linear-gradient(45deg, var(--primary), var(--accent));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

.feature-progress {
    margin-top: 1rem;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--primary));
    border-radius: 3px;
}

.sparkline {
    font-size: 2rem;
    margin-top: 1rem;
    text-align: center;
}

.mini-badge {
    display: inline-block;
    padding: 0.5rem;
    border-radius: 50%;
    margin: 0 0.3rem;
}

.mini-badge.gold {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #000;
}

.mini-badge.silver {
    background: linear-gradient(45deg, #C0C0C0, #808080);
    color: #000;
}

.mini-badge.bronze {
    background: linear-gradient(45deg, #CD7F32, #8B4513);
    color: white;
}

/* ====== TOPICS ====== */
.topics {
    padding: 6rem 0;
}

.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.topic-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    z-index: 0;
}

.topic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    pointer-events: none;
}

.topic-card.math-topic::before { background: linear-gradient(90deg, var(--math), #9d4edd); }
.topic-card.survey-topic::before { background: linear-gradient(90deg, var(--survey), #7bc950); }
.topic-card.transpo-topic::before { background: linear-gradient(90deg, var(--transpo), #ffb703); }
.topic-card.const-topic::before { background: linear-gradient(90deg, var(--construction), #4361ee); }
.topic-card.health-topic::before { background: linear-gradient(90deg, var(--health), #06d6a0); }

.topic-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.topic-header {
    margin-bottom: 1.5rem;
}

.topic-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.math-topic .topic-icon { color: var(--math); }
.survey-topic .topic-icon { color: var(--survey); }
.transpo-topic .topic-icon { color: var(--transpo); }
.const-topic .topic-icon { color: var(--construction); }
.health-topic .topic-icon { color: var(--health); }

.topic-stats {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

.btn-explore {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.8rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 1rem;
    display: block;
    text-align: center;
    text-decoration: none;
    position: relative;
    z-index: 2;
}

.topic-explore {
    margin-top: 1rem;
}

.topic-explore > summary.btn-explore {
    list-style: none;
}

.topic-explore > summary.btn-explore::-webkit-details-marker {
    display: none;
}

.topic-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 12px;
}

.discuss-thread-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 16px;
    padding: 14px;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
    color: #111827;
}

.discuss-thread-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.96);
}

.discuss-thread-card.selected {
    border-color: rgba(76, 201, 240, 0.65);
    box-shadow: 0 0 0 3px rgba(76, 201, 240, 0.18);
}

.discuss-thread-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.discuss-thread-main {
    min-width: 0;
}

.discuss-thread-title {
    font-weight: 900;
    font-size: 16px;
    line-height: 1.25;
    color: #0f172a;
}

.discuss-thread-meta {
    margin-top: 6px;
    opacity: 0.85;
    font-size: 13px;
    color: #334155;
}

.discuss-thread-open {
    background: rgba(67, 97, 238, 0.12);
    color: #0f172a;
    border: 1px solid rgba(15, 23, 42, 0.18);
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 800;
    flex: 0 0 auto;
    position: relative;
    z-index: 1;
}

.discuss-thread-open:hover {
    background: rgba(67, 97, 238, 0.18);
}

.discuss-thread-excerpt {
    margin-top: 10px;
    opacity: 0.95;
    line-height: 1.35;
    color: #111827;
}

.discuss-thread-image {
    margin-top: 10px;
}

.discuss-thread-image img {
    width: 100%;
    max-height: 260px;
    object-fit: contain;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0,0,0,0.12);
}

.btn-explore:hover {
    background: rgba(67, 97, 238, 0.3);
    transform: translateY(-2px);
}

/* ====== FORMULA EXPLORER ====== */
.formulas-section {
    padding: 6rem 0;
}

.formula-explorer {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    background: rgba(26, 26, 46, 0.8);
    border-radius: 25px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.formula-sidebar {
    background: rgba(0, 0, 0, 0.4);
    padding: 2rem;
}

.formula-search {
    position: relative;
    margin-bottom: 2rem;
}

.formula-search input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 3rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: white;
}

.formula-search i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
}

.category {
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.category:hover {
    background: rgba(255, 255, 255, 0.1);
}

.category.active {
    background: linear-gradient(90deg, rgba(67, 97, 238, 0.3), rgba(58, 12, 163, 0.3));
    border-left: 4px solid var(--primary);
}

.count {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-size: 0.8rem;
}

.formula-main {
    padding: 2rem;
}

.formula-display {
    height: 100%;
}

.formula-box {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    margin: 2rem 0;
    border: 2px solid rgba(67, 97, 238, 0.3);
    font-family: 'Courier New', monospace;
    font-size: 2rem;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ====== PRACTICE ARENA ====== */
.practice-section {
    padding: 6rem 0;
}

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

.user-stats {
    display: flex;
    gap: 1.5rem;
}

.stat-badge {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.8rem 1.5rem;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.difficulty-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.diff-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.diff-card.active {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.1);
    transform: scale(1.05);
}

.diff-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.diff-card[data-level="easy"] .diff-icon { color: var(--success); }
.diff-card[data-level="medium"] .diff-icon { color: var(--warning); }
.diff-card[data-level="hard"] .diff-icon { color: var(--accent); }

.xp-badge {
    background: linear-gradient(45deg, var(--warning), #ff9e00);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 1rem;
}

.problem-container {
    background: rgba(26, 26, 46, 0.8);
    border-radius: 25px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ====== LEADERBOARD ====== */
.leaderboard-section {
    padding: 6rem 0;
}

.leaderboard-container {
    background: rgba(26, 26, 46, 0.8);
    border-radius: 25px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    padding: 1rem;
}

.leaderboard-tab {
    flex: 1;
    background: none;
    border: none;
    color: white;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-modal:hover {
    color: rgba(255, 255, 255, 0.9);
    transform: scale(1.06);
}

.close-modal:focus-visible {
    outline: 2px solid rgba(76, 201, 240, 0.75);
    outline-offset: 4px;
    border-radius: 10px;
}

@keyframes trackGlowPulse {
    0% { filter: blur(0px); opacity: 0.35; }
    50% { filter: blur(1px); opacity: 0.55; }
    100% { filter: blur(0px); opacity: 0.35; }
}

@keyframes trackPillPopIn {
    0% { transform: translateY(10px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.leaderboard-tab.active {
    background: rgba(67, 97, 238, 0.3);
    border-radius: 10px;
}

.top-three {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2rem;
    padding: 3rem;
    align-items: end;
}

.podium {
    text-align: center;
    padding: 2rem;
    border-radius: 20px;
    position: relative;
}

.podium.first {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #000;
    transform: translateY(-30px);
}

.podium.second {
    background: linear-gradient(45deg, #C0C0C0, #808080);
    color: #000;
}

.podium.third {
    background: linear-gradient(45deg, #CD7F32, #8B4513);
    color: white;
}

.podium img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 1rem auto;
    border: 3px solid white;
}

.rank {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.crown {
    font-size: 2rem;
    margin-top: 0.5rem;
    color: #fff;
}

/* ====== MODALS ====== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.16s ease;
}

.modal.is-open {
    opacity: 0;
}

.modal.is-open.show {
    opacity: 1;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 25px;
    padding: 2rem;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateY(10px) scale(0.985);
    opacity: 0.98;
    transition: transform 0.16s ease, opacity 0.16s ease;
}

.modal.is-open.show .modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.login-modal {
    max-width: 1000px;
}

.login-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.track-picker-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 14px;
}

.track-pill {
    width: 100%;
    text-align: left;
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    display: grid;
    grid-template-columns: 44px 1fr;
    column-gap: 12px;
    row-gap: 2px;
    align-items: center;
    position: relative;
    overflow: hidden;
    animation: trackPillPopIn 0.24s ease both;
}

.track-pill:nth-child(1) { animation-delay: 0ms; }
.track-pill:nth-child(2) { animation-delay: 60ms; }
.track-pill:nth-child(3) { animation-delay: 120ms; }

.track-pill::before {
    content: '';
    position: absolute;
    inset: -40px;
    background: radial-gradient(circle at 30% 20%, rgba(76, 201, 240, 0.18), transparent 55%),
                radial-gradient(circle at 70% 60%, rgba(67, 97, 238, 0.18), transparent 55%);
    opacity: 0;
    transition: opacity 0.2s ease;
    animation: trackGlowPulse 2.2s ease-in-out infinite;
    pointer-events: none;
}

.track-pill:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(76, 201, 240, 0.35);
    box-shadow: 0 12px 26px rgba(67, 97, 238, 0.18);
}

.track-pill[data-track="MSTHC"]:hover {
    border-color: rgba(157, 78, 221, 0.45);
}

.track-pill[data-track="PSAD"]:hover {
    border-color: rgba(6, 214, 160, 0.40);
}

.track-pill[data-track="HGE"]:hover {
    border-color: rgba(255, 183, 3, 0.38);
}

.track-pill:hover::before {
    opacity: 1;
}

.track-pill.is-selected {
    border-color: rgba(76, 201, 240, 0.65);
    box-shadow: 0 14px 30px rgba(76, 201, 240, 0.12), 0 14px 30px rgba(67, 97, 238, 0.18);
    background: rgba(255, 255, 255, 0.10);
}

.track-pill.is-selected::before {
    opacity: 1;
}

.track-pill.is-selected .track-pill-title {
    background: linear-gradient(90deg, rgba(76, 201, 240, 1), rgba(247, 37, 133, 1));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.track-pill:focus-visible {
    outline: 2px solid rgba(76, 201, 240, 0.75);
    outline-offset: 3px;
}

.track-pill:active {
    transform: translateY(0);
}

.track-pill-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.35), rgba(76, 201, 240, 0.35));
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 18px;
}

.track-pill[data-track="MSTHC"] .track-pill-icon {
    background: linear-gradient(135deg, rgba(157, 78, 221, 0.35), rgba(76, 201, 240, 0.35));
}

.track-pill[data-track="PSAD"] .track-pill-icon {
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.35), rgba(6, 214, 160, 0.28));
}

.track-pill[data-track="HGE"] .track-pill-icon {
    background: linear-gradient(135deg, rgba(255, 183, 3, 0.25), rgba(76, 201, 240, 0.25));
}

.track-pill-title {
    font-weight: 800;
    letter-spacing: 0.4px;
    font-size: 16px;
    line-height: 1.2;
}

.track-pill-sub {
    grid-column: 2;
    color: rgba(255, 255, 255, 0.72);
    font-size: 13px;
    line-height: 1.3;
}

.track-picker-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

@media (min-width: 720px) {
    .track-picker-grid {
        grid-template-columns: 1fr 1fr;
    }
    .track-pill[data-track="MSTHC"] {
        grid-column: 1 / -1;
    }
}

/* ====== FOOTER ====== */
footer {
    background: rgba(0, 0, 0, 0.8);
    padding: 4rem 0 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: var(--primary);
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

.footer-bottom i {
    color: var(--accent);
    margin: 0 0.3rem;
}

/* ====== RESPONSIVE DESIGN ====== */
@media (max-width: 1024px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .formula-explorer {
        grid-template-columns: 1fr;
    }
    
    .top-three {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .podium.first {
        transform: none;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .nav-links.active {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        position: fixed;
        top: 72px;
        left: 0;
        right: 0;
        padding: 16px 20px;
        background: rgba(26, 26, 46, 0.98);
        backdrop-filter: blur(12px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 1100;
    }
    
    .menu-btn {
        display: block;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 2rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .login-container {
        grid-template-columns: 1fr;
    }
    
    .difficulty-selector {
        grid-template-columns: 1fr;
    }
}

/* ====== UTILITY CLASSES ====== */
.hidden {
    display: none !important;
}

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

.glow {
    box-shadow: 0 0 20px rgba(67, 97, 238, 0.5);
}

.shimmer {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}