/* Mastering HSK - Shared Styles */

:root {
    /* Colors - Dark Mode */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a26;
    --bg-card: #1e1e2e;
    --bg-hover: #2a2a3a;

    --text-primary: #f0f0f5;
    --text-secondary: #9b9bb5;
    --text-muted: #6b6b85;

    --accent: #8b7cf6;
    --accent-secondary: #c77dff;
    --accent-tertiary: #7dd3fc;
    --accent-light: #a78bfa;
    --accent-glow: rgba(139, 124, 246, 0.15);

    --success: #6ee7b7;
    --success-bg: rgba(110, 231, 183, 0.1);
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.1);
    --error: #f87171;
    --error-bg: rgba(248, 113, 113, 0.1);

    --border: #2a2a3a;
    --border-light: #3a3a4a;

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Effects */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;
}

/* Light Mode - Soft Pastel Palette */
[data-theme="light"] {
    --bg-primary: #faf9fe;
    --bg-secondary: #f5f3ff;
    --bg-tertiary: #ede9fe;
    --bg-card: #ffffff;
    --bg-hover: #f3f0ff;

    --text-primary: #2d2a40;
    --text-secondary: #7c7a8f;
    --text-muted: #a8a6b8;

    --accent: #8b7cf6;
    --accent-secondary: #c77dff;
    --accent-tertiary: #7dd3fc;
    --accent-light: #a78bfa;
    --accent-glow: rgba(139, 124, 246, 0.12);

    --success: #34d399;
    --success-bg: rgba(52, 211, 153, 0.12);
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.12);
    --error: #f87171;
    --error-bg: rgba(248, 113, 113, 0.12);

    --border: #e9e7f4;
    --border-light: #ddd9f0;

    --shadow-sm: 0 2px 8px rgba(139, 124, 246, 0.08);
    --shadow-md: 0 4px 16px rgba(139, 124, 246, 0.12);
    --shadow-lg: 0 8px 32px rgba(139, 124, 246, 0.16);
    --shadow-glow: 0 0 40px rgba(139, 124, 246, 0.2);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

.chinese-text {
    font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-light);
    box-shadow: var(--shadow-glow);
}

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

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* App Layout */
.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: transform var(--transition-slow);
}

.sidebar-header {
    margin-bottom: 32px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 50%, #ec4899 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.1) inset,
        0 0 20px rgba(99, 102, 241, 0.3),
        0 4px 16px rgba(0, 0, 0, 0.15);
    position: relative;
}

.logo-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.2) 0%,
        transparent 50%,
        rgba(0, 0, 0, 0.05) 100%);
    pointer-events: none;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 54px;
}

/* Navigation */
.nav {
    flex: 1;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding-left: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
}

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

.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
}

.nav-icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-item.active .nav-icon {
    opacity: 1;
}

/* Progress Ring */
.progress-ring-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
}

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

.progress-ring svg {
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 8;
}

.progress-ring-fill {
    fill: none;
    stroke: url(#gradient);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease;
}

.progress-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.progress-percentage {
    font-size: 1.75rem;
    font-weight: 700;
}

.progress-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Stats */
.sidebar-stats {
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 24px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.stat-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 600;
    font-size: 0.95rem;
}

.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }

/* Reset Button */
.reset-section {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.reset-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.reset-btn:hover {
    border-color: var(--error);
    color: var(--error);
    background: var(--error-bg);
}

/* Main Content */
.main {
    flex: 1;
    margin-left: 280px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.main-header {
    width: 100%;
    max-width: 700px;
    margin-bottom: 32px;
}

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

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Back Link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
    transition: color var(--transition);
}

.back-link:hover {
    color: var(--text-primary);
}

/* Content Area */
.content {
    width: 100%;
    max-width: 700px;
    display: none;
}

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

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

/* Flashcard */
.flashcard-container {
    perspective: 1000px;
    margin-bottom: 32px;
}

.flashcard {
    width: 100%;
    height: 380px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.card-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, var(--bg-card), var(--bg-tertiary));
}

.card-counter {
    position: absolute;
    top: 24px;
    right: 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.card-chinese {
    font-size: 6rem;
    font-weight: 500;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card-pinyin {
    font-size: 1.75rem;
    color: var(--accent);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.card-english {
    font-size: 2.25rem;
    font-weight: 600;
    text-align: center;
}

.card-hint {
    position: absolute;
    bottom: 24px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.card-status {
    position: absolute;
    top: 24px;
    left: 24px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.card-status.known {
    background: var(--success-bg);
    color: var(--success);
}

.card-status.review {
    background: var(--warning-bg);
    color: var(--warning);
}

/* Audio Button */
.audio-btn {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-glow);
    border: 1px solid var(--accent);
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    z-index: 10;
}

.audio-btn:hover {
    background: var(--accent);
    color: white;
    transform: translateX(-50%) scale(1.1);
}

.audio-btn:active {
    transform: translateX(-50%) scale(0.95);
}

.audio-btn.playing {
    background: var(--accent);
    color: white;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(99, 102, 241, 0); }
}

.audio-btn svg {
    width: 20px;
    height: 20px;
}

/* Card Controls */
.card-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.control-btn {
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
}

.btn-nav {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-nav:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.btn-know {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid transparent;
}

.btn-know:hover {
    background: var(--success);
    color: white;
}

.btn-review {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid transparent;
}

.btn-review:hover {
    background: var(--warning);
    color: white;
}

.btn-shuffle {
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid transparent;
}

.btn-shuffle:hover {
    background: var(--accent);
    color: white;
}

/* Keyboard Hints */
.keyboard-hints {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.key-hint {
    display: flex;
    align-items: center;
    gap: 6px;
}

kbd {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    padding: 4px 8px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Quiz Mode */
.quiz-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 48px;
    box-shadow: var(--shadow-md);
}

.quiz-progress {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.quiz-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #a855f7);
    transition: width var(--transition-slow);
}

.quiz-progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.quiz-question {
    text-align: center;
    margin-bottom: 40px;
}

.quiz-chinese {
    font-size: 5rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.quiz-pinyin {
    font-size: 1.5rem;
    color: var(--accent);
}

.quiz-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.quiz-option {
    padding: 20px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 1rem;
    text-align: center;
}

.quiz-option:hover:not(.disabled) {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.quiz-option.correct {
    border-color: var(--success);
    background: var(--success-bg);
}

.quiz-option.wrong {
    border-color: var(--error);
    background: var(--error-bg);
}

.quiz-option.disabled {
    cursor: default;
}

.quiz-feedback {
    text-align: center;
    margin-top: 24px;
    min-height: 50px;
    font-size: 1rem;
}

.quiz-next-btn {
    display: none;
    margin: 24px auto 0;
    padding: 14px 32px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.quiz-next-btn:hover {
    background: var(--accent-light);
}

.quiz-next-btn.visible {
    display: block;
}

/* Type Test Mode */
.type-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 48px;
    box-shadow: var(--shadow-md);
}

.type-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 32px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--radius-md);
}

.type-tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.type-tab:hover {
    color: var(--text-primary);
}

.type-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.type-question {
    text-align: center;
    margin-bottom: 32px;
}

.type-prompt {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.type-chinese {
    font-size: 5rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.type-hint {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.type-input-wrapper {
    margin-bottom: 24px;
}

.type-input {
    width: 100%;
    padding: 18px 24px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    color: var(--text-primary);
    text-align: center;
    outline: none;
    transition: all var(--transition);
    font-family: inherit;
}

.type-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.type-input.correct {
    border-color: var(--success);
    background: var(--success-bg);
}

.type-input.wrong {
    border-color: var(--error);
    background: var(--error-bg);
}

.type-feedback {
    text-align: center;
    min-height: 60px;
    font-size: 1rem;
}

.type-answer {
    color: var(--accent);
    font-weight: 600;
}

/* Browse Mode */
.browse-header {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 14px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition);
}

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

.search-input:focus {
    border-color: var(--accent);
}

.filter-tabs {
    display: flex;
    gap: 8px;
}

.filter-tab {
    padding: 14px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.filter-tab:hover {
    border-color: var(--border-light);
    color: var(--text-primary);
}

.filter-tab.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}

.browse-list {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    max-height: 600px;
    overflow-y: auto;
}

.browse-item {
    display: grid;
    grid-template-columns: 100px 140px 1fr 60px;
    gap: 16px;
    padding: 16px 24px;
    align-items: center;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--transition);
}

.browse-item:last-child {
    border-bottom: none;
}

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

.browse-chinese {
    font-size: 1.5rem;
    font-weight: 500;
}

.browse-pinyin {
    color: var(--accent);
    font-size: 0.95rem;
}

.browse-english {
    color: var(--text-secondary);
}

.browse-status {
    text-align: center;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.known { background: var(--success); }
.status-dot.review { background: var(--warning); }
.status-dot.unseen { background: var(--border); }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1rem;
}

/* Loading State */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 48px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.modal-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: var(--accent-glow);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

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

.modal-score {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.modal-message {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.modal-btn {
    padding: 14px 32px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.modal-btn:hover {
    background: var(--accent-light);
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.modal-btn-secondary:hover {
    background: var(--bg-hover);
}

.modal-btn-danger {
    background: var(--error);
}

.modal-btn-danger:hover {
    background: #dc2626;
}

/* Mobile Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    height: calc(60px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    align-items: center;
    justify-content: space-between;
    z-index: 99;
}

.menu-toggle {
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-logo {
    font-weight: 700;
    font-size: 1.1rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Sidebar-specific scrollbar - aligned and contained with rounded ends */
.landing-sidebar::-webkit-scrollbar {
    width: 6px;
}

.landing-sidebar::-webkit-scrollbar-track {
    background: transparent;
    margin: 16px 0;
    border-radius: 10px;
}

.landing-sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.landing-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
    margin: 16px 0;
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

/* ===== LANDING PAGE STYLES - SIDEBAR LAYOUT ===== */

.landing {
    min-height: 100vh;
    display: flex;
    position: relative;
}

/* Left Sidebar - Rounded Modern Design */
.landing-sidebar {
    width: 320px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 24px;
    padding: 28px 24px 28px 24px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: calc(100vh - 48px);
    left: 24px;
    top: 24px;
    z-index: 10;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    scrollbar-gutter: stable;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.landing-logo-mark {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 70%, var(--accent-tertiary) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.08) inset,
        0 8px 32px rgba(139, 124, 246, 0.25),
        0 4px 16px rgba(0, 0, 0, 0.12);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.landing-logo-mark .logo-character {
    font-size: 1.85rem;
    font-weight: 600;
    color: white;
    position: relative;
    z-index: 2;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.landing-logo-mark .logo-sparkle {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.95);
    animation: sparkleFloat 3s ease-in-out infinite;
    z-index: 3;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.5));
}

/* Light overlay */
.landing-logo-mark::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.3) 0%,
        transparent 60%);
    pointer-events: none;
}

/* Ambient glow */
.landing-logo-mark::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary), var(--accent-tertiary));
    z-index: -1;
    opacity: 0.4;
    filter: blur(12px);
    transition: opacity 0.3s ease;
}

.landing-logo:hover .landing-logo-mark {
    transform: translateY(-3px);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.12) inset,
        0 12px 40px rgba(139, 124, 246, 0.35),
        0 6px 20px rgba(0, 0, 0, 0.15);
}

.landing-logo:hover .landing-logo-mark::after {
    opacity: 0.6;
}

.landing-logo-text {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

/* Level Navigation */
.levels-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.level-nav-item {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: block;
}

.level-nav-item:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
    transform: translateX(4px);
}

.level-nav-item.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}

.level-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.level-nav-number {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.level-nav-percentage {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.level-nav-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.level-nav-progress {
    margin-bottom: 8px;
}

.level-nav-progress-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 100px;
    overflow: hidden;
}

.level-nav-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-secondary) 60%, var(--accent-tertiary) 100%);
    border-radius: 100px;
    transition: width 0.3s ease;
}

.level-nav-stats {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Right Content Area */
.landing-content {
    flex: 1;
    margin-left: 368px;
    padding: 24px 48px 24px 24px;
    background: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.content-hero {
    max-width: 720px;
    width: 100%;
}

/* Mobile Landing Header - Hidden on desktop */
.mobile-landing-header {
    display: none;
}

.mobile-landing-logo {
    display: none;
}

/* Mobile Level Section - Hidden on desktop */
.mobile-levels-section {
    display: none;
}

.mobile-levels-nav {
    display: none;
}

/* Hero Status */
.hero-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
    box-shadow: 0 0 0 0 var(--accent);
}

@keyframes pulse-dot {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(139, 124, 246, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(139, 124, 246, 0);
    }
}

.status-text {
    letter-spacing: 0.02em;
}

.hero-title {
    font-size: 3.25rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.025em;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.hero-description {
    font-size: 1.15rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 48px;
    max-width: 600px;
}

/* Feature Cards Grid */
.hero-features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 48px;
}

.feature-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s ease;
}

.feature-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(139, 124, 246, 0.12);
}

.feature-icon-wrap {
    width: 48px;
    height: 48px;
    background: var(--accent-glow);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: var(--accent);
}

.feature-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Stats Row */
.hero-stats-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stat-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 100px;
}

.stat-number {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.level-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    padding: 32px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.level-card:hover {
    border-color: var(--border-light);
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(139, 124, 246, 0.12);
}

.level-card.disabled {
    opacity: 0.6;
    pointer-events: none;
    filter: grayscale(0.3);
}

.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--accent-glow);
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 20px;
}

.level-badge .chinese-text {
    font-size: 0.95rem;
}

.level-name {
    font-size: 1.65rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.015em;
    color: var(--text-primary);
}

.level-description {
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 0.95rem;
    line-height: 1.6;
}

.level-stats {
    display: flex;
    gap: 32px;
    margin-bottom: 28px;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.level-stat {
    flex: 1;
    text-align: center;
}

.level-stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
}

.level-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.level-progress {
    margin-bottom: 28px;
}

.level-progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 100px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.level-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-secondary) 60%, var(--accent-tertiary) 100%);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 100px;
    box-shadow: 0 0 12px rgba(139, 124, 246, 0.4);
}

.level-progress-text {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.level-cta {
    display: flex;
    width: 100%;
    padding: 14px;
    background: var(--accent);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.level-cta:hover {
    background: var(--accent-light);
    transform: translateY(-2px);
}

.level-cta svg {
    transition: transform 0.3s ease;
}

.level-cta:hover svg {
    transform: translateX(4px);
}

.coming-soon {
    display: inline-block;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-radius: 100px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 16px;
    font-weight: 600;
    border: 1px solid var(--border);
}

.landing-footer {
    padding: 40px 48px;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

/* Responsive */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

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

    .mobile-header {
        display: flex;
    }

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

    .card-chinese, .quiz-chinese, .type-chinese {
        font-size: 4rem;
    }

    .browse-item {
        grid-template-columns: 80px 1fr 40px;
    }

    .browse-pinyin {
        display: none;
    }

    .keyboard-hints {
        display: none;
    }

    .quiz-options {
        grid-template-columns: 1fr;
    }

    .landing-sidebar {
        width: 280px;
        left: 16px;
        top: 16px;
        height: calc(100vh - 32px);
        padding: 24px 16px;
    }

    .landing-content {
        margin-left: 312px;
        padding: 24px;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-description {
        font-size: 1.05rem;
    }

    .hero-features-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 32px;
    }

    .hero-stats-row {
        justify-content: flex-start;
    }

    .stat-badge {
        padding: 10px 16px;
    }

    .stat-number {
        font-size: 1.2rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .main {
        padding: 70px 16px 16px;
        padding-top: calc(70px + env(safe-area-inset-top, 0px));
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }

    .card-face {
        padding: 32px 24px;
    }

    .flashcard {
        height: 320px;
    }

    .control-btn {
        padding: 12px 16px;
        font-size: 0.85rem;
    }

    .filter-tabs {
        width: 100%;
    }

    .filter-tab {
        flex: 1;
        padding: 12px 8px;
        font-size: 0.8rem;
        text-align: center;
    }

    .landing {
        flex-direction: column;
    }

    /* Hide desktop sidebar on mobile */
    .landing-sidebar {
        display: none;
    }

    /* Mobile landing header with logo and theme toggle */
    .mobile-landing-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 24px;
        padding-top: env(safe-area-inset-top, 0px);
    }

    .mobile-landing-logo {
        display: flex;
        align-items: center;
        gap: 0;
    }

    .mobile-landing-logo .landing-logo-mark {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .mobile-landing-logo .logo-character {
        font-size: 1.4rem;
    }

    .mobile-landing-logo .logo-sparkle {
        font-size: 0.5rem;
        top: 4px;
        right: 4px;
    }

    .mobile-theme-toggle {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    .mobile-theme-toggle svg {
        width: 18px;
        height: 18px;
    }

    /* Show mobile level section */
    .mobile-levels-section {
        display: block;
        margin-top: 40px;
        padding-top: 32px;
        border-top: 1px solid var(--border);
    }

    .mobile-levels-title {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: 16px;
        text-align: left;
    }

    .mobile-levels-nav {
        display: flex;
        gap: 10px;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .mobile-level-bubble {
        position: relative;
        width: 52px;
        height: 52px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        transition: transform 0.2s ease;
        flex-shrink: 0;
    }

    .mobile-level-bubble:active {
        transform: scale(0.95);
    }

    .mobile-level-bubble.disabled {
        opacity: 0.5;
        pointer-events: none;
    }

    .bubble-progress {
        position: absolute;
        inset: 0;
        border-radius: 50%;
        padding: 3px;
    }

    .bubble-progress::before {
        content: '';
        position: absolute;
        inset: 3px;
        background: var(--bg-card);
        border-radius: 50%;
    }

    .bubble-number {
        position: relative;
        z-index: 2;
        font-size: 1.15rem;
        font-weight: 700;
        color: var(--text-primary);
    }

    .landing-content {
        margin-left: 0;
        padding: 20px 16px;
        padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
        min-height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        display: block;
        align-items: flex-start;
    }

    .content-hero {
        max-width: 100%;
        text-align: left;
    }

    .hero-status {
        margin-bottom: 16px;
        font-size: 0.8rem;
    }

    .status-dot {
        width: 7px;
        height: 7px;
    }

    .hero-title {
        font-size: 1.85rem;
        margin-bottom: 14px;
        text-align: left;
        line-height: 1.25;
    }

    .hero-description {
        font-size: 0.95rem;
        margin-bottom: 28px;
        text-align: left;
        line-height: 1.6;
    }

    .hero-features-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 28px;
    }

    .feature-card {
        padding: 18px;
        border-radius: 12px;
    }

    .feature-icon-wrap {
        width: 38px;
        height: 38px;
        border-radius: 10px;
        margin-bottom: 10px;
    }

    .feature-icon-wrap svg {
        width: 18px;
        height: 18px;
    }

    .feature-card h3 {
        font-size: 0.9rem;
        margin-bottom: 4px;
    }

    .feature-card p {
        font-size: 0.8rem;
    }

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

    .stat-badge {
        padding: 8px 12px;
    }

    .stat-number {
        font-size: 1rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    /* Only apply fixed positioning styles to landing page toggle */
    .landing > .theme-toggle {
        top: 16px !important;
        top: calc(16px + env(safe-area-inset-top, 0px)) !important;
        right: 16px !important;
    }

    .mobile-landing-header .theme-toggle svg {
        width: 18px;
        height: 18px;
    }
}

/* Extra small mobile devices */
@media (max-width: 380px) {
    .landing-content {
        padding: 16px 12px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }

    .hero-title {
        font-size: 1.65rem;
    }

    .hero-description {
        font-size: 0.9rem;
    }

    .mobile-level-bubble {
        width: 48px;
        height: 48px;
    }

    .bubble-number {
        font-size: 1.05rem;
    }

    .feature-card {
        padding: 16px;
    }

    .stat-badge {
        padding: 6px 10px;
    }

    .stat-number {
        font-size: 0.95rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }
}

/* Welcome Animation - Seamless Transition Design */
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 1s ease-out;
    pointer-events: none;
}

.welcome-overlay.hidden {
    opacity: 0;
}

.welcome-container {
    text-align: center;
    padding: 0 32px;
}

.welcome-logo {
    margin-bottom: 32px;
    animation: logoFadeIn 0.8s ease-out;
}

.welcome-logo-mark {
    width: 130px;
    height: 130px;
    margin: 0 auto;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 70%, var(--accent-tertiary) 100%);
    border-radius: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 20px 60px rgba(139, 124, 246, 0.3),
        0 8px 32px rgba(0, 0, 0, 0.2);
    position: relative;
    transform-style: preserve-3d;
}

.logo-character {
    font-size: 4.5rem;
    font-weight: 600;
    color: white;
    position: relative;
    z-index: 2;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.logo-sparkle {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    animation: sparkleFloat 3s ease-in-out infinite;
    z-index: 3;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
}

@keyframes sparkleFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.9;
    }
    50% {
        transform: translateY(-4px) rotate(10deg);
        opacity: 1;
    }
}

/* Soft light overlay */
.welcome-logo-mark::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 32px;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.3) 0%,
        transparent 60%);
    pointer-events: none;
}

/* Ambient glow */
.welcome-logo-mark::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 36px;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary), var(--accent-tertiary));
    z-index: -1;
    opacity: 0.5;
    filter: blur(20px);
}

.welcome-title {
    font-size: 2.75rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin-bottom: 16px;
    color: var(--text-primary);
    animation: textFadeIn 0.8s ease-out 0.2s both;
}

.welcome-tagline {
    font-size: 1.4rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 12px;
    animation: textFadeIn 0.8s ease-out 0.4s both;
}

.welcome-subtitle {
    font-size: 1.2rem;
    color: var(--accent);
    font-weight: 500;
    animation: textFadeIn 0.8s ease-out 0.6s both;
}

@keyframes logoFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes textFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .welcome-logo-icon {
        width: 96px;
        height: 96px;
        font-size: 3rem;
        border-radius: 24px;
    }

    .welcome-logo-icon::before {
        border-radius: 24px;
    }

    .welcome-title {
        font-size: 2.25rem;
    }

    .welcome-tagline {
        font-size: 1.2rem;
    }

    .welcome-subtitle {
        font-size: 1.1rem;
    }
}

/* Theme Toggle Button - Base styles */
.theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
    flex-shrink: 0;
}

.theme-toggle:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* Theme icons - hide inactive, show active */
.theme-toggle .theme-icon {
    display: none;
}

.theme-toggle .theme-icon.active {
    display: block;
}

/* Ensure SVG icons inherit color */
.theme-toggle svg {
    color: var(--text-primary);
}

.theme-toggle svg path {
    fill: currentColor;
}

/* Landing page fixed toggle - Desktop only */
.landing > .theme-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
}

/* Hide fixed toggle on mobile for landing page */
@media (max-width: 768px) {
    .landing > .theme-toggle {
        display: none;
    }
}

/* Mobile landing header theme toggle */
.mobile-landing-header .theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

/* Inline nav toggle (lessons, grammar, about pages) */
.nav-right .theme-toggle {
    position: static !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    margin: 0;
    z-index: auto !important;
}

.nav-right .theme-toggle svg {
    width: 16px;
    height: 16px;
}

/* Smooth transition for all theme changes */
* {
    transition: background-color 0.3s ease,
                border-color 0.3s ease,
                box-shadow 0.3s ease;
}

/* Exclude elements that shouldn't transition */
*::before,
*::after,
.flashcard,
.flashcard *,
.welcome-overlay,
.welcome-overlay * {
    transition: none;
}

/* Allow text color transitions on specific elements */
body,
.nav-item,
.level-nav-item,
.feature-card,
.stat-badge,
h1, h2, h3, h4, h5, h6,
p, span, a {
    transition: background-color 0.3s ease,
                border-color 0.3s ease,
                box-shadow 0.3s ease,
                color 0.3s ease;
}

/* Improved logo gradient */
.landing-logo-icon,
.logo-icon {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 50%, #ec4899 100%);
    box-shadow: var(--shadow-glow);
}

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

