:root {
    --bg-primary: #0B0C10;
    --bg-secondary: #15161a;
    --accent: #E11D48;
    --accent-light: #FB7185;
    --accent-dark: #9F1239;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --success: #22C55E;
    --error: #EF4444;
    --warning: #3B82F6;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(225, 29, 72, 0.15);
}

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

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Ambient Background */
.ambient-glow {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(225, 29, 72, 0.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
    animation: rotate 20s linear infinite;
}

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

/* Glass Effect */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

/* Navigation */
.glass-nav {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 48px);
    max-width: 1200px;
    height: 72px;
    background: rgba(11, 12, 16, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 0 20px rgba(225, 29, 72, 0.4);
}

.nav-links {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
}

.nav-pill {
    padding: 10px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9375rem;
}

.nav-pill:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-pill.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.4);
}

/* Main Layout */
.main-container {
    padding-top: 120px;
    padding-bottom: 48px;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
}

.page {
    display: none;
    animation: fadeIn 0.4s ease;
}

.page.active {
    display: block;
}

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

/* Typography */
.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 24px;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.8;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-bottom: 48px;
}

.accent {
    color: var(--accent-light);
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-glass, .btn-ghost {
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 16px rgba(225, 29, 72, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(225, 29, 72, 0.5);
    background: var(--accent-light);
}

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

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

.btn-glass {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
}

.btn-ghost {
    background: rgba(225, 29, 72, 0.1);
    color: var(--accent-light);
    border: 1px solid rgba(225, 29, 72, 0.3);
}

.btn-ghost:hover {
    background: rgba(225, 29, 72, 0.2);
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    transition: transform 0.3s;
}

.btn-primary:hover .btn-icon {
    transform: translateX(4px);
}

/* Hero Section */
.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: center;
    min-height: calc(100vh - 200px);
}

.hero-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(225, 29, 72, 0.15);
    border: 1px solid rgba(225, 29, 72, 0.3);
    color: var(--accent-light);
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 24px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.hero-visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-card {
    width: 280px;
    height: 280px;
    background: linear-gradient(135deg, rgba(225, 29, 72, 0.2), rgba(225, 29, 72, 0.05));
    border: 1px solid rgba(225, 29, 72, 0.3);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
    animation: float 6s ease-in-out infinite;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-glow);
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.preview-text {
    font-size: 1rem;
    margin-top: 16px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Game Interface */
.game-interface {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    height: calc(100vh - 140px);
}

.control-panel {
    padding: 24px;
    border-radius: var(--radius-lg);
    height: fit-content;
    position: sticky;
    top: 96px;
}

.control-group {
    margin-bottom: 24px;
}

.control-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.select-modern {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.3s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

.select-modern:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.1);
}

.game-stage {
    padding: 24px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--glass-border);
}

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

.ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 3;
}

.ring-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s;
    filter: drop-shadow(0 0 4px var(--accent));
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.875rem;
    font-weight: 700;
}

.game-stats {
    display: flex;
    gap: 32px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-light);
}

.maze-grid {
    display: grid;
    gap: 4px;
    overflow: auto;
    flex: 1;
    padding: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
}

.cell {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: clamp(8px, 1vw, 12px);
    padding: 4px;
    text-align: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 40px;
}

.cell:hover {
    transform: scale(1.05);
    z-index: 10;
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(225, 29, 72, 0.3);
}

.cell.selected {
    background: rgba(225, 29, 72, 0.3);
    border-color: var(--accent);
    transform: scale(1.02);
}

.cell.correct {
    background: rgba(34, 197, 94, 0.3) !important;
    border-color: var(--success) !important;
    animation: pulse-green 0.5s;
}

.cell.wrong {
    background: rgba(239, 68, 68, 0.3) !important;
    border-color: var(--error) !important;
    animation: shake 0.5s;
}

.cell.missed {
    background: rgba(59, 130, 246, 0.2) !important;
    border-color: var(--warning) !important;
}

.cell.ghost {
    background: rgba(251, 113, 133, 0.15);
    border-style: dashed;
}

@keyframes pulse-green {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.cell-content {
    font-weight: 600;
    line-height: 1.2;
}

.cell-answer {
    font-size: 0.8em;
    opacity: 0.7;
    margin-top: 2px;
}

.game-actions {
    display: flex;
    gap: 16px;
    margin-top: 24px;
    justify-content: center;
}

/* Learn Section */
.learn-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.topic-card {
    padding: 32px;
    border-radius: var(--radius-lg);
    transition: transform 0.3s;
}

.topic-card:hover {
    transform: translateY(-4px);
}

.topic-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    display: inline-block;
    padding: 16px;
    background: rgba(225, 29, 72, 0.1);
    border-radius: var(--radius-md);
}

.topic-card h3 {
    font-size: 1.5rem;
    margin-bottom: 16px;
    font-weight: 700;
}

.difficulty-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.tag {
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-easy { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.tag-med { background: rgba(234, 179, 8, 0.2); color: #facc15; }
.tag-hard { background: rgba(239, 68, 68, 0.2); color: #f87171; }

.example-box, .formula-card {
    background: rgba(0, 0