        :root[data-theme="light"] {
            --bg-app: #f4f6fa;
            --bg-card: #ffffff;
            --text-primary: #0f172a;
            --text-secondary: #475569;
            --text-muted: #94a3b8;
            --border-color: #e2e8f0;
            --border-underline: #94a3b8;
            --accent: #3b82f6;
            --accent-hover: #2563eb;
            --accent-glow: rgba(59, 130, 246, 0.08);
            --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 4px 10px -2px rgba(0, 0, 0, 0.02);
            --feedback-correct: #10b981;
            --feedback-wrong: #ef4444;
            --menu-btn-new-bg: #ecfdf5;
            --menu-btn-new-text: #065f46;
            --menu-btn-review-bg: #f0f9ff;
            --menu-btn-review-text: #1e3a5f;
            --menu-btn-wrong-bg: #fef2f2;
            --menu-btn-wrong-text: #7f1d1d;
        }

        :root[data-theme="dark"] {
            --bg-app: #0f172a;
            --bg-card: #1e293b;
            --text-primary: #f8fafc;
            --text-secondary: #94a3b8;
            --text-muted: #64748b;
            --border-color: #334155;
            --border-underline: #64748b;
            --accent: #3b82f6;
            --accent-hover: #2563eb;
            --accent-glow: rgba(59, 130, 246, 0.15);
            --card-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.3);
            --feedback-correct: #34d399;
            --feedback-wrong: #f87171;
            --menu-btn-new-bg: #064e3b;
            --menu-btn-new-text: #a7f3d0;
            --menu-btn-review-bg: #1e3a5f;
            --menu-btn-review-text: #bfdbfe;
            --menu-btn-wrong-bg: #7f1d1d;
            --menu-btn-wrong-text: #fecaca;
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            user-select: none;
            transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
        }

        body {
            background-color: var(--bg-app);
            color: var(--text-primary);
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            min-height: 100vh;
            display: flex;
            flex-direction: row;
            overflow-x: hidden;
        }

        .floating-actions {
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 1100;
            display: flex;
            gap: 10px;
        }
        .mobile-menu-trigger {
            position: fixed;
            top: 20px;
            left: 20px;
            z-index: 1100;
            display: none;
        }

        #drawer-overlay.active ~ .mobile-menu-trigger {
            display: none !important;
        }

        .mobile-right-menu-trigger {
            position: fixed;
            top: 20px;
            right: 70px;
            z-index: 1100;
            display: none;
        }

        #right-drawer-overlay.active ~ .mobile-right-menu-trigger {
            display: none !important;
        }

        .btn-circle {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            color: var(--text-primary);
            width: 42px;
            height: 42px;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: var(--card-shadow);
            font-size: 16px;
        }
        .btn-circle:hover {
            border-color: var(--accent);
            color: var(--accent);
        }

        #sidebar-container {
            width: 280px;
            flex-shrink: 0;
            z-index: 1000;
        }

        .main-content {
            flex: 1;
            min-width: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 40px 24px;
            min-height: 100vh;
            transition: transform 0.3s ease, padding-bottom 0.3s ease;
        }

        body.vk-visible .main-content {
            padding-top: 20px;
            align-items: flex-start;
        }

        .game-card {
            background: var(--bg-card);
            border-radius: 24px;
            box-shadow: var(--card-shadow);
            padding: 40px 36px;
            max-width: 700px;
            width: 100%;
            text-align: center;
            border: 1px solid var(--border-color);
            margin: auto;
            transition: transform 0.3s ease;
        }

        .animate-fade {
            animation: fadeIn 0.25s ease-out;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(6px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .brand-title {
            font-size: 32px;
            font-weight: 700;
            letter-spacing: -0.03em;
            margin-bottom: 6px;
            color: var(--text-primary);
        }
        .brand-desc {
            font-size: 13px;
            color: var(--text-secondary);
            margin-bottom: 30px;
        }
        .chinese {
            font-size: 26px;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 24px;
            line-height: 1.4;
        }

        .mobile-hidden-input {
            position: fixed;
            top: 0;
            left: -100px;
            width: 50px;
            height: 50px;
            opacity: 0.01;
            font-size: 16px;
            background: transparent;
            border: none;
            outline: none;
            z-index: -1;
        }

        .user-panel {
            background: var(--bg-app);
            border-radius: 16px;
            padding: 16px 20px;
            margin-bottom: 24px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            text-align: left;
        }
        .user-row {
            display: flex;
            align-items: center;
            gap: 12px;
            flex-wrap: wrap;
        }
        .user-label {
            font-size: 14px;
            font-weight: 600;
            color: var(--text-secondary);
            white-space: nowrap;
        }
        .input-group {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-grow: 1;
            min-width: 200px;
        }
        .text-input {
            flex-grow: 1;
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 20px;
            padding: 8px 16px;
            font-size: 14px;
            color: var(--text-primary);
            outline: none;
            width: 100%;
        }
        .text-input:focus {
            border-color: var(--accent);
        }

        button {
            font-family: inherit;
            cursor: pointer;
            border: none;
            transition: all 0.15s ease;
        }
        .btn-action {
            background: var(--accent);
            color: white;
            font-size: 14px;
            font-weight: 500;
            padding: 12px 24px;
            border-radius: 40px;
            margin-top: 10px;
            width: 100%;
            display: inline-block;
        }
        .btn-action:hover { background: var(--accent-hover); }

        .btn-outline {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            color: var(--text-secondary);
            font-size: 12px;
            padding: 8px 14px;
            border-radius: 20px;
            white-space: nowrap;
        }
        .btn-outline:hover {
            border-color: var(--text-muted);
            color: var(--text-primary);
        }

        .btn-menu {
            display: block;
            width: 100%;
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            color: var(--text-primary);
            font-size: 15px;
            font-weight: 500;
            padding: 14px;
            border-radius: 14px;
            margin-bottom: 12px;
            text-align: center;
        }
        .btn-menu:hover {
            border-color: var(--accent);
            box-shadow: 0 4px 12px rgba(0,0,0,0.03);
        }

        .underline-row {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 0;
            margin: 24px 0;
            font-family: 'Courier New', 'Fira Code', monospace;
        }
        .letter-slot {
            position: relative;
            width: 1.2ch;
            text-align: center;
            font-size: 28px;
            font-weight: 500;
            color: var(--text-primary);
            border-bottom: 3px solid var(--border-underline);
            line-height: 1.4;
            margin: 0;
            min-height: 38px;
        }
        .word-space {
            position: relative;
            width: 1.5ch;
            min-height: 38px;
            margin: 0;
            display: inline-block;
            transition: all 0.2s ease;
        }
        .word-space.space-correct {
            background-color: rgba(16, 185, 129, 0.12);
        }

        .level-bar {
            font-size: 13px;
            color: var(--text-secondary);
            margin-bottom: 16px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-weight: 500;
        }
        .difficulty-badge {
            font-size: 11px;
            font-weight: 600;
            padding: 3px 10px;
            border-radius: 20px;
            white-space: nowrap;
        }
        .difficulty-high { background: rgba(16, 185, 129, 0.12); color: #10b981; }
        .difficulty-medium { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
        .difficulty-low { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
        .feedback {
            margin-top: 16px;
            font-size: 14px;
            font-weight: 600;
            min-height: 48px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .correct-feedback { color: var(--feedback-correct); }
        .wrong-feedback { color: var(--feedback-wrong); }

        .info {
            font-size: 12px;
            color: var(--text-muted);
            margin-top: 20px;
            line-height: 1.4;
        }

        .tip-card {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-top: 8px;
            padding: 8px 12px;
            background: rgba(99, 102, 241, 0.05);
            border-radius: 8px;
        }
        .tip-icon {
            font-size: 14px;
            flex-shrink: 0;
        }
        .tip-text {
            font-size: 11px;
            color: var(--text-secondary);
            line-height: 1.4;
        }

        .leaderboard-list {
            margin: 8px 0;
            border: 1px solid var(--border-color);
            border-radius: 12px;
            overflow-y: auto;
            max-height: 50vh;
        }
        .leaderboard-list::-webkit-scrollbar {
            width: 4px;
        }
        .leaderboard-list::-webkit-scrollbar-thumb {
            background: var(--border-color);
            border-radius: 10px;
        }
        .leaderboard-item {
            display: flex;
            justify-content: space-between;
            padding: 14px 16px;
            background: var(--bg-card);
            border-bottom: 1px solid var(--border-color);
            font-size: 14px;
        }
        .leaderboard-item:last-child { border-bottom: none; }

        .sidebar {
            position: sticky;
            top: 0;
            left: 0;
            width: 280px;
            height: 100vh;
            background: var(--bg-card);
            border-right: 1px solid var(--border-color);
            padding: 24px 20px;
            display: flex;
            flex-direction: column;
            box-shadow: 4px 0 20px rgba(0, 0, 0, 0.02);
            box-sizing: border-box;
        }
        .sidebar-nav {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-bottom: 20px;
            padding-bottom: 16px;
            border-bottom: 1px solid var(--border-color);
        }
        .sidebar-nav-btn {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 10px 14px;
            background: var(--accent-glow);
            border-radius: 10px;
            color: var(--accent);
            text-decoration: none;
            font-size: 14px;
            font-weight: 600;
            transition: all 0.2s ease;
        }
        .sidebar-nav-btn:hover {
            background: var(--accent);
            color: white;
        }
        .sidebar-header {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 24px;
            padding-bottom: 20px;
            border-bottom: 1px solid var(--border-color);
        }
        .sidebar-avatar {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--accent), #8b5cf6);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 18px;
            font-weight: 700;
        }
        .sidebar-user-info {
            flex: 1;
            text-align: left;
            min-width: 0;
        }
        .sidebar-username {
            font-size: 14px;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 2px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .sidebar-level {
            font-size: 11px;
            color: var(--text-muted);
        }
        .sidebar-stats {
            flex: 1;
            overflow-y: auto;
            padding-right: 4px;
        }
        .sidebar-stats::-webkit-scrollbar {
            width: 4px;
        }
        .sidebar-stats::-webkit-scrollbar-thumb {
            background: var(--border-color);
            border-radius: 10px;
        }

        .stat-card {
            background: var(--bg-app);
            border-radius: 12px;
            padding: 14px 16px;
            margin-bottom: 12px;
            text-align: left;
        }
        .stat-card-header {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 6px;
        }
        .stat-icon { font-size: 14px; }
        .stat-label {
            font-size: 12px;
            color: var(--text-secondary);
            font-weight: 500;
        }
        .stat-value {
            font-size: 20px;
            font-weight: 700;
            color: var(--text-primary);
        }
        .stat-sub {
            font-size: 11px;
            color: var(--text-muted);
            margin-top: 4px;
        }
        .stat-hint {
            font-size: 10px;
            color: var(--text-muted);
            margin-top: 2px;
            opacity: 0.7;
        }
        
        .stats-panel {
            background: var(--bg-app);
            border-radius: 12px;
            padding: 16px;
            margin-bottom: 12px;
        }
        .stats-panel-header {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 12px;
        }
        .stats-panel-icon { font-size: 18px; }
        .stats-panel-title {
            font-size: 14px;
            font-weight: 600;
            color: var(--text-primary);
        }
        .stats-panel-total {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 12px;
            background: var(--bg-card);
            border-radius: 8px;
            margin-bottom: 12px;
        }
        .stats-total-label {
            font-size: 12px;
            color: var(--text-secondary);
        }
        .stats-total-value {
            font-size: 18px;
            font-weight: 700;
            color: var(--accent);
        }
        .stats-panel-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 8px;
            margin-bottom: 12px;
        }
        .stats-grid-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 10px 8px;
            border-radius: 8px;
            gap: 2px;
        }
        .stats-grid-item.correct {
            background: rgba(16, 185, 129, 0.1);
        }
        .stats-grid-item.hinted {
            background: rgba(59, 130, 246, 0.1);
        }
        .stats-grid-item.wrong {
            background: rgba(239, 68, 68, 0.1);
        }
        .stats-grid-item.skip {
            background: rgba(245, 158, 11, 0.1);
        }
        .stats-item-icon {
            font-size: 16px;
        }
        .stats-grid-item.correct .stats-item-icon { color: #10b981; }
        .stats-grid-item.hinted .stats-item-icon { color: #3b82f6; }
        .stats-grid-item.wrong .stats-item-icon { color: #ef4444; }
        .stats-grid-item.skip .stats-item-icon { color: #f59e0b; }
        .stats-item-label {
            font-size: 10px;
            color: var(--text-muted);
        }
        .stats-item-value {
            font-size: 16px;
            font-weight: 700;
        }
        .stats-grid-item.correct .stats-item-value { color: #10b981; }
        .stats-grid-item.hinted .stats-item-value { color: #3b82f6; }
        .stats-grid-item.wrong .stats-item-value { color: #ef4444; }
        .stats-grid-item.skip .stats-item-value { color: #f59e0b; }
        .stats-panel-accuracy {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        .accuracy-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 6px 12px;
            background: var(--bg-card);
            border-radius: 6px;
        }
        .accuracy-label {
            font-size: 12px;
            color: var(--text-secondary);
        }
        .accuracy-value {
            font-size: 14px;
            font-weight: 700;
            color: #10b981;
        }
        .accuracy-value.sub {
            color: var(--text-muted);
        }
        
        .stat-bar {
            height: 5px;
            background: var(--border-color);
            border-radius: 3px;
            margin-top: 8px;
            overflow: hidden;
        }
        .stat-bar-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--accent), #8b5cf6);
            border-radius: 3px;
            transition: width 0.3s ease;
        }
        .sidebar-footer {
            padding-top: 16px;
            border-top: 1px solid var(--border-color);
        }
        .exchange-btn {
            width: 100%;
            background: linear-gradient(135deg, var(--accent), #8b5cf6);
            color: white;
            font-size: 13px;
            font-weight: 600;
            padding: 12px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
        }
        .exchange-btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 6px 20px rgba(59, 130, 246, 0.25);
        }

        .sidebar-drawer-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.4);
            backdrop-filter: blur(4px);
            z-index: 999;
            display: none;
            opacity: 0;
            transition: opacity 0.25s ease;
        }
        .sidebar-drawer-overlay.active {
            display: block;
            opacity: 1;
        }

        .right-sidebar-drawer-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.4);
            backdrop-filter: blur(4px);
            z-index: 999;
            display: none;
            opacity: 0;
            transition: opacity 0.25s ease;
        }
        .right-sidebar-drawer-overlay.active {
            display: block;
            opacity: 1;
        }

        .modal-overlay {
            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: 2000;
            padding: 16px;
        }
        .modal-content {
            background: var(--bg-card);
            border-radius: 20px;
            padding: 28px 24px;
            max-width: 420px;
            width: 100%;
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
            animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            max-height: 90vh;
            overflow-y: auto;
        }
        .modal-content-fixed {
            width: 80vw;
            max-width: 600px;
            height: 70vh;
            max-height: 70vh;
            display: flex;
            flex-direction: column;
        }
        .modal-content-fixed .modal-body-scroll {
            flex: 1;
            overflow-y: auto;
            min-height: 0;
        }
        @keyframes slideUp {
            from { opacity: 0; transform: translateY(15px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .modal-header {
            text-align: center;
            margin-bottom: 20px;
        }
        .modal-title {
            font-size: 18px;
            font-weight: 700;
            color: var(--text-primary);
            margin-bottom: 4px;
        }
        .modal-desc {
            font-size: 13px;
            color: var(--text-secondary);
            line-height: 1.4;
        }
        .exchange-list {
            margin-bottom: 20px;
        }
        .exchange-item {
            background: var(--bg-app);
            border: 1px solid var(--border-color);
            border-radius: 14px;
            padding: 14px 16px;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            transition: all 0.2s ease;
        }
        .exchange-item:not(.disabled):hover {
            border-color: var(--accent);
            transform: translateX(2px);
        }
        .exchange-item.disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }
        .exchange-left {
            display: flex;
            align-items: center;
            gap: 12px;
            min-width: 0;
        }
        .exchange-icon {
            width: 38px;
            height: 38px;
            border-radius: 10px;
            background: linear-gradient(135deg, var(--accent), #8b5cf6);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 16px;
            flex-shrink: 0;
        }
        .exchange-info {
            min-width: 0;
            text-align: left;
        }
        .exchange-info h4 {
            font-size: 13px;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 2px;
        }
        .exchange-info p {
            font-size: 11px;
            color: var(--text-muted);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .exchange-right {
            text-align: right;
            flex-shrink: 0;
        }
        .exchange-points {
            font-size: 16px;
            font-weight: 700;
            color: var(--feedback-correct);
        }
        .exchange-points span {
            font-size: 11px;
            font-weight: 500;
            color: var(--text-muted);
        }
        .modal-close-btn {
            width: 100%;
            background: var(--bg-app);
            border: 1px solid var(--border-color);
            color: var(--text-secondary);
            font-size: 14px;
            font-weight: 500;
            padding: 12px;
            border-radius: 12px;
        }
        .modal-close-btn:hover {
            background: var(--border-color);
            color: var(--text-primary);
        }

        .category-stats-detail .stat-correct {
            color: #10b981;
        }
        .category-stats-detail .stat-wrong {
            color: #ef4444;
        }
        .category-stats-detail .stat-show-answer {
            color: #f59e0b;
        }
        .btn-copy-code {
            background: var(--bg-app);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 4px 8px;
            font-size: 12px;
            cursor: pointer;
            color: var(--text-secondary);
            font-family: inherit;
        }
        .btn-copy-code:hover {
            border-color: var(--accent);
            color: var(--accent);
        }

        .tab-row {
            display: flex;
            gap: 4px;
            margin-bottom: 6px;
        }
        .tab-btn {
            flex: 1;
            padding: 6px 8px;
            border-radius: 8px;
            font-size: 12px;
            font-weight: 500;
            background: var(--bg-app);
            border: 1px solid var(--border-color);
            color: var(--text-secondary);
            cursor: pointer;
            text-align: center;
            font-family: inherit;
        }
        .tab-btn.active {
            background: var(--accent);
            color: white;
            border-color: var(--accent);
        }
        .tab-btn:hover:not(.active) {
            border-color: var(--accent);
            color: var(--accent);
        }

        .category-stats-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 4px;
            font-size: 13px;
            color: var(--text-secondary);
            border-bottom: 1px solid var(--border-color);
        }
        .category-stats-row:last-child {
            border-bottom: none;
        }
        .category-stats-label {
            font-weight: 600;
            color: var(--text-primary);
            min-width: 36px;
            font-size: 13px;
        }
        .category-stats-detail {
            flex: 1;
            text-align: center;
            font-size: 12px;
            color: var(--text-muted);
            display: flex;
            gap: 8px;
            justify-content: center;
        }
        .category-stats-detail span {
            display: inline-flex;
            align-items: center;
            gap: 2px;
        }
        .category-stats-rate {
            font-weight: 700;
            color: var(--accent);
            min-width: 48px;
            text-align: right;
            font-size: 13px;
        }

        .leaderboard-empty {
            padding: 30px 0;
            color: var(--text-muted);
            font-size: 13px;
        }

        .leaderboard-card {
            width: 80vw;
            max-width: 600px;
            height: 70vh;
            display: flex;
            flex-direction: column;
        }
        .leaderboard-card .leaderboard-body {
            flex: 1;
            overflow-y: auto;
            min-height: 0;
        }

        .wrongbook-card {
            width: 80vw;
            max-width: 600px;
            height: 70vh;
            display: flex;
            flex-direction: column;
        }
        .wrongbook-card .wrongbook-header {
            padding: 28px 28px 0 28px;
            flex-shrink: 0;
        }
        .wrongbook-card .wrongbook-body {
            flex: 1;
            overflow-y: auto;
            min-height: 0;
            padding: 0 28px;
        }
        .wrongbook-card .wrongbook-body::-webkit-scrollbar {
            width: 4px;
        }
        .wrongbook-card .wrongbook-body::-webkit-scrollbar-thumb {
            background: var(--border-color);
            border-radius: 10px;
        }
        .wrongbook-card .wrongbook-footer {
            padding: 0 28px 28px 28px;
            flex-shrink: 0;
        }

        .playing-top-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 12px;
        }
        .btn-back {
            background: var(--bg-app);
            border: 1px solid var(--border-color);
            color: var(--text-secondary);
            font-size: 12px;
            padding: 6px 14px;
            border-radius: 20px;
            font-family: inherit;
            cursor: pointer;
        }
        .btn-back:hover {
            border-color: var(--accent);
            color: var(--accent);
        }
        .remaining-badge {
            font-size: 12px;
            color: var(--text-muted);
            background: var(--bg-app);
            padding: 4px 12px;
            border-radius: 20px;
            border: 1px solid var(--border-color);
        }

        .confirm-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(4px);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 3000;
            animation: fadeIn 0.2s ease-out;
        }
        .confirm-box {
            background: var(--bg-card);
            border-radius: 20px;
            padding: 28px 24px;
            max-width: 360px;
            width: 90%;
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
            text-align: center;
        }
        .confirm-box-icon {
            font-size: 40px;
            margin-bottom: 12px;
        }
        .confirm-box-title {
            font-size: 16px;
            font-weight: 700;
            color: var(--text-primary);
            margin-bottom: 8px;
        }
        .confirm-box-desc {
            font-size: 13px;
            color: var(--text-secondary);
            margin-bottom: 20px;
            line-height: 1.5;
            white-space: pre-line;
        }
        .confirm-box-actions {
            display: flex;
            gap: 10px;
        }
        .confirm-box-actions button {
            flex: 1;
            padding: 10px 16px;
            border-radius: 12px;
            font-size: 14px;
            font-weight: 600;
            font-family: inherit;
            cursor: pointer;
            border: none;
        }
        .confirm-btn-cancel {
            background: var(--bg-app);
            border: 1px solid var(--border-color) !important;
            color: var(--text-secondary);
        }
        .confirm-btn-cancel:hover {
            background: var(--border-color);
            color: var(--text-primary);
        }
        .confirm-btn-ok {
            background: var(--accent);
            color: white;
        }
        .confirm-btn-ok:hover {
            background: var(--accent-hover);
        }

        @media (max-width: 850px) {
            body {
                flex-direction: column;
            }
            .mobile-menu-trigger {
                display: block;
            }
            .mobile-right-menu-trigger {
                display: block;
            }
            #sidebar-container {
                position: fixed;
                top: 0;
                left: 0;
                width: 280px !important;
                height: 100vh !important;
                z-index: 1050;
                pointer-events: none;
                overflow: visible;
            }
            .sidebar {
                position: absolute;
                top: 0;
                left: 0;
                width: 280px;
                height: 100vh;
                z-index: 1050;
                transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
                border-right: 1px solid var(--border-color);
                box-shadow: 10px 0 30px rgba(0,0,0,0.12);
                pointer-events: auto;
                transform: translateX(-100%);
            }
            .sidebar.active {
                transform: translateX(0);
            }
            #right-sidebar-container {
                position: fixed;
                top: 0;
                right: 0;
                width: 280px !important;
                height: 100vh !important;
                z-index: 1050;
                pointer-events: none;
                overflow: visible;
            }
            .right-sidebar {
                display: flex !important;
                flex-direction: column !important;
                position: absolute;
                top: 0;
                right: 0;
                width: 280px;
                height: 100vh;
                z-index: 1050;
                transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
                border-left: 1px solid var(--border-color);
                box-shadow: -10px 0 30px rgba(0,0,0,0.12);
                pointer-events: auto;
                transform: translateX(100%);
                padding: 24px 20px;
                box-sizing: border-box;
            }
            .right-sidebar.active {
                transform: translateX(0);
            }
            .main-content {
                padding: 84px 16px 40px 16px;
                width: 100%;
            }
            .game-card {
                padding: 30px 20px;
                border-radius: 20px;
            }
            .brand-title { font-size: 26px; }
            .chinese { font-size: 22px; }
        }

        @media (max-width: 360px) {
            .letter-slot {
                width: 1.2ch;
                font-size: 22px;
                min-height: 32px;
            }
            .word-space {
                width: 1.5ch;
                min-height: 32px;
            }
        }

        body.login-view #sidebar-container,
        body.login-view .mobile-menu-trigger,
        body.login-view .mobile-right-menu-trigger,
        body.login-view #right-sidebar-container {
            display: none !important;
        }
        body.login-view .main-content {
            padding: 0;
            width: 100% !important;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
        }

        #right-sidebar-container {
            width: 280px;
            flex-shrink: 0;
            z-index: 1000;
        }

        .right-sidebar {
            position: sticky;
            top: 0;
            right: 0;
            width: 280px;
            height: 100vh;
            background: var(--bg-card);
            border-left: 1px solid var(--border-color);
            padding: 24px 20px;
            display: flex;
            flex-direction: column;
            box-shadow: -4px 0 20px rgba(0, 0, 0, 0.02);
            box-sizing: border-box;
        }

        .right-sidebar-header {
            flex-shrink: 0;
            margin-bottom: 16px;
            padding-bottom: 12px;
            border-bottom: 1px solid var(--border-color);
        }

        .right-sidebar-stats {
            flex: 1;
            overflow-y: auto;
            padding-right: 4px;
            min-height: 0;
        }

        .right-sidebar-stats::-webkit-scrollbar {
            width: 4px;
        }

        .right-sidebar-stats::-webkit-scrollbar-thumb {
            background: var(--border-color);
            border-radius: 10px;
        }

        .history-list {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .history-item {
            padding: 6px 8px;
            background: var(--bg-app);
            border-radius: 6px;
            border: 1px solid var(--border-color);
            font-size: 12px;
            line-height: 1.4;
        }

        .history-pagination {
            flex-shrink: 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding-top: 12px;
            margin-top: 12px;
            border-top: 1px solid var(--border-color);
            background: var(--bg-card);
        }

        .pagination-btn {
            background: var(--bg-app);
            border: 1px solid var(--border-color);
            color: var(--text-secondary);
            font-size: 12px;
            padding: 6px 12px;
            border-radius: 8px;
            cursor: pointer;
            font-family: inherit;
        }

        .pagination-btn:hover:not(:disabled) {
            border-color: var(--accent);
            color: var(--accent);
        }

        .pagination-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        @media (max-width: 1200px) {
            #right-sidebar-container {
                width: 0;
                height: 0;
            }
            .right-sidebar {
                display: none;
            }
        }

        .detail-modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(6px);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 3000;
            padding: 20px;
        }

        .detail-modal-content {
            background: var(--bg-card);
            border-radius: 16px;
            width: 900px;
            max-width: 95vw;
            height: 600px;
            max-height: 85vh;
            display: flex;
            flex-direction: column;
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
            animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .detail-modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 20px;
            border-bottom: 1px solid var(--border-color);
            flex-shrink: 0;
        }

        .detail-modal-header h3 {
            font-size: 16px;
            font-weight: 700;
            color: var(--text-primary);
            margin: 0;
        }

        .detail-modal-close {
            background: var(--bg-app);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            width: 32px;
            height: 32px;
            font-size: 16px;
            color: var(--text-secondary);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: inherit;
        }

        .detail-modal-close:hover {
            background: var(--border-color);
            color: var(--text-primary);
        }

        .detail-modal-filters {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
            padding: 16px 20px;
            background: var(--bg-app);
            border-bottom: 1px solid var(--border-color);
            flex-shrink: 0;
        }

        .detail-filter-item {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .detail-filter-item label {
            font-size: 12px;
            font-weight: 600;
            color: var(--text-secondary);
            white-space: nowrap;
        }

        .detail-filter-item select {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 6px 10px;
            font-size: 12px;
            color: var(--text-primary);
            cursor: pointer;
            font-family: inherit;
            min-width: 100px;
        }

        .detail-filter-item select:focus {
            border-color: var(--accent);
            outline: none;
        }

        .detail-modal-info {
            padding: 10px 20px;
            font-size: 12px;
            color: var(--text-muted);
            border-bottom: 1px solid var(--border-color);
            flex-shrink: 0;
        }

        .detail-modal-table-wrapper {
            flex: 1;
            overflow: auto;
            min-height: 0;
        }

        .detail-modal-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 13px;
        }

        .detail-modal-table thead {
            position: sticky;
            top: 0;
            z-index: 10;
        }

        .detail-modal-table th {
            background: var(--bg-app);
            padding: 12px 16px;
            text-align: left;
            font-weight: 600;
            color: var(--text-secondary);
            border-bottom: 2px solid var(--border-color);
            white-space: nowrap;
        }

        .detail-modal-table td {
            padding: 12px 16px;
            border-bottom: 1px solid var(--border-color);
            color: var(--text-primary);
            max-width: 200px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .detail-modal-table tbody tr:hover {
            background: var(--bg-app);
        }

        .sortable-th {
            cursor: pointer;
            user-select: none;
            transition: background 0.2s ease;
        }

        .sortable-th:hover {
            background: var(--bg-hover);
        }

        .detail-modal-pagination {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 16px;
            padding: 16px 20px;
            border-top: 1px solid var(--border-color);
            flex-shrink: 0;
        }

        .menu-btn-wrapper {
            cursor: pointer;
        }

        .menu-btn-card {
            width: 100%;
            padding: 14px 16px;
            display: flex;
            flex-direction: column;
            gap: 4px;
            border: none;
            border-radius: 12px;
            cursor: pointer;
            font-family: inherit;
            text-align: left;
        }

        .menu-btn-new {
            background: var(--menu-btn-new-bg);
            color: var(--menu-btn-new-text);
        }

        .menu-btn-review {
            background: var(--menu-btn-review-bg);
            color: var(--menu-btn-review-text);
        }

        .menu-btn-wrong {
            background: var(--menu-btn-wrong-bg);
            color: var(--menu-btn-wrong-text);
        }

        .menu-btn-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 15px;
        }

        .menu-btn-left {
            font-weight: 600;
        }

        .menu-btn-right {
            font-size: 11px;
            font-weight: 500;
        }

        .menu-btn-row-sub {
            font-size: 11px;
            opacity: 0.7;
        }

        .menu-btn-wrapper:hover .menu-btn-main {
            opacity: 0.9;
        }

        .hint-btn:disabled,
        .hint-btn.hint-used {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .hint-btn.hint-used {
            background: var(--bg-app);
            color: var(--text-muted);
        }

        .btn-skip {
            background: #ef4444;
            color: white;
            border: none;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 500;
            cursor: pointer;
            font-family: inherit;
        }

        .btn-skip:hover {
            background: #dc2626;
        }

        .btn-delete-code {
            background: none;
            border: none;
            cursor: pointer;
            font-size: 14px;
            padding: 4px;
            opacity: 0.6;
        }

        .btn-delete-code:hover {
            opacity: 1;
        }

        .modal-confirm {
            max-width: 400px;
        }

        .btn-disabled {
            background: var(--border-color);
            color: var(--text-muted);
            cursor: not-allowed;
            opacity: 0.6;
        }

        .letter-slot.hint-show {
            background: rgba(59, 130, 246, 0.1);
            border-radius: 4px;
        }

        .letter-slot.hint-show .hint-letter {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            color: rgba(59, 130, 246, 0.4);
            font-size: 28px;
            font-weight: 500;
        }

        .letter-slot.hint-correct {
            background: rgba(16, 185, 129, 0.15);
            border-radius: 4px;
        }

        .letter-slot.hint-wrong {
            background: rgba(239, 68, 68, 0.15);
            border-radius: 4px;
        }

        .letter-slot.skip-answer {
            color: #ef4444;
            background: rgba(239, 68, 68, 0.1);
            border-radius: 4px;
        }

        /* Virtual Keyboard */
        .virtual-keyboard {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background: var(--bg-app);
            border-top: 1px solid var(--border);
            padding: 8px 6px 30px;
            z-index: 1001;
            transform: translateY(100%);
            transition: transform 0.3s ease;
            box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
        }
        .virtual-keyboard.show {
            transform: translateY(0);
        }

        .vk-row {
            display: flex;
            justify-content: center;
            gap: 5px;
            margin-bottom: 8px;
            padding: 0 4px;
        }

        .vk-key {
            height: 46px;
            border-radius: 6px;
            border: 1px solid var(--border);
            background: var(--bg-primary);
            color: var(--text-primary);
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            user-select: none;
            transition: background 0.1s, transform 0.1s;
            flex: 1;
            min-width: 0;
        }
        .vk-key:active {
            transform: scale(0.96);
        }
        .vk-key:active:not(.delete):not(.clear):not(.confirm):not(.collapse) {
            background: var(--bg-secondary);
        }

        .vk-key.space {
            flex: 5;
        }
        .vk-key.action {
            flex: 1.3;
            font-size: 13px;
        }
        .vk-key.delete {
            background: #f59e0b !important;
            color: white !important;
            border-color: #f59e0b !important;
        }
        .vk-key.delete:active {
            background: #d97706 !important;
        }
        .vk-key.clear {
            background: #ef4444 !important;
            color: white !important;
            border-color: #ef4444 !important;
        }
        .vk-key.clear:active {
            background: #dc2626 !important;
        }
        .vk-key.confirm {
            background: var(--accent) !important;
            color: white !important;
            border-color: var(--accent) !important;
        }
        .vk-key.confirm:active {
            opacity: 0.9;
        }
        .vk-key.collapse {
            background: #6b7280 !important;
            color: white !important;
            border-color: #6b7280 !important;
        }
        .vk-key.collapse:active {
            background: #4b5563 !important;
        }

        /* Dark theme adjustments */
        [data-theme="dark"] .virtual-keyboard {
            background: #1e1e2e;
            border-top-color: #333;
        }
        [data-theme="dark"] .vk-key {
            background: #2a2a3e;
            border-color: #3a3a4e;
            color: #e0e0e0;
        }
        [data-theme="dark"] .vk-key:active {
            background: #3a3a4e;
        }

        /* Mobile hidden input - keep for potential future use */
        .mobile-hidden-input {
            position: fixed;
            top: -100px;
            left: -100px;
            width: 1px;
            height: 1px;
            opacity: 0;
            pointer-events: none;
        }
