/* Practice Hub Premium Styles - Alternate Design Standards */

/* Navigation Overrides - Ensure key nav items are visible */
#petra-menu-container {
    display: block !important;
}

#petra-menu-button {
    display: inline-flex !important;
    /* Practice hub: restyle Petra button to match Flash Cards */
    background: transparent !important;
    box-shadow: none !important;
    color: #4B5563 !important; /* text-gray-700 to match Flash Cards */
    border-radius: 0.5rem !important;
}

#petra-menu-button:hover {
    background: #ecfdf5 !important; /* emerald-50 */
    color: #047857 !important;      /* emerald-700 */
}

/* Hide decorative Petra icons on practice hub (keep dropdown chevron) */
#petra-menu-button .fa-wand-magic-sparkles,
#petra-menu-button .fa-crown {
    display: none !important;
}

/* Ensure Petra AI text is always visible on practice hub (override hidden md:inline) */
#petra-menu-button span {
    display: inline !important;
}

/* Dark mode: make Petra AI button match Flash Cards pill styling */
body.dark-mode #petra-menu-button {
    background: transparent !important;
    border-color: transparent !important;
    color: #C9C5C0 !important; /* same as nav links in dark mode */
}

body.dark-mode #petra-menu-button:hover {
    background: rgba(127, 168, 127, 0.1) !important; /* same hover bg as nav links */
    color: #7FA87F !important; /* same hover text as nav links */
}

#desktop-nav-links {
    display: flex !important;
}

#nav-learn-link {
    display: inline-flex !important;
}

/* Hide individual assessment section links on practice hub */
#desktop-nav-links a[href^="/practice?section="] {
    display: none !important;
}

#upgrade-cta.show-upgrade {
    display: inline-flex !important;
}

/* Mobile Navigation Simplification for Practice Hub */
@media (max-width: 768px) {
    /* Prevent horizontal scroll issues */
    html, body {
        overflow-x: hidden;
        position: relative;
        margin: 0;
        padding: 0;
        width: 100%;
        max-width: 100vw;
    }
    
    /* Clean top nav - only show hamburger and user menu */
    #petra-menu-container,
    #nav-learn-link,
    #desktop-nav-links {
        display: none !important;
    }
    
    /* Note: Flash Cards desktop link already hidden on mobile via 'hidden lg:flex' class in navigation.html */
    
    /* Keep mobile menu hamburger visible */
    #mobile-menu-container {
        display: block !important;
    }
    
    /* Ensure user menu stays visible */
    #user-nav {
        display: flex !important;
    }
    
    /* Compact logo on mobile */
    nav .max-w-7xl {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Dark Mode Toggle Button */
.dark-mode-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    background: var(--bg-white);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 0.5rem;
}

.dark-mode-toggle:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.dark-mode-toggle svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-primary);
    fill: none;
    stroke-width: 2;
}

/* Navigation Dark Mode */
body.dark-mode nav {
    background: #1A1A1A !important;
    border-bottom-color: #2D2D2D !important;
}

body.dark-mode nav .text-gradient,
body.dark-mode nav .font-bold {
    color: #E8E6E3 !important;
}

body.dark-mode nav a {
    color: #C9C5C0 !important;
}

body.dark-mode nav a:hover {
    color: #7FA87F !important;
    background: rgba(127, 168, 127, 0.1) !important;
}

body.dark-mode nav button {
    background: #222222 !important;
    border-color: #2D2D2D !important;
    color: #C9C5C0 !important;
}

body.dark-mode nav button:hover {
    border-color: #7FA87F !important;
}

body.dark-mode nav #user-menu {
    background: #222222 !important;
    border-color: #2D2D2D !important;
}

body.dark-mode nav #mobile-main-menu {
    background: #222222 !important;
    border-color: #2D2D2D !important;
}

body.dark-mode nav #petra-menu {
    background: #222222 !important;
    border-color: #2D2D2D !important;
}

body.dark-mode nav #petra-menu a {
    color: #C9C5C0 !important;
}

body.dark-mode nav #petra-menu a:hover {
    color: #7FA87F !important;
    background: rgba(127, 168, 127, 0.1) !important;
}

body.dark-mode nav #petra-menu .text-emerald-600 {
    color: #7FA87F !important;
}

body.dark-mode nav #credits-menu-item {
    background: linear-gradient(to right, rgba(180, 130, 70, 0.15), rgba(217, 119, 6, 0.15)) !important;
    border-left-color: #d97706 !important;
}

body.dark-mode nav #credits-menu-item:hover {
    background: linear-gradient(to right, rgba(180, 130, 70, 0.25), rgba(217, 119, 6, 0.25)) !important;
}

body.dark-mode nav #credits-menu-item .text-gray-700 {
    color: #E8E6E3 !important;
}

body.dark-mode nav #credits-menu-item .text-yellow-700 {
    color: #fbbf24 !important;
}

body.dark-mode nav #credits-menu-item .text-gray-500 {
    color: #9E9689 !important;
}

body.dark-mode nav #credits-menu-item .text-yellow-600 {
    color: #f59e0b !important;
}

/* Core Color Variables - Light Mode */
:root {
    --primary: #5C6F5C;
    --primary-dark: #2d5f4d;
    --primary-light: rgba(92, 111, 92, 0.08);
    --primary-border: rgba(92, 111, 92, 0.15);
    --text-primary: #1A1816;
    --text-secondary: #3A3633;
    --border-primary: #E8E3DA;
    --text-muted: #9E9689;
    --bg-cream: #F7F4EF;
    --bg-white: #FEFEFE;
    --gray: #6b7280;
}

/* Dark Mode - Applied via body.dark-mode class */
body.dark-mode {
    --primary: #7FA87F;
    --primary-dark: #9bc49b;
    --primary-light: rgba(127, 168, 127, 0.12);
    --primary-border: rgba(127, 168, 127, 0.2);
    --text-primary: #E8E6E3;
    --text-secondary: #C9C5C0;
    --border-primary: #2D2D2D;
    --text-muted: #888581;
    --bg-cream: #1A1A1A;
    --bg-white: #222222;
    --gray: #9ca3af;
    background: #1A1A1A !important;
    color: #E8E6E3 !important;
}

body.dark-mode .spinner-ring-outer {
    border-color: #2D2D2D;
    border-top-color: var(--primary);
}

body.dark-mode .spinner-ring-inner {
    border-right-color: rgba(127, 168, 127, 0.4);
}

body.dark-mode .question-card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.dark-mode .question-card:hover {
    box-shadow: 0 4px 12px rgba(127, 168, 127, 0.2);
}

body.dark-mode .question-card.expanded {
    box-shadow: 0 8px 24px rgba(127, 168, 127, 0.25);
}

body.dark-mode .question-drawer {
    box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.2);
}

body.dark-mode .drawer-header {
    background: #1A1A1A;
    border-bottom-color: #2D2D2D;
}

body.dark-mode .question-sidebar {
    background: #1A1A1A;
    border-right-color: #2D2D2D;
}

body.dark-mode .sidebar-header {
    border-bottom-color: #2D2D2D;
}

body.dark-mode .sidebar-title {
    color: #E8E6E3;
}

body.dark-mode .sidebar-toggle,
body.dark-mode .sidebar-toggle-button {
    color: #9E9689;
}

body.dark-mode .sidebar-toggle:hover,
body.dark-mode .sidebar-toggle-button:hover {
    background: rgba(127, 168, 127, 0.12);
    color: #7FA87F;
    border-color: #7FA87F;
}

body.dark-mode .sidebar-progress {
    border-bottom-color: #2D2D2D;
}

body.dark-mode .sidebar-progress-bar {
    background: #2D2D2D;
}

body.dark-mode .sidebar-progress-text {
    color: #9E9689;
}

body.dark-mode .sidebar-question-item {
    background: transparent;
}

body.dark-mode .sidebar-question-item:hover:not(.locked) {
    background: rgba(127, 168, 127, 0.08);
    border-color: rgba(127, 168, 127, 0.2);
}

body.dark-mode .sidebar-question-item.active {
    background: rgba(127, 168, 127, 0.15);
    border-color: #7FA87F;
}

body.dark-mode .sidebar-question-number {
    background: #2D2D2D;
    color: #9E9689;
}

body.dark-mode .sidebar-question-item.active .sidebar-question-number {
    background: #7FA87F;
    color: #1A1A1A;
}

body.dark-mode .sidebar-question-title {
    color: #E8E6E3;
}

body.dark-mode .sidebar-status-badge.new {
    background: rgba(33, 150, 243, 0.2);
    color: #64B5F6;
}

body.dark-mode .sidebar-status-badge.in-progress {
    background: rgba(245, 124, 0, 0.2);
    color: #FFB74D;
}

body.dark-mode .sidebar-status-badge.completed {
    background: rgba(56, 142, 60, 0.2);
    color: #81C784;
}

body.dark-mode .nav-button-icon {
    background: #222222;
    border-color: #2D2D2D;
    color: #E8E6E3;
}

body.dark-mode .nav-button-icon:hover:not(:disabled) {
    background: rgba(127, 168, 127, 0.12);
    border-color: #7FA87F;
    color: #7FA87F;
}

body.dark-mode .sidebar-footer {
    background: #1A1A1A;
    border-top-color: #2D2D2D;
}

body.dark-mode .shortcut-item {
    color: #9E9689;
}

body.dark-mode .shortcut-item kbd {
    background: #222222;
    border-color: #2D2D2D;
    color: #E8E6E3;
}

body.dark-mode .upgrade-modal {
    background: rgba(0, 0, 0, 0.85);
}

body.dark-mode .search-input,
body.dark-mode .test-dropdown-sidebar,
body.dark-mode .filter-chip {
    background: var(--bg-white);
    border-color: var(--border-primary);
    color: var(--text-primary);
}

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

body.dark-mode .filter-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

body.dark-mode .filter-chip.active {
    background: var(--primary);
    color: #1A1A1A;
}

/* Dark mode - Sidebar Subsections */
body.dark-mode .sidebar-subsection-group {
    background: #1A1A1A;
    border-left-color: #2D2D2D;
}

body.dark-mode .sidebar-subsection:hover {
    background: var(--primary-light);
}

body.dark-mode .sidebar-subsection.active {
    background: var(--primary-light);
}

body.dark-mode .sidebar-subsection.active::before {
    background: var(--primary);
}

body.dark-mode .subsection-dot {
    background: #666666;
}

body.dark-mode .sidebar-subsection:hover .subsection-dot {
    background: var(--primary);
}

body.dark-mode .sidebar-subsection.active .subsection-dot {
    background: var(--primary);
}

body.dark-mode .subsection-label {
    color: #C9C5C0;
}

body.dark-mode .sidebar-subsection:hover .subsection-label {
    color: var(--primary);
}

body.dark-mode .sidebar-subsection.active .subsection-label {
    color: var(--primary);
}

body.dark-mode .drawer-back-button {
    background: var(--primary-light);
    border-color: var(--border-primary);
    color: var(--primary);
}

body.dark-mode .drawer-back-button:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #1A1A1A;
}

body.dark-mode .drawer-close {
    background: var(--primary);
    border-color: var(--primary);
    color: #1A1A1A;
}

body.dark-mode .drawer-close:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #1A1A1A;
}

body.dark-mode kbd {
    background: var(--bg-white) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

/* Dark Mode - Question Cards */
body.dark-mode .question-card-title {
    color: var(--text-primary);
}

body.dark-mode .question-card-meta {
    opacity: 1;
}

body.dark-mode .question-card-description {
    color: #9E9689;
}

body.dark-mode .question-card-author {
    color: var(--primary);
    border-bottom-color: #2D2D2D;
}

/* Dark Mode - Type Badges */
body.dark-mode .type-badge.integrated {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.3);
}

body.dark-mode .type-badge.academic_discussion,
body.dark-mode .type-badge.academic.discussion {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border-color: rgba(168, 85, 247, 0.3);
}

body.dark-mode .type-badge.independent {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}

body.dark-mode .type-badge.integrated_reading,
body.dark-mode .type-badge.integrated_listening,
body.dark-mode .type-badge.integrated_both,
body.dark-mode .type-badge.integrated.reading,
body.dark-mode .type-badge.integrated.listening,
body.dark-mode .type-badge.integrated.both {
    background: rgba(168, 162, 158, 0.15) !important;
    color: #a8a29e !important;
    border-color: rgba(168, 162, 158, 0.3) !important;
}

/* Dark Mode - Speaking Task-Specific Colors */
body.dark-mode .type-badge.task2 {
    background: rgba(148, 163, 184, 0.15) !important;
    color: #94a3b8 !important;
    border-color: rgba(148, 163, 184, 0.3) !important;
}

body.dark-mode .type-badge.task3 {
    background: rgba(167, 139, 250, 0.15) !important;
    color: #a78bfa !important;
    border-color: rgba(167, 139, 250, 0.3) !important;
}

body.dark-mode .type-badge.task4 {
    background: rgba(251, 191, 36, 0.15) !important;
    color: #fbbf24 !important;
    border-color: rgba(251, 191, 36, 0.3) !important;
}

body.dark-mode .type-badge.lecture {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border-color: rgba(99, 102, 241, 0.3);
}

body.dark-mode .type-badge.conversation {
    background: rgba(236, 72, 153, 0.15);
    color: #f472b6;
    border-color: rgba(236, 72, 153, 0.3);
}

body.dark-mode .type-badge.passage {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.3);
}

body.dark-mode .type-badge.user-generated {
    background: linear-gradient(135deg, rgba(92, 111, 92, 0.2) 0%, rgba(127, 168, 127, 0.2) 100%);
    color: #7FA87F;
    border-color: rgba(127, 168, 127, 0.35);
}

/* Dark Mode - Status Badges */
body.dark-mode .status-badge.locked {
    background: rgba(107, 114, 128, 0.15);
    color: #9ca3af;
    border-color: rgba(107, 114, 128, 0.3);
}

body.dark-mode .status-badge.completed {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}

body.dark-mode .status-badge.new {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.3);
}

body.dark-mode .status-badge.in-progress {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
}

/* Dark Mode - Scores */
body.dark-mode .question-card-score.excellent {
    color: #34d399;
}

body.dark-mode .question-card-score.good {
    color: #7FA87F;
}

body.dark-mode .question-card-score.average {
    color: #fbbf24;
}

body.dark-mode .question-card-score.needs-improvement {
    color: #f87171;
}

body.dark-mode .question-card-score.no-score {
    color: var(--text-muted);
}

/* Dark Mode - Action Buttons */
body.dark-mode .question-card-action {
    background: var(--primary);
    color: #1A1A1A;
}

body.dark-mode .question-card:hover .question-card-action {
    background: var(--primary-dark);
}

body.dark-mode .question-card-action.completed {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.4);
}

body.dark-mode .question-card-action.locked {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
    border-color: rgba(107, 114, 128, 0.4);
}

/* Dark Mode - Text Elements */
body.dark-mode .practice-title {
    color: var(--text-primary);
}

body.dark-mode .practice-subtitle {
    color: var(--text-muted);
}

body.dark-mode .results-count {
    color: var(--text-muted);
}

body.dark-mode .loading-text {
    color: var(--primary);
}

body.dark-mode .drawer-title {
    color: var(--text-primary);
}

body.dark-mode .empty-state-title {
    color: var(--text-secondary);
}

body.dark-mode .upgrade-modal-content {
    background: #1A1A1A;
    border-color: #2D2D2D;
}

body.dark-mode .upgrade-modal-header {
    border-bottom-color: #2D2D2D;
}

body.dark-mode .upgrade-modal-label {
    color: #7FA87F;
}

body.dark-mode .upgrade-modal-icon-wrap {
    background: #2D2D2D;
}

body.dark-mode .upgrade-modal-icon-wrap i {
    color: #7FA87F;
}

body.dark-mode .upgrade-modal-title {
    color: #E8E6E3;
}

body.dark-mode .upgrade-modal-message {
    color: #A0A0A0;
}

body.dark-mode .upgrade-modal-upgrade-box {
    background: linear-gradient(135deg, rgba(92, 111, 92, 0.2) 0%, rgba(127, 168, 127, 0.1) 100%);
    border-color: #5C6F5C;
}

body.dark-mode .upgrade-modal-upgrade-title {
    color: #7FA87F;
}

body.dark-mode .upgrade-modal-upgrade-text {
    color: #C0C0C0;
}

body.dark-mode .upgrade-modal-btn-primary {
    background: #5C6F5C;
    border-color: #5C6F5C;
}

body.dark-mode .upgrade-modal-btn-primary:hover {
    background: #7FA87F;
    border-color: #7FA87F;
    box-shadow: 0 4px 12px rgba(127, 168, 127, 0.25);
}

body.dark-mode .upgrade-modal-btn-close {
    color: #808080;
}

body.dark-mode .upgrade-modal-btn-close:hover {
    color: #C0C0C0;
}

/* Dark Mode - Daily Limit Modal (from limit-ui.js) */
body.dark-mode .limit-modal-card {
    background: #1A1A1A !important;
    border-color: #2D2D2D !important;
}
body.dark-mode .limit-modal-header {
    border-bottom-color: #2D2D2D !important;
}
body.dark-mode .limit-modal-label {
    color: #7FA87F !important;
}
body.dark-mode .limit-modal-icon {
    background: #2D2D2D !important;
}
body.dark-mode .limit-modal-icon i {
    color: #7FA87F !important;
}
body.dark-mode .limit-modal-title {
    color: #E8E6E3 !important;
}
body.dark-mode .limit-modal-description {
    color: #A0A0A0 !important;
}
body.dark-mode .limit-modal-countdown-box {
    background: #222222 !important;
    border-color: #2D2D2D !important;
}
body.dark-mode .limit-modal-countdown-label {
    color: #C0C0C0 !important;
}
body.dark-mode .limit-modal-countdown {
    color: #7FA87F !important;
}
body.dark-mode .limit-modal-upgrade-box {
    background: #1A1A1A !important;
    border-color: #5C6F5C !important;
}
body.dark-mode .limit-modal-upgrade-box.primary {
    background: linear-gradient(135deg, rgba(92, 111, 92, 0.2) 0%, rgba(127, 168, 127, 0.1) 100%) !important;
    border-color: #5C6F5C !important;
}
body.dark-mode .limit-modal-upgrade-box.secondary {
    background: #1A1A1A !important;
    border-color: #2D2D2D !important;
}
body.dark-mode .limit-modal-upgrade-title {
    color: #7FA87F !important;
}
body.dark-mode .limit-modal-upgrade-box.secondary .limit-modal-upgrade-title {
    color: #A0A0A0 !important;
}
body.dark-mode .limit-modal-upgrade-text {
    color: #C0C0C0 !important;
}
body.dark-mode .limit-modal-btn-primary {
    background: #5C6F5C !important;
    border-color: #5C6F5C !important;
}
body.dark-mode .limit-modal-btn-primary:hover {
    background: #7FA87F !important;
    border-color: #7FA87F !important;
    box-shadow: 0 4px 12px rgba(127, 168, 127, 0.25) !important;
}
body.dark-mode .limit-modal-btn-outline {
    border-color: #5C6F5C !important;
    color: #7FA87F !important;
}
body.dark-mode .limit-modal-btn-outline:hover {
    background: rgba(127, 168, 127, 0.1) !important;
    box-shadow: 0 4px 12px rgba(127, 168, 127, 0.15) !important;
}
body.dark-mode .limit-modal-btn-secondary {
    color: #808080 !important;
}
body.dark-mode .limit-modal-btn-secondary:hover {
    color: #C0C0C0 !important;
}

/* Dark Mode - Question Content in Drawer */
body.dark-mode .question-prompt,
body.dark-mode .reading-passage {
    background: rgba(127, 168, 127, 0.08) !important;
    border-color: rgba(127, 168, 127, 0.2) !important;
    color: var(--text-primary) !important;
}

body.dark-mode .question-prompt h3,
body.dark-mode .reading-passage h3 {
    color: var(--text-primary) !important;
}

body.dark-mode .question-prompt div,
body.dark-mode .reading-passage div {
    color: var(--text-secondary) !important;
}

body.dark-mode textarea,
body.dark-mode input[type="text"] {
    background: var(--bg-white) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

body.dark-mode textarea::placeholder {
    color: var(--text-muted) !important;
}

body.dark-mode #word-count {
    color: var(--text-muted) !important;
}

body.dark-mode .cta-button {
    background: var(--primary);
    border-color: var(--primary);
    color: #1A1A1A;
}

body.dark-mode .cta-button:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #1A1A1A;
}

body.dark-mode .cta-button.secondary {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

body.dark-mode .cta-button.secondary:hover {
    background: var(--primary-light);
}

/* Hide footer on practice page */
footer {
    display: none !important;
}

/* Container Layout */
.practice-container {
    display: flex;
    min-height: calc(100vh - 64px);
    background: linear-gradient(135deg, var(--bg-cream) 0%, var(--bg-white) 100%);
    position: relative;
}

/* Mobile Bottom Tabs - Hidden by default (desktop) */
.mobile-bottom-tabs {
    display: none;
}

/* Sidebar Styles */
.practice-sidebar {
    width: 275px;
    background: var(--bg-white);
    border-right: 1px solid var(--border-primary);
    padding: 0;
    overflow-y: auto;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 2rem 1.5rem 1.5rem;
    border-bottom: 1px solid var(--border-primary);
    background: linear-gradient(135deg, rgba(92, 111, 92, 0.04) 0%, rgba(92, 111, 92, 0.01) 100%);
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.test-selector-sidebar {
    position: relative;
    z-index: 20; /* Ensure dropdown appears above other content */
}

.test-selector-sidebar label {
    display: block;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Custom Dropdown Styling */
#test-select-btn {
    position: relative;
    overflow: hidden;
    /* Ensure the button visually fills the sidebar width and feels more substantial */
    width: 100%;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

#test-select-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0.1), transparent);
    pointer-events: none;
}

#test-select-menu.open {
    display: block !important;
    opacity: 1 !important;
    transform: scale(100%) !important;
}

#test-select-btn[aria-expanded="true"] #test-select-chevron {
    transform: rotate(180deg);
}

#test-select-menu button.selected {
    background-color: var(--primary-light);
    color: var(--primary);
}

.dark #test-select-menu button.selected {
    background-color: var(--primary-light);
    color: var(--primary);
}

#test-select-menu button.selected .check-icon {
    opacity: 1 !important;
}

#test-select-menu button:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

#test-select-menu button:hover .check-icon {
    opacity: 0.5;
}

#test-select-menu button:hover .text-xs {
    color: var(--primary);
    opacity: 0.7;
}

#test-select-menu .check-icon {
    color: var(--primary);
}

.test-format-info {
    margin-top: 0.75rem;
    padding: 0 0.75rem;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(92, 111, 92, 0.05) 0%, rgba(92, 111, 92, 0.02) 100%);
    border: 1px solid rgba(92, 111, 92, 0.1);
    height: 4.5rem;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.dark .test-format-info {
    background: linear-gradient(135deg, rgba(92, 111, 92, 0.15) 0%, rgba(92, 111, 92, 0.08) 100%);
    border: 1px solid rgba(92, 111, 92, 0.2);
}

.format-indicator {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.format-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #78716c; /* gray-500 - for legacy format */
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dark .format-badge {
    color: #9ca3af; /* gray-400 */
}

.format-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.dark .format-description {
    color: #9ca3af; /* gray-400 */
}

/* TOEFL 2026 Current Format - PrepEx green */
.format-indicator.format-2026 .format-badge {
    color: var(--primary);
}

.dark .format-indicator.format-2026 .format-badge {
    color: #6ee7b7; /* emerald-300 */
}

.sidebar-tabs {
    padding: 1rem 0;
    flex: 1;
}

.sidebar-tab {
    padding: 1rem 1.5rem;
    margin: 0.25rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid transparent;
    background: transparent;
    position: relative;
}

.sidebar-tab:hover {
    background: var(--primary-light);
    border-color: var(--primary-border);
    transform: translateX(2px);
}

.sidebar-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(92, 111, 92, 0.15);
    transform: translateX(2px);
}

.sidebar-tab.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: white;
    border-radius: 0 4px 4px 0;
}

.sidebar-tab.active .tab-icon {
    color: white;
}

.tab-icon {
    width: 24px;
    height: 24px;
    color: var(--primary);
    flex-shrink: 0;
}

.tab-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tab-label {
    flex: 1;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.tab-count {
    font-size: 0.85rem;
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-weight: 700;
    min-width: 28px;
    text-align: center;
}

.sidebar-tab.active .tab-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Practice Test Tab - Minimalist Design */
.sidebar-tab-highlight {
    background: transparent;
    border: 1px solid var(--border-primary) !important;
    position: relative;
}

.sidebar-tab-highlight::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
    opacity: 0.6;
    transition: opacity 0.2s ease, height 0.2s ease;
}

.sidebar-tab-highlight:hover {
    background: var(--primary-light);
    border-color: var(--primary-border) !important;
}

.sidebar-tab-highlight:hover::after {
    opacity: 1;
    height: 70%;
}

.sidebar-tab-highlight .tab-icon {
    color: var(--primary);
}

.sidebar-tab-highlight .tab-label {
    font-weight: 500;
}

.sidebar-tab-highlight.active {
    background: var(--primary);
    border-color: var(--primary) !important;
}

.sidebar-tab-highlight.active::after {
    display: none;
}

.sidebar-tab-highlight.active .tab-icon {
    color: white;
}

.sidebar-tab-highlight.active .tab-label {
    color: white;
}

/* Dark mode support for practice test tab */
body.dark-mode .sidebar-tab-highlight {
    background: transparent;
    border-color: #3f3f46 !important;
}

body.dark-mode .sidebar-tab-highlight::after {
    background: #7FA87F;
}

body.dark-mode .sidebar-tab-highlight:hover {
    background: rgba(127, 168, 127, 0.1);
    border-color: rgba(127, 168, 127, 0.3) !important;
}

body.dark-mode .sidebar-tab-highlight .tab-icon {
    color: #7FA87F;
}

body.dark-mode .sidebar-tab-highlight.active {
    background: #7FA87F;
    border-color: #7FA87F !important;
}

body.dark-mode .sidebar-tab-highlight.active .tab-icon {
    color: #1A1A1A;
}

body.dark-mode .sidebar-tab-highlight.active .tab-label {
    color: #1A1A1A;
}

/* Usage Tracker - Shared Pool Display */
.usage-tracker {
    margin: 0;
    padding: 0.875rem;
    background: var(--bg-white);
    border: 1.5px solid var(--border-primary);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.usage-tracker.unlimited {
    border-color: var(--primary);
    background: var(--primary-light);
}

.usage-tracker-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.usage-tracker-label {
    font-family: 'Poppins', sans-serif;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: var(--text-muted);
}

.usage-tracker-count {
    font-family: 'Poppins', sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

.usage-tracker-count .count-number {
    font-size: 1.125rem;
    color: var(--primary);
}

.usage-tracker-count.depleted {
    color: var(--text-primary);
}

.usage-tracker-count.depleted .count-number {
    color: var(--primary);
}

.usage-tracker-bar {
    height: 5px;
    background: var(--border-primary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.usage-tracker-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.usage-tracker-fill.warning {
    background: var(--primary);
}

.usage-tracker-fill.depleted {
    background: var(--primary);
}

.usage-tracker-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Poppins', sans-serif;
    font-size: 0.625rem;
    color: var(--text-muted);
}

.usage-tracker-reset {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.usage-tracker-reset svg {
    width: 10px;
    height: 10px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.usage-tracker-upgrade {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.usage-tracker-upgrade:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.usage-tracker-unlimited {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    color: var(--primary);
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.25rem 0;
}

.usage-tracker-unlimited svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* Dark mode for usage tracker */
body.dark-mode .usage-tracker {
    background: #1A1A1A;
    border-color: #2D2D2D;
}

body.dark-mode .usage-tracker.unlimited {
    background: rgba(127, 168, 127, 0.1);
    border-color: rgba(127, 168, 127, 0.3);
}

body.dark-mode .usage-tracker-label {
    color: #9E9689;
}

body.dark-mode .usage-tracker-count {
    color: #E8E6E3;
}

body.dark-mode .usage-tracker-bar {
    background: #2D2D2D;
}

body.dark-mode .usage-tracker-footer {
    color: #9E9689;
}

body.dark-mode .usage-tracker-upgrade {
    color: #7FA87F;
}

body.dark-mode .usage-tracker-upgrade:hover {
    color: #9FC99F;
}

body.dark-mode .usage-tracker-unlimited {
    color: #7FA87F;
}

/* Hide usage tracker completely until auth loaded */
.usage-tracker.loading {
    opacity: 0;
}

.usage-tracker.hidden {
    display: none;
}

/* Loading indicator removed */

/* Main Content Area */
.practice-main {
    flex: 1;
    padding: 2.5rem 3rem;
    overflow-y: auto;
    background: linear-gradient(135deg, var(--bg-cream) 0%, var(--bg-white) 100%);
}

/* Top Bar */
.practice-header {
    margin-bottom: 2rem;
    transition: opacity 0.3s ease, max-height 0.3s ease;
    opacity: 1;
    max-height: 500px;
    overflow: hidden;
}

/* Hidden state for section switching (Learn tab) - override generic .hidden */
.practice-header.hidden {
    display: block !important; /* Override generic .hidden { display: none !important } */
    opacity: 0;
    max-height: 0;
    margin-bottom: 0;
    pointer-events: none;
}

/* Hidden state for drawer open - immediate hide, no transition */
.practice-header.drawer-open {
    display: none !important;
}

.practice-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.practice-header-content {
    flex: 1;
}

.practice-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.practice-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
}

/* Section Stats - Minimalistic 3-card layout */
.section-stats-container {
    margin-top: 1rem;
}

.section-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.section-stat-card {
    background: var(--bg-white);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 0.875rem 1rem;
    text-align: center;
}

.section-stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.25rem;
}

.section-stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.section-stat-suffix {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-muted);
}

/* Dark mode */
body.dark-mode .section-stat-card {
    background: #222222;
    border-color: #2D2D2D;
}

body.dark-mode .section-stat-label {
    color: #888;
}

body.dark-mode .section-stat-value {
    color: #E8E6E3;
}

body.dark-mode .section-stat-suffix {
    color: #666;
}

/* Responsive: Mobile */
@media (max-width: 640px) {
    .section-stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .section-stat-card {
        padding: 0.625rem 0.5rem;
    }
    
    .section-stat-label {
        font-size: 0.65rem;
    }
    
    .section-stat-value {
        font-size: 1.25rem;
    }
    
    .section-stat-suffix {
        font-size: 0.75rem;
    }
}

/* Search and Filters */
.practice-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-container {
    position: relative;
    flex: 1;
    min-width: 300px;
}

.search-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    border: 2px solid var(--border-primary);
    border-radius: 12px;
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

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

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

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.clear-search {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: none;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.clear-search:hover {
    color: var(--text-primary);
    background: var(--primary-light);
}

.clear-search svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.search-input:not(:placeholder-shown) ~ .clear-search {
    display: block;
}

.filter-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-chip {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-primary);
    border-radius: 20px;
    background: var(--bg-white);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.filter-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Play/Shuffle Button */

.play-shuffle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 2px solid var(--primary);
    border-radius: 24px 0 0 24px;
    background: var(--primary);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.play-shuffle-btn:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(92, 111, 92, 0.3);
}

.play-shuffle-btn:active {
    transform: scale(0.98);
}

.play-shuffle-btn:disabled {
    cursor: wait;
}

.play-shuffle-btn.loading {
    pointer-events: none;
}

.play-shuffle-btn.loading .play-icon {
    display: none;
}

.play-shuffle-btn.loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: play-btn-spin 0.6s linear infinite;
}

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

.play-shuffle-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.play-shuffle-btn .play-icon {
    transition: transform 0.2s ease;
}

.play-shuffle-btn:hover .play-icon {
    transform: scale(1.1);
}

.play-settings-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border: 2px solid var(--primary);
    border-left: none;
    border-radius: 0 24px 24px 0;
    background: var(--primary);
    color: white;
    cursor: pointer;
    transition: all 0.15s ease;
}

.play-settings-toggle:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.play-settings-toggle svg {
    width: 12px;
    height: 12px;
    opacity: 0.9;
    transition: transform 0.2s ease;
}

.play-settings-toggle.open svg {
    transform: rotate(180deg);
}

/* Play Settings Popover - uses position:fixed to escape overflow:hidden parents */
.play-settings-popover {
    position: fixed;
    width: 280px;
    background: var(--bg-white);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.play-settings-popover.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.play-settings-header {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-primary);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

.play-settings-body {
    padding: 0.75rem 0;
}

.play-setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.play-setting-item:hover {
    background: rgba(92, 111, 92, 0.04);
}

.play-setting-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.play-setting-toggle {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--border-primary);
    border-radius: 10px;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.play-setting-toggle.active {
    background: var(--primary);
}

.play-setting-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease;
}

.play-setting-toggle.active::after {
    transform: translateX(16px);
}

.play-settings-divider {
    height: 1px;
    background: var(--border-primary);
    margin: 0.5rem 0;
}

/* All Completed Modal */
.shuffle-complete-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.shuffle-complete-modal.open {
    opacity: 1;
    visibility: visible;
}

.shuffle-complete-content {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.shuffle-complete-modal.open .shuffle-complete-content {
    transform: scale(1);
}

.shuffle-complete-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(92, 111, 92, 0.15) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shuffle-complete-icon svg {
    width: 32px;
    height: 32px;
    stroke: var(--primary);
    fill: none;
    stroke-width: 2.5;
}

.shuffle-complete-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.shuffle-complete-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.shuffle-complete-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.shuffle-complete-actions button {
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.shuffle-complete-actions .btn-secondary {
    background: transparent;
    border: 2px solid var(--border-primary);
    color: var(--text-secondary);
}

.shuffle-complete-actions .btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.shuffle-complete-actions .btn-primary {
    background: var(--primary);
    border: 2px solid var(--primary);
    color: white;
}

.shuffle-complete-actions .btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Dark Mode - Play Button */
body.dark-mode .play-shuffle-btn {
    background: #7FA87F;
    border-color: #7FA87F;
    color: #1A1A1A;
}

body.dark-mode .play-shuffle-btn:hover {
    background: #5C6F5C;
    border-color: #5C6F5C;
}

body.dark-mode .play-shuffle-btn.loading::before {
    border-color: rgba(26, 26, 26, 0.3);
    border-top-color: #1A1A1A;
}

body.dark-mode .play-settings-toggle {
    background: #7FA87F;
    border-color: #7FA87F;
    color: #1A1A1A;
}

body.dark-mode .play-settings-toggle:hover {
    background: #5C6F5C;
    border-color: #5C6F5C;
}

body.dark-mode .play-settings-popover {
    background: #222222;
    border-color: #2D2D2D;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

body.dark-mode .play-settings-header {
    border-bottom-color: #2D2D2D;
    color: #9E9689;
}

body.dark-mode .play-setting-item:hover {
    background: rgba(127, 168, 127, 0.08);
}

body.dark-mode .play-setting-label {
    color: #E8E6E3;
}

body.dark-mode .play-setting-toggle {
    background: #3D3D3D;
}

body.dark-mode .play-setting-toggle.active {
    background: #7FA87F;
}

body.dark-mode .play-settings-divider {
    background: #2D2D2D;
}

/* Action Buttons Container (Create + Play) */
.action-buttons-container {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
    align-items: center;
}

.play-shuffle-wrapper {
    position: relative;
    display: flex;
}

/* Create Button - Subtle outline style */
.create-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    border: 1.5px solid var(--primary);
    border-radius: 20px;
    background: transparent;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.create-btn:hover {
    background: rgba(92, 111, 92, 0.08);
    transform: translateY(-1px);
}

.create-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

body.dark-mode .create-btn {
    border-color: #7FA87F;
    color: #7FA87F;
}

body.dark-mode .create-btn:hover {
    background: rgba(127, 168, 127, 0.15);
}

/* Mine filter chip - Icon-only toggle with green accent */
.filter-chip-mine {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 2px solid var(--border-primary);
    border-radius: 50%;
    background: var(--bg-white);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

/* Larger invisible hit target for easier clicking */
.filter-chip-mine::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border-radius: 50%;
}

.filter-chip-mine:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(92, 111, 92, 0.05);
}

.filter-chip-mine.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 0 3px rgba(92, 111, 92, 0.2);
}

body.dark-mode .filter-chip-mine {
    background: #1A1A1A;
    border-color: #3D3D3D;
    color: #888;
}

body.dark-mode .filter-chip-mine:hover {
    background: #2D2D2D;
    border-color: #7FA87F;
    color: #7FA87F;
}

body.dark-mode .filter-chip-mine.active {
    background: #5C6F5C;
    border-color: #5C6F5C;
    color: white;
    box-shadow: 0 0 0 3px rgba(127, 168, 127, 0.25);
}

/* CTW Generation Modal */
.ctw-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ctw-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.ctw-modal {
    background: var(--bg-white);
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.ctw-modal-overlay.open .ctw-modal {
    transform: scale(1);
}

.ctw-modal-header {
    padding: 1.5rem 1.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.ctw-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ctw-modal-header h3 svg {
    color: var(--primary);
}

.ctw-modal-close {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.ctw-modal-close:hover {
    color: var(--text-primary);
}

.ctw-modal-subtitle {
    margin: 0.5rem 0 0;
    padding: 0 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.ctw-modal-body {
    padding: 1.5rem;
}

.ctw-form-group {
    margin-bottom: 1.25rem;
}

.ctw-form-group:last-child {
    margin-bottom: 0;
}

.ctw-form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.ctw-form-input,
.ctw-form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-white);
    transition: border-color 0.2s;
}

.ctw-form-input:focus,
.ctw-form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(92, 111, 92, 0.1);
}

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

.ctw-modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ctw-footer-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ctw-user-balance {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ctw-user-balance span {
    font-weight: 500;
    color: var(--text-secondary);
}

.ctw-section-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ctw-section-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-white);
}

.ctw-section-option input[type="radio"] {
    display: none;
}

.ctw-section-option:hover:not(.ctw-section-disabled) {
    border-color: var(--primary);
    background: rgba(92, 111, 92, 0.05);
}

.ctw-section-selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(92, 111, 92, 0.1) 0%, rgba(127, 168, 127, 0.05) 100%);
}

.ctw-section-selected .ctw-section-label {
    color: var(--primary);
    font-weight: 600;
}

.ctw-section-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: var(--bg-card);
}

.ctw-section-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    flex: 1;
}

.ctw-coming-soon-badge {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: rgba(150, 140, 130, 0.15);
    color: var(--text-muted);
    white-space: nowrap;
}

.ctw-credit-cost {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.ctw-credit-cost strong {
    color: var(--primary);
}

.ctw-modal-actions {
    display: flex;
    gap: 0.75rem;
}

.ctw-cancel-btn {
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.ctw-cancel-btn:hover {
    background: var(--bg-hover);
}

.ctw-submit-btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #5C6F5C 0%, #7FA87F 100%);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ctw-submit-btn:hover {
    background: linear-gradient(135deg, #4A5D4A 0%, #6B966B 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(92, 111, 92, 0.3);
}

.ctw-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ctw-submit-btn .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

body.dark-mode .ctw-modal {
    background: #1A1A1A;
}

body.dark-mode .ctw-modal-header h3 {
    color: #E8E6E3;
}

body.dark-mode .ctw-modal-subtitle {
    color: #9E9689;
}

body.dark-mode .ctw-form-label {
    color: #E8E6E3;
}

body.dark-mode .ctw-form-input,
body.dark-mode .ctw-form-select {
    background: #222222;
    border-color: #3D3D3D;
    color: #E8E6E3;
}

body.dark-mode .ctw-form-input:focus,
body.dark-mode .ctw-form-select:focus {
    border-color: #7FA87F;
}

body.dark-mode .ctw-modal-footer {
    border-top-color: #2D2D2D;
}

body.dark-mode .ctw-cancel-btn {
    background: #2D2D2D;
    border-color: #3D3D3D;
    color: #E8E6E3;
}

body.dark-mode .ctw-cancel-btn:hover {
    background: #3D3D3D;
}

body.dark-mode .ctw-user-balance {
    color: #7A756F;
}

body.dark-mode .ctw-user-balance span {
    color: #9E9689;
}

body.dark-mode .ctw-section-option {
    background: #222222;
    border-color: #3D3D3D;
}

body.dark-mode .ctw-section-option:hover:not(.ctw-section-disabled) {
    border-color: #7FA87F;
    background: rgba(127, 168, 127, 0.1);
}

body.dark-mode .ctw-section-selected {
    border-color: #7FA87F;
    background: linear-gradient(135deg, rgba(127, 168, 127, 0.15) 0%, rgba(92, 111, 92, 0.08) 100%);
}

body.dark-mode .ctw-section-label {
    color: #E8E6E3;
}

body.dark-mode .ctw-section-disabled {
    background: #1A1A1A;
}

body.dark-mode .ctw-coming-soon-badge {
    background: rgba(100, 95, 90, 0.25);
    color: #7A756F;
}

/* CTW Form Enhancements */
.ctw-topic-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-style: italic;
}

.ctw-form-row {
    display: flex;
    gap: 1rem;
}

.ctw-form-half {
    flex: 1;
}

body.dark-mode .ctw-topic-hint {
    color: #7A756F;
}

/* CTW Loading Overlay */
.ctw-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 24, 22, 0.85);
    backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100001;
    animation: ctwFadeIn 0.3s ease-out;
}

.ctw-loading-overlay.hidden {
    display: none;
}

@keyframes ctwFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ctw-loading-modal {
    text-align: center;
    padding: 2.5rem;
}

.ctw-loading-spinner {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 1.5rem;
}

.ctw-loading-spinner svg {
    width: 100%;
    height: 100%;
    color: var(--primary);
    animation: ctwSpinnerRotate 1.5s linear infinite;
}

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

.ctw-loading-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.ctw-petra-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    box-shadow: 0 0 25px rgba(92, 111, 92, 0.5);
    animation: petraPulse 2s ease-in-out infinite;
}

@keyframes petraPulse {
    0%, 100% { 
        transform: scale(1); 
        box-shadow: 0 0 25px rgba(92, 111, 92, 0.5);
    }
    50% { 
        transform: scale(1.05); 
        box-shadow: 0 0 40px rgba(92, 111, 92, 0.7);
    }
}

.ctw-loading-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #FFFFFF;
    margin-bottom: 0.5rem;
    font-family: 'Instrument Serif', serif;
}

.ctw-loading-status {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1.5rem;
}

.ctw-loading-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.ctw-loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: ctwDot 1.4s ease-in-out infinite;
}

.ctw-loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.ctw-loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes ctwDot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* CTW Variations Selection Overlay */
.ctw-variations-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    opacity: 1;
    animation: ctwFadeIn 0.3s ease-out;
    padding: 1rem;
}

.ctw-variations-overlay.hidden {
    display: none;
}

.ctw-variations-modal {
    background: var(--bg-white);
    border-radius: 20px;
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.25);
    animation: ctwSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes ctwSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ctw-variations-header {
    padding: 1.5rem 1.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ctw-variations-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ctw-variations-header h3 svg {
    color: var(--primary);
}

.ctw-variations-subtitle {
    margin: 0.5rem 0 0;
    padding: 0 1.5rem 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-primary);
}

.ctw-variations-grid {
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ctw-variation-card {
    background: var(--bg-cream);
    border: 2px solid var(--border-primary);
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.ctw-variation-card:hover {
    border-color: var(--primary);
    background: rgba(92, 111, 92, 0.04);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(92, 111, 92, 0.12);
}

.ctw-variation-card:active {
    transform: translateY(0);
}

.ctw-variation-number {
    position: absolute;
    top: -10px;
    left: 1rem;
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.ctw-variation-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    padding-top: 0.5rem;
}

.ctw-variation-preview {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ctw-variation-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ctw-variation-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.ctw-variation-start {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    font-weight: 500;
    font-size: 0.85rem;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.2s ease;
}

.ctw-variation-card:hover .ctw-variation-start {
    opacity: 1;
    transform: translateX(0);
}

/* Re-roll button footer */
.ctw-variations-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-primary);
    display: flex;
    justify-content: center;
}

.ctw-reroll-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: 2px solid var(--primary);
    border-radius: 24px;
    background: transparent;
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ctw-reroll-btn:hover {
    background: rgba(92, 111, 92, 0.1);
    transform: translateY(-1px);
}

.ctw-reroll-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.ctw-reroll-btn.used {
    border-color: var(--text-muted);
    color: var(--text-muted);
}

body.dark-mode .ctw-variations-footer {
    border-top-color: #2D2D2D;
}

body.dark-mode .ctw-reroll-btn {
    border-color: #7FA87F;
    color: #7FA87F;
}

body.dark-mode .ctw-reroll-btn:hover {
    background: rgba(127, 168, 127, 0.15);
}

body.dark-mode .ctw-reroll-btn.used {
    border-color: #888;
    color: #888;
}

/* Dark mode for loading and variations */
body.dark-mode .ctw-loading-overlay {
    background: rgba(10, 10, 10, 0.9);
}

body.dark-mode .ctw-loading-title {
    color: #E8E6E3;
}

body.dark-mode .ctw-loading-status {
    color: rgba(232, 230, 227, 0.6);
}

body.dark-mode .ctw-variations-modal {
    background: #1A1A1A;
}

body.dark-mode .ctw-variations-header h3 {
    color: #E8E6E3;
}

body.dark-mode .ctw-variations-subtitle {
    color: #9E9689;
    border-bottom-color: #2D2D2D;
}

body.dark-mode .ctw-variation-card {
    background: #222222;
    border-color: #3D3D3D;
}

body.dark-mode .ctw-variation-card:hover {
    background: rgba(127, 168, 127, 0.08);
    border-color: #7FA87F;
}

body.dark-mode .ctw-variation-title {
    color: #E8E6E3;
}

body.dark-mode .ctw-variation-preview {
    color: #B8B5B2;
}

body.dark-mode .ctw-variation-meta {
    color: #7A756F;
}

/* CTW Credits Modal (Insufficient Credits) */
.ctw-credits-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100002;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 1rem;
}

.ctw-credits-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.ctw-credits-modal {
    background: var(--bg-white);
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.25);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.ctw-credits-modal-overlay.open .ctw-credits-modal {
    transform: scale(1) translateY(0);
}

.ctw-credits-modal-icon {
    width: 64px;
    height: 64px;
    margin: 2rem auto 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(92, 111, 92, 0.1) 0%, rgba(127, 168, 127, 0.08) 100%);
}

.ctw-credits-modal-icon svg {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.ctw-credits-modal-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin: 0 1.5rem;
    font-family: 'Instrument Serif', serif;
}

.ctw-credits-modal-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: center;
    margin: 0.75rem 1.5rem 0;
    line-height: 1.5;
}

.ctw-credits-modal-balance {
    margin: 1.5rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ctw-credits-balance-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.ctw-credits-balance-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ctw-credits-balance-value.insufficient {
    color: #dc3545;
}

.ctw-credits-modal-cta {
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(92, 111, 92, 0.05) 0%, rgba(127, 168, 127, 0.03) 100%);
    border-top: 1px solid var(--border-primary);
}

.ctw-credits-upgrade-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #5C6F5C 0%, #7FA87F 100%);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.ctw-credits-upgrade-btn:hover {
    background: linear-gradient(135deg, #4A5D4A 0%, #6B966B 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(92, 111, 92, 0.35);
}

.ctw-credits-upgrade-btn svg {
    width: 18px;
    height: 18px;
}

.ctw-credits-close-btn {
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.ctw-credits-close-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

/* Paid user variant */
.ctw-credits-modal.paid-variant .ctw-credits-modal-icon {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(99, 102, 241, 0.08) 100%);
}

.ctw-credits-modal.paid-variant .ctw-credits-modal-icon svg {
    color: #3b82f6;
}

.ctw-credits-modal.paid-variant .ctw-credits-coming-soon {
    margin: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(99, 102, 241, 0.05) 100%);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 12px;
    text-align: center;
}

.ctw-credits-coming-soon-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #3b82f6;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.ctw-credits-coming-soon-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.ctw-credits-modal.paid-variant .ctw-credits-modal-cta {
    background: var(--bg-card);
}

/* Dark mode */
body.dark-mode .ctw-credits-modal {
    background: #1A1A1A;
}

body.dark-mode .ctw-credits-modal-title {
    color: #E8E6E3;
}

body.dark-mode .ctw-credits-modal-subtitle {
    color: #9E9689;
}

body.dark-mode .ctw-credits-modal-balance {
    background: #222222;
}

body.dark-mode .ctw-credits-balance-label {
    color: #7A756F;
}

body.dark-mode .ctw-credits-balance-value {
    color: #E8E6E3;
}

body.dark-mode .ctw-credits-modal-cta {
    background: rgba(127, 168, 127, 0.05);
    border-top-color: #2D2D2D;
}

body.dark-mode .ctw-credits-close-btn {
    border-color: #3D3D3D;
    color: #9E9689;
}

body.dark-mode .ctw-credits-close-btn:hover {
    border-color: #7FA87F;
    color: #E8E6E3;
}

body.dark-mode .ctw-credits-modal.paid-variant .ctw-credits-coming-soon {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.2);
}

body.dark-mode .ctw-credits-coming-soon-text {
    color: #B8B5B2;
}

body.dark-mode .shuffle-complete-modal {
    background: rgba(0, 0, 0, 0.7);
}

body.dark-mode .shuffle-complete-content {
    background: #222222;
}

body.dark-mode .shuffle-complete-icon {
    background: linear-gradient(135deg, rgba(127, 168, 127, 0.15) 0%, rgba(127, 168, 127, 0.08) 100%);
}

body.dark-mode .shuffle-complete-icon svg {
    stroke: #7FA87F;
}

body.dark-mode .shuffle-complete-title {
    color: #E8E6E3;
}

body.dark-mode .shuffle-complete-message {
    color: #B8B5B2;
}

body.dark-mode .shuffle-complete-actions .btn-secondary {
    border-color: #3D3D3D;
    color: #B8B5B2;
}

body.dark-mode .shuffle-complete-actions .btn-secondary:hover {
    border-color: #7FA87F;
    color: #7FA87F;
}

body.dark-mode .shuffle-complete-actions .btn-primary {
    background: #7FA87F;
    border-color: #7FA87F;
    color: #1A1A1A;
}

/* Template Button */
.template-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: 2px solid var(--primary);
    border-radius: 10px;
    background: transparent;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-button:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(92, 111, 92, 0.2);
}

.template-button svg {
    width: 1rem;
    height: 1rem;
}

/* Template Button in Drawer */
.drawer-template-button {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

@media (max-width: 768px) {
    .drawer-template-button span {
        display: none;
    }
    .drawer-template-button {
        padding: 0.5rem;
        min-width: 40px;
        justify-content: center;
    }
}

/* Template Modal */
.template-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.template-modal.show {
    opacity: 1;
}

.template-modal-content {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 2rem;
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.template-modal.show .template-modal-content {
    transform: scale(1);
}

.template-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-primary);
}

.template-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.template-modal-close {
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    background: var(--bg-cream);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.template-modal-close:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.template-modal-close svg {
    width: 1.25rem;
    height: 1.25rem;
}

.template-modal-body {
    color: var(--text-secondary);
    line-height: 1.7;
}

.template-modal-body h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 0.75rem 0;
}

.template-modal-body h3:first-child {
    margin-top: 0;
}

.template-modal-body p {
    margin: 0.5rem 0;
}

.template-modal-body ul, .template-modal-body ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.template-modal-body li {
    margin: 0.5rem 0;
}

.template-modal-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

.template-modal-body .template-section {
    background: var(--bg-cream);
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin: 1rem 0;
    border-left: 3px solid var(--primary);
}

.template-modal-body .template-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(92, 111, 92, 0.1);
    color: var(--primary);
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-right: 0.5rem;
}

/* Dark Mode for Template Button and Modal */
body.dark-mode .template-button {
    border-color: #7FA87F;
    color: #7FA87F;
}

body.dark-mode .template-button:hover {
    background: #7FA87F;
    color: #1A1A1A;
}

body.dark-mode .drawer-template-button {
    border-color: #7FA87F;
    color: #7FA87F;
}

body.dark-mode .drawer-template-button:hover {
    background: #7FA87F;
    color: #1A1A1A;
}

body.dark-mode .template-modal {
    background: rgba(0, 0, 0, 0.85);
}

body.dark-mode .template-modal-content {
    background: #222222;
}

body.dark-mode .template-modal-header {
    border-color: #2D2D2D;
}

body.dark-mode .template-modal-title {
    color: #E8E6E3;
}

body.dark-mode .template-modal-close {
    background: #1A1A1A;
    color: #B8B5B2;
}

body.dark-mode .template-modal-close:hover {
    background: rgba(127, 168, 127, 0.15);
    color: #7FA87F;
}

body.dark-mode .template-modal-body {
    color: #B8B5B2;
}

body.dark-mode .template-modal-body h3 {
    color: #E8E6E3;
}

body.dark-mode .template-modal-body strong {
    color: #E8E6E3;
}

body.dark-mode .template-modal-body .template-section {
    background: #1A1A1A;
    border-left-color: #7FA87F;
}

body.dark-mode .template-modal-body .template-badge {
    background: rgba(127, 168, 127, 0.15);
    color: #7FA87F;
}

/* Sidebar Subsections (nested under main sections) */
.sidebar-subsection-group {
    display: flex;
    flex-direction: column;
    background: var(--bg-cream);
    border-left: 2px solid var(--border-primary);
    margin-left: 1rem;
    animation: slideDown 0.2s ease-out;
}

.sidebar-subsection {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem 0.75rem 1.5rem;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.sidebar-subsection:hover {
    background: var(--primary-light);
}

.sidebar-subsection.active {
    background: var(--primary-light);
}

.sidebar-subsection.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
}

.subsection-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.sidebar-subsection:hover .subsection-dot {
    background: var(--primary);
    transform: scale(1.3);
}

.sidebar-subsection.active .subsection-dot {
    background: var(--primary);
    transform: scale(1.5);
}

.subsection-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.sidebar-subsection:hover .subsection-label {
    color: var(--primary);
}

.sidebar-subsection.active .subsection-label {
    color: var(--primary);
    font-weight: 600;
}

/* Premium Pack Subsection Styling */
.sidebar-subsection.premium-pack {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.08) 0%, rgba(245, 158, 11, 0.04) 100%);
    border-top: 1px solid rgba(251, 191, 36, 0.15);
    border-bottom: 1px solid rgba(251, 191, 36, 0.15);
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
}

.sidebar-subsection.premium-pack:hover {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(245, 158, 11, 0.08) 100%);
}

.sidebar-subsection.premium-pack.active {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(245, 158, 11, 0.1) 100%);
}

.sidebar-subsection.premium-pack.active::before {
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
}

.subsection-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d97706;
    flex-shrink: 0;
}

.sidebar-subsection.premium-pack .subsection-label {
    color: #92400e;
    font-weight: 600;
}

.sidebar-subsection.premium-pack:hover .subsection-label,
.sidebar-subsection.premium-pack.active .subsection-label {
    color: #78350f;
}

.subsection-badge {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    margin-left: auto;
    flex-shrink: 0;
}

/* Dark Mode Premium Pack */
body.dark-mode .sidebar-subsection.premium-pack {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.12) 0%, rgba(245, 158, 11, 0.06) 100%);
    border-top-color: rgba(251, 191, 36, 0.25);
    border-bottom-color: rgba(251, 191, 36, 0.25);
}

body.dark-mode .sidebar-subsection.premium-pack:hover {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(245, 158, 11, 0.1) 100%);
}

body.dark-mode .sidebar-subsection.premium-pack .subsection-label {
    color: #fbbf24;
}

body.dark-mode .sidebar-subsection.premium-pack:hover .subsection-label,
body.dark-mode .sidebar-subsection.premium-pack.active .subsection-label {
    color: #fcd34d;
}

body.dark-mode .subsection-icon {
    color: #fbbf24;
}

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

.results-count {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Questions Grid */
.questions-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    /* Very light transition for section switches */
    transition: opacity 0.18s ease-out, transform 0.18s ease-out;
}

.questions-grid.questions-grid-fade-in-start {
    opacity: 0;
    transform: translateY(4px);
}

.questions-grid.questions-grid-fade-in-end {
    opacity: 1;
    transform: translateY(0);
}

/* Question Card */
.question-card {
    background: var(--bg-white);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, max-height 0.3s ease;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    opacity: 1;
    max-height: 500px;
    overflow: hidden;
    min-height: 180px;
}

.question-card.hidden {
    opacity: 0;
    max-height: 0;
    padding: 0;
    margin: 0;
    pointer-events: none;
}

.question-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--border-primary);
    border-radius: 12px 0 0 12px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.question-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(92, 111, 92, 0.12);
    transform: translateY(-2px);
}

.question-card:hover::before {
    background: var(--primary);
    width: 6px;
}

.question-card.expanded {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(92, 111, 92, 0.12);
    background: var(--bg-white);
    border-radius: 12px 12px 0 0;
    border-bottom: none;
}

.question-card.expanded::before {
    background: var(--primary);
    width: 6px;
    border-radius: 12px 0 0 0;
}

/* Question Card Content */
.question-card-main {
    flex: 1;
    min-width: 0;
}

.question-card-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    margin-bottom: 0.75rem;
}

.question-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin: 0;
}

.question-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Question Card Description */
.question-card-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 0.75rem;
    margin-bottom: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Question Card Author Attribution */
.question-card-author {
    font-size: 0.75rem;
    font-style: italic;
    color: var(--primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.question-card-author .author-icon {
    fill: currentColor;
    flex-shrink: 0;
    opacity: 0.8;
}

.question-card-author .author-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s ease;
}

.question-card-author .author-link::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235C6F5C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.6;
    flex-shrink: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.question-card-author .author-link:hover {
    text-decoration: underline;
}

.question-card-author .author-link:hover::after {
    opacity: 1;
    transform: translate(1px, -1px);
}

/* Question Card Sidebar */
.question-card-sidebar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-shrink: 0;
}

.question-card-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    min-width: 80px;
}

.question-card-status-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.question-card-score {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Inter', -apple-system, sans-serif;
    font-variant-numeric: tabular-nums;
}

.question-card-score.excellent { color: #059669; }
.question-card-score.good { color: #5C6F5C; }
.question-card-score.average { color: #d97706; }
.question-card-score.needs-improvement { color: #ef4444; }
.question-card-score.no-score {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 400;
}

.question-card-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
}

.question-card-action svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.question-card:hover .question-card-action {
    background: var(--primary-dark);
    transform: translateX(2px);
}

.question-card-action.completed {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 2px solid rgba(16, 185, 129, 0.2);
}

.question-card-action.locked {
    background: rgba(107, 114, 128, 0.1);
    color: var(--gray);
    border: 2px solid rgba(107, 114, 128, 0.2);
    cursor: not-allowed;
}

.question-card-secondary-action {
    background: transparent;
    border: none;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.question-card-secondary-action:hover {
    opacity: 0.8;
}

/* Pronunciation Pack Cards (Practice Hub playlist style) */
.question-card.pronunciation-pack-card {
    align-items: center;
    gap: 0.9rem;
    padding: 0.78rem 0.95rem;
    min-height: 118px;
    border: 1px solid transparent;
    border-bottom: 1px solid var(--border-primary);
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
}

.question-card.pronunciation-pack-card:last-child {
    border-bottom-color: transparent;
}

.question-card.pronunciation-pack-card::before {
    display: none;
}

.question-card.pronunciation-pack-card:hover,
.question-card.pronunciation-pack-card.expanded {
    transform: none;
    border-color: rgba(92, 111, 92, 0.2);
    border-bottom-color: rgba(92, 111, 92, 0.2);
    background: rgba(92, 111, 92, 0.06);
    box-shadow: none;
}

.question-card.pronunciation-pack-card .pronunciation-pack-visual {
    width: 56px;
    min-height: 78px;
    border-radius: 8px;
    border: 1px solid rgba(92, 111, 92, 0.18);
    background: rgba(92, 111, 92, 0.08);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.question-card.pronunciation-pack-card .pronunciation-pack-hover-play {
    position: absolute;
    inset: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    opacity: 0.65;
    transform: scale(0.96);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.question-card.pronunciation-pack-card .pronunciation-pack-hover-play svg {
    width: 18px;
    height: 18px;
}

.question-card.pronunciation-pack-card:hover .pronunciation-pack-hover-play {
    opacity: 1;
    transform: scale(1);
}

.question-card.pronunciation-pack-card .pronunciation-pack-wave {
    width: 24px;
    height: 10px;
    margin-top: auto;
    margin-bottom: 8px;
    background:
        linear-gradient(rgba(92, 111, 92, 0.36), rgba(92, 111, 92, 0.36)) 0 50% / 3px 6px no-repeat,
        linear-gradient(rgba(92, 111, 92, 0.52), rgba(92, 111, 92, 0.52)) 6px 50% / 3px 9px no-repeat,
        linear-gradient(rgba(92, 111, 92, 0.72), rgba(92, 111, 92, 0.72)) 12px 50% / 3px 10px no-repeat,
        linear-gradient(rgba(92, 111, 92, 0.52), rgba(92, 111, 92, 0.52)) 18px 50% / 3px 9px no-repeat;
}

.question-card.pronunciation-pack-card .pronunciation-pack-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.36rem;
    min-width: 0;
}

.question-card.pronunciation-pack-card .pronunciation-pack-header {
    margin-bottom: 0;
}

.question-card.pronunciation-pack-card .pronunciation-pack-title {
    letter-spacing: -0.008em;
}

.question-card.pronunciation-pack-card .pronunciation-pack-description {
    margin-top: 0.22rem;
    margin-bottom: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    -webkit-line-clamp: 1;
}

.question-card.pronunciation-pack-card .pronunciation-pack-meta {
    gap: 0.34rem;
}

.question-card.pronunciation-pack-card .pron-pack-level-chip,
.question-card.pronunciation-pack-card .pron-pack-sentence-meta,
.question-card.pronunciation-pack-card .pron-pack-theme-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.58rem;
    border-radius: 999px;
    font-size: 0.71rem;
    font-weight: 600;
    line-height: 1.1;
    border: 1px solid var(--border-primary);
}

.question-card.pronunciation-pack-card .pron-pack-level-chip.level-beginner {
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
    border-color: rgba(16, 185, 129, 0.2);
}

.question-card.pronunciation-pack-card .pron-pack-level-chip.level-intermediate {
    background: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
    border-color: rgba(59, 130, 246, 0.2);
}

.question-card.pronunciation-pack-card .pron-pack-level-chip.level-advanced {
    background: rgba(139, 92, 246, 0.12);
    color: #6d28d9;
    border-color: rgba(139, 92, 246, 0.25);
}

.question-card.pronunciation-pack-card .pron-pack-sentence-meta {
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.02);
}

.question-card.pronunciation-pack-card .pron-pack-theme-chip {
    background: rgba(92, 111, 92, 0.08);
    color: var(--primary);
    border-color: rgba(92, 111, 92, 0.16);
}

.question-card.pronunciation-pack-card .question-card-sidebar {
    margin-left: auto;
    min-width: 122px;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.question-card.pronunciation-pack-card .question-card-action {
    min-width: 86px;
    justify-content: center;
    padding: 0.45rem 0.82rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: #1db954;
    color: #052112;
    border: 1px solid rgba(29, 185, 84, 0.45);
}

.question-card.pronunciation-pack-card .question-card-action svg {
    width: 13px;
    height: 13px;
}

.question-card.pronunciation-pack-card:hover .question-card-action:not(.locked) {
    background: #1ed760;
    color: #03170c;
}

.question-card.pronunciation-pack-card .question-card-action.locked {
    background: rgba(107, 114, 128, 0.12);
    color: var(--gray);
    border: 1px solid rgba(107, 114, 128, 0.34);
}

.question-card.pronunciation-pack-card .pron-pack-history-btn {
    padding: 0;
}

.question-card.pronunciation-pack-card .pron-pack-history-btn span {
    font-size: 0.66rem;
    letter-spacing: 0.055em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-decoration: none;
}

.question-card.pronunciation-pack-card .pron-pack-history-btn:hover span {
    color: var(--text-secondary);
}

.question-card.pronunciation-pack-card[data-pack-level="intermediate"] .pronunciation-pack-visual {
    border-color: rgba(59, 130, 246, 0.24);
    background: rgba(59, 130, 246, 0.11);
}

.question-card.pronunciation-pack-card[data-pack-level="advanced"] .pronunciation-pack-visual {
    border-color: rgba(139, 92, 246, 0.26);
    background: rgba(139, 92, 246, 0.12);
}

.question-card.pronunciation-pack-card[data-pack-status="completed"] .pronunciation-pack-visual {
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.2);
}

body.dark-mode .question-card.pronunciation-pack-card {
    border-bottom-color: #2d2d2d;
}

body.dark-mode .question-card.pronunciation-pack-card:hover,
body.dark-mode .question-card.pronunciation-pack-card.expanded {
    border-color: rgba(127, 168, 127, 0.35);
    border-bottom-color: rgba(127, 168, 127, 0.35);
    background: rgba(127, 168, 127, 0.14);
}

body.dark-mode .question-card.pronunciation-pack-card .pronunciation-pack-visual {
    border-color: rgba(127, 168, 127, 0.28);
    background: rgba(127, 168, 127, 0.16);
}

body.dark-mode .question-card.pronunciation-pack-card[data-pack-level="intermediate"] .pronunciation-pack-visual {
    border-color: rgba(96, 165, 250, 0.3);
    background: rgba(96, 165, 250, 0.16);
}

body.dark-mode .question-card.pronunciation-pack-card[data-pack-level="advanced"] .pronunciation-pack-visual {
    border-color: rgba(167, 139, 250, 0.34);
    background: rgba(167, 139, 250, 0.18);
}

body.dark-mode .question-card.pronunciation-pack-card .pronunciation-pack-hover-play {
    color: #e8e6e3;
}

body.dark-mode .question-card.pronunciation-pack-card .pronunciation-pack-wave {
    background:
        linear-gradient(rgba(201, 197, 192, 0.35), rgba(201, 197, 192, 0.35)) 0 50% / 3px 6px no-repeat,
        linear-gradient(rgba(201, 197, 192, 0.5), rgba(201, 197, 192, 0.5)) 6px 50% / 3px 9px no-repeat,
        linear-gradient(rgba(201, 197, 192, 0.72), rgba(201, 197, 192, 0.72)) 12px 50% / 3px 10px no-repeat,
        linear-gradient(rgba(201, 197, 192, 0.5), rgba(201, 197, 192, 0.5)) 18px 50% / 3px 9px no-repeat;
}

body.dark-mode .question-card.pronunciation-pack-card .pron-pack-level-chip.level-beginner {
    background: rgba(16, 185, 129, 0.18);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.36);
}

body.dark-mode .question-card.pronunciation-pack-card .pron-pack-level-chip.level-intermediate {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.36);
}

body.dark-mode .question-card.pronunciation-pack-card .pron-pack-level-chip.level-advanced {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    border-color: rgba(139, 92, 246, 0.36);
}

body.dark-mode .question-card.pronunciation-pack-card .pron-pack-sentence-meta {
    background: rgba(255, 255, 255, 0.03);
    border-color: #3a3a3a;
    color: #9e9689;
}

body.dark-mode .question-card.pronunciation-pack-card .pron-pack-theme-chip {
    background: rgba(127, 168, 127, 0.15);
    border-color: rgba(127, 168, 127, 0.3);
    color: #a8d0a8;
}

body.dark-mode .question-card.pronunciation-pack-card .question-card-action {
    background: #1db954;
    color: #03170c;
    border-color: rgba(29, 185, 84, 0.55);
}

body.dark-mode .question-card.pronunciation-pack-card:hover .question-card-action:not(.locked) {
    background: #1ed760;
    color: #03170c;
}

body.dark-mode .question-card.pronunciation-pack-card .question-card-action.locked {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
    border-color: rgba(107, 114, 128, 0.44);
}

body.dark-mode .question-card.pronunciation-pack-card .pron-pack-history-btn span {
    color: #9e9689;
}

@media (max-width: 768px) {
    .question-card.pronunciation-pack-card {
        gap: 0.75rem;
        padding: 0.72rem 0.78rem;
    }

    .question-card.pronunciation-pack-card .pronunciation-pack-visual {
        width: 50px;
        min-height: 72px;
    }

    .question-card.pronunciation-pack-card .question-card-sidebar {
        min-width: auto;
        margin-left: 0;
        justify-content: space-between;
    }

    .question-card.pronunciation-pack-card .question-card-action {
        min-width: 78px;
        font-size: 0.75rem;
        padding: 0.42rem 0.72rem;
    }
}

@media (max-width: 560px) {
    .question-card.pronunciation-pack-card {
        flex-wrap: wrap;
    }

    .question-card.pronunciation-pack-card .pronunciation-pack-main {
        flex: 1 1 calc(100% - 62px);
    }

    .question-card.pronunciation-pack-card .question-card-sidebar {
        width: 100%;
        flex-direction: row;
        justify-content: flex-end;
        gap: 0.7rem;
    }
}

/* Results Modal Styles */
#results-modal-root .results-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#results-modal-root .results-modal-container {
    background: var(--bg-white);
    border-radius: 16px;
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
}

#results-modal-root .results-modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-white);
}

#results-modal-root .results-modal-body {
    flex: 1;
    overflow: hidden;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 0;
}

#results-modal-root .attempts-list {
    border-right: 1px solid var(--border-primary);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: var(--bg-cream);
}

#results-modal-root .attempt-item {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

#results-modal-root .attempt-item:hover {
    background: var(--bg-white);
    border-color: var(--border-primary);
}

#results-modal-root .attempt-item.selected {
    background: rgba(92, 111, 92, 0.1);
    border-color: var(--primary);
}

#results-modal-root .detail-pane {
    overflow-y: auto;
    padding: 2rem;
    background: var(--bg-white);
}

#results-modal-root .close-button {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

#results-modal-root .close-button:hover {
    color: var(--text-primary);
}

/* Dark Mode - Results Modal */
body.dark-mode #results-modal-root .results-modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

body.dark-mode #results-modal-root .results-modal-container {
    background: #1A1A1A;
}

body.dark-mode #results-modal-root .results-modal-header {
    border-bottom-color: #2D2D2D;
}

body.dark-mode #results-modal-root .results-modal-body {
    background: #1A1A1A;
}

body.dark-mode #results-modal-root .attempts-list {
    border-right-color: #2D2D2D;
    background: #1A1A1A;
}

body.dark-mode #results-modal-root .attempt-item {
    color: #E8E6E3;
}

body.dark-mode #results-modal-root .attempt-item:hover {
    background: #222222;
    border-color: #2D2D2D;
}

body.dark-mode #results-modal-root .attempt-item.selected {
    background: rgba(127, 168, 127, 0.2);
    border-color: #7FA87F;
}

body.dark-mode #results-modal-root .detail-pane {
    background: #1A1A1A;
    color: #E8E6E3;
}

body.dark-mode #results-modal-root .close-button {
    color: #9E9689;
}

body.dark-mode #results-modal-root .close-button:hover {
    color: #E8E6E3;
}

/* Dark Mode - Results Modal Detail Content */
body.dark-mode #results-modal-root .detail-pane .text-gray-400 {
    color: #9E9689 !important;
}

body.dark-mode #results-modal-root .detail-pane .text-gray-500 {
    color: #888581 !important;
}

body.dark-mode #results-modal-root .detail-pane .text-gray-600 {
    color: #9E9689 !important;
}

body.dark-mode #results-modal-root .detail-pane .text-gray-700 {
    color: #C8C4BC !important;
}

body.dark-mode #results-modal-root .detail-pane .text-gray-800 {
    color: #E8E6E3 !important;
}

body.dark-mode #results-modal-root .detail-pane .text-gray-900 {
    color: #F5F4F1 !important;
}

body.dark-mode #results-modal-root .detail-pane .bg-gray-50 {
    background-color: #222222 !important;
}

body.dark-mode #results-modal-root .detail-pane .border-gray-200 {
    border-color: #2D2D2D !important;
}

body.dark-mode #results-modal-root .detail-pane .border-gray-100 {
    border-color: #2D2D2D !important;
}

/* Dark Mode - Feedback sections (emerald colors) */
body.dark-mode #results-modal-root .detail-pane .bg-emerald-50\/60,
body.dark-mode #results-modal-root .detail-pane .bg-emerald-50 {
    background-color: rgba(127, 168, 127, 0.15) !important;
}

body.dark-mode #results-modal-root .detail-pane .border-emerald-100 {
    border-color: rgba(127, 168, 127, 0.3) !important;
}

body.dark-mode #results-modal-root .detail-pane .text-emerald-800 {
    color: #A8D4A8 !important;
}

body.dark-mode #results-modal-root .detail-pane .text-emerald-900 {
    color: #C8E6C8 !important;
}

/* Dark Mode - Indigo colors (if any links remain) */
body.dark-mode #results-modal-root .detail-pane .text-indigo-600 {
    color: #818CF8 !important;
}

body.dark-mode #results-modal-root .detail-pane .text-indigo-800 {
    color: #A5B4FC !important;
}

/* Dark Mode - Error states */
body.dark-mode #results-modal-root .detail-pane .text-red-700 {
    color: #FCA5A5 !important;
}

body.dark-mode #results-modal-root .detail-pane .bg-red-50 {
    background-color: rgba(248, 113, 113, 0.15) !important;
}

body.dark-mode #results-modal-root .attempts-list .text-red-700 {
    color: #FCA5A5 !important;
}

body.dark-mode #results-modal-root .attempts-list .bg-red-50 {
    background-color: rgba(248, 113, 113, 0.15) !important;
}

/* Dark Mode - Attempt Items (buttons) */
body.dark-mode #results-modal-root .attempts-list .bg-white {
    background-color: #222222 !important;
}

body.dark-mode #results-modal-root .attempts-list .bg-gray-50 {
    background-color: #1A1A1A !important;
}

body.dark-mode #results-modal-root .attempts-list button:hover {
    background-color: #222222 !important;
}

body.dark-mode #results-modal-root .attempts-list .text-gray-900 {
    color: #F5F4F1 !important;
}

body.dark-mode #results-modal-root .attempts-list .text-gray-700 {
    color: #C8C4BC !important;
}

body.dark-mode #results-modal-root .attempts-list .text-gray-500 {
    color: #888581 !important;
}

body.dark-mode #results-modal-root .attempts-list .text-gray-400 {
    color: #9E9689 !important;
}

body.dark-mode #results-modal-root .attempts-list .border-gray-100 {
    border-color: #2D2D2D !important;
}

/* Type Badges */
.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.02em;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.type-badge svg {
    width: 12px;
    height: 12px;
    stroke-width: 2.5;
}

.type-badge.integrated {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    border-color: rgba(59, 130, 246, 0.15);
}

.type-badge.academic_discussion,
.type-badge.academic.discussion {
    background: rgba(168, 85, 247, 0.08);
    color: #7c3aed;
    border-color: rgba(168, 85, 247, 0.15);
}

.type-badge.independent {
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
    border-color: rgba(16, 185, 129, 0.15);
}

.type-badge.integrated_reading,
.type-badge.integrated_listening,
.type-badge.integrated_both,
.type-badge.integrated.reading,
.type-badge.integrated.listening,
.type-badge.integrated.both {
    background: rgba(120, 113, 108, 0.08) !important;
    color: #78716c !important;
    border-color: rgba(120, 113, 108, 0.15) !important;
}

/* Speaking Task-Specific Colors - Muted & Minimalistic */
.type-badge.task2 {
    background: rgba(100, 116, 139, 0.08) !important;
    color: #64748b !important;
    border-color: rgba(100, 116, 139, 0.15) !important;
}

.type-badge.task3 {
    background: rgba(139, 92, 246, 0.08) !important;
    color: #7c3aed !important;
    border-color: rgba(139, 92, 246, 0.15) !important;
}

.type-badge.task4 {
    background: rgba(217, 119, 6, 0.08) !important;
    color: #d97706 !important;
    border-color: rgba(217, 119, 6, 0.15) !important;
}

.type-badge.lecture {
    background: rgba(99, 102, 241, 0.08);
    color: #4f46e5;
    border-color: rgba(99, 102, 241, 0.15);
}

.type-badge.conversation {
    background: rgba(236, 72, 153, 0.08);
    color: #db2777;
    border-color: rgba(236, 72, 153, 0.15);
}

.type-badge.passage {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    border-color: rgba(59, 130, 246, 0.15);
}

.type-badge.user-generated {
    background: linear-gradient(135deg, rgba(92, 111, 92, 0.12) 0%, rgba(127, 168, 127, 0.12) 100%);
    color: #5C6F5C;
    border-color: rgba(92, 111, 92, 0.25);
}

.type-badge.user-generated::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #5C6F5C 0%, #7FA87F 100%);
    border-radius: 50%;
    margin-right: 4px;
}

/* Expert Content Badge */
.expert-content-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.08);
    color: #4f46e5;
    border: 1px solid rgba(99, 102, 241, 0.15);
    text-transform: none;
    letter-spacing: 0.02em;
    transition: all 0.2s ease;
}

.expert-content-badge svg {
    width: 11px;
    height: 11px;
    fill: currentColor;
    flex-shrink: 0;
}

body.dark-mode .expert-content-badge {
    background: rgba(129, 140, 248, 0.12);
    color: #a5b4fc;
    border-color: rgba(129, 140, 248, 0.2);
}

/* Premium Pack Badge */
.pack-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(245, 158, 11, 0.1) 100%);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.25);
    text-transform: none;
    letter-spacing: 0.02em;
    transition: all 0.2s ease;
}

.pack-badge svg {
    flex-shrink: 0;
    color: #d97706;
}

body.dark-mode .pack-badge {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(245, 158, 11, 0.12) 100%);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.3);
}

body.dark-mode .pack-badge svg {
    color: #fbbf24;
}

/* Premium Pack Badge (Pro-only content) */
.pack-badge.premium-pack {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.12) 0%, rgba(139, 92, 246, 0.08) 100%);
    color: #7c3aed;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.pack-badge.premium-pack svg {
    color: #8b5cf6;
}

.pack-badge .pro-indicator {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.4rem;
    margin-left: 0.25rem;
    border-radius: 4px;
    font-size: 0.55rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

body.dark-mode .pack-badge.premium-pack {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2) 0%, rgba(139, 92, 246, 0.12) 100%);
    color: #a78bfa;
    border-color: rgba(168, 85, 247, 0.35);
}

body.dark-mode .pack-badge.premium-pack svg {
    color: #a78bfa;
}

body.dark-mode .pack-badge .pro-indicator {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
}

/* Specialty Question Type Badges (Q9 and Q10) */
.specialty-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.02em;
    transition: all 0.2s ease;
    border: 1px solid;
}

.specialty-badge svg {
    width: 12px;
    height: 12px;
    stroke: currentColor;
    flex-shrink: 0;
}

/* Prose Summary Badge (Q10) - Purple/Blue */
.prose-summary-badge {
    background: rgba(139, 92, 246, 0.08);
    color: #7c3aed;
    border-color: rgba(139, 92, 246, 0.15);
}

body.dark-mode .prose-summary-badge {
    background: rgba(167, 139, 250, 0.12);
    color: #c4b5fd;
    border-color: rgba(167, 139, 250, 0.2);
}

/* Sentence Insertion Badge (Q9) - Purple (same as Prose Summary) */
.sentence-insertion-badge {
    background: rgba(139, 92, 246, 0.08);
    color: #7c3aed;
    border-color: rgba(139, 92, 246, 0.15);
}

body.dark-mode .sentence-insertion-badge {
    background: rgba(167, 139, 250, 0.12);
    color: #c4b5fd;
    border-color: rgba(167, 139, 250, 0.2);
}

/* Table Completion Badge (Q9) - Teal */
.table-completion-badge {
    background: rgba(20, 184, 166, 0.08);
    color: #0f766e;
    border-color: rgba(20, 184, 166, 0.15);
}

body.dark-mode .table-completion-badge {
    background: rgba(20, 184, 166, 0.12);
    color: #5eead4;
    border-color: rgba(20, 184, 166, 0.2);
}

/* Difficulty Display */
.difficulty {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.difficulty-dots {
    display: flex;
    gap: 3px;
}

.difficulty-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-primary);
    transition: all 0.2s ease;
}

.difficulty.beginner .difficulty-dot:nth-child(1) { background: #10b981; }
.difficulty.beginner .difficulty-dot:nth-child(2),
.difficulty.beginner .difficulty-dot:nth-child(3) { background: #e8e3da; }

.difficulty.intermediate .difficulty-dot:nth-child(1),
.difficulty.intermediate .difficulty-dot:nth-child(2) { background: #f59e0b; }
.difficulty.intermediate .difficulty-dot:nth-child(3) { background: #e8e3da; }

.difficulty.advanced .difficulty-dot:nth-child(1),
.difficulty.advanced .difficulty-dot:nth-child(2),
.difficulty.advanced .difficulty-dot:nth-child(3) { background: #ef4444; }

.difficulty.easy .difficulty-dot:nth-child(1) { background: #10b981; }
.difficulty.easy .difficulty-dot:nth-child(2),
.difficulty.easy .difficulty-dot:nth-child(3) { background: #e8e3da; }

.difficulty.hard .difficulty-dot:nth-child(1),
.difficulty.hard .difficulty-dot:nth-child(2),
.difficulty.hard .difficulty-dot:nth-child(3) { background: #ef4444; }

.difficulty-label {
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: capitalize;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.status-badge svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
}

.status-badge.locked {
    background: rgba(107, 114, 128, 0.1);
    color: var(--gray);
    border: 1px solid rgba(107, 114, 128, 0.2);
}

.status-badge.completed {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.completed svg {
    animation: checkmark 0.5s ease;
}

@keyframes checkmark {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.status-badge.new {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.status-badge.in-progress {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Score Display */
.score-display {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, sans-serif;
    font-variant-numeric: tabular-nums;
}

.score-display.excellent {
    color: #059669;
}

.score-display.good {
    color: #5C6F5C;
}

.score-display.average {
    color: #d97706;
}

.score-display.needs-improvement {
    color: #ef4444;
}

.score-display.no-score {
    color: var(--text-muted);
    font-weight: 400;
}

/* Question Drawer */
.question-drawer {
    border-top: 3px solid var(--primary);
    background: var(--bg-white);
    padding: 2.5rem 3rem;
    animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.04);
    border-radius: 12px 12px 0 0;
    margin-top: 1.5rem;
}

.question-drawer-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    border-radius: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    animation: fadeIn 0.3s ease;
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Question Sidebar */
.question-sidebar {
    position: relative;
    width: 320px;
    background: var(--bg-white);
    border-right: 2px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

/* Collapsed state only applies to mobile - see media query below */

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.sidebar-toggle {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.sidebar-toggle svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
}

.sidebar-progress {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-primary);
}

.sidebar-progress-bar {
    height: 4px;
    background: var(--border-primary);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.sidebar-progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

.sidebar-progress-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.sidebar-questions-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

/* Collapsible Sidebar - Slide to Left */
.question-sidebar {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.question-sidebar.sidebar-hidden {
    width: 48px !important;
    min-width: 48px !important;
    overflow: hidden;
}

.question-sidebar.sidebar-hidden .sidebar-header,
.question-sidebar.sidebar-hidden .sidebar-progress,
.question-sidebar.sidebar-hidden .sidebar-questions-list,
.question-sidebar.sidebar-hidden .sidebar-footer {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.question-sidebar.sidebar-hidden .sidebar-expand-tab {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Expand tab (visible when collapsed) */
.sidebar-expand-tab {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 1rem;
    background: var(--bg-white);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.sidebar-expand-tab:hover {
    background: var(--primary-light);
}

.sidebar-expand-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.sidebar-expand-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
}

.sidebar-expand-label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Collapse button in header */
.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-primary);
    background: var(--bg-white);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.sidebar-collapse-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
}

/* Dark mode for collapsible sidebar */
body.dark-mode .sidebar-expand-tab {
    background: #1A1A1A;
}

body.dark-mode .sidebar-expand-tab:hover {
    background: rgba(127, 168, 127, 0.12);
}

body.dark-mode .sidebar-expand-icon {
    background: #7FA87F;
}

body.dark-mode .sidebar-expand-label {
    color: #E8E6E3;
}

body.dark-mode .sidebar-collapse-btn {
    background: #252525;
    border-color: #2D2D2D;
    color: #9E9689;
}

body.dark-mode .sidebar-collapse-btn:hover {
    background: #7FA87F;
    border-color: #7FA87F;
    color: #1A1A1A;
}

.sidebar-question-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.sidebar-question-item:hover:not(.locked) {
    background: var(--primary-light);
    border-color: var(--primary-border);
}

.sidebar-question-item.active {
    background: var(--primary-light);
    border-color: var(--primary);
}

.sidebar-question-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.sidebar-question-number {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--border-primary);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-question-item.active .sidebar-question-number {
    background: var(--primary);
    color: white;
}

.sidebar-question-content {
    flex: 1;
    min-width: 0;
}

.sidebar-question-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-question-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-status-badge {
    font-size: 0.6875rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-weight: 500;
}

.sidebar-status-badge.new {
    background: #E3F2FD;
    color: #1976D2;
}

.sidebar-status-badge.in-progress {
    background: #FFF3E0;
    color: #F57C00;
}

.sidebar-status-badge.completed {
    background: #E8F5E9;
    color: #388E3C;
}

.sidebar-score {
    font-size: 0.75rem;
    font-weight: 600;
}

.sidebar-lock-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-primary);
    background: var(--bg-cream);
}

.sidebar-shortcuts {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.shortcut-item kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 20px;
    padding: 0 0.375rem;
    background: var(--bg-white);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Main Content Area */
.question-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.question-main-content .drawer-content {
    flex: 1;
    overflow-y: auto;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 2000px;
        padding-top: 2.5rem;
        padding-bottom: 2.5rem;
        transform: translateY(0);
    }
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 2px solid var(--border-primary);
    background: var(--bg-white);
    position: sticky;
    top: 0;
    z-index: 10;
    gap: 1rem;
}

.drawer-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-toggle-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-toggle-button:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.sidebar-toggle-button svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
}

.drawer-navigation {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-button-icon {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    background: var(--bg-white);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-button-icon:hover:not(:disabled) {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.nav-button-icon:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-button-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
}

.drawer-back-button {
    background: var(--primary-light);
    border: 2px solid var(--border-primary);
    color: var(--primary);
    padding: 0.625rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.drawer-back-button:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateX(-2px);
}

.drawer-back-button svg {
    stroke: currentColor;
}

.drawer-close {
    background: var(--primary);
    border: 2px solid var(--primary);
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: 0.02em;
}

.drawer-close:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(92, 111, 92, 0.25);
}

.drawer-close svg {
    stroke: currentColor;
}

.drawer-content {
    min-height: 400px;
    padding: 0 2rem 2rem;
}

.question-main-content .drawer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Mobile Backdrop for Closing Drawer */
.mobile-drawer-backdrop {
    display: none; /* Hidden on desktop */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
}

/* Sidebar Backdrop (for closing sidebar on mobile) */
.mobile-sidebar-backdrop {
    display: none; /* Hidden on desktop */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-sidebar-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile Menu Toggle Button (Hamburger) */
.mobile-menu-toggle {
    display: none; /* Hidden on desktop */
    min-height: 44px;
    min-width: 44px;
    padding: 0.5rem;
    background: transparent;
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.mobile-menu-toggle:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

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

.mobile-menu-toggle svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

/* Sidebar Close Button */
.sidebar-close-btn {
    display: none; /* Hidden on desktop */
    min-height: 44px;
    min-width: 44px;
    padding: 0.5rem;
    background: transparent;
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

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

.sidebar-close-btn:active {
    transform: scale(0.95);
}

.sidebar-close-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    /* Show backdrop on mobile (for closing entire drawer) */
    .question-drawer-fullscreen .mobile-drawer-backdrop {
        display: block;
        opacity: 1;
        pointer-events: auto;
        animation: fadeIn 0.2s ease;
    }
    
    /* Show sidebar backdrop on mobile */
    .question-drawer-fullscreen .mobile-sidebar-backdrop {
        display: block;
    }
    
    /* Show mobile menu toggle button */
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Show sidebar close button */
    .sidebar-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Update sidebar header to include close button */
    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
    }
    
    /* Sidebar positioned over backdrop */
    .question-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 85%;
        max-width: 320px;
        z-index: 1001; /* Above backdrop */
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* Hide sidebar by default on mobile, show when not collapsed */
    .question-sidebar.collapsed {
        transform: translateX(-100%);
    }
    
    .question-sidebar:not(.collapsed) {
        transform: translateX(0);
    }
    
    /* Main content positioned over backdrop */
    .question-main-content {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000; /* Above backdrop, below sidebar */
        background: var(--bg-white);
    }
    
    /* Make close button more prominent on mobile */
    .drawer-close {
        min-height: 44px; /* iOS touch target minimum */
        min-width: 80px;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        font-weight: 600;
        border-radius: 8px;
        background: var(--primary);
        color: white;
        border: 2px solid var(--primary);
        display: flex;
        align-items: center;
        gap: 0.5rem;
        touch-action: manipulation; /* Prevent zoom on double tap */
    }
    
    .drawer-close:active {
        transform: scale(0.97);
        background: var(--primary-dark);
    }
    
    .drawer-close svg {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
    }
    
    /* Header optimized for mobile */
    .drawer-header {
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--bg-white);
        padding: 0.75rem 1rem;
        border-bottom: 2px solid var(--border-primary);
        display: grid;
        grid-template-columns: auto auto 1fr auto;
        align-items: center;
        gap: 0.5rem;
    }
    
    .drawer-title {
        font-size: 0.85rem;
        min-width: 0; /* Allow text truncation */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: center;
    }
    
    /* Navigation buttons smaller on mobile */
    .drawer-navigation {
        display: flex;
        gap: 0.5rem;
        flex-shrink: 0;
    }
    
    .nav-button-icon {
        min-height: 44px;
        min-width: 44px;
        padding: 0.5rem;
        touch-action: manipulation;
    }
    
    .nav-button-icon:active:not(:disabled) {
        transform: scale(0.95);
    }
    
    /* Content area */
    .question-main-content .drawer-content {
        padding: 1rem;
        height: calc(100vh - 60px); /* Account for header */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Sidebar toggle button */
    .sidebar-toggle-button {
        padding: 0.5rem;
        font-size: 0;
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
    }
    
    .sidebar-toggle-button svg {
        margin: 0;
    }
    
    /* Sidebar items more tappable */
    .sidebar-question-item {
        min-height: 52px;
        padding: 0.75rem 1rem;
        touch-action: manipulation;
        cursor: pointer;
    }
    
    .sidebar-question-item:active:not(.locked) {
        background: var(--primary-light);
    }
}

/* Loading States */
.loading-spinner {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 5rem 4rem;
    color: var(--primary);
    gap: 1.5rem;
}

.spinner-container {
    position: relative;
    width: 48px;
    height: 48px;
}

.spinner-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.spinner-ring-outer {
    border: 4px solid #E8E3DA;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
}

.spinner-ring-inner {
    border: 4px solid transparent;
    border-right-color: rgba(92, 111, 92, 0.4);
    animation: spin 1.5s linear infinite reverse;
}

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

.loading-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.02em;
}

/* Skeleton Loading */
.skeleton-row {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    height: 20px;
    border-radius: 4px;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    opacity: 0.3;
}

.empty-state-icon svg {
    width: 100%;
    height: 100%;
    stroke: var(--primary);
    fill: none;
    stroke-width: 1.5;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* Upgrade Modal */
.upgrade-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.upgrade-modal-content {
    background: #FEFEFE;
    border: 2px solid #E8E3DA;
    border-radius: 12px;
    max-width: 32rem;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

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

.upgrade-modal-header {
    text-align: center;
    padding: 2.5rem 2rem 1.5rem;
    border-bottom: 1px solid #E8E3DA;
}

.upgrade-modal-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: #2d5f4d;
    margin-bottom: 1rem;
}

.upgrade-modal-icon-wrap {
    width: 4rem;
    height: 4rem;
    background: #E8E3DA;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.upgrade-modal-icon-wrap i {
    font-size: 1.5rem;
    color: #9E9689;
}

.upgrade-modal-title {
    font-size: 1.75rem;
    font-weight: 400;
    color: #1A1816;
    text-align: center;
    margin: 0 0 0.75rem 0;
}

.upgrade-modal-message {
    font-size: 1rem;
    line-height: 1.6;
    color: #9E9689;
    text-align: center;
    margin: 0;
}

.upgrade-modal-body {
    padding: 2rem;
}

.upgrade-modal-upgrade-box {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px solid #2d5f4d;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 0.75rem;
}

.upgrade-modal-upgrade-title {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: #2d5f4d;
    margin-bottom: 0.75rem;
}

.upgrade-modal-upgrade-text {
    font-size: 0.875rem;
    line-height: 1.5;
    color: #3A3633;
    margin-bottom: 1rem;
}

.upgrade-modal-btn-primary {
    background: #2d5f4d;
    border: 2px solid #2d5f4d;
    color: white;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9375rem;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    display: block;
    text-decoration: none;
    box-sizing: border-box;
}

.upgrade-modal-btn-primary:hover {
    background: #1f4537;
    border-color: #1f4537;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 95, 77, 0.25);
    color: white;
}

.upgrade-modal-btn-close {
    background: transparent;
    border: none;
    color: #9E9689;
    padding: 0.75rem;
    font-size: 0.875rem;
    font-weight: 400;
    cursor: pointer;
    width: 100%;
    transition: color 0.2s ease;
    margin-top: 0.25rem;
}

.upgrade-modal-btn-close:hover {
    color: #3A3633;
}

.upgrade-modal-actions {
    display: flex;
    gap: 1rem;
}

.cta-button {
    flex: 1;
    background: var(--primary);
    border: 2px solid var(--primary);
    color: white;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.cta-button:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(92, 111, 92, 0.25);
    color: white;
    text-decoration: none;
}

.cta-button.secondary {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.cta-button.secondary:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    .practice-sidebar {
        width: 280px;
    }
    
    .practice-main {
        padding: 2rem;
    }
}

/* Mobile Format Toggle - Hidden on desktop */
.mobile-format-toggle {
    display: none;
}

@media (max-width: 768px) {
    /* Mobile Format Toggle - Visible on mobile */
    .mobile-format-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.625rem 1rem;
        background: var(--bg-white);
        border-bottom: 1px solid var(--border-primary);
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    .mobile-format-label {
        font-size: 0.8125rem;
        font-weight: 500;
        color: var(--text-muted);
    }
    
    .mobile-format-buttons {
        display: flex;
        background: var(--bg-cream);
        border-radius: 8px;
        padding: 3px;
        gap: 2px;
    }
    
    .mobile-format-btn {
        padding: 0.375rem 0.875rem;
        font-size: 0.8125rem;
        font-weight: 600;
        border: none;
        border-radius: 6px;
        background: transparent;
        color: var(--text-muted);
        cursor: pointer;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }
    
    .mobile-format-btn.active {
        background: var(--primary);
        color: white;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .mobile-format-btn:not(.active):active {
        background: rgba(92, 111, 92, 0.1);
    }
    
    /* Dark mode for mobile format toggle */
    body.dark-mode .mobile-format-toggle {
        background: #1A1A1A;
        border-bottom-color: #2D2D2D;
    }
    
    body.dark-mode .mobile-format-label {
        color: #9E9689;
    }
    
    body.dark-mode .mobile-format-buttons {
        background: #222222;
    }
    
    body.dark-mode .mobile-format-btn {
        color: #9E9689;
    }
    
    body.dark-mode .mobile-format-btn.active {
        background: #7FA87F;
        color: #1A1A1A;
    }
    
    body.dark-mode .mobile-format-btn:not(.active):active {
        background: rgba(127, 168, 127, 0.15);
    }
    
    /* Hide sidebar completely on mobile - use bottom tabs instead */
    .practice-sidebar {
        display: none !important;
    }
    
    /* Full width content on mobile */
    .practice-container {
        flex-direction: column;
        padding-bottom: 80px; /* Space for bottom tab bar */
    }
    
    .practice-main {
        padding: 1rem;
        width: 100%;
    }
    
    /* Compact header on mobile */
    .practice-header-top {
        flex-direction: column;
        gap: 1rem;
    }
    
    .practice-title {
        font-size: 1.5rem;
    }
    
    .practice-subtitle {
        font-size: 0.9rem;
    }
    
    .practice-controls {
        flex-wrap: wrap;
        align-items: center;
        gap: 0.5rem;
    }
    
    /* Hide search on mobile */
    .search-container {
        display: none;
    }
    
    /* Compact filter chips on mobile */
    .filter-group {
        flex: 1;
        min-width: 0;
        gap: 0.375rem;
    }
    
    .filter-label {
        font-size: 0.7rem;
    }
    
    .filter-chip {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
    
    /* Hide 'Done' filter on mobile to fit one row */
    .filter-chip[data-filter="completed"] {
        display: none;
    }
    
    /* Play button inline with filters */
    .action-buttons-container {
        margin-left: auto;
        flex-shrink: 0;
    }
    
    .play-shuffle-btn {
        padding: 0.35rem 0.7rem;
        font-size: 0.8rem;
    }
    
    .play-settings-toggle {
        padding: 0.35rem;
    }
    
    .play-settings-popover {
        width: 260px;
    }
    
    /* Adjust cards on mobile */
    .question-card {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1.25rem;
    }
    
    .question-card-sidebar {
        flex-direction: row;
        justify-content: space-between;
        gap: 1rem;
    }
    
    .question-card-status {
        min-width: auto;
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .question-card-score {
        font-size: 1.25rem;
    }
    
    .question-card-action {
        flex: 1;
        justify-content: center;
    }
    
    .question-drawer {
        padding: 1.5rem;
        margin-top: 1rem;
    }
    
    .drawer-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .drawer-header > div {
        width: 100%;
    }
    
    .drawer-back-button {
        display: none;
    }
    
    .drawer-close {
        width: 100%;
        justify-content: center;
    }
    
    .drawer-title {
        font-size: 1.25rem;
    }
    
    /* Mobile Bottom Tab Bar - iOS/Android style */
    .mobile-bottom-tabs {
        display: flex !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        height: 40px;
        background: var(--bg-white);
        border-top: 1px solid var(--border-primary);
        z-index: 1000;
        padding: 0;
        margin: 0;
        box-sizing: border-box !important;
        box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.04);
        /* iOS safe area */
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .mobile-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.1rem;
        padding: 0.2rem 0.125rem;
        cursor: pointer;
        transition: all 0.2s ease;
        background: transparent;
        border: none;
        -webkit-tap-highlight-color: transparent;
        min-width: 0; /* Allow flex shrink */
    }
    
    .mobile-tab:active {
        transform: scale(0.95);
        background: var(--primary-light);
    }
    
    .mobile-tab-icon {
        width: 16px;
        height: 16px;
        color: #9CA3AF; /* gray-400 */
        transition: all 0.2s ease;
    }
    
    .mobile-tab-icon svg {
        width: 100%;
        height: 100%;
        stroke: currentColor;
        fill: none;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }
    
    .mobile-tab-label {
        font-size: 0.575rem;
        font-weight: 500;
        color: #9CA3AF; /* gray-400 */
        transition: all 0.2s ease;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        line-height: 1;
    }
    
    .mobile-tab.active .mobile-tab-icon {
        color: var(--primary);
        transform: scale(1.05);
    }
    
    .mobile-tab.active .mobile-tab-label {
        color: var(--primary);
        font-weight: 600;
    }
    
    /* Active indicator dot */
    .mobile-tab.active::before {
        content: '';
        position: absolute;
        top: 2px;
        width: 2px;
        height: 2px;
        background: var(--primary);
        border-radius: 50%;
    }
    
    /* Dark mode adjustments */
    body.dark-mode .mobile-bottom-tabs {
        background: #1A1A1A;
        border-top-color: #2D2D2D;
    }
    
    body.dark-mode .mobile-tab-icon,
    body.dark-mode .mobile-tab-label {
        color: #6B7280; /* gray-500 dark */
    }
    
    body.dark-mode .mobile-tab.active .mobile-tab-icon,
    body.dark-mode .mobile-tab.active .mobile-tab-label {
        color: #7FA87F;
    }
    
    body.dark-mode .mobile-tab:active {
        background: rgba(127, 168, 127, 0.1);
    }
}

/* Hidden Utility */
.hidden {
    display: none !important;
}

/* Learn Tab Content */
.learn-content-container {
    max-width: 100%;
    padding: 0;
}

.learn-content-container .max-w-5xl,
.learn-content-container .max-w-6xl {
    max-width: 100%;
    padding: 0 1rem;
}

/* Override guide card styles for practice hub context */
.learn-content-container .guide-card {
    margin-bottom: 1.5rem;
}

.learn-content-container .cheat-header {
    margin-top: 3rem;
}

/* Reading type filters */
.reading-type-filters {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-primary);
}


/* ============================================================
   GRADING MODAL (For Writing Assessment)
   ============================================================ */

#essay-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease-out;
}

#essay-loading-overlay.hidden {
    display: none;
}

.grading-modal-content {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 2rem;
    max-width: 28rem;
    margin: 0 1rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Spacing utilities for modal content */
.grading-modal-content .mb-6 {
    margin-bottom: 1.5rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.grading-modal-icon {
    width: 4rem;
    height: 4rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(92, 111, 92, 0.05) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    border: 2px solid var(--primary-border);
}

.grading-modal-icon i {
    color: var(--primary);
    font-size: 1.5rem;
}

.grading-modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    text-align: center;
}

.grading-modal-description {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    text-align: center;
    line-height: 1.6;
}

.grading-progress-container {
    margin-bottom: 1.5rem;
}

.grading-progress-circle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.grading-progress-circle {
    position: relative;
    width: 4rem;
    height: 4rem;
}

.grading-progress-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.grading-progress-circle .progress-bg {
    stroke: var(--border-primary);
    stroke-width: 4;
    fill: none;
}

.grading-progress-circle .progress-fill {
    stroke: var(--primary);
    stroke-width: 4;
    fill: none;
    stroke-dasharray: 175.93;
    stroke-dashoffset: 175.93;
    transition: all 0.5s ease-out;
}

.grading-progress-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grading-progress-icon i {
    color: var(--primary);
    font-size: 1.25rem;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.grading-countdown-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.3s ease;
}

.grading-progress-bar-container {
    margin-top: 0.5rem;
}

.grading-progress-bar-bg {
    background: var(--bg-cream);
    border-radius: 9999px;
    height: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--border-primary);
}

.grading-progress-bar-fill {
    background: var(--primary);
    height: 100%;
    border-radius: 9999px;
    transition: all 0.5s ease-out;
    width: 0%;
}

.grading-info-box {
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    border-radius: 12px;
    padding: 1rem;
}

.grading-info-content {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 0.875rem;
    gap: 0.5rem;
}

.grading-info-content i {
    flex-shrink: 0;
}

/* Dark Mode - Grading Modal */
body.dark-mode #essay-loading-overlay {
    background: rgba(0, 0, 0, 0.75);
}

body.dark-mode .grading-modal-content {
    background: #222222;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

body.dark-mode .grading-modal-icon {
    background: rgba(127, 168, 127, 0.15);
    border-color: rgba(127, 168, 127, 0.3);
}

body.dark-mode .grading-modal-title {
    color: #E8E6E3;
}

body.dark-mode .grading-modal-description {
    color: #9E9689;
}

body.dark-mode .grading-progress-circle .progress-bg {
    stroke: #2D2D2D;
}

body.dark-mode .grading-progress-circle .progress-fill {
    stroke: var(--primary);
}

body.dark-mode .grading-progress-bar-bg {
    background: #1A1A1A;
    border-color: #2D2D2D;
}

body.dark-mode .grading-info-box {
    background: rgba(127, 168, 127, 0.12);
    border-color: rgba(127, 168, 127, 0.25);
}

body.dark-mode .grading-info-content {
    color: var(--primary);
}

/* ============================================================
   EMBEDDED ASSESSMENT ANIMATIONS & MICRO-INTERACTIONS
   ============================================================ */

/* Slide Animations */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in {
    animation: slideInRight 0.4s ease-out;
}

/* Fade Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* Celebration & Bounce */
@keyframes celebrateBounce {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.celebrate-bounce {
    animation: celebrateBounce 0.6s ease-out;
}

@keyframes completedBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.completed-bounce {
    animation: completedBounce 0.5s ease-out;
}

/* Score Reveal */
@keyframes scoreReveal {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.score-animate {
    animation: scoreReveal 0.8s ease-out;
}

/* Checkmark Growth */
@keyframes checkmarkGrow {
    from {
        transform: scale(0) rotate(-45deg);
    }
    to {
        transform: scale(1) rotate(0deg);
    }
}

.checkmark-grow {
    display: inline-block;
    animation: checkmarkGrow 0.4s ease-out;
}

/* Timer Urgency */
.timer-warning {
    color: #f59e0b !important;
    font-weight: 600;
}

.timer-urgent {
    color: #ef4444 !important;
    font-weight: 700;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Glow Effect */
@keyframes glow {
    50% {
        box-shadow: 0 0 20px rgba(92, 111, 92, 0.4);
    }
}

.updating-glow {
    animation: glow 0.6s ease-in-out;
}

/* Shake Animation (for warnings) */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Confetti Animation */
@keyframes confettiFall {
    to {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.confetti-particle {
    animation: confettiFall 2s ease-out forwards;
}

/* Results Card Styles */
.results-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
}

.score-display {
    text-align: center;
    margin-bottom: 2rem;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 1rem;
    border: 4px solid currentColor;
}

.score-circle.score-excellent {
    background: #E8F5E9;
    color: #2E7D32;
    border-color: #4CAF50;
}

.score-circle.score-good {
    background: #E3F2FD;
    color: #1565C0;
    border-color: #2196F3;
}

.score-circle.score-average {
    background: #FFF3E0;
    color: #E65100;
    border-color: #FF9800;
}

.score-circle.score-needs-improvement {
    background: #FFEBEE;
    color: #C62828;
    border-color: #F44336;
}

.score-number {
    font-size: 2.5rem;
    line-height: 1;
}

.score-max {
    font-size: 1rem;
    opacity: 0.7;
}

.score-message {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.feedback-section {
    margin: 2rem 0;
}

.feedback-sections {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feedback-section-item {
    padding: 1rem;
    background: var(--bg-cream);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    animation: slideInRight 0.4s ease-out both;
}

.feedback-section-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.feedback-section-content {
    color: var(--text-secondary);
    line-height: 1.6;
}

.results-next-container {
    text-align: center;
    margin-top: 2rem;
}

.next-question-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.next-question-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(92, 111, 92, 0.3);
}

.next-question-btn svg {
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
}

/* Ask Petra Pill - Prominent call-to-action button */
.petra-pill-wrapper {
    display: flex;
    justify-content: center;
    margin: 1rem 0 1.5rem;
    animation: fadeSlideUp 0.5s ease-out 0.2s both;
}

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

.ask-petra-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #5C6F5C 0%, #4a5d4a 100%);
    border: 2px solid rgba(127, 168, 127, 0.4);
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #FEFEFE;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(92, 111, 92, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.ask-petra-pill::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 26px;
    background: linear-gradient(135deg, rgba(127, 168, 127, 0.6) 0%, rgba(92, 111, 92, 0.6) 50%, rgba(127, 168, 127, 0.6) 100%);
    background-size: 200% 200%;
    animation: petraGlow 2s ease-in-out infinite;
    opacity: 0.6;
    z-index: -1;
}

@keyframes petraGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.ask-petra-pill:hover {
    background: linear-gradient(135deg, #4a5d4a 0%, #3d4d3d 100%);
    border-color: rgba(127, 168, 127, 0.6);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 24px rgba(92, 111, 92, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.ask-petra-pill:hover::before {
    opacity: 1;
}

.ask-petra-pill:active,
.ask-petra-pill.clicked {
    transform: translateY(-1px) scale(0.98);
}

.petra-pill-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: petraPulse 2s ease-in-out infinite;
}

@keyframes petraPulse {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.85;
        transform: scale(1.1);
    }
}

.petra-pill-icon svg {
    fill: #FEFEFE;
}

.petra-pill-text {
    white-space: nowrap;
}

/* Petra pill hint text */
.petra-pill-hint {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.85;
    margin-left: 4px;
}

/* Dark Mode - Results */
body.dark-mode .results-card {
    background: #222222;
}

body.dark-mode .score-circle.score-excellent {
    background: rgba(52, 211, 153, 0.15);
    color: #6EE7B7;
    border-color: rgba(52, 211, 153, 0.4);
}

body.dark-mode .score-circle.score-good {
    background: rgba(96, 165, 250, 0.15);
    color: #93C5FD;
    border-color: rgba(96, 165, 250, 0.4);
}

body.dark-mode .score-circle.score-average {
    background: rgba(251, 191, 36, 0.15);
    color: #FCD34D;
    border-color: rgba(251, 191, 36, 0.4);
}

body.dark-mode .score-circle.score-needs-improvement {
    background: rgba(248, 113, 113, 0.15);
    color: #FCA5A5;
    border-color: rgba(248, 113, 113, 0.4);
}

body.dark-mode .score-message {
    color: #E8E6E3;
}

body.dark-mode .score-max {
    opacity: 0.6;
}

body.dark-mode .feedback-section-item {
    background: #1A1A1A;
    border-left-color: #7FA87F;
}

body.dark-mode .next-question-btn {
    background: #7FA87F;
    color: #1A1A1A;
}

body.dark-mode .next-question-btn:hover {
    background: #5C6F5C;
}

/* Dark mode - Ask Petra Pill */
body.dark-mode .ask-petra-pill {
    background: linear-gradient(135deg, #5C6F5C 0%, #4a5d4a 100%);
    border-color: rgba(127, 168, 127, 0.5);
    color: #FEFEFE;
    box-shadow: 0 4px 16px rgba(127, 168, 127, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

body.dark-mode .ask-petra-pill:hover {
    background: linear-gradient(135deg, #6a806a 0%, #5C6F5C 100%);
    border-color: rgba(127, 168, 127, 0.7);
    box-shadow: 0 8px 24px rgba(127, 168, 127, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

body.dark-mode .ask-petra-pill::before {
    background: linear-gradient(135deg, rgba(127, 168, 127, 0.5) 0%, rgba(158, 200, 158, 0.5) 50%, rgba(127, 168, 127, 0.5) 100%);
}

body.dark-mode .petra-pill-icon svg {
    fill: #FEFEFE;
}

/* Speaking Grading Modal/Overlay (matches standalone page) */
#speaking-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 24, 22, 0.8);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

#speaking-loading-overlay.hidden {
    display: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.95); }
}

/* Speaking Radar Chart Animations */
.speaking-radar-chart .radar-polygon {
    animation: radarReveal 0.8s ease-out forwards;
    transform-origin: center;
}

@keyframes radarReveal {
    from {
        opacity: 0;
        transform: scale(0.3);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.speaking-radar-chart .radar-dot {
    transition: r 0.2s ease, filter 0.2s ease;
    cursor: pointer;
}

.speaking-radar-chart .radar-dot:hover {
    r: 7;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* Word Confidence Heatmap */
.word-confidence-span {
    transition: all 0.2s ease;
}

.word-confidence-span:hover {
    transform: scale(1.1);
    z-index: 10;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Dark Mode - Speaking Results */
body.dark-mode .speaking-assessment-embedded #results-section .rounded-xl,
body.dark-mode .speaking-assessment-embedded #results-section .rounded-lg {
    background: #222222 !important;
    border-color: #2D2D2D !important;
}

body.dark-mode .speaking-assessment-embedded #results-section [style*="background: var(--bg-cream)"] {
    background: #1A1A1A !important;
}

body.dark-mode .speaking-assessment-embedded #results-section [style*="background: var(--bg-white)"] {
    background: #222222 !important;
}

body.dark-mode .speaking-assessment-embedded #results-section [style*="rgba(45, 95, 77"] {
    background: rgba(127, 168, 127, 0.12) !important;
    border-color: rgba(127, 168, 127, 0.25) !important;
}

body.dark-mode .speaking-assessment-embedded #results-section .fa-chevron-down {
    color: #888581 !important;
}

/* Dark Mode - Writing Results/Feedback */
body.dark-mode #results-section,
body.dark-mode #score-results {
    color: #E8E6E3;
}

body.dark-mode #results-section .bg-gradient-to-r {
    background: linear-gradient(to right, rgba(42, 42, 42, 0.95), rgba(34, 34, 34, 0.85)) !important;
    border-color: rgba(127, 168, 127, 0.2) !important;
}

body.dark-mode #results-section .bg-white {
    background: #222222 !important;
    border-color: #2D2D2D !important;
}

body.dark-mode #results-section .text-gray-800,
body.dark-mode #results-section .text-gray-700,
body.dark-mode #results-section .text-slate-800,
body.dark-mode #results-section .text-slate-700 {
    color: #E8E6E3 !important;
}

body.dark-mode #results-section .text-gray-600,
body.dark-mode #results-section .text-gray-500 {
    color: #9E9689 !important;
}

body.dark-mode #results-section .bg-green-50 {
    background: rgba(16, 185, 129, 0.1) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}

body.dark-mode #results-section .bg-amber-50 {
    background: rgba(245, 158, 11, 0.1) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
}

body.dark-mode #results-section .bg-slate-50 {
    background: rgba(71, 85, 105, 0.1) !important;
    border-color: rgba(71, 85, 105, 0.3) !important;
}

body.dark-mode #results-section .bg-green-100,
body.dark-mode #results-section .bg-emerald-100,
body.dark-mode #results-section .bg-blue-100,
body.dark-mode #results-section .bg-amber-100,
body.dark-mode #results-section .bg-yellow-100,
body.dark-mode #results-section .bg-orange-100,
body.dark-mode #results-section .bg-red-100,
body.dark-mode #results-section .bg-slate-100 {
    background: rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode #results-section .text-green-700,
body.dark-mode #results-section .text-green-800 {
    color: #86EFAC !important;
}

body.dark-mode #results-section .text-amber-700,
body.dark-mode #results-section .text-amber-800 {
    color: #FDE68A !important;
}

body.dark-mode #results-section .text-green-500,
body.dark-mode #results-section .text-green-600 {
    color: #6EE7B7 !important;
}

body.dark-mode #results-section .text-amber-500,
body.dark-mode #results-section .text-amber-600 {
    color: #FCD34D !important;
}

body.dark-mode #results-section .text-slate-600 {
    color: #94a3b8 !important;
}

/* Dark Mode - Score Display Colors */
body.dark-mode #results-section .text-emerald-800 {
    color: #A7F3D0 !important;
}

body.dark-mode #results-section .text-blue-800 {
    color: #BFDBFE !important;
}

body.dark-mode #results-section .text-yellow-800 {
    color: #FEF08A !important;
}

body.dark-mode #results-section .text-orange-800 {
    color: #FED7AA !important;
}

body.dark-mode #results-section .text-red-800 {
    color: #FECACA !important;
}

body.dark-mode #results-section .bg-emerald-50 {
    background: rgba(52, 211, 153, 0.12) !important;
    border-color: rgba(52, 211, 153, 0.25) !important;
}

body.dark-mode #results-section .bg-blue-50 {
    background: rgba(96, 165, 250, 0.12) !important;
    border-color: rgba(96, 165, 250, 0.25) !important;
}

body.dark-mode #results-section .bg-yellow-50 {
    background: rgba(251, 191, 36, 0.12) !important;
    border-color: rgba(251, 191, 36, 0.25) !important;
}

body.dark-mode #results-section .bg-orange-50 {
    background: rgba(251, 146, 60, 0.12) !important;
    border-color: rgba(251, 146, 60, 0.25) !important;
}

body.dark-mode #results-section .bg-red-50 {
    background: rgba(248, 113, 113, 0.12) !important;
    border-color: rgba(248, 113, 113, 0.25) !important;
}

body.dark-mode #results-section .border-green-200,
body.dark-mode #results-section .border-amber-200,
body.dark-mode #results-section .border-slate-200,
body.dark-mode #results-section .border-emerald-200,
body.dark-mode #results-section .border-blue-200,
body.dark-mode #results-section .border-yellow-200,
body.dark-mode #results-section .border-orange-200,
body.dark-mode #results-section .border-red-200 {
    border-color: #2D2D2D !important;
}

/* Dark Mode - Tabbed Listening Results (T26 Conversation, Announcement, Academic Talk) */
body.dark-mode .listening-results-tabbed {
    background: var(--bg-white) !important;
    border-color: var(--border-primary) !important;
}

body.dark-mode .listening-results-tabbed .listening-tabs-nav {
    border-color: var(--border-primary) !important;
}

body.dark-mode .listening-results-tabbed .listening-tab-btn {
    color: var(--text-muted) !important;
}

body.dark-mode .listening-results-tabbed .listening-tab-btn.active {
    color: #7FA87F !important;
    border-bottom-color: #7FA87F !important;
}

body.dark-mode .listening-results-tabbed .listening-tab-content {
    background: var(--bg-white) !important;
}

body.dark-mode .listening-results-tabbed .listening-result-item {
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode .listening-results-tabbed .ask-petra-btn {
    background: linear-gradient(135deg, #5C6F5C 0%, #4a5d4a 100%) !important;
}

body.dark-mode .listening-results-tabbed .ask-petra-btn:hover {
    background: linear-gradient(135deg, #4a5d4a 0%, #3d4d3d 100%) !important;
}

/* ========================================
   Bottom Petra Bar - Ask Petra Chat Interface
   ======================================== */

/* Light Mode - Alternate Design Standards */
.bottom-activity-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(180deg, #FEFEFE 0%, #F7F4EF 100%);
    border-top: 2px solid #5C6F5C;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #1A1816;
    display: none;
}

.bottom-activity-bar.collapsed {
    transform: translateY(calc(100% - 40px));
}

.bottom-activity-bar-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #E8E3DA;
    display: flex;
    align-items: center;
}

.bottom-activity-bar-header:hover {
    background: rgba(92, 111, 92, 0.08);
}

.bottom-activity-bar-header:active {
    background: rgba(92, 111, 92, 0.12);
}

.bottom-activity-bar-toggle {
    background: #5C6F5C;
    border: 1px solid #5C6F5C;
    color: #FEFEFE;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    border-radius: 4px;
    flex-shrink: 0;
    outline: none;
}

.bottom-activity-bar-toggle:focus {
    outline: none;
    box-shadow: none;
}

.bottom-activity-bar-toggle:hover {
    background: #2d5f4d;
    border-color: #2d5f4d;
    box-shadow: 0 2px 8px rgba(92, 111, 92, 0.25);
}

.bottom-activity-bar.collapsed .toggle-text-collapse {
    display: none;
}

.bottom-activity-bar:not(.collapsed) .toggle-text-expand {
    display: none;
}

/* Petra Header Title */
.petra-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    padding-top: 2px;
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
}

.petra-header-title svg {
    opacity: 0.8;
}

.petra-title-text {
    font-family: 'Poppins', sans-serif;
}

/* Petra Content Area */
.petra-content-area {
    height: calc(100% - 40px);
    position: absolute;
    top: 40px;
    left: 0;
    right: 0;
    bottom: 0;
}

.credits-badge,
.usage-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    margin-left: 6px;
}

.usage-badge.warning {
    background: rgba(217, 119, 6, 0.15);
    color: #d97706;
}

.usage-badge.depleted {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

/* Petra Bar Action Buttons */
.activity-bar-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid #E8E3DA;
    border-radius: 6px;
    color: #9E9689;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    flex-shrink: 0;
}

.activity-bar-action-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.activity-bar-action-btn:focus {
    outline: none;
}

.activity-bar-action-btn.expand-btn {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.activity-bar-action-btn.expand-btn:hover {
    background: var(--primary);
    color: white;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.bottom-activity-bar-header .keyboard-hint {
    position: static;
    margin: 0;
    padding-right: 16px;
    border-right: 1px solid #E8E3DA;
    color: #9E9689;
    font-size: 11px;
    white-space: nowrap;
}

/* Petra Chat Styles */
.petra-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.petra-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

.petra-messages::-webkit-scrollbar {
    width: 6px;
}

.petra-messages::-webkit-scrollbar-track {
    background: transparent;
}

.petra-messages::-webkit-scrollbar-thumb {
    background: rgba(92, 111, 92, 0.3);
    border-radius: 3px;
}

.petra-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9E9689;
    text-align: center;
}

.petra-empty-state .empty-icon {
    color: #5C6F5C;
    opacity: 0.5;
    margin-bottom: 12px;
}

.petra-empty-state .empty-text {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
}

.petra-empty-state .empty-hint {
    font-size: 11px;
    opacity: 0.7;
}

.petra-message {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    max-width: 85%;
}

.petra-message.user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.petra-message.system {
    max-width: 100%;
    justify-content: center;
}

.petra-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5C6F5C 0%, #2d5f4d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.petra-message.petra .message-bubble {
    background: rgba(92, 111, 92, 0.1);
    color: #3A3633;
    border-bottom-left-radius: 4px;
}

.petra-message.user .message-bubble {
    background: #5C6F5C;
    color: #FEFEFE;
    border-bottom-right-radius: 4px;
}

.petra-message.system .message-bubble {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
    font-size: 12px;
}

.petra-input-area {
    display: flex;
    gap: 10px;
    padding: 12px 24px;
    border-top: 1px solid #E8E3DA;
    background: rgba(248, 244, 240, 0.5);
}

#petra-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #E8E3DA;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    background: #FEFEFE;
    color: #1A1816;
    transition: border-color 0.2s ease;
}

#petra-chat-input:focus {
    outline: none;
    border-color: #5C6F5C;
}

#petra-chat-input:disabled {
    background: #F7F4EF;
    cursor: not-allowed;
}

.petra-send-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: #5C6F5C;
    color: #FEFEFE;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.petra-send-btn:hover:not(:disabled) {
    background: #2d5f4d;
}

.petra-send-btn:disabled {
    background: #E8E3DA;
    color: #9E9689;
    cursor: not-allowed;
}

.petra-loading, .petra-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: #9E9689;
}

.petra-error .error-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
}

.petra-upgrade-modal {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 24px;
    background: linear-gradient(135deg, rgba(248, 244, 240, 0.8) 0%, rgba(255, 255, 255, 0.9) 100%);
    border-radius: 12px;
    margin: 12px;
}

.petra-upgrade-modal .upgrade-icon {
    color: #5C6F5C;
    margin-bottom: 16px;
    opacity: 0.8;
}

.petra-upgrade-modal .upgrade-title {
    font-size: 18px;
    font-weight: 700;
    color: #1A1816;
    margin-bottom: 10px;
    font-family: 'Poppins', sans-serif;
}

.petra-upgrade-modal .upgrade-text {
    font-size: 14px;
    color: #3A3633;
    margin-bottom: 20px;
    line-height: 1.6;
}

.petra-upgrade-modal .upgrade-text strong {
    color: #5C6F5C;
    font-weight: 600;
}

.petra-upgrade-modal .upgrade-text .reset-time,
.petra-upgrade-modal .upgrade-text .trial-info {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #9E9689;
}

.petra-upgrade-modal .upgrade-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    background: linear-gradient(135deg, #5C6F5C 0%, #2d5f4d 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(92, 111, 92, 0.25);
}

.petra-upgrade-modal .upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(92, 111, 92, 0.35);
}

.petra-upgrade-modal .upgrade-hint {
    font-size: 12px;
    color: #9E9689;
    margin-top: 16px;
    max-width: 280px;
    line-height: 1.4;
}

/* Typing animation */
.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #5C6F5C;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Expanded Mode - Taller bar for easier chatting */
.bottom-activity-bar.fully-expanded {
    height: 400px;
}

.bottom-activity-bar.fully-expanded .petra-messages {
    padding: 20px 24px;
}

.bottom-activity-bar.fully-expanded #petra-chat-input {
    min-height: 60px;
}

/* Focus Mode - Maximum expansion (70vh) for extended conversations */
.bottom-activity-bar.focus-mode {
    height: 70vh;
    max-height: calc(100vh - 60px);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
}

.bottom-activity-bar.focus-mode .petra-messages {
    padding: 24px 32px;
}

.bottom-activity-bar.focus-mode #petra-chat-input {
    min-height: 80px;
    font-size: 15px;
}

.bottom-activity-bar.focus-mode .petra-input-area {
    padding: 16px 24px;
}

.bottom-activity-bar.focus-mode .petra-message {
    max-width: 85%;
}

/* Focus Mode Backdrop */
.petra-focus-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.petra-focus-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Expand button states */
.activity-bar-action-btn.expand-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.activity-bar-action-btn.expand-btn.focus-active {
    background: #2D5A27;
    border-color: #2D5A27;
    color: white;
}

.activity-bar-action-btn.expand-btn .expand-icon {
    display: none;
}

.activity-bar-action-btn.expand-btn .expand-icon.level-0,
.activity-bar-action-btn.expand-btn[data-level="0"] .level-0 {
    display: block;
}

.activity-bar-action-btn.expand-btn[data-level="1"] .level-0 { display: none; }
.activity-bar-action-btn.expand-btn[data-level="1"] .level-1 { display: block; }

.activity-bar-action-btn.expand-btn[data-level="2"] .level-0 { display: none; }
.activity-bar-action-btn.expand-btn[data-level="2"] .level-1 { display: none; }
.activity-bar-action-btn.expand-btn[data-level="2"] .level-2 { display: block; }

/* History View Styles */
.petra-chat-view.hidden,
.petra-history-view.hidden {
    display: none !important;
}

.petra-history-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.petra-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid #E8E3DA;
    background: rgba(248, 244, 240, 0.5);
}

.history-back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #E8E3DA;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

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

.history-back-btn:focus {
    outline: none;
}

.history-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.petra-sessions-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 24px;
}

.petra-loading-state,
.petra-empty-history,
.petra-error-history {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9E9689;
    font-size: 13px;
}

.petra-session-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: #FEFEFE;
    border: 1px solid #E8E3DA;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.petra-session-card:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.session-info {
    flex: 1;
    min-width: 0;
}

.session-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #9E9689;
}

.section-badge {
    padding: 2px 6px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 4px;
    font-weight: 500;
    text-transform: capitalize;
}

.message-count {
    color: #9E9689;
}

.session-date {
    font-size: 11px;
    color: #9E9689;
    white-space: nowrap;
    margin-left: 12px;
}

/* Dark Mode Support - Bloomberg Terminal Style */
body.dark-mode .bottom-activity-bar {
    background: linear-gradient(180deg, #1A1816 0%, #0A0908 100%);
    border-top-color: #7FA87F;
    color: #00FF41;
}

body.dark-mode .bottom-activity-bar-header {
    border-bottom-color: rgba(127, 168, 127, 0.2);
}

body.dark-mode .bottom-activity-bar-header:hover {
    background: rgba(127, 168, 127, 0.1);
}

body.dark-mode .bottom-activity-bar-header:active {
    background: rgba(127, 168, 127, 0.15);
}

body.dark-mode .bottom-activity-bar-toggle {
    background: rgba(127, 168, 127, 0.2);
    border-color: #7FA87F;
    color: #7FA87F;
}

body.dark-mode .bottom-activity-bar-toggle:hover {
    background: rgba(127, 168, 127, 0.4);
    border-color: #7FA87F;
    box-shadow: 0 2px 8px rgba(127, 168, 127, 0.3);
}

body.dark-mode .petra-header-title {
    color: var(--primary);
}

body.dark-mode .credits-badge,
body.dark-mode .usage-badge {
    background: var(--primary-light);
    color: var(--primary);
}

body.dark-mode .usage-badge.warning {
    background: rgba(217, 119, 6, 0.25);
    color: #f59e0b;
}

body.dark-mode .usage-badge.depleted {
    background: rgba(220, 38, 38, 0.2);
    color: #ef4444;
}

body.dark-mode .petra-upgrade-modal {
    background: linear-gradient(135deg, rgba(26, 24, 22, 0.9) 0%, rgba(10, 9, 8, 0.95) 100%);
}

body.dark-mode .petra-upgrade-modal .upgrade-icon {
    color: #7FA87F;
}

body.dark-mode .petra-upgrade-modal .upgrade-title {
    color: #E8E6E3;
}

body.dark-mode .petra-upgrade-modal .upgrade-text {
    color: #A0A0A0;
}

body.dark-mode .petra-upgrade-modal .upgrade-text strong {
    color: #7FA87F;
}

body.dark-mode .petra-upgrade-modal .upgrade-btn {
    background: linear-gradient(135deg, rgba(127, 168, 127, 0.4) 0%, rgba(127, 168, 127, 0.6) 100%);
    box-shadow: 0 2px 8px rgba(127, 168, 127, 0.2);
}

body.dark-mode .petra-upgrade-modal .upgrade-btn:hover {
    box-shadow: 0 4px 16px rgba(127, 168, 127, 0.3);
}

body.dark-mode .activity-bar-action-btn {
    border-color: #3D3D3D;
    color: #9E9689;
}

body.dark-mode .activity-bar-action-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

body.dark-mode .activity-bar-action-btn.expand-btn {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

body.dark-mode .activity-bar-action-btn.expand-btn:hover {
    background: var(--primary);
    color: white;
}

body.dark-mode .activity-bar-action-btn.expand-btn.focus-active {
    background: #4A7C59;
    border-color: #4A7C59;
}

/* Dark mode focus mode */
body.dark-mode .bottom-activity-bar.focus-mode {
    background: linear-gradient(180deg, #1A1816 0%, #0D0C0B 100%);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
}

body.dark-mode .petra-focus-backdrop {
    background: rgba(0, 0, 0, 0.5);
}

body.dark-mode .petra-messages::-webkit-scrollbar-thumb {
    background: rgba(127, 168, 127, 0.4);
}

body.dark-mode .petra-empty-state {
    color: #7FA87F;
}

body.dark-mode .petra-empty-state .empty-icon {
    color: #7FA87F;
}

body.dark-mode .petra-message.petra .message-bubble {
    background: rgba(127, 168, 127, 0.15);
    color: #E8E6E3;
}

body.dark-mode .petra-message.user .message-bubble {
    background: rgba(127, 168, 127, 0.4);
    color: #FEFEFE;
}

body.dark-mode .petra-input-area {
    border-top-color: rgba(127, 168, 127, 0.2);
    background: rgba(26, 24, 22, 0.5);
}

body.dark-mode #petra-chat-input {
    background: rgba(26, 24, 22, 0.8);
    border-color: rgba(127, 168, 127, 0.3);
    color: #E8E6E3;
}

body.dark-mode #petra-chat-input:focus {
    border-color: #7FA87F;
}

body.dark-mode #petra-chat-input:disabled {
    background: rgba(26, 24, 22, 0.5);
}

body.dark-mode .petra-send-btn {
    background: rgba(127, 168, 127, 0.3);
    color: #00FF41;
}

body.dark-mode .petra-send-btn:hover:not(:disabled) {
    background: rgba(127, 168, 127, 0.5);
}

body.dark-mode .petra-send-btn:disabled {
    background: rgba(127, 168, 127, 0.1);
    color: #7FA87F;
}

body.dark-mode .petra-avatar {
    background: linear-gradient(135deg, rgba(127, 168, 127, 0.4) 0%, rgba(127, 168, 127, 0.6) 100%);
}

body.dark-mode .typing-dots span {
    background: #7FA87F;
}

body.dark-mode .petra-upgrade-modal .upgrade-title {
    color: #E8E6E3;
}

body.dark-mode .petra-upgrade-modal .upgrade-btn {
    background: linear-gradient(135deg, rgba(127, 168, 127, 0.4) 0%, rgba(127, 168, 127, 0.6) 100%);
}

/* Dark mode - History view */
body.dark-mode .petra-history-header {
    border-bottom-color: rgba(127, 168, 127, 0.2);
    background: rgba(26, 24, 22, 0.5);
}

body.dark-mode .history-back-btn {
    border-color: #3D3D3D;
    color: #9E9689;
}

body.dark-mode .history-back-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

body.dark-mode .petra-session-card {
    background: rgba(26, 24, 22, 0.8);
    border-color: #3D3D3D;
}

body.dark-mode .petra-session-card:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

body.dark-mode .session-name {
    color: #E8E6E3;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .activity-row {
        grid-template-columns: 70px 90px 1fr 70px;
        gap: 12px;
        font-size: 11px;
    }
    
    /* Compact header on smaller screens */
    .bottom-activity-bar-header .keyboard-hint {
        display: none;
    }
    
    .header-tabs {
        padding: 4px 6px;
    }
    
    .tab-btn {
        padding: 5px 10px;
        font-size: 11px;
        gap: 4px;
    }
    
    .tab-btn svg {
        width: 12px;
        height: 12px;
    }
    
    .credits-badge {
        padding: 1px 4px;
        font-size: 9px;
    }
}

@media (max-width: 768px) {
    /* Hide bottom Petra bar on mobile - replaced by bottom tab bar */
    .bottom-activity-bar {
        display: none !important;
    }
}

