/**
 * 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;
}

body,
main {
    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: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

h1 { font-size: 2.75rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.375rem; }
h5 { font-size: 1.125rem; }
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;
}

/* ========== 404 Search Bar ========== */
.search-404 {
    display: flex;
    align-items: stretch;
    gap: 0;
    max-width: 480px;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.search-404-select {
    border: none;
    outline: none;
    background: var(--surface-2, rgba(0,0,0,0.04));
    padding: 0.875rem 0.625rem 0.875rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    flex-shrink: 0;
    min-width: 0;
    max-width: 45%;
    border-right: 2px solid var(--border);
    appearance: auto;
}

.search-404-select option {
    color: #111827;
    background: #fff;
}

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

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

.search-404-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-left: 2px solid var(--border);
    background: var(--primary);
    color: #fff;
    padding: 0.875rem 1.375rem;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.search-404-btn:hover {
    opacity: 0.9;
}

/* ========== 404 Game Tags ========== */
.game-tag-404 {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.game-tag-404:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.game-tag-404-logo {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.game-tag-404-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ========== 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 */
    height: 0;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.14)),
        var(--surface-2);
    border-radius: 1rem;
    overflow: hidden;
}
.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background:
        linear-gradient(90deg, rgba(229,231,235,0.4) 25%, rgba(243,244,246,0.85) 37%, rgba(229,231,235,0.4) 63%)
        0 0 / 400% 100% no-repeat,
        var(--surface-2);
}

.video-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.12) 37%, rgba(255,255,255,0.03) 63%)
        0 0 / 400% 100% no-repeat;
    animation: videoShimmer 1.4s ease-in-out infinite;
    pointer-events: none;
    z-index: 2;
}
.video-container:not(.is-loading)::before {
    opacity: 0;
    animation: none;
}
.video-container iframe {
    z-index: 1;
    opacity: 1;
    transition: opacity 0.18s ease;
}
.video-container.is-loading iframe {
    opacity: 0.01;
}

/* 点击播放：封面 + 播放按钮 */
.video-cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 3;
}
.video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    width: 68px;
    height: 48px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    transition: transform 0.15s ease;
}
.video-play-btn svg {
    display: block;
}
.video-play-btn-bg {
    fill: rgba(33, 33, 33, 0.8);
    transition: fill 0.15s ease;
}
.video-play-btn-icon {
    fill: #fff;
}
.video-container:hover .video-play-btn-bg,
.video-play-btn:focus-visible .video-play-btn-bg {
    fill: #f00;
}
.video-container:hover .video-play-btn {
    transform: translate(-50%, -50%) scale(1.04);
}

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

.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; }

    /* Prevent iOS Safari from zooming inputs on focus */
    .search-input,
    .hero-search-input,
    .hero-search-select,
    .mobile-nav-search-input,
    .mobile-nav-search-select,
    .comment-form-input,
    .comment-form-textarea,
    input[type="text"],
    input[type="email"],
    input[type="search"],
    input[type="password"],
    input[type="tel"],
    input[type="url"],
    textarea,
    select {
        font-size: 16px;
    }
    
    .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;
    }

    /* Fixed header on mobile so it stays visible while scrolling */
    .header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
    }

    main {
        padding-top: 48px;
    }

    .mobile-menu-panel,
    #mobile-menu-overlay {
        top: 64px;
    }
    
    /* 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.75rem, 3.6vw, 2.8rem);
    font-weight: 700;
    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.5rem, 3vw, 2.1rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Homepage SEO / How It Works blocks */
.home-seo-panel,
.home-how-panel {
    position: relative;
    overflow: hidden;
    padding: 1.5rem;
    border: 1px solid var(--border);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.94));
    box-shadow: 0 20px 45px -34px rgba(15,23,42,0.3);
}

.home-seo-panel::before,
.home-how-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at top right, rgba(59,130,246,0.12), transparent 28%),
        radial-gradient(circle at bottom left, rgba(236,72,153,0.08), transparent 30%);
}

.home-seo-heading,
.home-how-heading {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    z-index: 1;
}

.home-seo-icon {
    width: 3rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    box-shadow: 0 14px 24px -16px rgba(59,130,246,0.75);
    flex-shrink: 0;
}

.home-seo-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.home-seo-copy {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.75;
}

.home-seo-copy i {
    margin-top: 0.2rem;
    color: var(--primary);
    flex-shrink: 0;
}

.home-seo-chip-row {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1rem;
}

.home-seo-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
    background: rgba(255,255,255,0.92);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 700;
}

.home-seo-chip i {
    color: var(--primary);
}

.home-how-panel {
    padding-bottom: 1.6rem;
}

.home-how-card {
    position: relative;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.96));
    box-shadow: 0 16px 36px -30px rgba(15,23,42,0.28);
}

.home-how-card::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(59,130,246,0.05), transparent 35%);
}

.home-how-card-icon {
    width: 3.15rem;
    height: 3.15rem;
    margin: 0 auto 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(59,130,246,0.08);
    color: var(--primary);
    font-size: 1.2rem;
}

.home-how-card h3 {
    position: relative;
    z-index: 1;
}

.home-how-card p {
    position: relative;
    z-index: 1;
    margin-bottom: 0;
}

/* Scroll reveal */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(28px) scale(0.985);
    filter: blur(5px);
    transition:
        opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        filter 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: var(--reveal-delay, 0ms);
    will-change: opacity, transform, filter;
}

.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
}

@media (prefers-reduced-motion: reduce) {
    .reveal-on-scroll {
        opacity: 1;
        transform: none;
        filter: none;
        transition: none;
    }
}

/* 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, 1.75rem);
    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;
    }
}

/* ========== Image Search Module ========== */
.image-search-upload-row {
    display: grid;
    grid-template-columns: 1fr 80px;
    gap: 1rem;
    align-items: stretch;
}
.image-search-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.image-search-actions [data-image-search-submit],
.image-search-actions [data-image-search-clear] {
    min-height: 2.6rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.875rem;
    border-radius: 0.9rem;
}
.image-search-actions [data-image-search-submit] i {
    font-size: 0.9em;
}
.image-search-actions [data-image-search-status] {
    flex: 1 1 180px;
    margin-left: 0 !important;
    text-align: center;
    line-height: 1.35;
}
@media (max-width: 640px) {
    .image-search-upload-row {
        grid-template-columns: 1fr 110px;
        gap: 0.6rem;
    }
    .image-search-dropzone {
        min-height: 120px;
        padding: 0.75rem;
    }
    .image-search-preview {
        max-height: 140px;
    }
    .image-search-reference img {
        max-height: 140px;
    }
}
.image-search-dropzone {
    border: 2px dashed var(--border, #d1d5db);
    border-radius: var(--radius-lg, 12px);
    /* padding: 1.5rem; */
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: var(--surface-2, #f9fafb);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
}
.image-search-dropzone:hover,
.image-search-dropzone.dragover {
    border-color: var(--primary, #4f46e5);
    background: color-mix(in srgb, var(--primary) 8%, transparent);
}
.image-search-placeholder {
    color: var(--text-secondary, #6b7280);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* 图片搜索：游戏下拉（自定义箭头 + hover/focus） */
.image-search-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    padding: 0.7rem 2.6rem 0.7rem 1rem;
    border: 1.5px solid var(--border, #d1d5db);
    border-radius: 0.9rem;
    background: var(--surface, #fff) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 1rem center;
    color: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.image-search-select:hover { border-color: var(--primary, #4f46e5); }
.image-search-select:focus {
    outline: none;
    border-color: var(--primary, #4f46e5);
    box-shadow: 0 0 0 4px var(--glow, rgba(79, 70, 229, 0.15));
}
.image-search-select:invalid { color: var(--text-secondary, #6b7280); }
.image-search-select option { color: #111827; background: #fff; }

/* 上传框：指针 + 圆形图标 + 提示 */
.image-search-upload-card .image-search-dropzone {
    cursor: pointer;
    padding: 2rem 1.5rem;
    transition: border-color 0.2s, background 0.2s;
}
.image-search-upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    margin-bottom: 0.6rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary, #4f46e5) 12%, transparent);
    color: var(--primary, #4f46e5);
    font-size: 1.35rem;
    transition: transform 0.15s ease, background 0.2s;
}
.image-search-dropzone:hover .image-search-upload-icon,
.image-search-dropzone.dragover .image-search-upload-icon {
    transform: scale(1.08);
    background: color-mix(in srgb, var(--primary, #4f46e5) 20%, transparent);
}
.image-search-upload-hint {
    margin: 0.25rem 0 0;
    font-size: 0.75rem;
    color: var(--text-secondary, #6b7280);
}
.image-search-preview {
    display: block;
    margin: 0 auto;
    object-fit: contain;
    max-height: 140px;
    width: auto;
    max-width: 100%;
    border-radius: 8px;
}
.image-search-reference {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    border: 1px solid var(--border, #d1d5db);
    border-radius: var(--radius-lg, 12px);
    padding: 0.5rem;
    background: var(--surface, #fff);
    text-align: center;
    min-height: 180px;
}
.image-search-reference-label {
    font-size: 0.75rem;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 0.5rem;
}
.image-search-reference img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 6px;
}
.image-search-results-wrapper:empty,
.image-search-results:empty { display: none; }
.image-search-results-wrapper:not(:empty),
.image-search-results {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #d1d5db);
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
}
.image-search-results-wrapper > p,
.image-search-results > p { grid-column: 1 / -1; }
@media (max-width: 1024px) {
    .image-search-results-wrapper:not(:empty),
    .image-search-results { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
    .image-search-results-wrapper:not(:empty),
    .image-search-results { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .image-search-results-wrapper:not(:empty),
    .image-search-results { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
    .image-search-reference { min-height: 140px; }
    .image-search-reference img { height: 140px; }
}
.image-search-result-item {
    border-radius: var(--radius-lg, 10px);
    overflow: hidden;
    background: var(--surface, #fff);
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    text-decoration: none;
    color: inherit;
    position: relative;
    display: flex;
    flex-direction: column;
}
.image-search-progress { width: 100%; }
.image-search-progress-track {
    width: 100%;
    height: 8px;
    background: var(--surface-2, #f3f4f6);
    border-radius: 999px;
    overflow: hidden;
}
.image-search-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary, #4f46e5), #8b5cf6);
    transition: width 0.2s linear;
    border-radius: 999px;
}
.image-search-progress-label {
    font-size: 0.8125rem;
    text-align: right;
}
.image-search-result-thumb {
    position: relative;
    aspect-ratio: 9 / 16;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2, #f9fafb);
    overflow: hidden;
}
.image-search-result-thumb img {
    width: auto;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    display: block;
}
.image-search-result-similarity {
    position: absolute;
    top: 0.5rem; right: 0.5rem;
    background: var(--primary, #4f46e5);
    color: #fff;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.image-search-result-meta {
    padding: 0.5rem 0.5rem;
    font-size: 0.75rem;
    text-align: center;
    line-height: 1.35;
    min-height: 2.7em;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========== 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-select {
    border: none;
    outline: none;
    background: transparent;
    padding: 0.625rem 0.25rem 0.625rem 0.875rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    max-width: 45%;
    cursor: pointer;
    flex-shrink: 1;
    min-width: 0;
}

.mobile-nav-search-select option {
    color: #111827;
    background: #fff;
}

.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: 340px;
    opacity: 1;
    pointer-events: auto;
}

.nav-search-select {
    border: none;
    outline: none;
    background: transparent;
    padding: 0.4rem 0.125rem 0.4rem 0.625rem;
    font-size: 0.8rem;
    color: var(--text-primary);
    max-width: 130px;
    cursor: pointer;
    flex-shrink: 1;
    min-width: 0;
}

.nav-search-select option {
    color: #111827;
    background: #fff;
}

.nav-search-input {
    border: none;
    outline: none;
    background: transparent;
    padding: 0.4rem 0.625rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    width: 90px;
    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--games {
    width: 420px;
}

.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--games {
    padding: 0.5rem;
}

.nav-dropdown-inner--levels {
    padding: 0.375rem 0;
}

.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.375rem 1rem;
    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.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
}

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

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

.nav-dropdown-level {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 24px;
    font-size: 0.625rem;
    font-weight: 500;
    border-radius: 3px;
    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.1);
}

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

/* ========== Nav Dropdown: Games List (compact rows with logo + latest levels) ========== */
.nav-dropdown-games-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-dropdown-game-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color 0.15s;
    text-decoration: none;
}

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

.nav-dropdown-game-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--surface-2, #f3f4f6);
}

.nav-dropdown-game-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nav-dropdown-game-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
}

.nav-dropdown-game-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.nav-dropdown-game-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.nav-dropdown-game-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    min-width: 0;
}

.nav-dropdown-game-latest-line {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-secondary);
    line-height: 1.2;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-dropdown-game-latest-line i {
    color: var(--primary);
    font-size: 0.7rem;
}

.nav-dropdown-game-name {
    flex: 1;
    min-width: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-dropdown-game-count {
    flex-shrink: 0;
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-subtle, rgba(0,0,0,0.04));
    padding: 1px 6px;
    border-radius: 999px;
}

.nav-dropdown-game-latest {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
}

.nav-dropdown-game-chip {
    display: inline-flex;
    align-items: center;
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
    white-space: nowrap;
}

.nav-dropdown-game-chip--empty {
    color: var(--text-muted, #9ca3af);
    border-style: dashed;
}

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

.footer-brand-title {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    letter-spacing: -0.02em;
}

.footer-brand-title i {
    color: var(--primary);
}

.footer {
    position: relative;
    overflow: hidden;
}

.footer::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    background: linear-gradient(90deg, rgba(59,130,246,0), rgba(59,130,246,0.25), rgba(236,72,153,0.25), rgba(59,130,246,0));
    pointer-events: none;
}

.footer .grid {
    align-items: start;
}

.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 Guide Accordion ========== */
.mobile-guide-accordion {
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.mobile-guide-accordion:last-child {
    border-bottom: none;
}

.mobile-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-guide-toggle.active,
.mobile-guide-toggle.active .mobile-guide-caret {
    color: var(--primary);
}

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

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

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

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

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

.mobile-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-guide-levels {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}

.mobile-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-guide-level.active,
.mobile-guide-level:hover,
.mobile-guide-level:active {
    background-color: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Mobile guide game list (inside accordion) */
.mobile-guide-games-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mobile-guide-game-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.375rem;
    border-radius: 6px;
    transition: background-color 0.15s;
    text-decoration: none;
}

.mobile-guide-game-row:hover,
.mobile-guide-game-row:active {
    background: var(--bg-subtle, rgba(244,63,94,0.04));
}

.mobile-guide-game-thumb {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--surface-2, #f3f4f6);
}

.mobile-guide-game-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mobile-guide-game-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.mobile-guide-game-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.mobile-guide-game-name {
    flex: 1;
    min-width: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-guide-game-count {
    flex-shrink: 0;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-subtle, rgba(0,0,0,0.04));
    padding: 1px 5px;
    border-radius: 999px;
}

/* ========== 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;
}

/* ========== Mobile-only refinements: smaller fonts & spacing ========== */
@media (max-width: 768px) {
    html { font-size: 14px; }

    body { line-height: 1.5; }

    .container { padding: 0 0.75rem; }

    .card { padding: 0.875rem; }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }

    h1 { font-size: 1.625rem; }
    h2 { font-size: 1.375rem; }
    h3 { font-size: 1.125rem; }
    h4 { font-size: 1rem; }

    .section-title { font-size: 1.375rem !important; }

    .py-10 { padding-top: 1.75rem; padding-bottom: 1.75rem; }
    .py-12 { padding-top: 1.75rem; padding-bottom: 1.75rem; }
    .py-16,
    .py-20 { padding-top: 2.25rem; padding-bottom: 2.25rem; }

    .gap-6 { gap: 0.875rem; }
    .gap-8 { gap: 1.125rem; }

    .mb-6 { margin-bottom: 0.875rem; }
    .mb-8 { margin-bottom: 1.25rem; }
    .mb-10 { margin-bottom: 1.5rem; }
    .mb-12 { margin-bottom: 1.75rem; }

    .comments-section,
    .comment-form-card { padding: 1rem; }
}

@media (max-width: 480px) {
    html { font-size: 13px; }

    .container { padding: 0 0.625rem; }

    .card { padding: 0.75rem; }

    .btn {
        padding: 0.4375rem 0.875rem;
        font-size: 0.75rem;
    }

    h1 { font-size: 1.375rem; }
    h2 { font-size: 1.1875rem; }
    h3 { font-size: 1.0625rem; }

    .section-title { font-size: 1.25rem !important; }

    .py-10 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
    .py-12 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
    .py-16,
    .py-20 { padding-top: 1.75rem; padding-bottom: 1.75rem; }

    .comments-section,
    .comment-form-card { padding: 0.75rem; }
}

/* Prevent inherited font-size changes from animating on small screens */
@media (max-width: 768px) {
    * { transition: none !important; }
    .mobile-menu-panel { transition: transform 0.25s ease !important; }
}

/* iOS Safari: keep form controls at 16px to prevent focus zoom */
@media (max-width: 768px) {
    html {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    .search-input,
    .hero-search-input,
    .hero-search-select,
    .mobile-nav-search-input,
    .mobile-nav-search-select,
    .nav-search-input,
    .search-404-input,
    .search-404-select,
    .detail-level-select select,
    .comment-form-input,
    .comment-form-textarea,
    .form-input,
    input[type="text"],
    input[type="email"],
    input[type="search"],
    input[type="password"],
    input[type="tel"],
    input[type="url"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* ========== Video Walkthrough (wt-*) ========== */
.wt-guide {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.wt-section {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #d1d5db);
    border-radius: var(--radius-lg, 12px);
    padding: 1.25rem;
}
.wt-intro {
    border-left: 4px solid var(--primary, #4f46e5);
    background: color-mix(in srgb, var(--primary, #4f46e5) 5%, var(--surface, #fff));
}
.wt-answer {
    border-left: 4px solid #16a34a;
    background: color-mix(in srgb, #16a34a 6%, var(--surface, #fff));
}
.wt-faq {
    border-left: 4px solid var(--primary, #4f46e5);
    background: color-mix(in srgb, var(--primary, #4f46e5) 5%, var(--surface, #fff));
}
.wt-faq .wt-label { color: var(--primary, #4f46e5); }
.wt-faq-item {
    padding: 1rem 1.25rem;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius-lg, 12px);
    margin-bottom: 0.75rem;
}
.wt-faq-item:last-child { margin-bottom: 0; }
.wt-question {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.5;
    color: #1976d2;
}
.wt-answer-text {
    margin: 0 0 0.5rem 0;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-primary, #1f2937);
}
.wt-faq-mark {
    display: inline-block;
    margin-right: 0.3rem;
    color: var(--primary, #4f46e5);
}
html.dark .wt-faq-item {
    background: var(--surface-2, #1f2937);
    border-color: rgba(255, 255, 255, 0.1);
}
html.dark .wt-question { color: #60a5fa; }
html.dark .wt-answer-text { color: var(--text-primary, #f3f4f6); }
.wt-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--primary, #4f46e5);
    margin-bottom: 0.6rem;
}
.wt-answer .wt-label { color: #16a34a; }
.wt-text {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-primary, #1f2937);
}
.wt-steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: wt-step;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.wt-step {
    counter-increment: wt-step;
    position: relative;
    padding: 0.7rem 0.9rem 0.7rem 2.75rem;
    background: var(--surface-2, #f9fafb);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary, #1f2937);
}
.wt-step::before {
    content: counter(wt-step);
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    background: var(--primary, #4f46e5);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
@media (max-width: 640px) {
    .wt-section { padding: 0.875rem; }
    .wt-step { padding: 0.6rem 0.75rem 0.6rem 2.4rem; font-size: 0.8125rem; }
}

/* ========== Blog Post Article (moved from index/blog_post.html) ========== */
.article-body{font-size:1.0625rem;line-height:1.85;color:#374151}
.dark .article-body{color:#d1d5db}
.article-body p{margin:0 0 1.25em}
.article-body h2{font-size:1.5rem;font-weight:800;margin:2em 0 .75em;color:#111827}
.article-body h3{font-size:1.25rem;font-weight:700;margin:1.75em 0 .6em;color:#111827}
.article-body h4{font-size:1.1rem;font-weight:700;margin:1.5em 0 .5em;color:#111827}
.dark .article-body h2,.dark .article-body h3,.dark .article-body h4{color:#f9fafb}
.article-body ul,.article-body ol{margin:0 0 1.25em;padding-left:1.5em}
.article-body ul{list-style:disc}
.article-body ol{list-style:decimal}
.article-body li{margin-bottom:.4em}
.article-body img{max-width:100%;height:auto;border-radius:12px;margin:1.25em auto;display:block;cursor:zoom-in}
.article-body a{color:var(--color-primary,#f43f5e);text-decoration:underline;text-underline-offset:3px}
.article-body blockquote{margin:1.5em 0;padding:.9em 1.25em;border-left:4px solid var(--color-primary,#f43f5e);background:rgba(244,63,94,.06);border-radius:0 10px 10px 0;font-style:italic}
.article-body table{width:100%;border-collapse:collapse;margin:1.5em 0;font-size:.95rem}
.article-body th,.article-body td{border:1px solid #e5e7eb;padding:.6em .9em;text-align:left}
.dark .article-body th,.dark .article-body td{border-color:#374151}
.article-body th{background:#f9fafb;font-weight:700}
.dark .article-body th{background:#1f2937}
.article-body code{background:#f3f4f6;padding:.15em .45em;border-radius:6px;font-size:.9em}
.dark .article-body code{background:#1f2937}
.article-body pre{background:#111827;color:#e5e7eb;padding:1em 1.25em;border-radius:12px;overflow-x:auto;margin:1.5em 0}
.article-body pre code{background:transparent;padding:0}
.article-body hr{border:none;border-top:1px solid #e5e7eb;margin:2em 0}
.dark .article-body hr{border-color:#374151}
.post-hero{position:relative;border-radius:20px;overflow:hidden;margin-bottom:2rem}
.post-hero img{width:100%;max-height:420px;object-fit:cover;display:block}
.meta-chip{display:inline-flex;align-items:center;gap:.4rem;padding:.35rem .8rem;border-radius:9999px;background:#f3f4f6;font-size:.8rem;font-weight:600;color:#4b5563}
.dark .meta-chip{background:#1f2937;color:#9ca3af}

/* ========== Updates Page (moved from index/updates.html) ========== */
.update-content { position: relative; overflow: hidden; transition: max-height .35s ease; }
.update-content.collapsed { max-height: 120px; }
.update-content.collapsed::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 48px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), var(--surface, #fff));
    pointer-events: none;
}
[data-theme="dark"] .update-content.collapsed::after {
    background: linear-gradient(to bottom, rgba(0,0,0,0), var(--surface, #120c20));
}
.update-expand-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-top: .5rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--primary);
    font-size: .85rem;
    font-weight: 700;
    cursor: pointer;
}
.update-expand-btn:hover { opacity: .8; }
.update-expand-btn i { transition: transform .25s; font-size: .7rem; }
.update-expand-btn.expanded i { transform: rotate(180deg); }
.update-item { animation: updateItemIn .35s ease both; border-left: 3px solid var(--primary, #E94560); }
.update-item.is-hidden { display: none; }
.update-item.is-compact .update-content { max-height: 0; }
.update-item.is-compact .update-content::after { display: none; }
.update-item.is-compact [data-update-links] { display: none; }
@keyframes updateItemIn {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}
