/* ===== IMPORTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Playfair+Display:wght@700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ===== CSS VARIABLES ===== */
:root {
    --primary: #6c63ff;
    --primary-light: #8b83ff;
    --primary-dark: #4a42d4;
    --accent: #ff6b9d;
    --accent2: #00d4aa;
    --accent3: #ffa726;
    --accent4: #42a5f5;
    --bg-dark: #0a0a1a;
    --bg-card: #12122a;
    --bg-card2: #1a1a3e;
    --bg-sidebar: #0d0d24;
    --text: #e8e8f0;
    --text-dim: #8888aa;
    --text-bright: #ffffff;
    --border: rgba(108, 99, 255, 0.2);
    --glass: rgba(255, 255, 255, 0.05);
    --glass2: rgba(255, 255, 255, 0.08);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(108, 99, 255, 0.15);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 280px;
}

/* ===== RESET ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

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

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary), var(--accent));
    border-radius: 4px;
}

/* ===== WATERMARK OVERLAY ===== */
.watermark-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    overflow: hidden;
}

.watermark-text {
    position: absolute;
    font-family: 'Inter', sans-serif;
    font-weight: 900;
    font-size: 48px;
    color: rgba(255, 255, 255, 0.035);
    white-space: nowrap;
    transform: rotate(-25deg);
    user-select: none;
    text-transform: uppercase;
    letter-spacing: 8px;
}

/* ===== THEME TOGGLE ===== */
.theme-toggle-btn {
    width: 40px;
    height: 40px;
    background: var(--glass2);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: var(--transition);
    flex-shrink: 0;
}

.theme-toggle-btn:hover {
    background: var(--glass);
    border-color: var(--primary);
    transform: rotate(20deg);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-footer span {
    font-size: 12px;
    color: var(--text-dim);
}

/* ===== LIGHT MODE ===== */
/* ===== LIGHT MODE ===== */
html.light-mode {
    --bg-dark: #f0f2f8;
    --bg-card: #ffffff;
    --bg-card2: #f5f6fa;
    --bg-sidebar: #ffffff;
    --text: #2d2d3a;
    --text-dim: #6b6b80;
    --text-bright: #1a1a2e;
    --border: rgba(108, 99, 255, 0.15);
    --glass: rgba(108, 99, 255, 0.05);
    --glass2: rgba(108, 99, 255, 0.08);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 40px rgba(108, 99, 255, 0.1);
}

.theme-toggle-desktop {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: var(--glass2);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    z-index: 10001;
    /* Higher than everything */
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.theme-toggle-desktop:hover {
    background: var(--glass);
    transform: rotate(15deg) scale(1.1);
    box-shadow: 0 0 15px var(--primary);
}

html.light-mode .watermark-text {
    color: rgba(0, 0, 0, 0.04);
}

html.light-mode .mobile-header {
    background: rgba(240, 242, 248, 0.95);
}

html.light-mode ::-webkit-scrollbar-track {
    background: #f0f2f8;
}

html.light-mode .hero-bg {
    background:
        radial-gradient(ellipse at 20% 50%, rgba(108, 99, 255, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(255, 107, 157, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(0, 212, 170, 0.04) 0%, transparent 50%);
}

html.light-mode .particle {
    opacity: 0.15;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow: hidden;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.1), rgba(255, 107, 157, 0.05));
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 24px;
    color: white;
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.4);
}

.logo-text h1 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-bright);
    line-height: 1.2;
}

.logo-text span {
    font-size: 11px;
    color: var(--text-dim);
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--primary-dark);
    border-radius: 2px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-dim);
    padding: 16px 20px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
    font-size: 14px;
    color: var(--text-dim);
    text-decoration: none;
}

.nav-item:hover {
    background: var(--glass);
    color: var(--text);
}

.nav-item.active {
    background: rgba(108, 99, 255, 0.1);
    color: var(--primary-light);
    border-left-color: var(--primary);
    font-weight: 600;
}

.nav-item .nav-icon {
    font-size: 18px;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.nav-item .nav-label {
    flex: 1;
}

.nav-item .nav-badge {
    font-size: 10px;
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    position: relative;
}

/* ===== MOBILE HEADER ===== */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(10, 10, 26, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 999;
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
}

.hamburger {
    width: 36px;
    height: 36px;
    background: var(--glass2);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: var(--transition);
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

.mobile-title {
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mobile-install-btn {
    width: 36px;
    height: 36px;
    background: var(--glass2);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: var(--text);
    transition: var(--transition);
}

/* ===== OVERLAY ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    backdrop-filter: blur(4px);
}

/* ===== HERO SECTION ===== */
.hero {
    position: relative;
    padding: 80px 40px 60px;
    overflow: hidden;
    min-height: 500px;
    display: flex;
    align-items: center;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(108, 99, 255, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(255, 107, 157, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(0, 212, 170, 0.08) 0%, transparent 50%);
    z-index: 0;
}

.hero-particles {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    animation: float-particle linear infinite;
    opacity: 0.3;
}

@keyframes float-particle {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 0.3;
    }

    90% {
        opacity: 0.3;
    }

    100% {
        transform: translateY(-10vh) rotate(720deg);
        opacity: 0;
    }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(108, 99, 255, 0.15);
    border: 1px solid rgba(108, 99, 255, 0.3);
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-light);
    margin-bottom: 24px;
    animation: fadeInUp 0.6s ease-out;
}

.hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 20px;
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

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

.hero p {
    font-size: 18px;
    color: var(--text-dim);
    max-width: 600px;
    margin-bottom: 32px;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.hero-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 20px rgba(108, 99, 255, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(108, 99, 255, 0.5);
}

.btn-secondary {
    background: var(--glass2);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--glass);
    border-color: var(--primary);
    color: var(--primary-light);
}

.hero-stats {
    display: flex;
    gap: 40px;
    margin-top: 48px;
    animation: fadeInUp 0.6s ease-out 0.4s both;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ===== HERO 3D FLOATING ELEMENTS ===== */
.hero-3d-elements {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    perspective: 1000px;
}

.floating-card {
    width: 180px;
    padding: 20px;
    background: var(--glass2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
    position: absolute;
    animation: float3d 6s ease-in-out infinite;
    box-shadow: var(--shadow);
    text-align: center;
}

.floating-card:nth-child(1) {
    top: -100px;
    right: 0;
    animation-delay: 0s;
    transform: rotateY(-15deg) rotateX(5deg);
}

.floating-card:nth-child(2) {
    top: 20px;
    right: 120px;
    animation-delay: -2s;
    transform: rotateY(10deg) rotateX(-5deg);
}

.floating-card:nth-child(3) {
    top: 140px;
    right: 20px;
    animation-delay: -4s;
    transform: rotateY(-10deg) rotateX(10deg);
}

.floating-card .card-emoji {
    font-size: 32px;
    margin-bottom: 8px;
}

.floating-card .card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-bright);
}

.floating-card .card-sub {
    font-size: 11px;
    color: var(--text-dim);
}

@keyframes float3d {

    0%,
    100% {
        transform: rotateY(-15deg) rotateX(5deg) translateY(0px);
    }

    50% {
        transform: rotateY(-15deg) rotateX(5deg) translateY(-20px);
    }
}

/* ===== TOPIC SECTION ===== */
.topic-section {
    display: none;
    padding: 32px 40px 60px;
    animation: fadeIn 0.4s ease-out;
}

.topic-section.active {
    display: block;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== SECTION HEADER ===== */
.section-header {
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.section-header .section-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

.badge-purple {
    background: rgba(108, 99, 255, 0.15);
    color: var(--primary-light);
    border: 1px solid rgba(108, 99, 255, 0.3);
}

.badge-pink {
    background: rgba(255, 107, 157, 0.15);
    color: var(--accent);
    border: 1px solid rgba(255, 107, 157, 0.3);
}

.badge-green {
    background: rgba(0, 212, 170, 0.15);
    color: var(--accent2);
    border: 1px solid rgba(0, 212, 170, 0.3);
}

.badge-orange {
    background: rgba(255, 167, 38, 0.15);
    color: var(--accent3);
    border: 1px solid rgba(255, 167, 38, 0.3);
}

.badge-blue {
    background: rgba(66, 165, 245, 0.15);
    color: var(--accent4);
    border: 1px solid rgba(66, 165, 245, 0.3);
}

.section-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-bright);
}

.section-header p {
    font-size: 16px;
    color: var(--text-dim);
    max-width: 700px;
}

/* ===== CONTENT CARDS ===== */
.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.content-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--accent2));
    opacity: 0;
    transition: var(--transition);
}

.content-card:hover {
    border-color: rgba(108, 99, 255, 0.4);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.content-card:hover::before {
    opacity: 1;
}

.content-card h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.content-card h3 .card-icon {
    font-size: 24px;
}

.content-card h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-light);
    margin: 20px 0 10px;
}

.content-card p {
    color: var(--text-dim);
    margin-bottom: 12px;
    font-size: 15px;
}

.content-card ul,
.content-card ol {
    padding-left: 20px;
    margin-bottom: 12px;
}

.content-card li {
    color: var(--text-dim);
    margin-bottom: 8px;
    font-size: 14px;
}

.content-card li strong {
    color: var(--text);
}

/* ===== GRID LAYOUTS ===== */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* ===== TABLES ===== */
.grammar-table-wrapper {
    overflow-x: auto;
    margin: 16px 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.grammar-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.grammar-table thead th {
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.2), rgba(108, 99, 255, 0.1));
    padding: 14px 16px;
    text-align: left;
    font-weight: 700;
    color: var(--primary-light);
    border-bottom: 2px solid var(--primary-dark);
    white-space: nowrap;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.grammar-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(108, 99, 255, 0.1);
    color: var(--text);
}

.grammar-table tbody tr:hover {
    background: var(--glass);
}

.grammar-table tbody tr:last-child td {
    border-bottom: none;
}

.grammar-table .highlight {
    color: var(--accent);
    font-weight: 600;
}

.grammar-table .formula {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    background: rgba(108, 99, 255, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
    color: var(--primary-light);
    display: inline-block;
}

/* ===== FORMULA BOX ===== */
.formula-box {
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.1), rgba(108, 99, 255, 0.05));
    border: 1px solid rgba(108, 99, 255, 0.3);
    border-radius: var(--radius-sm);
    padding: 20px 24px;
    margin: 16px 0;
    text-align: center;
}

.formula-box .formula-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.formula-box .formula-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-light);
}

.formula-box .formula-text .plus {
    color: var(--accent);
    margin: 0 8px;
}

/* ===== EXAMPLE BOX ===== */
.example-box {
    background: var(--bg-card2);
    border-left: 4px solid var(--accent2);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 16px 20px;
    margin: 12px 0;
}

.example-box .example-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent2);
    font-weight: 700;
    margin-bottom: 6px;
}

.example-box .example-sentence {
    font-size: 15px;
    color: var(--text);
    font-style: italic;
}

.example-box .example-sentence .em {
    color: var(--accent);
    font-weight: 600;
    font-style: normal;
    text-decoration: underline;
    text-decoration-color: rgba(255, 107, 157, 0.4);
    text-underline-offset: 3px;
}

/* ===== TIP BOX ===== */
.tip-box {
    background: rgba(255, 167, 38, 0.08);
    border: 1px solid rgba(255, 167, 38, 0.3);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin: 16px 0;
    display: flex;
    gap: 12px;
}

.tip-box .tip-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.tip-box .tip-text {
    font-size: 14px;
    color: var(--accent3);
}

/* ===== FLOWCHART ===== */
.flowchart {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin: 24px 0;
    padding: 24px;
    background: var(--bg-card2);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.flow-node {
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.2), rgba(108, 99, 255, 0.1));
    border: 1px solid rgba(108, 99, 255, 0.4);
    border-radius: var(--radius-sm);
    padding: 14px 28px;
    text-align: center;
    font-weight: 600;
    color: var(--text-bright);
    font-size: 14px;
    min-width: 200px;
    transition: var(--transition);
}

.flow-node:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(108, 99, 255, 0.3);
}

.flow-node.decision {
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.2), rgba(255, 107, 157, 0.1));
    border-color: rgba(255, 107, 157, 0.4);
    transform: rotate(0deg);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    padding: 30px 40px;
}

.flow-node.start {
    background: linear-gradient(135deg, rgba(0, 212, 170, 0.2), rgba(0, 212, 170, 0.1));
    border-color: rgba(0, 212, 170, 0.4);
    border-radius: 50px;
}

.flow-node.end {
    background: linear-gradient(135deg, rgba(255, 167, 38, 0.2), rgba(255, 167, 38, 0.1));
    border-color: rgba(255, 167, 38, 0.4);
    border-radius: 50px;
}

.flow-arrow {
    width: 2px;
    height: 30px;
    background: var(--primary);
    position: relative;
}

.flow-arrow::after {
    content: '▼';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--primary);
    font-size: 10px;
}

.flow-arrow-label {
    font-size: 11px;
    color: var(--text-dim);
    margin: 4px 0;
    font-weight: 600;
}

.flow-row {
    display: flex;
    align-items: center;
    gap: 20px;
}

.flow-branch {
    display: flex;
    gap: 40px;
    margin: 8px 0;
}

.flow-branch-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

/* ===== TENSE CARD (special 3D card) ===== */
.tense-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.tense-card:hover {
    transform: translateY(-4px) rotateX(2deg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), var(--shadow-glow);
    border-color: var(--primary);
}

.tense-card .tense-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 8px;
}

.tense-card .tense-use {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.tense-card .tense-formula {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    background: rgba(108, 99, 255, 0.1);
    padding: 8px 14px;
    border-radius: 8px;
    color: var(--primary-light);
    margin-bottom: 12px;
    border: 1px solid rgba(108, 99, 255, 0.2);
}

.tense-card .tense-example {
    font-size: 14px;
    color: var(--text);
    font-style: italic;
    padding-left: 12px;
    border-left: 3px solid var(--accent);
}

/* ===== COMPARISON TABLE ===== */
.comparison-wrapper {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: center;
    margin: 20px 0;
}

.comparison-box {
    background: var(--bg-card2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.comparison-box.active-voice {
    border-color: rgba(0, 212, 170, 0.3);
}

.comparison-box.passive-voice {
    border-color: rgba(255, 107, 157, 0.3);
}

.comparison-box h4 {
    margin-top: 0;
}

.comparison-arrow {
    font-size: 28px;
    color: var(--primary);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* ===== TOPIC CARDS GRID (for home) ===== */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 0 40px 40px;
}

.topic-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
}

.topic-card:hover {
    transform: translateY(-6px) rotateX(3deg) rotateY(-2deg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), var(--shadow-glow);
    border-color: var(--primary);
}

.topic-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.05), transparent);
    opacity: 0;
    transition: var(--transition);
}

.topic-card:hover::after {
    opacity: 1;
}

.topic-card .topic-icon {
    font-size: 36px;
    margin-bottom: 16px;
    display: block;
}

.topic-card .topic-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 8px;
}

.topic-card .topic-desc {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.6;
}

.topic-card .topic-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 14px;
    padding: 4px 12px;
    background: var(--glass2);
    border-radius: 50px;
    font-size: 12px;
    color: var(--text-dim);
}

/* ===== INSTALL BANNER ===== */
.install-banner {
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.15), rgba(255, 107, 157, 0.1));
    border: 1px solid rgba(108, 99, 255, 0.3);
    border-radius: var(--radius);
    padding: 24px 32px;
    margin: 0 40px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.install-banner-text h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 4px;
}

.install-banner-text p {
    font-size: 14px;
    color: var(--text-dim);
}

#installBtn {
    display: none;
}

/* ===== FOOTER ===== */
.footer {
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border);
    padding: 40px;
    text-align: center;
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
}

.footer-brand {
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.footer-brand strong {
    color: var(--primary-light);
    font-weight: 700;
}

.footer-title {
    font-size: 12px;
    color: var(--text-dim);
    opacity: 0.7;
    margin-bottom: 16px;
}

.footer-divider {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    margin: 16px auto;
    border-radius: 1px;
}

.footer-copy {
    font-size: 12px;
    color: var(--text-dim);
    opacity: 0.5;
}

/* ===== SCROLL ANIMATIONS ===== */
.animate-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

.animate-in.delay-1 {
    transition-delay: 0.1s;
}

.animate-in.delay-2 {
    transition-delay: 0.2s;
}

.animate-in.delay-3 {
    transition-delay: 0.3s;
}

.animate-in.delay-4 {
    transition-delay: 0.4s;
}

/* ===== 3D CHART BARS ===== */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 200px;
    padding: 20px;
    background: var(--bg-card2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin: 16px 0;
}

.bar-chart .bar {
    flex: 1;
    border-radius: 8px 8px 0 0;
    position: relative;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    min-width: 30px;
    transform-style: preserve-3d;
}

.bar-chart .bar:hover {
    filter: brightness(1.3);
    transform: scaleY(1.05) translateZ(10px);
}

.bar-chart .bar .bar-label {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-dim);
    white-space: nowrap;
    font-weight: 600;
}

.bar-chart .bar .bar-value {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--text);
    font-weight: 700;
}

/* ===== TAB SYSTEM ===== */
.tab-container {
    margin: 20px 0;
}

.tab-buttons {
    display: flex;
    gap: 4px;
    background: var(--bg-card2);
    padding: 4px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 10px rgba(108, 99, 255, 0.4);
}

.tab-btn:hover:not(.active) {
    background: var(--glass);
    color: var(--text);
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-panel.active {
    display: block;
}

/* ===== ACCORDION ===== */
.accordion-item {
    background: var(--bg-card2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    overflow: hidden;
}

.accordion-header {
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: var(--text);
    transition: var(--transition);
}

.accordion-header:hover {
    background: var(--glass);
}

.accordion-header .acc-arrow {
    transition: var(--transition);
    font-size: 12px;
    color: var(--text-dim);
}

.accordion-item.open .accordion-header .acc-arrow {
    transform: rotate(180deg);
}

.accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding: 0 20px;
}

.accordion-item.open .accordion-body {
    max-height: 2000px;
    padding: 0 20px 20px;
}

/* ===== PROGRESS INDICATORS ===== */
.mini-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
}

.mini-badge.past {
    background: rgba(66, 165, 245, 0.15);
    color: var(--accent4);
}

.mini-badge.present {
    background: rgba(0, 212, 170, 0.15);
    color: var(--accent2);
}

.mini-badge.future {
    background: rgba(255, 167, 38, 0.15);
    color: var(--accent3);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .hero-3d-elements {
        display: none;
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1001;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-header {
        display: flex;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding-top: 60px;
    }

    .hero {
        padding: 40px 20px;
        min-height: auto;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 15px;
    }

    .hero-stats {
        gap: 24px;
        flex-wrap: wrap;
    }

    .topics-grid {
        padding: 0 20px 20px;
        grid-template-columns: 1fr;
    }

    .topic-section {
        padding: 20px 16px 40px;
    }

    .install-banner {
        margin: 0 16px 20px;
        flex-direction: column;
        text-align: center;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .grid-4 {
        grid-template-columns: 1fr;
    }

    .comparison-wrapper {
        grid-template-columns: 1fr;
    }
}

/* ===== REPORTED SPEECH SPECIFIC STYLES (Imported) ===== */
.note {
    padding: 20px;
    margin: 20px 0;
    border-radius: var(--radius-sm);
    border-left: 5px solid;
    background: var(--bg-card2);
}

.note-info {
    background: rgba(33, 150, 243, 0.1);
    border-color: #2196F3;
}

.note-warning {
    background: rgba(255, 152, 0, 0.1);
    border-color: #ff9800;
}

.note-success {
    background: rgba(76, 175, 80, 0.1);
    border-color: #4caf50;
}

.note-tip {
    background: rgba(156, 39, 176, 0.1);
    border-color: #9c27b0;
}

.note-title {
    font-weight: 700;
    font-size: 1.1em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    color: var(--text-bright);
}

.note-icon {
    margin-right: 10px;
    font-size: 1.3em;
}

.direct-speech {
    background: rgba(255, 249, 196, 0.1);
    padding: 15px;
    border-left: 4px solid #fbc02d;
    margin: 10px 0;
    border-radius: 5px;
    color: var(--text);
}

.reported-speech {
    background: rgba(200, 230, 201, 0.1);
    padding: 15px;
    border-left: 4px solid #388e3c;
    margin: 10px 0;
    border-radius: 5px;
    color: var(--text);
}

.card-blue {
    border-top: 5px solid #2196F3;
}

.card-green {
    border-top: 5px solid #4caf50;
}

.card-orange {
    border-top: 5px solid #ff9800;
}

.card-purple {
    border-top: 5px solid #9c27b0;
}

.highlight {
    background: linear-gradient(120deg, var(--accent), var(--accent2));
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.tense-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.tense-table th {
    background: rgba(108, 99, 255, 0.2);
    color: var(--primary-light);
    padding: 15px;
    text-align: left;
}

.tense-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.tense-table tr:last-child td {
    border-bottom: none;
}

/* Light mode overrides for these specific elements */
html.light-mode .note-info {
    background: #e3f2fd;
}

html.light-mode .note-warning {
    background: #fff3e0;
}

html.light-mode .note-success {
    background: #e8f5e9;
}

html.light-mode .note-tip {
    background: #f3e5f5;
}

html.light-mode .direct-speech {
    background: #fff9c4;
    color: #333;
}

html.light-mode .reported-speech {
    background: #c8e6c9;
    color: #333;
}


.comparison-arrow {
    transform: rotate(90deg);
    justify-self: center;
}

.footer {
    padding: 24px 16px;
}

.flow-branch {
    flex-direction: column;
    gap: 0;
}

.flowchart {
    padding: 16px;
}

.tab-buttons {
    flex-wrap: wrap;
}

.bar-chart {
    height: 150px;
}

.section-header h2 {
    font-size: 1.5rem;
}

.content-card {
    padding: 20px;
}

.watermark-text {
    font-size: 32px;
    letter-spacing: 4px;
}
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.6rem;
    }

    .hero-stats {
        gap: 16px;
    }

    .stat-number {
        font-size: 24px;
    }

    .hero-actions {
        flex-direction: column;
    }

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

    .formula-box .formula-text {
        font-size: 14px;
    }

    .watermark-text {
        font-size: 24px;
        letter-spacing: 3px;
    }
}

/* ===== PRINT STYLES ===== */
@media print {

    .sidebar,
    .mobile-header,
    .watermark-overlay,
    .install-banner {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .topic-section {
        display: block !important;
        padding: 20px !important;
    }

    body {
        background: white;
        color: black;
    }
}

/* ===== BACK TO HOME BUTTON ===== */
.back-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--glass2);
    border: 1px solid var(--border);
    border-radius: 50px;
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 24px;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
}

.back-home-btn:hover {
    background: var(--glass);
    color: var(--primary-light);
    border-color: var(--primary);
}

/* ===== SECTION VISIBILITY FIX ===== */
.home-section,
.topic-section {
    display: none !important;
    /* Force hide */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.home-section.active,
.topic-section.active {
    display: block !important;
    /* Force show */
    opacity: 1;
    animation: fadeIn 0.5s ease-out;
}

/* ===== DESKTOP SIDEBAR TOGGLE ===== */
.sidebar-toggle-desktop {
    position: fixed;
    top: 24px;
    left: 20px;
    z-index: 2000;
    width: 44px;
    height: 44px;
    display: none;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
    border-radius: 12px;
    transition: var(--transition);
}

.sidebar-toggle-desktop:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-bright);
}

/* Specific styling for when sidebar is CLOSED */
body.sidebar-closed .sidebar-toggle-desktop {
    left: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: var(--shadow);
}

body.sidebar-closed .sidebar-toggle-desktop:hover {
    background: var(--glass);
    color: var(--primary);
}

/* Hide Sidebar State (Desktop) */
body.sidebar-closed .sidebar {
    transform: translateX(-100%);
}

body.sidebar-closed .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding-left: 80px;
    /* Ensure content isn't under the toggle button */
}

/* Align button when sidebar is OPEN */
body:not(.sidebar-closed) .sidebar-toggle-desktop {
    left: 220px;
    /* Align with sidebar logo */
}

@media (min-width: 901px) {
    .sidebar-toggle-desktop {
        display: flex;
    }
}

/* ===== FLOWCHART STYLES ===== */
.flowchart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
    padding: 20px;
    background: var(--bg-card2);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.flow-step {
    background: var(--bg-card);
    border: 2px solid var(--primary);
    padding: 15px 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow);
    max-width: 90%;
    width: 300px;
    font-weight: 600;
    position: relative;
    transition: var(--transition);
}

.flow-step:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
}

.flow-arrow {
    font-size: 24px;
    color: var(--text-dim);
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(5px);
    }
}

/* ===== PRACTICE BOX STYLES ===== */
.practice-box {
    background: linear-gradient(135deg, rgba(66, 165, 245, 0.1), rgba(0, 212, 170, 0.1));
    border: 1px solid var(--accent4);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.practice-item {
    background: var(--bg-card);
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary);
    cursor: pointer;
    transition: var(--transition);
}

.practice-item:hover {
    background: var(--bg-card2);
}

.practice-q {
    font-weight: 600;
    color: var(--text-bright);
    margin-bottom: 5px;
}

.practice-a {
    font-size: 14px;
    color: var(--accent2);
    font-weight: 600;
    display: none;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px dashed var(--border);
}

.practice-item:hover .practice-a {
    display: block;
    animation: fadeIn 0.3s;
}

.mistake-box {
    border: 1px solid #ff5252;
    background: rgba(255, 82, 82, 0.05);
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.mistake-wrong {
    color: #ff5252;
    text-decoration: line-through;
    margin-right: 10px;
}

.mistake-right {
    color: #00e676;
    font-weight: bold;
}