:root {
    --bg-dark: #0a0a0f;
    --bg-panel: rgba(20, 20, 30, 0.6);
    --primary: #00e5ff;
    --secondary: #7b2cbf;
    --accent: #ff007a;
    --text-main: #e0e0e0;
    --text-muted: #808090;
    --code-font: 'Fira Code', monospace;
    --body-font: 'Outfit', sans-serif;

    --success: #00ff9d;
    --error: #ff4d4d;
    --comment: #6272a4;
}

body.light-theme {
    --bg-dark: #ffffff;
    --bg-panel: rgba(0, 0, 0, 0.05);
    --text-main: #000000;
    --text-muted: #555555;
    --primary: #0984e3;
    --secondary: #6c5ce7;
    --accent: #e84393;
    --success: #00b894;
    --error: #d63031;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--body-font);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Background Effects */
.background-glow {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(123, 44, 191, 0.15) 0%, transparent 60%);
    z-index: -1;
    pointer-events: none;
    animation: pulse 15s infinite ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 0.5;
    }
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }

    14% {
        transform: scale(1.3);
    }

    28% {
        transform: scale(1);
    }

    42% {
        transform: scale(1.3);
    }

    70% {
        transform: scale(1);
    }
}

/* Glassmorphism Logic */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

body.light-theme .glass-panel {
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Navigation */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 5%;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-icon {
    color: var(--primary);
    margin-right: 0.3rem;
}

.highlight {
    color: var(--primary);
}

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

.nav-item {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-item:hover {
    color: var(--primary);
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: none;
    font-family: var(--body-font);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary), var(--accent));
    color: white;
    box-shadow: 0 4px 15px rgba(123, 44, 191, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(123, 44, 191, 0.6);
}

/* Container */
.container {
    padding: 2rem 5%;
    max-width: 1400px;
    margin: 0 auto;
}

.landing-header {
    text-align: center;
    margin-bottom: 3rem;
}

.landing-header h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, #bbb);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light-theme .landing-header h1 {
    background: none;
    -webkit-text-fill-color: initial;
    color: var(--text-main);
}

.flashy-text {
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(300deg, var(--primary), var(--secondary), var(--accent), var(--primary));
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rainbow 6s ease-in-out infinite;
}

body.dark-theme .flashy-text {
    text-shadow: 0 0 30px rgba(0, 229, 255, 0.3);
}

body.light-theme .flashy-text {
    text-shadow: none;
    /* Remove glow in light mode to avoid blurriness */
}

@keyframes rainbow {
    0% {
        background-position: 0% 50%
    }

    50% {
        background-position: 100% 50%
    }

    100% {
        background-position: 0% 50%
    }
}

.landing-header p {
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* Typing Area */
.typing-container {
    max-width: 900px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    position: relative;
    text-align: left;
    /* Ensure code aligns left */
}

body.light-theme .typing-container {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.code-header {
    padding: 0.8rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

body.light-theme .code-header {
    background: #f1f3f5;
    border-bottom: 1px solid #dee2e6;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.red {
    background: #ff5f56;
}

.dot.yellow {
    background: #ffbd2e;
}

.dot.green {
    background: #27c93f;
}

.code-window {
    padding: 2rem;
    font-family: var(--code-font);
    font-size: 1rem;
    line-height: 1.6;
    background: rgba(10, 10, 15, 0.8);
    position: relative;
    user-select: none;
    /* Prevent selection cheating */
    height: 60vh;
    overflow-y: auto;
    white-space: pre-wrap;
    /* or pre */
}

body.light-theme .code-window {
    background: #ffffff;
    color: #24292e;
    /* GitHub-style dark grey/black */
}

/* Typing Mechanics */
.code-char {
    position: relative;
    color: var(--text-muted);
    /* Default untyped color */
    transition: color 0.1s;
}

.code-char.correct {
    color: var(--success);
    text-shadow: 0 0 5px rgba(0, 255, 157, 0.4);
}

body.light-theme .code-char.correct {
    color: #22863a !important;
    text-shadow: none;
    font-weight: 500;
}

.code-char.incorrect {
    color: var(--error);
    background: rgba(255, 77, 77, 0.2);
    border-radius: 2px;
}

body.light-theme .code-char.incorrect {
    color: #cb2431 !important;
    background: #ffeef0 !important;
}

.code-char.current {
    border-bottom: 2px solid var(--primary);
    animation: blink 1s infinite;
}

.code-char.comment {
    color: var(--comment);
    opacity: 0.7;
    font-style: italic;
}

body.light-theme .code-char.comment {
    color: #6a737d;
    opacity: 0.8;
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .landing-header h1 {
        font-size: 2rem;
    }

    .code-window {
        font-size: 0.9rem;
    }
}

/* Curriculum Styles */
.curriculum-header {
    margin-bottom: 3.5rem;
    text-align: center;
}

.curriculum-header h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 0%, #888 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.curriculum-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    align-items: start;
}

.curriculum-section {
    padding: 1.5rem;
    border-radius: 20px;
    background: var(--bg-panel);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.curriculum-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

.curriculum-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-progress {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 10px;
    background: rgba(0, 229, 255, 0.1);
    color: var(--primary);
    border-radius: 20px;
    border: 1px solid rgba(0, 229, 255, 0.2);
}

.problem-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.curriculum-card {
    text-decoration: none;
    color: inherit;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.curriculum-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.02);
}

.curriculum-card.completed {
    border-left: 3px solid var(--success);
}

.curriculum-card.premium-locked {
    opacity: 0.6;
    cursor: default;
}

.difficulty-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.difficulty-badge.easy {
    background: rgba(0, 255, 157, 0.1);
    color: var(--success);
}

.difficulty-badge.medium {
    background: rgba(255, 189, 46, 0.1);
    color: #ffbd2e;
}

.difficulty-badge.hard {
    background: rgba(255, 77, 77, 0.1);
    color: var(--error);
}

/* Global Mobile Fixes */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
        padding: 0.8rem;
    }

    .nav-links {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .landing-header h1 {
        font-size: 2.2rem;
    }

    .flashy-text {
        font-size: 2.5rem;
    }

    .container {
        padding: 1rem;
    }

    .curriculum-grid {
        gap: 1rem;
    }

    .problem-layout {
        display: flex;
        flex-direction: column;
        height: auto;
    }

    .problem-desc,
    .work-area {
        height: auto;
        min-height: 400px;
    }
}

footer {
    text-align: center;
    padding: 3rem 1.2rem;
    margin-top: 2rem;
    color: var(--text-muted);
    width: 100%;
}

footer p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}