/**
 * Custom Styles
 * Modern SaaS-style design with dark/light theme support
 */

/* ========== CSS Variables for Theme Colors ========== */
:root {
    /* Light Theme (Default) */
    --primary: #f43f5e;
    --primary-hover: #e11d48;
    --secondary: #0891b2;
    --accent: #a855f7;
    --background: #FFFFFF;
    --background-alt: #FAF5FF;
    --surface: #FFFFFF;
    --surface-2: #F8FAFC;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border: #E5E7EB;
    --border-hover: #CBD5E1;
    --glow: rgba(244, 63, 94, 0.12);
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --info: #3B82F6;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.625rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme - SoundButtons-inspired neon */
[data-theme="dark"] {
    --primary: #fb7185;
    --primary-hover: #f43f5e;
    --secondary: #2dd4ff;
    --accent: #a855f7;
    --background: #07050e;
    --background-alt: #0d0a18;
    --surface: #120c20;
    --surface-2: #0d0a18;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.18);
    --glow: rgba(168, 85, 247, 0.25);
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --info: #3B82F6;
}

/* ========== Base Styles ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

img, iframe, video, embed {
    max-width: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-base), color var(--transition-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-image:
        linear-gradient(var(--grid-line, rgba(0, 0, 0, 0.04)) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line, rgba(0, 0, 0, 0.04)) 1px, transparent 1px);
    background-size: 48px 48px;
    background-position: center top;
}

[data-theme="dark"] body {
    --grid-line: rgba(255, 255, 255, 0.06);
}

main {
    background-image:
        linear-gradient(var(--grid-line-main, rgba(0, 0, 0, 0.02)) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line-main, rgba(0, 0, 0, 0.02)) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center top;
}

[data-theme="dark"] main {
    --grid-line-main: rgba(255, 255, 255, 0.04);
}

/* Prevent layout shift for images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Aspect ratio containers to prevent CLS */
.aspect-video {
    aspect-ratio: 16 / 9;
}

/* Dark mode ambient background glow */
[data-theme="dark"] body {
    background-image:
        radial-gradient(ellipse 80% 50% at 15% 0%, rgba(168, 85, 247, 0.12), transparent 60%),
        radial-gradient(ellipse 70% 50% at 90% 10%, rgba(45, 212, 255, 0.10), transparent 60%);
    background-attachment: fixed;
}

/* ========== Typography ========== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

h1 { font-size: 3rem; }
h2 { font-size: 2.25rem; }
h3 { font-size: 1.875rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
}

/* ========== Container ========== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

/* ========== Header/Navigation ========== */
.header {
    background-color: color-mix(in srgb, var(--background) 85%, transparent);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: all var(--transition-base);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    gap: var(--spacing-md);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--text-primary);
    flex-shrink: 0;
    min-width: 0;
}

.nav-logo-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.nav-logo img {
    height: 36px;
    width: auto;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    margin-left: auto;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    list-style: none;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.9375rem;
    transition: color var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

.nav-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 700;
    border-radius: var(--radius-lg);
    background-color: #e11d48;
    color: white;
    white-space: nowrap;
    transition: all var(--transition-fast);
    box-shadow: 0 6px 16px -6px rgba(225, 29, 72, 0.5);
}

.nav-cta:hover {
    background-color: #be123c;
    transform: translateY(-2px);
    color: white;
    box-shadow: 0 10px 22px -6px rgba(225, 29, 72, 0.55);
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background-image: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    box-shadow: 0 8px 20px -8px var(--primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px -8px var(--primary);
    color: white;
}

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

.btn-secondary:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-hover);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.0625rem;
}

/* Gradient text accent */
.gradient-text {
    background-image: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 50%, var(--primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* ========== Cards ========== */
.card {
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    border: 0.5px solid var(--border);
    padding: var(--spacing-lg);
    transition: all var(--transition-base);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--border-hover);
}

[data-theme="dark"] .card:hover {
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.25), 0 18px 40px -16px rgba(168, 85, 247, 0.45);
}

.card-image {
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-md);
}

/* ========== Level Cards ========== */
.level-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    background-color: var(--surface);
    transition: all var(--transition-base);
}

.level-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--border-hover);
}

.level-badge {
    position: absolute;
    top: 0.625rem;
    left: 0.625rem;
    background-image: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.75rem;
    line-height: 1.4;
    z-index: 20;
    pointer-events: none;
}

.level-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    line-height: 1.3;
}

.level-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.level-view-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    transition: color var(--transition-fast);
}

.level-view-link:hover {
    color: var(--primary-hover);
}

.level-card .card-image {
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
}

/* ========== Grid Layouts ========== */
.grid {
    display: grid;
    gap: var(--spacing-lg);
}

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

/* ========== Search Box ========== */
.search-box {
    position: relative;
    width: 100%;
    max-width: 600px;
}

.search-input {
    width: 100%;
    padding: 1rem 3rem 1rem 1.5rem;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background-color: var(--surface);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--glow);
}

[data-theme="dark"] .search-input {
    background-color: rgba(255, 255, 255, 0.04);
}

.search-button {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    transition: opacity 0.2s, transform 0.2s;
}

.search-button:hover {
    transform: translateY(-50%) scale(1.02);
    opacity: 0.95;
}

/* ========== Theme Toggle ========== */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background-color: var(--background-alt);
    transform: rotate(180deg);
}

/* ========== Pagination ========== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-2xl);
}

.page-link {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background-color: var(--surface);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.page-link:hover,
.page-link.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ========== Video Player ========== */
.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    border-radius: var(--radius-xl);
    overflow: hidden;
    background-color: var(--surface-2);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 2;
}

.video-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    background-image:
        linear-gradient(135deg, var(--surface-2) 0%, var(--surface) 100%);
    z-index: 1;
}

.video-placeholder-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 2rem;
    color: #fff;
    background-image: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    box-shadow: 0 10px 30px -10px var(--primary);
}

.video-placeholder span {
    font-size: 0.9375rem;
    font-weight: 500;
}

/* ========== Tab Buttons ========== */
.tab-btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.dark .tab-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.tab-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ========== Loading Spinner ========== */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

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

/* ========== Footer ========== */
.footer {
    background-color: var(--surface);
    border-top: 1px solid var(--border);
    padding: var(--spacing-2xl) 0;
    margin-top: var(--spacing-2xl);
}

/* ========== Breadcrumbs ========== */
.breadcrumbs {
    padding: var(--spacing-md) 0;
}

.breadcrumbs ol {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.breadcrumbs li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumbs a {
    color: var(--text-secondary);
    font-weight: 500;
    transition: color var(--transition-fast);
}

.breadcrumbs a:hover {
    color: var(--primary);
}

.breadcrumbs .current {
    color: var(--text-primary);
    font-weight: 700;
}

.breadcrumbs i {
    color: var(--border-hover);
    font-size: 0.75rem;
}

/* ========== Enhanced Navigation Effects ========== */
.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background-image: linear-gradient(135deg, var(--primary), var(--accent));
    transition: width var(--transition-base);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.header {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .header {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ========== Mobile Responsive Design ========== */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
    
    .container {
        padding: 0 1rem;
    }
}

@media (max-width: 768px) {
    /* Typography adjustments */
    h1 { font-size: 1.875rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .hero-title {
        font-size: 1.75rem !important;
    }
    
    .section-title {
        font-size: 1.5rem !important;
    }
    
    /* Spacing adjustments */
    .container {
        padding: 0 0.875rem;
    }
    
    .py-12 { padding-top: 2rem; padding-bottom: 2rem; }
    .py-16 { padding-top: 3rem; padding-bottom: 3rem; }
    .py-20 { padding-top: 3rem; padding-bottom: 3rem; }
    
    .mb-6 { margin-bottom: 1rem; }
    .mb-8 { margin-bottom: 1.5rem; }
    .mb-10 { margin-bottom: 2rem; }
    .mb-12 { margin-bottom: 2rem; }
    
    .gap-6 { gap: 1rem; }
    .gap-8 { gap: 1.25rem; }
    
    /* Grid adjustments */
    .grid-3,
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    
    .nav {
        gap: 0.5rem;
    }

    .nav-logo {
        font-size: 1rem;
        gap: 0.375rem;
        flex: 1;
        min-width: 0;
    }

    .nav-logo-text {
        max-width: 140px;
    }

    .nav-logo img {
        height: 28px;
    }

    .nav-menu {
        display: none;
    }
    
    /* Mobile menu — handled by slide-in panel CSS */
    #mobile-menu .nav-link {
        padding: 0.75rem 0;
        font-size: 1rem;
        border-bottom: 1px solid var(--border);
    }
    
    #mobile-menu .nav-link:last-child {
        border-bottom: none;
    }
    
    /* Button adjustments */
    .btn {
        padding: 0.625rem 1.125rem;
        font-size: 0.875rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 0.9375rem;
    }
    
    /* Card adjustments */
    .card {
        padding: 1rem;
    }
    
    /* Tab buttons */
    .tab-btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }
    
    /* Hero section */
    .hero-badge {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
    
    /* Video cards */
    .video-card h3 {
        font-size: 0.8125rem;
    }
    
    .video-card .level-badge,
    .level-badge {
        font-size: 0.5625rem;
        padding: 0.0625rem 0.375rem;
        top: 0.25rem;
        left: 0.25rem;
    }
    
    .video-card img,
    .card-image {
        border-radius: var(--radius-md);
    }
}

@media (max-width: 480px) {
    /* Further reduce spacing */
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    
    .hero-title {
        font-size: 1.5rem !important;
    }
    
    .container {
        padding: 0 0.75rem;
    }
    
    .py-12 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
    .py-16, .py-20 { padding-top: 2rem; padding-bottom: 2rem; }
    
    .gap-4 { gap: 0.625rem; }
    .gap-6 { gap: 0.75rem; }
    
    .grid-2,
    .grid-3,
    .grid-4 { grid-template-columns: 1fr; }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }
    
    .card {
        padding: 0.875rem;
        border-radius: 0.75rem;
    }
    
    /* Make text more readable */
    body {
        font-size: 0.9375rem;
    }
    
    p {
        font-size: 0.875rem;
    }
}

/* ========== Utility Classes ========== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mt-4 { margin-top: var(--spacing-xl); }

.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mb-4 { margin-bottom: var(--spacing-xl); }

.hidden { display: none; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.block { display: block; }
.inline-block { display: inline-block; }

/* ========== Homepage Components (SoundButtons style) ========== */
.hero-section {
    position: relative;
    background-image: radial-gradient(ellipse 60% 50% at 50% 0%, var(--glow), transparent 70%);
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--secondary);
    background-color: color-mix(in srgb, var(--secondary) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--secondary) 30%, transparent);
}

.hero-title {
    font-size: clamp(1.875rem, 4vw, 3rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

/* Hero right-side preview cards */
.hero-card {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.hero-card:hover {
    transform: translateY(-6px) scale(1.02);
}

.hero-card-media {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.hero-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

[data-theme="dark"] .hero-card:hover {
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.3), 0 20px 45px -18px rgba(168, 85, 247, 0.55);
}

.hero-card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    padding: 1rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent 60%);
}

/* Play button overlay used by cards */
.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background-image: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 8px 20px -6px var(--primary);
    opacity: 0;
    transition: all var(--transition-base);
    pointer-events: none;
}

.group:hover .play-overlay {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Play Online CTA banner */
.play-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-radius: var(--radius-xl);
    color: #fff;
    background-image: linear-gradient(135deg, var(--primary) 0%, var(--accent) 60%, var(--secondary) 120%);
    box-shadow: 0 18px 40px -18px var(--accent);
    transition: transform var(--transition-base);
}

.play-cta:hover { transform: translateY(-3px); color: #fff; }
.play-cta h2, .play-cta p { color: #fff; }

/* Tab buttons - enhanced styling */
.tab-btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 999px;
    border: 1px solid var(--border);
    background-color: var(--surface-2);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background-color: var(--surface);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.15);
}

.tab-btn.active {
    color: #fff;
    border-color: transparent;
    background-image: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 8px 20px -6px var(--primary);
    transform: translateY(-1px);
}

[data-theme="dark"] .tab-btn:hover {
    box-shadow: 0 4px 16px -4px rgba(168, 85, 247, 0.3);
}

[data-theme="dark"] .tab-btn.active {
    box-shadow: 0 8px 24px -6px rgba(168, 85, 247, 0.6);
}

/* Loading spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Section title with accent */
.section-title {
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    font-weight: 900;
    letter-spacing: -0.02em;
}

/* Level grid - 5 columns on desktop */
.level-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.25rem;
}

@media (max-width: 1280px) { .level-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 1024px) { .level-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .level-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; } }
@media (max-width: 480px) { .level-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; } }

/* Video card */
.video-card {
    display: block;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    background-color: var(--surface);
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.video-card:hover { color: var(--text-primary); transform: translateY(-4px); border-color: var(--border-hover); box-shadow: var(--shadow-xl); }

.video-card .level-badge {
    z-index: 2;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    border-radius: var(--radius-md);
    background-image: linear-gradient(135deg, var(--primary), var(--accent));
}

.video-card .video-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Aspect ratio helper for covers */
.aspect-video {
    aspect-ratio: 16 / 9;
}

/* ========== Detail Page Navigation ========== */
.detail-nav-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.detail-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.detail-nav-link:hover {
    border-color: var(--border-hover);
    background-color: var(--surface);
    transform: translateY(-2px);
    color: var(--text-primary);
}

.detail-nav-link.next {
    flex-direction: row-reverse;
    text-align: right;
}

.detail-nav-link img {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
}

.detail-nav-link .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.detail-nav-link .title {
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Detail page title */
.detail-title {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--text-primary);
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Detail video controls - prev | dropdown | next */
.detail-video-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.detail-video-controls .nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background-color: var(--surface-2);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    white-space: nowrap;
    flex: 0 0 auto;
}

.detail-video-controls .nav-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.detail-video-controls .nav-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.detail-level-select {
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
}

.detail-level-select select {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background-color: var(--surface-2);
    color: var(--primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f43f5e' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
    text-align: center;
    text-align-last: center;
}

.detail-level-select:hover select {
    border-color: var(--primary);
    background-color: color-mix(in srgb, var(--primary) 8%, var(--surface-2));
}

.detail-level-select select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

.detail-quick-search {
    width: 100%;
    max-width: 360px;
    margin-bottom: 1.5rem;
}

.detail-quick-search .search-box {
    max-width: none;
}

.detail-quick-search .search-input {
    padding: 0.875rem 3rem 0.875rem 1rem;
}

.detail-quick-search .search-button {
    position: absolute;
    right: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
}

/* Adjacent Levels grid */
.adjacent-levels-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.adjacent-level {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.adjacent-level:hover {
    border-color: var(--primary);
    color: var(--primary);
    background-color: var(--surface);
}

.adjacent-level.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

@media (max-width: 768px) {
    .detail-title {
        font-size: 1.5rem;
    }

    .detail-nav-split {
        grid-template-columns: 1fr;
    }

    .detail-nav-link.next {
        flex-direction: row;
        text-align: left;
    }

    .detail-video-controls {
        flex-wrap: nowrap;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .detail-video-controls .nav-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .detail-level-select select {
        font-size: 0.875rem;
        padding: 0.5rem 2rem 0.5rem 0.75rem;
    }

    .detail-quick-search {
        max-width: 100%;
    }

    .adjacent-levels-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .adjacent-level {
        font-size: 0.8125rem;
        padding: 0.5rem 0.125rem;
    }
}

/* ========== Accessibility ========== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========== Mobile Nav Search ========== */
.mobile-nav-search {
    display: flex;
    align-items: center;
    background: var(--surface-2, rgba(0,0,0,0.04));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

[data-theme="dark"] .mobile-nav-search {
    background: rgba(255,255,255,0.05);
}

.mobile-nav-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    color: var(--text-primary);
    min-width: 0;
}

.mobile-nav-search-input::placeholder {
    color: var(--text-secondary);
}

.mobile-nav-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.mobile-nav-search-btn:hover {
    opacity: 0.85;
}

/* ========== Nav Search ========== */
.nav-search {
    display: flex;
    align-items: center;
    position: relative;
    margin-left: 0.5rem;
}

.nav-search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    flex-shrink: 0;
}

.nav-search-icon:hover,
.nav-search.open .nav-search-icon {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(244,63,94,0.06);
}

.nav-search-box {
    display: flex;
    align-items: center;
    overflow: hidden;
    max-width: 0;
    opacity: 0;
    pointer-events: none;
    transition: max-width 0.25s ease, opacity 0.2s ease;
    position: absolute;
    right: 44px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.nav-search.open .nav-search-box {
    max-width: 220px;
    opacity: 1;
    pointer-events: auto;
}

.nav-search-input {
    border: none;
    outline: none;
    background: transparent;
    padding: 0.4rem 0.625rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    width: 160px;
    min-width: 0;
}

.nav-search-input::placeholder {
    color: var(--text-secondary);
}

.nav-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    cursor: pointer;
    font-size: 0.75rem;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.nav-search-btn:hover {
    opacity: 0.85;
}

/* ========== Nav Dropdown: Level Guide ========== */
.nav-dropdown-wrap {
    position: relative;
}

.nav-dropdown-trigger {
    cursor: pointer;
}

.nav-caret {
    font-size: 0.625rem;
    transition: transform var(--transition-fast);
    margin-left: 2px;
}

.nav-dropdown-wrap:hover .nav-caret {
    transform: rotate(180deg);
}


.nav-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: 360px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
    z-index: 997;
    max-height: 480px;
    overflow: hidden;
    flex-direction: column;
}

.nav-dropdown-wrap:hover .nav-dropdown {
    display: flex;
}

/* Vertical scroll, single column of groups */
.nav-dropdown-inner {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    padding: 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    max-height: 410px;
}

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

.nav-dropdown-inner::-webkit-scrollbar-track {
    background: transparent;
}

.nav-dropdown-inner::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.nav-dropdown-group {
    width: 100%;
    padding: 0.5rem 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.15s;
}

.nav-dropdown-group:last-child {
    border-bottom: none;
}

.nav-dropdown-group:hover {
    background: var(--bg-subtle, rgba(244,63,94,0.03));
}

.nav-dropdown-group-title {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
    margin-bottom: 0.375rem;
    white-space: nowrap;
}

.nav-dropdown-levels {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 3px;
}

.nav-dropdown-level {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 28px;
    font-size: 0.6875rem;
    font-weight: 500;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: background-color 0.12s, color 0.12s, transform 0.1s;
}

.nav-dropdown-level:hover {
    background-color: var(--primary);
    color: #fff;
    transform: scale(1.15);
}

.nav-dropdown-footer {
    border-top: 1px solid var(--border);
    padding: 0.5rem 1.5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-dropdown-scroll-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.nav-dropdown-all {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--primary);
}

.nav-dropdown-all:hover {
    text-decoration: underline;
}

/* ========== Mobile Menu Panel (2/3 width) ========== */
.mobile-menu-panel {
    position: fixed;
    top: 64px;
    right: 0;
    bottom: 0;
    width: 66.666vw;
    max-width: 320px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    overflow-y: auto;
    padding: 0.75rem 0 2rem 0;
    transform: translateX(100%);
    transition: transform 0.25s ease;
}

.mobile-menu-panel .container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

.mobile-menu-panel.open {
    transform: translateX(0);
}

/* Backdrop overlay */
#mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 999;
}

#mobile-menu-overlay.open {
    display: block;
}

/* ========== Mobile Level Guide Accordion ========== */
.mobile-level-guide {
    padding-bottom: 0.5rem;
}

.mobile-level-guide-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.75rem 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-level-guide-caret {
    transition: transform var(--transition-fast);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.mobile-level-guide-toggle[aria-expanded="false"] .mobile-level-guide-caret {
    transform: rotate(180deg);
}

.mobile-level-guide-body {
    overflow-y: auto;
    max-height: 320px;
    padding-bottom: 0.5rem;
}

.mobile-level-guide-body.collapsed {
    display: none;
}

.mobile-level-guide-group {
    margin-bottom: 0.75rem;
}

.mobile-level-guide-group-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-secondary);
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.375rem;
}

.mobile-level-guide-levels {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}

.mobile-level-guide-level {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.mobile-level-guide-level:hover,
.mobile-level-guide-level:active {
    background-color: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ========== Comments Section ========== */
.comments-section {
    margin-top: 2rem;
}

.comments-header {
    margin-bottom: 1.25rem;
}

.comments-title {
    font-size: 1.375rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--text-primary);
}

.comments-count {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.comment-form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.comment-form-title {
    font-size: 1.0625rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.comment-form-group {
    margin-bottom: 1rem;
}

.comment-form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.comment-form-input,
.comment-form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-2);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    font-family: inherit;
}

.comment-form-input:focus,
.comment-form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

.comment-form-textarea {
    resize: vertical;
    min-height: 100px;
}

.comment-char-count {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.comment-image-upload {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.comment-image-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.comment-image-btn:hover {
    border-color: var(--primary);
    background-color: color-mix(in srgb, var(--primary) 8%, var(--surface-2));
}

.comment-image-name {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.comment-image-preview {
    max-width: 160px;
    max-height: 100px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 1px solid var(--border);
}

.comment-image-remove {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    cursor: pointer;
    margin-left: 0.5rem;
    color: var(--text-secondary);
}

.comment-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.comment-form-note {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.comment-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    flex-shrink: 0;
}

.comment-submit-btn {
    min-width: 160px;
}

.comment-form-success {
    padding: 0.625rem 0.875rem;
    background-color: color-mix(in srgb, #10b981 12%, transparent);
    color: #065f46;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
}

[data-theme="dark"] .comment-form-success {
    color: #6ee7b7;
}

.comment-form-error {
    padding: 0.625rem 0.875rem;
    background-color: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
}

.comment-reply-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    background-color: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 600;
}

.comment-reply-badge button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    padding: 0;
    line-height: 1;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comments-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-xl);
    color: var(--text-secondary);
    gap: 0.75rem;
}

.comments-empty i {
    font-size: 2rem;
    opacity: 0.5;
}

.comments-empty p {
    font-size: 0.9375rem;
}

.comment-item {
    display: flex;
    gap: 0.875rem;
    padding: 1.125rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
}

.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.375rem;
}

.comment-author {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.comment-reply-to {
    font-size: 0.8125rem;
    color: var(--primary);
    font-weight: 500;
}

.comment-time {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-left: auto;
}

.comment-content {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-primary);
    word-break: break-word;
    margin-bottom: 0.5rem;
}

.comment-img {
    max-width: 240px;
    max-height: 160px;
    border-radius: var(--radius-md);
    object-fit: cover;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
    cursor: pointer;
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.comment-vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3125rem 0.625rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--surface-2);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.comment-vote-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.comment-vote-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.comment-reply-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3125rem 0.625rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border: none;
    background: none;
    color: var(--primary);
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.comment-reply-btn:hover {
    opacity: 0.75;
}

.comment-replies {
    margin-top: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding-left: 0.875rem;
    border-left: 2px solid var(--border);
}

.comment-reply {
    display: flex;
    gap: 0.625rem;
}

.comment-reply .comment-body {
    font-size: 0.9375rem;
}

/* ========== Custom Level Picker ========== */
.detail-level-select {
    flex: 0 0 auto;
    min-width: 0;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.level-picker-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
    min-width: 120px;
    justify-content: space-between;
}

.level-picker-btn:hover,
.level-picker-btn.open {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--glow);
}

.level-picker-caret {
    font-size: 0.625rem;
    transition: transform 0.2s;
    color: var(--text-secondary);
}

.level-picker-btn.open .level-picker-caret {
    transform: rotate(180deg);
}

.level-picker-panel {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 -8px 32px rgba(0,0,0,0.14);
    z-index: 500;
    overflow: hidden;
    flex-direction: column;
}

.level-picker-panel.open {
    display: flex;
}

.level-picker-header {
    padding: 0.5rem 0.875rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    background: var(--bg, var(--surface-2, #f8f8f8));
    flex-shrink: 0;
}

[data-theme="dark"] .level-picker-header {
    background: rgba(255,255,255,0.04);
}

.level-picker-list {
    overflow-y: auto;
    max-height: 260px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.level-picker-list::-webkit-scrollbar {
    width: 4px;
}

.level-picker-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.level-picker-item {
    display: block;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: background-color 0.1s, color 0.1s;
    border-bottom: 1px solid transparent;
}

.level-picker-item:hover {
    background-color: rgba(244,63,94,0.06);
    color: var(--primary);
}

.level-picker-item.active {
    background: var(--primary);
    color: #fff;
    font-weight: 700;
}
