/* Anti-copy protection */
        body {
            -webkit-user-select: none !important;
            -moz-user-select: none !important;
            -ms-user-select: none !important;
            user-select: none !important;
        }
        input, textarea, [contenteditable="true"] {
            -webkit-user-select: text !important;
            -moz-user-select: text !important;
            -ms-user-select: text !important;
            user-select: text !important;
        }
        /* === PERFORMANCE OPTIMIZATIONS === */
        * { box-sizing: border-box; }
        .option-button, .next-btn, .mode-btn, .question-card {
            will-change: transform;
            -webkit-font-smoothing: antialiased;
        }
        .question-card {
            contain: layout style;
            transform: translateZ(0);
        }
        img { will-change: auto; }
        /* Reduce motion for users who prefer it */
        @media (prefers-reduced-motion: reduce) {
            *, *::before, *::after {
                animation-duration: 0.01ms !important;
                animation-iteration-count: 1 !important;
                transition-duration: 0.01ms !important;
            }
        }

        :root {
            /* Surfaces */
            --bg-main: #f0f4f8;
            --bg-color: var(--bg-main);        /* Legacy alias */
            --card-bg: #ffffff;
            --card-bg-solid: #ffffff;
            --card-border: rgba(13, 118, 177, 0.12);
            --input-bg: #ffffff;
            --btn-shadow: #cbd5e1;

            /* Typography */
            --text-main: #1b2d4a;
            --text-primary: var(--text-main);  /* Portal/OSCE alias */
            --text-muted: #576b8c;
            --text-secondary: var(--text-muted); /* Portal alias */
            --text-dim: #64748b;

            /* Accent & Feedback */
            --accent-teal: #0d76b1;
            --accent-blue: var(--accent-teal); /* Legacy alias */
            --accent-cyan: var(--accent-teal); /* Legacy alias */
            --primary: var(--accent-teal);
            --accent-emerald: #10b981;
            --accent-purple: #1e40af;          /* Adjusted for >=4.8:1 on white */
            --accent-gold: #b45309;            /* Adjusted for >=4.8:1 on white */
            --accent-red: #dc2626;
            --success: #10b981;
            --success-green: var(--success);
            --success-text: #047857;
            --error: #ef4444;
            --error-red: var(--error);
            --error-text: #b91c1c;
            --glow-teal: rgba(13, 118, 177, 0.15);
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            font-family: 'Inter', sans-serif;
            background-color: var(--bg-color);
            color: var(--text-main);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            overflow-x: hidden;
            background-image: 
                radial-gradient(circle at 0% 0%, rgba(79, 172, 254, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 100% 100%, rgba(0, 242, 254, 0.05) 0%, transparent 50%);
            background-attachment: fixed;
        }

        header {
            padding: 20px 40px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid var(--card-border);
            background: rgba(13, 14, 18, 0.8);
            position: sticky;
            top: 0;
            z-index: 100;
        }

        .header-logo {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .logo-badge {
            width: 48px;
            height: 48px;
            border-radius: 12px;
            border: 1px solid rgba(0, 242, 254, 0.22);
            background: rgba(15, 23, 42, 0.45);
            box-shadow: 0 4px 12px rgba(0, 242, 254, 0.1);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .logo-text h1 {
            font-family: 'Outfit', sans-serif;
            font-size: 1.3rem;
            font-weight: 700;
            letter-spacing: -0.5px;
        }

        .logo-text span {
            font-size: 0.7rem;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 1.5px;
            display: block;
        }

        .score-board {
            display: flex;
            gap: 20px;
            font-size: 0.9rem;
            background: rgba(255, 255, 255, 0.03);
            padding: 8px 16px;
            border-radius: 10px;
            border: 1px solid var(--card-border);
        }

        .score-item span {
            font-weight: 600;
        }

        .score-green { color: var(--success); }
        .score-red { color: var(--error); }

        main {
            flex: 1;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 40px 20px;
        }

        .container {
            max-width: 800px;
            width: 100%;
        }

        /* Start Screen styling */
        .start-screen {
            background: var(--card-bg);
            border: 1px solid var(--card-border);
            border-radius: 24px;
            padding: 50px 40px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
            text-align: center;
        }

        .start-logo {
            width: 72px;
            height: 72px;
            border-radius: 16px;
            border: 1px solid rgba(0, 242, 254, 0.22);
            background: rgba(15, 23, 42, 0.45);
            box-shadow: 0 8px 20px rgba(0, 242, 254, 0.12);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 20px;
        }

        .start-title {
            font-family: 'Outfit', sans-serif;
            font-size: 2.2rem;
            font-weight: 800;
            margin-bottom: 10px;
            background: linear-gradient(135deg, #fff 0%, var(--accent-teal) 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .db-info {
            font-size: 0.95rem;
            color: var(--text-muted);
            margin-bottom: 40px;
            background: rgba(255, 255, 255, 0.02);
            border: 1px solid var(--card-border);
            padding: 12px 24px;
            border-radius: 30px;
            display: inline-block;
        }

        .db-info strong {
            color: var(--accent-teal);
        }

        .mode-list {
            display: grid;
            grid-template-columns: 1fr;
            gap: 16px;
            max-width: 500px;
            margin: 0 auto;
        }

        .mode-btn {
            background: rgba(255, 255, 255, 0.02);
            border: 1px solid var(--card-border);
            padding: 20px 30px;
            border-radius: 16px;
            color: var(--text-main);
            text-align: left;
            cursor: pointer;
            transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
        }

        .mode-btn:hover {
            background: rgba(255, 255, 255, 0.05);
            border-color: var(--accent-teal);
            transform: translateY(-2px);
        }

        .mode-info h3 {
            font-family: 'Outfit', sans-serif;
            font-size: 1.1rem;
            font-weight: 700;
            margin-bottom: 4px;
            color: var(--text-main);
        }

        .mode-info p {
            font-size: 0.8rem;
            color: var(--text-muted);
        }

        .mode-badge-num {
            background: rgba(0, 242, 254, 0.1);
            color: var(--accent-teal);
            padding: 4px 12px;
            border-radius: 20px;
            font-family: 'Outfit', sans-serif;
            font-weight: 700;
            font-size: 0.9rem;
        }

        /* Dashboard & Stats Styling */
        .stats-dashboard {
            background: rgba(255, 255, 255, 0.01);
            border: 1px solid var(--card-border);
            border-radius: 20px;
            padding: 24px;
            margin-top: 30px;
            text-align: left;
        }

        .stats-title {
            font-family: 'Outfit', sans-serif;
            font-size: 1.1rem;
            font-weight: 700;
            margin-bottom: 16px;
            color: var(--text-main);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .stats-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 12px;
        }

        @media (min-width: 600px) {
            .stats-grid {
                grid-template-columns: 1fr 1fr;
            }
        }

        .stat-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            background: rgba(255, 255, 255, 0.01);
            border: 1px solid var(--card-border);
            border-radius: 14px;
            padding: 14px 18px;
            transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
        }

        .stat-item:only-child {
            grid-column: 1 / -1;
        }

        .stat-item:hover {
            transform: translateY(-2px);
            
            border-color: rgba(255, 255, 255, 0.1);
        }

        body.theme-nordic .stat-item:hover {
            border-color: var(--accent-teal) !important;
            
        }

        .stat-info {
            display: flex;
            flex-direction: column;
            gap: 4px;
            text-align: left;
        }

        .stat-name {
            font-size: 0.9rem;
            font-weight: 600;
            color: var(--text-main);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 170px;
        }

        .stat-meta {
            font-size: 0.75rem;
            color: var(--text-muted);
        }

        /* Radial progress circle styles */
        .radial-progress {
            position: relative;
            width: 48px;
            height: 48px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .radial-progress svg {
            width: 48px;
            height: 48px;
            transform: rotate(-90deg);
        }

        .radial-progress circle {
            fill: none;
            stroke-width: 4.5px;
        }

        .radial-progress .circle-bg {
            stroke: rgba(255, 255, 255, 0.04);
        }

        body.theme-nordic .radial-progress .circle-bg,
        body.theme-samgmu-white .radial-progress .circle-bg,
        body.theme-medictest-white .radial-progress .circle-bg {
            stroke: rgba(0, 0, 0, 0.08) !important;
        }

        .radial-progress .circle-fill {
            stroke: url(#statGradient);
            stroke-linecap: round;
            transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .radial-progress .percentage {
            position: absolute;
            font-size: 0.75rem;
            font-weight: 700;
            color: var(--text-main);
            font-family: 'Outfit', sans-serif;
        }
        /* Error Mode Button styling */
        .error-mode-container {
            margin-top: 20px;
        }

        .error-btn {
            background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.2) 100%);
            border: 1px solid rgba(239, 68, 68, 0.3);
            padding: 18px 30px;
            border-radius: 16px;
            color: #ef4444;
            text-align: left;
            cursor: pointer;
            transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
            font-weight: 600;
            box-shadow: 0 4px 15px rgba(239, 68, 68, 0.1);
        }

        .error-btn:hover:not(.disabled) {
            background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.3) 100%);
            border-color: #ef4444;
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(239, 68, 68, 0.2);
        }

        .error-btn.disabled {
            opacity: 0.4;
            cursor: not-allowed;
            border-color: var(--card-border);
            color: var(--text-muted);
            background: rgba(255,255,255,0.01);
            box-shadow: none;
        }

        .error-badge {
            background: rgba(239, 68, 68, 0.2);
            color: #ef4444;
            padding: 4px 12px;
            border-radius: 20px;
            font-family: 'Outfit', sans-serif;
            font-weight: 700;
            font-size: 0.9rem;
        }

        .error-btn.disabled .error-badge {
            background: rgba(255,255,255,0.05);
            color: var(--text-muted);
        }

        /* Bookmarks Button styling */
        .bookmark-btn {
            background: linear-gradient(135deg, rgba(255, 183, 0, 0.05) 0%, rgba(255, 183, 0, 0.12) 100%);
            border: 1px solid rgba(255, 183, 0, 0.25);
            padding: 16px 28px;
            border-radius: 16px;
            color: var(--accent-gold);
            text-align: left;
            cursor: pointer;
            transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
            font-weight: 600;
            box-shadow: 0 4px 15px rgba(255, 183, 0, 0.05);
            margin-top: 15px;
        }

        .bookmark-btn:hover:not(.disabled) {
            background: linear-gradient(135deg, rgba(255, 183, 0, 0.15) 0%, rgba(255, 183, 0, 0.22) 100%);
            border-color: var(--accent-gold);
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(255, 183, 0, 0.15);
        }

        .bookmark-btn.disabled {
            opacity: 0.4;
            cursor: not-allowed;
            border-color: var(--card-border);
            color: var(--text-muted);
            background: rgba(255,255,255,0.01);
            box-shadow: none;
        }

        .bookmark-badge {
            background: rgba(255, 183, 0, 0.15);
            color: var(--accent-gold);
            padding: 4px 12px;
            border-radius: 20px;
            font-family: 'Outfit', sans-serif;
            font-weight: 700;
            font-size: 0.9rem;
        }

        .bookmark-btn.disabled .bookmark-badge {
            background: rgba(255,255,255,0.05);
            color: var(--text-muted);
        }

        /* Database Search CSS styling */
        .db-search-results {
            scrollbar-width: thin;
            scrollbar-color: var(--card-border) transparent;
        }
        .db-search-results::-webkit-scrollbar {
            width: 6px;
        }
        .db-search-results::-webkit-scrollbar-thumb {
            background-color: var(--card-border);
            border-radius: 4px;
        }
        .search-result-card {
            background: rgba(255, 255, 255, 0.02);
            border: 1px solid var(--card-border);
            border-radius: 10px;
            padding: 12px 16px;
            cursor: pointer;
            transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
            margin-bottom: 8px;
            text-align: left;
        }
        .search-result-card:hover {
            background: rgba(255, 255, 255, 0.04);
            border-color: rgba(255, 255, 255, 0.2);
            transform: translateY(-1px);
        }
        .search-result-question {
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--text-main);
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            gap: 10px;
        }
        .search-result-question-text {
            flex: 1;
        }
        .search-result-num {
            font-size: 0.75rem;
            color: var(--text-muted);
            background: rgba(255,255,255,0.05);
            padding: 2px 6px;
            border-radius: 4px;
            white-space: nowrap;
        }
        .search-result-details {
            margin-top: 10px;
            padding-top: 10px;
            border-top: 1px solid rgba(255, 255, 255, 0.08);
            display: none;
            flex-direction: column;
            gap: 6px;
        }
        .search-result-card.expanded .search-result-details {
            display: flex;
        }
        .search-result-option {
            font-size: 0.8rem;
            padding: 6px 10px;
            border-radius: 6px;
            background: rgba(255, 255, 255, 0.01);
            border: 1px solid transparent;
            color: var(--text-muted);
        }
        .search-result-option.correct {
            background: rgba(16, 185, 129, 0.1);
            border: 1px solid rgba(16, 185, 129, 0.3);
            color: var(--success);
            font-weight: 500;
        }
        .search-ai-btn {
            background: rgba(0, 242, 254, 0.1);
            border: 1px solid rgba(0, 242, 254, 0.2);
            color: var(--accent-teal);
            padding: 6px 12px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.75rem;
            margin-top: 8px;
            align-self: flex-start;
            transition: all 0.2s;
        }
        .search-ai-btn:hover:not(:disabled) {
            background: rgba(0, 242, 254, 0.2);
            border-color: var(--accent-teal);
        }
        .search-ai-response {
            margin-top: 8px;
            padding: 10px;
            background: rgba(0, 242, 254, 0.03);
            border-left: 2px solid var(--accent-teal);
            border-radius: 4px;
            font-size: 0.8rem;
            line-height: 1.4;
            color: #fff;
            display: none;
        }

        /* History styling */
        .history-list {
            margin-top: 15px;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .history-item {
            background: rgba(255, 255, 255, 0.01);
            border: 1px solid rgba(255, 255, 255, 0.02);
            border-radius: 10px;
            padding: 10px 16px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.8rem;
        }

        .history-topic {
            font-weight: 500;
            color: var(--text-main);
            max-width: 50%;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .history-score {
            font-weight: 700;
        }

        .history-date {
            color: var(--text-muted);
            font-size: 0.75rem;
        }

        /* Test Card — Apple Frosted Glass */
        .test-card {
            background: var(--card-bg);
            backdrop-filter: blur(24px) saturate(180%);
            -webkit-backdrop-filter: blur(24px) saturate(180%);
            border: 1px solid var(--card-border);
            border-radius: 28px;
            padding: 38px 40px;
            box-shadow: 
                0 24px 48px -12px rgba(0, 0, 0, 0.45),
                0 1px 2px 0 rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
            position: relative;
            display: none; /* Show only during active test */
            transition: border-color 0.25s ease, box-shadow 0.25s ease;
        }

        .progress-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 22px;
            font-size: 0.85rem;
            color: var(--text-muted);
        }

        .topic-badge {
            background: rgba(79, 172, 254, 0.08);
            border: 1px solid rgba(79, 172, 254, 0.18);
            padding: 5px 14px;
            border-radius: 9999px;
            color: var(--accent-purple);
            font-size: 0.8rem;
            font-weight: 600;
            letter-spacing: 0.02em;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 350px;
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
        }

        .progress-indicator {
            font-family: 'Outfit', sans-serif;
            font-weight: 600;
            letter-spacing: 0.02em;
        }

        .progress-bar-container {
            width: 100%;
            height: 5px;
            background: rgba(255, 255, 255, 0.06);
            border-radius: 9999px;
            overflow: hidden;
            margin-bottom: 28px;
        }

        .progress-bar {
            height: 100%;
            width: 0%;
            background: linear-gradient(90deg, var(--accent-purple), var(--accent-teal));
            border-radius: 9999px;
            box-shadow: 0 0 10px rgba(0, 242, 254, 0.35);
            transition: width 0.35s cubic-bezier(0.34, 1.3, 0.64, 1);
        }

        .question-text {
            font-size: 1.25rem;
            line-height: 1.55;
            font-weight: 600;
            letter-spacing: -0.01em;
            margin-bottom: 28px;
            color: var(--text-main);
        }

        .options-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 12px;
            margin-bottom: 28px;
        }

        .option-button {
            background: rgba(255, 255, 255, 0.03);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border: 1px solid var(--card-border);
            border-top: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 18px;
            padding: 16px 20px;
            text-align: left;
            color: var(--text-main);
            font-size: 0.95rem;
            line-height: 1.45;
            font-family: inherit;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 16px;
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 0 var(--btn-shadow, rgba(0, 0, 0, 0.4));
            transition: 
                transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
                background-color 0.2s ease,
                border-color 0.2s ease,
                box-shadow 0.15s ease,
                color 0.2s ease;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
            position: relative;
        }

        .option-letter {
            width: 34px;
            height: 34px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid var(--card-border);
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: 'Outfit', sans-serif;
            font-weight: 700;
            font-size: 0.9rem;
            color: var(--text-muted);
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
            transition: 
                transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                background-color 0.2s ease,
                border-color 0.2s ease,
                color 0.2s ease;
            flex-shrink: 0;
        }

        .option-button:hover:not(.disabled):not(.correct):not(.incorrect):not(.selected) {
            background: rgba(255, 255, 255, 0.06);
            border-color: rgba(79, 172, 254, 0.35);
            transform: translateY(-1.5px);
            box-shadow: 
                inset 0 1px 0 rgba(255, 255, 255, 0.25),
                0 5px 0 var(--btn-shadow, rgba(0, 0, 0, 0.4));
        }

        .option-button:hover:not(.disabled) .option-letter {
            background: rgba(79, 172, 254, 0.12);
            color: var(--accent-teal);
            border-color: rgba(0, 242, 254, 0.4);
            transform: scale(1.05);
        }

        /* Tactile Duolingo 3D Spring Compression */
        .option-button:active:not(.disabled) {
            transform: translateY(3px);
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 0 var(--btn-shadow, rgba(0, 0, 0, 0.4));
            transition-duration: 0.06s;
        }

        .option-button.correct {
            background: #10b981 !important;
            border-color: #059669 !important;
            border-top: 1px solid rgba(255, 255, 255, 0.35) !important;
            color: #ffffff !important;
            box-shadow: 
                inset 0 1px 0 rgba(255, 255, 255, 0.35),
                0 4px 0 #059669 !important;
        }

        .option-button.correct:active:not(.disabled) {
            transform: translateY(3px) !important;
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 0 #059669 !important;
        }

        .option-button.correct .option-letter {
            background: rgba(255, 255, 255, 0.25) !important;
            color: #ffffff !important;
            border-color: rgba(255, 255, 255, 0.4) !important;
            transform: scale(1.06);
        }

        .option-button.incorrect {
            background: #ef4444 !important;
            border-color: #dc2626 !important;
            border-top: 1px solid rgba(255, 255, 255, 0.25) !important;
            color: #ffffff !important;
            box-shadow: 
                inset 0 1px 0 rgba(255, 255, 255, 0.25),
                0 4px 0 #991b1b !important;
            animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
        }

        .option-button.incorrect:active:not(.disabled) {
            transform: translateY(3px) !important;
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 #991b1b !important;
        }

        .option-button.incorrect .option-letter {
            background: rgba(255, 255, 255, 0.25) !important;
            color: #ffffff !important;
            border-color: rgba(255, 255, 255, 0.4) !important;
        }

        @keyframes shake {
            0%, 100% { transform: translateX(0); }
            20%, 60% { transform: translateX(-6px); }
            40%, 80% { transform: translateX(6px); }
        }

        .option-button.disabled {
            pointer-events: none;
            opacity: 0.55;
        }

        .option-button.disabled.correct,
        .option-button.disabled.incorrect {
            opacity: 1 !important;
        }

        /* --- Exam Mode Styles --- */
        .option-button.selected {
            background: rgba(0, 242, 254, 0.12) !important;
            border-color: var(--accent-teal) !important;
            box-shadow: 
                0 0 16px var(--glow-teal),
                inset 0 1px 0 rgba(0, 242, 254, 0.3) !important;
        }

        .option-button.selected .option-letter {
            background: var(--accent-teal) !important;
            color: #0d0e12 !important;
            border-color: var(--accent-teal) !important;
        }

        /* Toggle Switch */
        .switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }
        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #2e303f;
            transition: .4s;
            border-radius: 26px;
        }
        .slider:before {
            position: absolute;
            content: "";
            height: 18px;
            width: 18px;
            left: 4px;
            bottom: 4px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
            box-shadow: 0 2px 4px rgba(0,0,0,0.2);
        }
        .switch input:checked + .slider {
            background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
        }
        .switch input:checked + .slider:before {
            transform: translateX(20px);
        }

        /* Timer pulse animations */
        @keyframes pulse-teal {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.75; }
            70% { box-shadow: 0 0 0 6px rgba(0, 242, 254, 0); }
            100% { box-shadow: 0 0 0 0 rgba(0, 242, 254, 0); }
        }
        @keyframes pulse-red {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.6; }
            70% { box-shadow: 0 0 0 8px rgba(255, 77, 77, 0); }
            100% { box-shadow: 0 0 0 0 rgba(255, 77, 77, 0); }
        }

        /* --- Trend Chart Styles --- */
        #historyChartContainer {
            transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
        }
        .chart-grid-line {
            stroke: rgba(255, 255, 255, 0.05);
            stroke-width: 1;
        }
        body.theme-nordic .chart-grid-line,
        body.theme-samgmu-white .chart-grid-line,
        body.theme-medictest-white .chart-grid-line {
            stroke: rgba(0, 0, 0, 0.08) !important;
        }

        /* --- Toast styles --- */
        #medictestToast {
            pointer-events: none;
            box-shadow: 0 10px 30px rgba(0,0,0,0.5);
        }
        body.theme-nordic #medictestToast {
            box-shadow: 0 8px 24px rgba(0,0,0,0.15);
            color: #1f2937 !important;
        }

        /* Explanation Box — Apple Dynamic Island / System Card Style */
        .explanation-box {
            background: rgba(255, 255, 255, 0.03);
            backdrop-filter: blur(20px) saturate(160%);
            -webkit-backdrop-filter: blur(20px) saturate(160%);
            border: 1px solid var(--card-border);
            border-radius: 20px;
            padding: 22px 24px;
            margin-bottom: 28px;
            font-size: 0.95rem;
            line-height: 1.55;
            display: none;
            box-shadow: 
                0 12px 28px -4px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.08);
            animation: appleSpringDown 0.4s cubic-bezier(0.34, 1.3, 0.64, 1);
            position: relative;
            overflow: hidden;
        }

        .explanation-box.success {
            background: rgba(16, 185, 129, 0.06);
            border: 1px solid rgba(16, 185, 129, 0.28);
            box-shadow: 
                0 12px 28px -4px rgba(16, 185, 129, 0.15),
                inset 0 1px 0 rgba(16, 185, 129, 0.25);
        }

        .explanation-box.error {
            background: rgba(239, 68, 68, 0.06);
            border: 1px solid rgba(239, 68, 68, 0.28);
            box-shadow: 
                0 12px 28px -4px rgba(239, 68, 68, 0.15),
                inset 0 1px 0 rgba(239, 68, 68, 0.25);
        }

        .explanation-title {
            font-weight: 700;
            font-size: 1rem;
            letter-spacing: -0.01em;
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .explanation-box.success .explanation-title { color: var(--success); }
        .explanation-box.error .explanation-title { color: var(--error); }

        @keyframes appleSpringDown {
            from {
                opacity: 0;
                transform: translateY(-12px) scale(0.98);
            }
            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        /* Bottom Controls */
        .controls-row {
            display: flex;
            justify-content: flex-end;
        }

        .next-btn {
            background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-teal) 100%);
            color: #0d0e12;
            border: none;
            border-radius: 9999px;
            padding: 14px 34px;
            font-family: 'Outfit', sans-serif;
            font-weight: 700;
            font-size: 0.95rem;
            letter-spacing: 0.01em;
            cursor: pointer;
            box-shadow: 
                0 4px 16px rgba(0, 242, 254, 0.25),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
            display: none;
            transition: 
                transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease,
                background-color 0.15s ease;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
        }

        .next-btn:hover {
            transform: translateY(-1.5px);
            box-shadow: 
                0 6px 22px rgba(0, 242, 254, 0.35),
                inset 0 1px 0 rgba(255, 255, 255, 0.5);
        }

        .next-btn:active {
            transform: scale(0.97);
            transition-duration: 0.08s;
        }

        /* End Screen Overlay */
        .end-screen {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: var(--bg-color);
            border-radius: 24px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 40px;
            text-align: center;
            z-index: 50;
            display: none;
        }

        .end-title {
            font-family: 'Outfit', sans-serif;
            font-size: 2.2rem;
            font-weight: 800;
            margin-bottom: 15px;
            background: linear-gradient(135deg, #fff 0%, var(--accent-teal) 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        body.theme-nordic .end-title,
        body.theme-samgmu-white .end-title,
        body.theme-medictest-white .end-title {
            background: none !important;
            -webkit-background-clip: unset !important;
            -webkit-text-fill-color: initial !important;
            color: #1e293b !important;
        }

        .score-circle {
            width: 140px;
            height: 140px;
            border-radius: 50%;
            border: 4px solid var(--card-border);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            margin: 20px 0 30px 0;
        }

        .score-percent {
            font-family: 'Outfit', sans-serif;
            font-size: 2.2rem;
            font-weight: 800;
            color: var(--text-main);
        }

        .score-text {
            font-size: 0.75rem;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .result-status {
            font-size: 1.2rem;
            font-weight: 600;
            margin-bottom: 25px;
        }

        .result-status.passed { color: var(--success); }
        .result-status.failed { color: var(--error); }

        .review-list {
            width: 100%;
            max-height: 250px;
            overflow-y: auto;
            margin-bottom: 30px;
            text-align: left;
            padding-right: 8px;
        }

        .review-item {
            background: rgba(255, 255, 255, 0.02);
            border: 1px solid var(--card-border);
            border-radius: 12px;
            padding: 16px;
            margin-bottom: 12px;
            font-size: 0.9rem;
        }

        .review-question {
            font-weight: 600;
            margin-bottom: 6px;
        }

        .restart-btn {
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid var(--card-border);
            color: var(--text-main);
            padding: 16px 36px;
            border-radius: 30px;
            font-family: 'Outfit', sans-serif;
            font-weight: 700;
            cursor: pointer;
            transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
        }

        .restart-btn:hover {
            background: rgba(255, 255, 255, 0.08);
            border-color: var(--accent-teal);
        }

        body.theme-nordic .restart-btn,
        body.theme-samgmu-white .restart-btn,
        body.theme-medictest-white .restart-btn {
            background: #ffffff !important;
            border: 1.5px solid #cbd5e1 !important;
            color: #0f172a !important;
            box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08), 0 4px 0 #cbd5e1 !important;
        }

        /* Custom Scrollbar */
        ::-webkit-scrollbar {
            width: 6px;
        }
        ::-webkit-scrollbar-track {
            background: rgba(255, 255, 255, 0.01);
            border-radius: 3px;
        }
        ::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.08);
            border-radius: 3px;
        }

        /* AI Settings and Loader Styles */
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        .ai-loader {
            animation: spin 1s linear infinite;
        }
        .settings-btn {
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid var(--card-border);
            border-radius: 8px;
            color: var(--text-main);
            width: 36px;
            height: 36px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
        }
        .settings-btn:hover {
            background: rgba(255, 255, 255, 0.08);
            border-color: var(--accent-teal);
            color: var(--accent-teal);
        }
    
        /* ========================================== */
        /* MOBILE RESPONSIVE ADAPTATION (breakpoint: 600px) */
        /* ========================================== */
        @media (max-width: 600px) {
            header {
                padding: 12px 16px !important;
            }
            .logo-text span {
                display: none !important; /* Hide subtitle on mobile to save space */
            }
            .logo-text h1 {
                font-size: 1.1rem !important;
            }
            .score-board {
                gap: 10px !important;
                padding: 6px 10px !important;
                font-size: 0.8rem !important;
            }
            main {
                padding: 16px 8px !important;
                align-items: flex-start !important; /* Fix centering overflow bug on mobile */
            }
            .start-screen {
                padding: 24px 16px !important;
                border-radius: 16px !important;
            }
            .start-title {
                font-size: 1.6rem !important;
            }
            .db-info {
                font-size: 0.85rem !important;
                padding: 8px 16px !important;
                margin-bottom: 20px !important;
            }
            .mode-list {
                gap: 10px !important;
            }
            .mode-btn {
                padding: 14px 16px !important;
                border-radius: 12px !important;
            }
            .mode-info h3 {
                font-size: 0.95rem !important;
            }
            .mode-info p {
                font-size: 0.75rem !important;
            }
            .mode-badge-num {
                padding: 2px 8px !important;
                font-size: 0.8rem !important;
            }
            .error-btn, .bookmark-btn {
                padding: 14px 16px !important;
                border-radius: 12px !important;
            }
            .error-btn div span:first-child, .bookmark-btn div span:first-child {
                font-size: 0.95rem !important;
            }
            .error-btn div span:last-child, .bookmark-btn div span:last-child {
                font-size: 0.7rem !important;
            }
            .stats-dashboard {
                padding: 16px !important;
                margin-top: 20px !important;
            }
            .stats-title {
                font-size: 0.95rem !important;
                margin-bottom: 12px !important;
            }
            .stat-item {
                padding: 10px !important;
            }
            .stat-name {
                font-size: 0.75rem !important;
            }
            .stat-val {
                font-size: 0.75rem !important;
            }
            
            /* Test Card adjustments */
            .test-card {
                padding: 20px 16px !important;
                border-radius: 16px !important;
            }
            .progress-header {
                margin-bottom: 16px !important;
            }
            .topic-badge {
                font-size: 0.75rem !important;
                padding: 2px 8px !important;
                max-width: 50% !important;
            }
            .progress-indicator {
                font-size: 0.75rem !important;
            }
            .progress-bar-container {
                margin-bottom: 20px !important;
            }
            .question-text {
                font-size: 1.05rem !important;
                line-height: 1.4 !important;
                margin-bottom: 20px !important;
            }
            .options-grid {
                gap: 10px !important;
                margin-bottom: 20px !important;
            }
            .option-button {
                padding: 12px 14px !important;
                border-radius: 12px !important;
                font-size: 0.85rem !important;
                gap: 12px !important;
            }
            .option-letter {
                width: 26px !important;
                height: 26px !important;
                font-size: 0.8rem !important;
            }
            .explanation-box {
                padding: 14px !important;
                font-size: 0.85rem !important;
                margin-bottom: 20px !important;
            }
            .explanation-actions {
                flex-wrap: wrap !important;
                gap: 8px !important;
            }
            #aiExplainBtn, #webSearchBtn {
                padding: 8px 12px !important;
                font-size: 0.75rem !important;
                width: 100% !important; /* Stack explanation buttons on mobile */
                justify-content: center !important;
            }
            .next-btn:not(#finishEarlyBtn):not(#prevBtn) {
                width: 100% !important; /* Next button full-width on mobile */
                text-align: center !important;
                padding: 14px 24px !important;
                border-radius: 20px !important;
            }
            #finishEarlyBtn, #prevBtn {
                width: auto !important;
                white-space: nowrap !important;
                border-radius: 20px !important;
            }
            
            /* End Screen adjustments */
            .end-screen {
                padding: 24px 16px !important;
                border-radius: 16px !important;
            }
            .end-title {
                font-size: 1.6rem !important;
            }
            .score-circle {
                width: 110px !important;
                height: 110px !important;
                margin: 15px 0 20px 0 !important;
            }
            .score-percent {
                font-size: 1.8rem !important;
            }
            .result-status {
                font-size: 1.05rem !important;
                margin-bottom: 20px !important;
            }
            .review-list {
                max-height: 200px !important;
                margin-bottom: 20px !important;
            }
            .restart-btn {
                width: 100% !important;
                padding: 14px 24px !important;
                font-size: 0.95rem !important;
            }
            
            /* Modal / Settings screen */
            .modal-content {
                padding: 20px !important;
                width: 95% !important;
                max-height: 90vh !important;
                overflow-y: auto !important;
            }
            .modal-content h3 {
                font-size: 1.15rem !important;
                margin-bottom: 12px !important;
            }
            .modal-content p {
                font-size: 0.8rem !important;
                margin-bottom: 15px !important;
            }
        }

        /* --- Login Overlay --- */
        #login-overlay {
            position: fixed;
            top: 0; left: 0;
            width: 100vw; height: 100vh;
            background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
            z-index: 999999;
            display: flex;
            justify-content: center;
            align-items: center;
            font-family: 'Inter', sans-serif;
            color: var(--text-main);
        }
        .login-card {
            background: rgba(30, 41, 59, 0.7);
            border: 1px solid rgba(255, 255, 255, 0.08);
            border-radius: 16px;
            padding: 32px;
            width: 90%; max-width: 420px;
            box-shadow: 0 10px 25px rgba(0,0,0,0.5);
            text-align: center;
        }
        .login-card h2 {
            font-family: 'Outfit', sans-serif;
            font-size: 1.8rem;
            margin-bottom: 8px;
            background: linear-gradient(to right, var(--accent-teal), var(--accent-purple));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            font-weight: 800;
        }
        .login-card p {
            color: var(--text-muted);
            font-size: 0.9rem;
            margin-bottom: 24px;
            line-height: 1.4;
        }
        .login-input-wrapper {
            margin-bottom: 16px;
            text-align: left;
        }
        .login-input-wrapper label {
            display: block;
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--text-muted);
            margin-bottom: 6px;
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }
        .login-card input {
            width: 100%;
            padding: 12px 16px;
            background: rgba(15, 23, 42, 0.6);
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 8px;
            color: var(--text-main);
            font-size: 1rem;
            transition: all 0.2s;
            outline: none;
            box-sizing: border-box;
        }
        .login-card input:focus {
            border-color: var(--accent-teal);
            box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
        }
        .login-card button {
            width: 100%;
            padding: 12px;
            background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-teal) 100%);
            border: none;
            border-radius: 8px;
            color: white;
            font-weight: 600;
            font-size: 1rem;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 8px;
        }
        .login-card button:hover { opacity: 0.9; transform: translateY(-1px); }
        .login-card button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
        #auth-error {
            color: var(--error);
            font-size: 0.85rem;
            margin-top: 12px;
            min-height: 1.2rem;
        }
        .auth-spinner {
            display: none;
            width: 16px; height: 16px;
            border: 2px solid rgba(255,255,255,0.3);
            border-radius: 50%;
            border-top-color: white;
            animation: authSpin 1s ease-in-out infinite;
        }
                @keyframes authSpin { to { transform: rotate(360deg); } }

        /* --- Themes --- */
        body.theme-deepspace, .theme-deepspace {
            --bg-main: #090D16;
            --bg-color: #090D16;
            --card-bg: rgba(20, 26, 40, 0.6);
            --card-bg-solid: #141a28;
            --card-border: rgba(255, 255, 255, 0.08);
            --text-main: #f8fafc;
            --text-primary: var(--text-main);
            --text-muted: #94a3b8;
            --text-secondary: var(--text-muted);
            --text-dim: #64748b;
            --accent-teal: #38BDF8;
            --accent-blue: var(--accent-teal);
            --accent-cyan: var(--accent-teal);
            --accent-purple: #818CF8;
            --accent-gold: #fbbf24;
            --accent-red: #F87171;
            --success: #34D399;
            --success-green: var(--success);
            --success-text: #34d399;
            --error: #F87171;
            --error-red: var(--error);
            --error-text: #f87171;
            --primary: var(--accent-teal);
            --accent-emerald: #10b981;
            --glow-teal: rgba(56, 189, 248, 0.15);
            --input-bg: rgba(255, 255, 255, 0.03);
            --btn-shadow: rgba(0, 0, 0, 0.4);
        }

        body.theme-mint, .theme-mint {
            --bg-main: #0A1315;
            --bg-color: #0A1315;
            --card-bg: rgba(18, 32, 35, 0.65);
            --card-bg-solid: #122023;
            --card-border: rgba(45, 212, 191, 0.15);
            --text-main: #E6FAF6;
            --text-primary: var(--text-main);
            --text-muted: #8FA4A6;
            --text-secondary: var(--text-muted);
            --text-dim: #5eead4;
            --accent-teal: #2DD4BF;
            --accent-blue: var(--accent-teal);
            --accent-cyan: var(--accent-teal);
            --accent-purple: #0D9488;
            --accent-gold: #fbbf24;
            --accent-red: #FB7185;
            --success: #34D399;
            --success-green: var(--success);
            --success-text: #34d399;
            --error: #FB7185;
            --error-red: var(--error);
            --error-text: #f87171;
            --primary: var(--accent-teal);
            --accent-emerald: #10b981;
            --glow-teal: rgba(45, 212, 191, 0.1);
            --input-bg: rgba(45, 212, 191, 0.03);
            --btn-shadow: rgba(0, 0, 0, 0.4);
            background-image: 
                radial-gradient(circle at 0% 0%, rgba(45, 212, 191, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 100% 100%, rgba(52, 211, 153, 0.05) 0%, transparent 50%) !important;
        }

        body.theme-amoled, .theme-amoled {
            --bg-main: #000000;
            --bg-color: #000000;
            --card-bg: #0C0C0E;
            --card-bg-solid: #0C0C0E;
            --card-border: rgba(255, 255, 255, 0.12);
            --text-main: #FFFFFF;
            --text-primary: var(--text-main);
            --text-muted: #9CA3AF;
            --text-secondary: var(--text-muted);
            --text-dim: #6b7280;
            --accent-teal: #06B6D4;
            --accent-blue: var(--accent-teal);
            --accent-cyan: var(--accent-teal);
            --accent-purple: #A855F7;
            --accent-gold: #fbbf24;
            --accent-red: #F87171;
            --success: #34D399;
            --success-green: var(--success);
            --success-text: #34d399;
            --error: #F87171;
            --error-red: var(--error);
            --error-text: #f87171;
            --primary: var(--accent-teal);
            --accent-emerald: #10b981;
            --glow-teal: rgba(6, 182, 212, 0.08);
            --input-bg: #161821;
            --btn-shadow: rgba(0, 0, 0, 0.4);
            background-image: none !important;
        }

        body.theme-nordic, .theme-nordic {
            --bg-main: #e8ecef;
            --bg-color: #e8ecef;
            --card-bg: rgba(255, 255, 255, 0.72);
            --card-bg-solid: #ffffff;
            --card-border: rgba(13, 118, 177, 0.15);
            --text-main: #1e293b;
            --text-primary: var(--text-main);
            --text-muted: #475569;
            --text-secondary: var(--text-muted);
            --text-dim: #64748b;
            --accent-teal: #0369a1;
            --accent-blue: var(--accent-teal);
            --accent-cyan: var(--accent-teal);
            --accent-purple: #4f46e5;
            --accent-gold: #b45309;
            --accent-red: #dc2626;
            --success: #10b981;
            --success-green: var(--success);
            --success-text: #047857;
            --error: #ef4444;
            --error-red: var(--error);
            --error-text: #b91c1c;
            --primary: var(--accent-teal);
            --accent-emerald: #10b981;
            --glow-teal: rgba(3, 105, 161, 0.08);
            --input-bg: rgba(255, 255, 255, 0.45);
            --btn-shadow: #cbd5e1;
            background-image: 
                radial-gradient(circle at 0% 0%, rgba(79, 70, 229, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 100% 100%, rgba(2, 132, 199, 0.06) 0%, transparent 50%) !important;
        }
        .theme-nordic header {
            background: rgba(255, 255, 255, 0.8) !important;
            backdrop-filter: blur(12px) !important;
            -webkit-backdrop-filter: blur(12px) !important;
            border-bottom: 1px solid rgba(13, 118, 177, 0.15) !important;
        }
        body.theme-nordic .start-screen,
        body.theme-nordic .test-card,
        body.theme-nordic .login-card,
        body.theme-nordic .modal-content {
            background: rgba(255, 255, 255, 0.75) !important;
            backdrop-filter: blur(20px) !important;
            -webkit-backdrop-filter: blur(20px) !important;
            border: 1px solid rgba(13, 118, 177, 0.15) !important;
            box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08) !important;
        }

        body.theme-nordic .start-screen span,
        body.theme-samgmu-white .start-screen span,
        body.theme-medictest-white .start-screen span {
            color: var(--text-main) !important;
        }
        body.theme-nordic .start-screen span[style*="color: var(--text-muted)"],
        body.theme-samgmu-white .start-screen span[style*="color: var(--text-muted)"],
        body.theme-medictest-white .start-screen span[style*="color: var(--text-muted)"] {
            color: var(--text-muted) !important;
        }
        .theme-nordic .score-board {
            background: rgba(0, 0, 0, 0.03) !important;
            border-color: rgba(0, 0, 0, 0.05) !important;
        }
        .theme-nordic .settings-btn {
            background: rgba(0, 0, 0, 0.03) !important;
            border-color: rgba(0, 0, 0, 0.05) !important;
        }
        .theme-nordic .settings-btn:hover {
            background: rgba(0, 0, 0, 0.06) !important;
            border-color: var(--accent-teal) !important;
        }

        body.theme-sunset, .theme-sunset {
            --bg-main: #140F0B;
            --bg-color: #140F0B;
            --card-bg: rgba(32, 24, 18, 0.65);
            --card-bg-solid: #201812;
            --card-border: rgba(245, 158, 11, 0.18);
            --text-main: #FEF3C7;
            --text-primary: var(--text-main);
            --text-muted: #F59E0B;
            --text-secondary: var(--text-muted);
            --text-dim: #d97706;
            --accent-teal: #FBBF24;
            --accent-blue: var(--accent-teal);
            --accent-cyan: var(--accent-teal);
            --accent-purple: #F87171;
            --accent-gold: #fbbf24;
            --accent-red: #F87171;
            --success: #34D399;
            --success-green: var(--success);
            --success-text: #34d399;
            --error: #F87171;
            --error-red: var(--error);
            --error-text: #f87171;
            --primary: var(--accent-teal);
            --accent-emerald: #10b981;
            --glow-teal: rgba(245, 158, 11, 0.12);
            --input-bg: rgba(32, 24, 18, 0.3);
            --btn-shadow: rgba(0, 0, 0, 0.4);
        }
        body.theme-forest, .theme-forest {
            --bg-main: #0C120E;
            --bg-color: #0C120E;
            --card-bg: rgba(20, 30, 22, 0.65);
            --card-bg-solid: #141e16;
            --card-border: rgba(52, 211, 153, 0.15);
            --text-main: #F0FDF4;
            --text-primary: var(--text-main);
            --text-muted: #A7F3D0;
            --text-secondary: var(--text-muted);
            --text-dim: #6ee7b7;
            --accent-teal: #34D399;
            --accent-blue: var(--accent-teal);
            --accent-cyan: var(--accent-teal);
            --accent-purple: #A7F3D0;
            --accent-gold: #fbbf24;
            --accent-red: #F87171;
            --success: #34D399;
            --success-green: var(--success);
            --success-text: #34d399;
            --error: #F87171;
            --error-red: var(--error);
            --error-text: #f87171;
            --primary: var(--accent-teal);
            --accent-emerald: #10b981;
            --glow-teal: rgba(52, 211, 153, 0.1);
            --input-bg: rgba(20, 30, 22, 0.3);
            --btn-shadow: rgba(0, 0, 0, 0.4);
        }
        body.theme-ocean, .theme-ocean {
            --bg-main: #070F20;
            --bg-color: #070F20;
            --card-bg: rgba(12, 24, 48, 0.65);
            --card-bg-solid: #0c1830;
            --card-border: rgba(96, 165, 250, 0.18);
            --text-main: #EFF6FF;
            --text-primary: var(--text-main);
            --text-muted: #93C5FD;
            --text-secondary: var(--text-muted);
            --text-dim: #60a5fa;
            --accent-teal: #60A5FA;
            --accent-blue: var(--accent-teal);
            --accent-cyan: var(--accent-teal);
            --accent-purple: #3B82F6;
            --accent-gold: #fbbf24;
            --accent-red: #F87171;
            --success: #34D399;
            --success-green: var(--success);
            --success-text: #34d399;
            --error: #F87171;
            --error-red: var(--error);
            --error-text: #f87171;
            --primary: var(--accent-teal);
            --accent-emerald: #10b981;
            --glow-teal: rgba(96, 165, 250, 0.12);
            --input-bg: rgba(12, 24, 48, 0.3);
            --btn-shadow: rgba(0, 0, 0, 0.4);
        }
        body.theme-royal, .theme-royal {
            --bg-main: #0D091A;
            --bg-color: #0D091A;
            --card-bg: rgba(22, 14, 48, 0.65);
            --card-bg-solid: #160e30;
            --card-border: rgba(167, 139, 250, 0.18);
            --text-main: #FAF5FF;
            --text-primary: var(--text-main);
            --text-muted: #C084FC;
            --text-secondary: var(--text-muted);
            --text-dim: #a855f7;
            --accent-teal: #C084FC;
            --accent-blue: var(--accent-teal);
            --accent-cyan: var(--accent-teal);
            --accent-purple: #8B5CF6;
            --accent-gold: #fbbf24;
            --accent-red: #F87171;
            --success: #34D399;
            --success-green: var(--success);
            --success-text: #34d399;
            --error: #F87171;
            --error-red: var(--error);
            --error-text: #f87171;
            --primary: var(--accent-teal);
            --accent-emerald: #10b981;
            --glow-teal: rgba(167, 139, 250, 0.12);
            --input-bg: rgba(22, 14, 48, 0.3);
            --btn-shadow: rgba(0, 0, 0, 0.4);
        }

        /* --- SamGMU and Medictest Themes (Dark & Light) --- */
        body.theme-samgmu, .theme-samgmu {
            --bg-main: #0b0b0d;
            --bg-color: #0b0b0d;
            --card-bg: rgba(25, 25, 30, 0.55);
            --card-bg-solid: #19191e;
            --card-border: rgba(255, 255, 255, 0.08);
            --text-main: #f8fafc;
            --text-primary: var(--text-main);
            --text-muted: #94a3b8;
            --text-secondary: var(--text-muted);
            --text-dim: #64748b;
            --accent-teal: #00d2ff;
            --accent-blue: var(--accent-teal);
            --accent-cyan: var(--accent-teal);
            --accent-purple: #ffb700;
            --accent-gold: #fbbf24;
            --accent-red: #ef4444;
            --success: #10b981;
            --success-green: var(--success);
            --success-text: #34d399;
            --error: #ef4444;
            --error-red: var(--error);
            --error-text: #f87171;
            --primary: var(--accent-teal);
            --accent-emerald: #10b981;
            --glow-teal: rgba(0, 210, 255, 0.15);
            --input-bg: rgba(25, 25, 30, 0.25);
            --btn-shadow: rgba(0, 0, 0, 0.4);
            background-image: 
                radial-gradient(circle at 10% 20%, rgba(0, 210, 255, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(255, 183, 0, 0.06) 0%, transparent 40%) !important;
        }
        body.theme-samgmu .theme-select-btn[data-theme="samgmu"] {
            border-color: var(--accent-teal) !important;
        }

        body.theme-medictest, .theme-medictest {
            --bg-main: #0d0e12;
            --bg-color: #0d0e12;
            --card-bg: rgba(22, 24, 33, 0.6);
            --card-bg-solid: #161821;
            --card-border: rgba(255, 255, 255, 0.06);
            --text-main: #f8fafc;
            --text-primary: var(--text-main);
            --text-muted: #94a3b8;
            --text-secondary: var(--text-muted);
            --text-dim: #64748b;
            --accent-teal: #00f2fe;
            --accent-blue: var(--accent-teal);
            --accent-cyan: var(--accent-teal);
            --accent-purple: #4facfe;
            --accent-gold: #fbbf24;
            --accent-red: #ef4444;
            --success: #10b981;
            --success-green: var(--success);
            --success-text: #34d399;
            --error: #ef4444;
            --error-red: var(--error);
            --error-text: #f87171;
            --primary: var(--accent-teal);
            --accent-emerald: #10b981;
            --glow-teal: rgba(0, 242, 254, 0.1);
            --input-bg: rgba(22, 24, 33, 0.3);
            --btn-shadow: rgba(0, 0, 0, 0.4);
            background-image: 
                radial-gradient(circle at 0% 0%, rgba(79, 172, 254, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 100% 100%, rgba(0, 242, 254, 0.05) 0%, transparent 50%) !important;
        }
        body.theme-medictest .theme-select-btn[data-theme="medictest"] {
            border-color: var(--accent-teal) !important;
        }

        body.theme-samgmu-white, .theme-samgmu-white {
            --bg-main: #f0f4f8;
            --bg-color: #f0f4f8;
            --card-bg: #ffffff;
            --card-bg-solid: #ffffff;
            --card-border: rgba(13, 118, 177, 0.12);
            --text-main: #1b2d4a;
            --text-primary: var(--text-main);
            --text-muted: #576b8c;
            --text-secondary: var(--text-muted);
            --text-dim: #64748b;
            --accent-teal: #0d76b1;
            --accent-blue: var(--accent-teal);
            --accent-cyan: var(--accent-teal);
            --accent-purple: #1d6fa5;
            --accent-gold: #b45309;
            --accent-red: #dc2626;
            --success: #10b981;
            --success-green: var(--success);
            --success-text: #047857;
            --error: #ef4444;
            --error-red: var(--error);
            --error-text: #b91c1c;
            --primary: var(--accent-teal);
            --accent-emerald: #10b981;
            --glow-teal: rgba(13, 118, 177, 0.15);
            --input-bg: #ffffff;
            --btn-shadow: #cbd5e1;
            background-image: 
                radial-gradient(circle at 10% 20%, rgba(36, 137, 197, 0.06) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(13, 118, 177, 0.04) 0%, transparent 40%) !important;
        }
        body.theme-samgmu-white .theme-select-btn[data-theme="samgmu-white"] {
            border-color: var(--accent-teal) !important;
        }
        body.theme-samgmu-white header {
            background: #0d76b1 !important;
            border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
        }
        body.theme-samgmu-white header h1, 
        body.theme-samgmu-white header h2, 
        body.theme-samgmu-white header span, 
        body.theme-samgmu-white header .score-item {
            color: #ffffff !important;
        }

        body.theme-medictest-white, .theme-medictest-white {
            --bg-main: #f4f6f8;
            --bg-color: #f4f6f8;
            --card-bg: #ffffff;
            --card-bg-solid: #ffffff;
            --card-border: rgba(52, 152, 219, 0.12);
            --text-main: #2c3e50;
            --text-primary: var(--text-main);
            --text-muted: #475569;
            --text-secondary: var(--text-muted);
            --text-dim: #64748b;
            --accent-teal: #1d72b8;
            --accent-blue: var(--accent-teal);
            --accent-cyan: var(--accent-teal);
            --accent-purple: #2980b9;
            --accent-gold: #b45309;
            --accent-red: #dc2626;
            --success: #2ecc71;
            --success-green: var(--success);
            --success-text: #047857;
            --error: #e74c3c;
            --error-red: var(--error);
            --error-text: #b91c1c;
            --primary: var(--accent-teal);
            --accent-emerald: #10b981;
            --glow-teal: rgba(29, 114, 184, 0.15);
            --input-bg: #ffffff;
            --btn-shadow: #cbd5e1;
            background-image: 
                radial-gradient(circle at 0% 0%, rgba(52, 152, 219, 0.06) 0%, transparent 50%),
                radial-gradient(circle at 100% 100%, rgba(46, 204, 113, 0.04) 0%, transparent 50%) !important;
        }
        body.theme-medictest-white .theme-select-btn[data-theme="medictest-white"] {
            border-color: var(--accent-teal) !important;
        }
        body.theme-medictest-white header {
            background: #1d72b8 !important;
            border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
        }
        body.theme-medictest-white header h1, 
        body.theme-medictest-white header h2, 
        body.theme-medictest-white header span, 
        body.theme-medictest-white header .score-item {
            color: #ffffff !important;
        }

        #casesPlayScreen header h2 {
            color: #ffffff !important;
        }
        #casesPlayScreen header span {
            color: rgba(255, 255, 255, 0.9) !important;
        }

        /* Плашки верхние в шапке в белых темах — полупрозрачное матовое стекло, идеально гармонирующее с синей шапкой */
        body.theme-samgmu-white header .settings-btn,
        body.theme-medictest-white header .settings-btn {
            background: rgba(255, 255, 255, 0.16) !important;
            border: 1px solid rgba(255, 255, 255, 0.28) !important;
            border-radius: 10px !important;
            color: #ffffff !important;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
            backdrop-filter: blur(8px) !important;
            -webkit-backdrop-filter: blur(8px) !important;
            transition: transform 0.18s cubic-bezier(0.2, 0, 0, 1), background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
        }
        body.theme-samgmu-white header .settings-btn svg,
        body.theme-medictest-white header .settings-btn svg {
            stroke: currentColor !important;
            transition: stroke 0.15s ease, transform 0.15s ease;
        }
        body.theme-samgmu-white header .settings-btn:hover,
        body.theme-medictest-white header .settings-btn:hover {
            background: rgba(255, 255, 255, 0.28) !important;
            transform: translateY(-2px) !important;
            box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18) !important;
            color: #ffffff !important;
            border-color: rgba(255, 255, 255, 0.6) !important;
        }
        body.theme-samgmu-white header .settings-btn:active,
        body.theme-medictest-white header .settings-btn:active {
            transform: translateY(1px) !important;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12) !important;
        }
        /* Звук выключен — приглушенная иконка на матовой плашке */
        body.theme-samgmu-white header #headerSoundBtn[aria-label="Включить звук"] svg,
        body.theme-medictest-white header #headerSoundBtn[aria-label="Включить звук"] svg {
            opacity: 0.45 !important;
            stroke: rgba(255, 255, 255, 0.6) !important;
        }
        /* Кнопка тарифов в шапке */
        body.theme-samgmu-white header #headerTariffBtn,
        body.theme-medictest-white header #headerTariffBtn {
            background: rgba(255, 255, 255, 0.16) !important;
            border: 1px solid rgba(255, 255, 255, 0.28) !important;
            border-radius: 10px !important;
            color: #ffffff !important;
            backdrop-filter: blur(8px) !important;
            -webkit-backdrop-filter: blur(8px) !important;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
        }
        body.theme-samgmu-white header #headerTariffBtn:hover,
        body.theme-medictest-white header #headerTariffBtn:hover {
            transform: translateY(-2px) !important;
            box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18) !important;
            background: rgba(255, 255, 255, 0.28) !important;
            border-color: rgba(255, 255, 255, 0.6) !important;
            color: #ffffff !important;
        }
        /* Score board в шапке белых тем */
        body.theme-samgmu-white header .score-board,
        body.theme-medictest-white header .score-board {
            background: rgba(0, 0, 0, 0.18) !important;
            border: 1px solid rgba(255, 255, 255, 0.2) !important;
            border-radius: 10px !important;
            color: #ffffff !important;
            backdrop-filter: blur(8px) !important;
            -webkit-backdrop-filter: blur(8px) !important;
            box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12) !important;
        }


        /* Light themes UI Adaptations (Nordic, SamGMU White, Medictest White) */
        body.theme-nordic, body.theme-samgmu-white, body.theme-medictest-white {
            color: var(--text-main) !important;
        }
        body.theme-nordic .start-title, body.theme-samgmu-white .start-title, body.theme-medictest-white .start-title,
        body.theme-nordic .logo-text h1,
        body.theme-nordic h3, body.theme-samgmu-white h3, body.theme-medictest-white h3,
        body.theme-nordic h2, body.theme-samgmu-white h2, body.theme-medictest-white h2 {
            color: var(--text-main) !important;
        }
        body.theme-nordic .modal-content, body.theme-samgmu-white .modal-content, body.theme-medictest-white .modal-content {
            background: #ffffff !important;
            color: var(--text-main) !important;
            box-shadow: 0 20px 40px rgba(0,0,0,0.1) !important;
        }
        body.theme-nordic .modal-content h3,
        body.theme-samgmu-white .modal-content h3,
        body.theme-medictest-white .modal-content h3 {
            background: linear-gradient(135deg, #0737a5 0%, #0d76b1 100%) !important;
            -webkit-background-clip: text !important;
            -webkit-text-fill-color: transparent !important;
            color: #0d76b1 !important;
        }
        body.theme-nordic #login-overlay, body.theme-samgmu-white #login-overlay, body.theme-medictest-white #login-overlay {
            background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%) !important;
        }
        body.theme-nordic .login-card, body.theme-samgmu-white .login-card, body.theme-medictest-white .login-card {
            background: #ffffff !important;
            box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
            color: #1f2937 !important;
        }
        body.theme-nordic .login-card p, body.theme-samgmu-white .login-card p, body.theme-medictest-white .login-card p {
            color: #4b5563 !important;
        }
        body.theme-nordic .login-card input, body.theme-samgmu-white .login-card input, body.theme-medictest-white .login-card input {
            background: #f9fafb !important;
            color: #1f2937 !important;
            border: 1px solid rgba(0, 0, 0, 0.05) !important;
        }
        body.theme-nordic select, body.theme-samgmu-white select, body.theme-medictest-white select {
            background: #ffffff !important;
            color: var(--text-main) !important;
            border: 1px solid var(--card-border) !important;
        }
        body.theme-nordic .test-card,
        body.theme-samgmu-white .test-card,
        body.theme-medictest-white .test-card {
            background: rgba(255, 255, 255, 0.88) !important;
            backdrop-filter: blur(24px) saturate(180%) !important;
            -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
            border: 1px solid rgba(0, 0, 0, 0.08) !important;
            box-shadow: 
                0 20px 48px -10px rgba(0, 0, 0, 0.08),
                0 1px 3px 0 rgba(0, 0, 0, 0.04),
                inset 0 1px 0 rgba(255, 255, 255, 1) !important;
        }
        body.theme-nordic .progress-bar-container,
        body.theme-samgmu-white .progress-bar-container,
        body.theme-medictest-white .progress-bar-container {
            background: rgba(0, 0, 0, 0.06) !important;
        }
        body.theme-nordic .option-button:not(.correct):not(.incorrect):not(.selected),
        body.theme-samgmu-white .option-button:not(.correct):not(.incorrect):not(.selected),
        body.theme-medictest-white .option-button:not(.correct):not(.incorrect):not(.selected) {
            background: #ffffff !important;
            color: var(--text-main) !important;
            border: 1px solid #cbd5e1 !important; /* Тонкий аккуратный контур без жирных полос */
            box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02) !important; /* Убрана выпуклая 3D-ступенька */
            transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.15s ease !important;
        }
        body.theme-nordic .option-button:not(.correct):not(.incorrect):not(.selected):active,
        body.theme-samgmu-white .option-button:not(.correct):not(.incorrect):not(.selected):active,
        body.theme-medictest-white .option-button:not(.correct):not(.incorrect):not(.selected):active {
            transform: translateY(1px) !important;
            box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
        }
        body.theme-nordic .option-button:hover:not(.disabled):not(.correct):not(.incorrect):not(.selected),
        body.theme-samgmu-white .option-button:hover:not(.disabled):not(.correct):not(.incorrect):not(.selected),
        body.theme-medictest-white .option-button:hover:not(.disabled):not(.correct):not(.incorrect):not(.selected) {
            background: #ffffff !important;
            transform: translateY(-2px) !important; /* Аккуратное подпрыгивание */
            border-color: #0d76b1 !important; /* Четкий тонкий акцентный контур */
            box-shadow: 0 4px 12px rgba(13, 118, 177, 0.12), 0 1px 3px rgba(13, 118, 177, 0.08) !important; /* Мягкое парение без жирной полосы */
        }
        body.theme-nordic .option-button:hover:not(.disabled):not(.correct):not(.incorrect):not(.selected) .option-letter,
        body.theme-samgmu-white .option-button:hover:not(.disabled):not(.correct):not(.incorrect):not(.selected) .option-letter,
        body.theme-medictest-white .option-button:hover:not(.disabled):not(.correct):not(.incorrect):not(.selected) .option-letter {
            background: #f0f7ff !important;
            border-color: #0d76b1 !important;
            color: #0d76b1 !important;
            transform: scale(1.03) !important;
        }
        body.theme-nordic .option-letter, body.theme-samgmu-white .option-letter, body.theme-medictest-white .option-letter {
            background: #f8fafc !important;
            color: var(--text-muted) !important;
            border: 1px solid #cbd5e1 !important;
            box-shadow: none !important;
            transition: all 0.18s ease !important;
        }

        /* Кнопка «Далее →» в белых темах — мягкий гармоничный цвет под фон, без резкого контраста с белым */
        body.theme-nordic .next-btn:not(#finishEarlyBtn):not(#prevBtn),
        body.theme-samgmu-white .next-btn:not(#finishEarlyBtn):not(#prevBtn),
        body.theme-medictest-white .next-btn:not(#finishEarlyBtn):not(#prevBtn),
        body.theme-nordic .exam-nav-btn#examNextBtn,
        body.theme-samgmu-white .exam-nav-btn#examNextBtn,
        body.theme-medictest-white .exam-nav-btn#examNextBtn {
            background: #e0f2fe !important;
            color: #0369a1 !important;
            border: 1.5px solid #7dd3fc !important;
            font-weight: 700 !important;
            box-shadow: 0 2px 8px rgba(2, 132, 199, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
            transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease !important;
        }
        body.theme-nordic .next-btn:not(#finishEarlyBtn):not(#prevBtn):hover,
        body.theme-samgmu-white .next-btn:not(#finishEarlyBtn):not(#prevBtn):hover,
        body.theme-medictest-white .next-btn:not(#finishEarlyBtn):not(#prevBtn):hover,
        body.theme-nordic .exam-nav-btn#examNextBtn:hover,
        body.theme-samgmu-white .exam-nav-btn#examNextBtn:hover,
        body.theme-medictest-white .exam-nav-btn#examNextBtn:hover {
            background: #bae6fd !important;
            border-color: #0284c7 !important;
            color: #0c4a6e !important;
            transform: translateY(-2px) !important;
            box-shadow: 0 6px 16px rgba(2, 132, 199, 0.22) !important;
        }
        body.theme-nordic .next-btn:not(#finishEarlyBtn):not(#prevBtn):active,
        body.theme-samgmu-white .next-btn:not(#finishEarlyBtn):not(#prevBtn):active,
        body.theme-medictest-white .next-btn:not(#finishEarlyBtn):not(#prevBtn):active,
        body.theme-nordic .exam-nav-btn#examNextBtn:active,
        body.theme-samgmu-white .exam-nav-btn#examNextBtn:active,
        body.theme-medictest-white .exam-nav-btn#examNextBtn:active {
            background: #7dd3fc !important;
            transform: translateY(1px) !important;
            box-shadow: 0 1px 3px rgba(2, 132, 199, 0.2) !important;
        }

        /* Подсветка правильного ответа по ВСЕЙ плашке в белых темах */
        body.theme-nordic .option-button.correct,
        body.theme-samgmu-white .option-button.correct,
        body.theme-medictest-white .option-button.correct {
            background: #10b981 !important;
            border: 1.5px solid #059669 !important;
            border-top: 1.5px solid rgba(255, 255, 255, 0.4) !important;
            color: #ffffff !important;
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 4px 0 #059669 !important;
        }
        body.theme-nordic .option-button.correct:active,
        body.theme-samgmu-white .option-button.correct:active,
        body.theme-medictest-white .option-button.correct:active {
            transform: translateY(3px) !important;
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 0 #059669 !important;
        }
        body.theme-nordic .option-button.correct .option-letter,
        body.theme-samgmu-white .option-button.correct .option-letter,
        body.theme-medictest-white .option-button.correct .option-letter {
            background: rgba(255, 255, 255, 0.25) !important;
            border-color: rgba(255, 255, 255, 0.4) !important;
            color: #ffffff !important;
            font-weight: 700 !important;
        }

        /* Подсветка ошибочного ответа по ВСЕЙ плашке в белых темах */
        body.theme-nordic .option-button.incorrect,
        body.theme-samgmu-white .option-button.incorrect,
        body.theme-medictest-white .option-button.incorrect {
            background: #ef4444 !important;
            border: 1.5px solid #dc2626 !important;
            border-top: 1.5px solid rgba(255, 255, 255, 0.3) !important;
            color: #ffffff !important;
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 0 #991b1b !important;
            animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both !important;
        }
        body.theme-nordic .option-button.incorrect:active,
        body.theme-samgmu-white .option-button.incorrect:active,
        body.theme-medictest-white .option-button.incorrect:active {
            transform: translateY(3px) !important;
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 1px 0 #991b1b !important;
        }
        body.theme-nordic .option-button.incorrect .option-letter,
        body.theme-samgmu-white .option-button.incorrect .option-letter,
        body.theme-medictest-white .option-button.incorrect .option-letter {
            background: rgba(255, 255, 255, 0.25) !important;
            border-color: rgba(255, 255, 255, 0.4) !important;
            color: #ffffff !important;
            font-weight: 700 !important;
        }

        /* Выбор ответа в режиме экзамена для белых тем */
        body.theme-nordic .option-button.selected,
        body.theme-samgmu-white .option-button.selected,
        body.theme-medictest-white .option-button.selected {
            background: #e0f2fe !important;
            border: 1.5px solid #0284c7 !important;
            color: #0369a1 !important;
            box-shadow: 0 4px 14px rgba(2, 132, 199, 0.2) !important;
        }
        body.theme-nordic .option-button.selected .option-letter,
        body.theme-samgmu-white .option-button.selected .option-letter,
        body.theme-medictest-white .option-button.selected .option-letter {
            background: #0284c7 !important;
            border-color: #0369a1 !important;
            color: #ffffff !important;
            font-weight: 700 !important;
        }

        /* Корректная прозрачность при блокировке ответов в белых темах */
        body.theme-nordic .option-button.disabled.correct,
        body.theme-samgmu-white .option-button.disabled.correct,
        body.theme-medictest-white .option-button.disabled.correct,
        body.theme-nordic .option-button.disabled.incorrect,
        body.theme-samgmu-white .option-button.disabled.incorrect,
        body.theme-medictest-white .option-button.disabled.incorrect {
            opacity: 1 !important;
        }
        body.theme-nordic .option-button.disabled:not(.correct):not(.incorrect),
        body.theme-samgmu-white .option-button.disabled:not(.correct):not(.incorrect),
        body.theme-medictest-white .option-button.disabled:not(.correct):not(.incorrect) {
            opacity: 0.65 !important;
            background: #f8fafc !important;
            color: #64748b !important;
        }

        body.theme-nordic .topic-badge, body.theme-samgmu-white .topic-badge, body.theme-medictest-white .topic-badge {
            background: rgba(0, 0, 0, 0.05) !important;
            color: var(--text-main) !important;
        }


        /* Adjustments for light themes (Nordic, SamGMU White, Medictest White) readability */
        body.theme-nordic .start-title,
        body.theme-samgmu-white .start-title,
        body.theme-medictest-white .start-title {
            background: none !important;
            -webkit-background-clip: unset !important;
            -webkit-text-fill-color: initial !important;
            color: #1e293b !important;
        }
        .start-title .brand-name {
            background: linear-gradient(135deg, #0737a5 0%, #0d76b1 55%, #00b4d8 100%) !important;
            -webkit-background-clip: text !important;
            -webkit-text-fill-color: transparent !important;
            display: inline-block;
        }
        body.theme-samgmu-white header .logo-text h1,
        body.theme-medictest-white header .logo-text h1 {
            color: #ffffff !important;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
        }
        body.theme-nordic .logo-text h1 {
            color: var(--text-main) !important;
        }
        body.theme-nordic h3,
        body.theme-samgmu-white h3,
        body.theme-medictest-white h3 {
            color: var(--text-main) !important;
        }
        body.theme-samgmu-white #authTitle,
        body.theme-medictest-white #authTitle,
        body.theme-nordic #authTitle {
            background: linear-gradient(135deg, #0737a5 0%, #0d76b1 55%, #00b4d8 100%) !important;
            -webkit-background-clip: text !important;
            -webkit-text-fill-color: transparent !important;
        }
        body.theme-nordic .logo-badge,
        body.theme-samgmu-white .logo-badge,
        body.theme-medictest-white .logo-badge,
        body.theme-nordic .start-logo,
        body.theme-samgmu-white .start-logo,
        body.theme-medictest-white .start-logo {
            width: 52px !important;
            height: 52px !important;
            background: rgba(255, 255, 255, 0.9) !important;
            border: 1px solid rgba(13, 118, 177, 0.18) !important;
            box-shadow: 0 4px 14px rgba(13, 118, 177, 0.1) !important;
        }
        body.theme-nordic .db-info,
        body.theme-samgmu-white .db-info,
        body.theme-medictest-white .db-info {
            background: rgba(13, 118, 177, 0.05) !important;
            border: 1px solid rgba(13, 118, 177, 0.15) !important;
            color: var(--text-main) !important;
        }
        body.theme-nordic select,
        body.theme-samgmu-white select,
        body.theme-medictest-white select,
        body.theme-nordic input,
        body.theme-samgmu-white input,
        body.theme-medictest-white input {
            background: #ffffff !important;
            color: var(--text-main) !important;
            border: 1px solid rgba(0, 0, 0, 0.08) !important;
        }
        body.theme-nordic .mode-btn,
        body.theme-samgmu-white .mode-btn,
        body.theme-medictest-white .mode-btn {
            background: #ffffff !important;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.03) !important;
            border: 1px solid var(--card-border) !important;
        }
        body.theme-nordic .mode-btn:hover,
        body.theme-samgmu-white .mode-btn:hover,
        body.theme-medictest-white .mode-btn:hover {
            border-color: var(--accent-purple) !important;
            background: #fdfdfd !important;
        }
        body.theme-nordic .modal-content {
            background: #ffffff !important;
            color: #1f2937 !important;
            box-shadow: 0 20px 40px rgba(0,0,0,0.1) !important;
        }
        body.theme-nordic .theme-select-btn[data-theme="nordic"] {
            border-color: var(--accent-teal) !important;
        }
        body.theme-nordic #login-overlay {
            background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%) !important;
        }
        body.theme-nordic .login-card {
            background: #ffffff !important;
            box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
            color: #1f2937 !important;
        }
        body.theme-nordic .login-card p {
            color: #4b5563 !important;
        }
        body.theme-nordic .login-card input {
            background: #f9fafb !important;
            color: #1f2937 !important;
            border: 1px solid #d1d5db !important;
        }

        /* Active theme button styling */
        .theme-select-btn.active {
            border-color: var(--accent-teal) !important;
            box-shadow: 0 0 12px var(--glow-teal) !important;
            transform: scale(1.02);
        }

        /* Anki Spaced Repetition Styles */
        .anki-rate-btn {
            border: 2px solid transparent;
            border-radius: 12px;
            padding: 12px 6px;
            font-family: 'Outfit', sans-serif;
            font-weight: 700;
            font-size: 0.85rem;
            cursor: pointer;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            outline: none;
            text-align: center;
            color: #ffffff;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }
        .anki-rate-btn:active {
            transform: scale(0.96);
        }
        .anki-rate-btn.again {
            background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
            box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
        }
        .anki-rate-btn.again:hover {
            
            transform: translateY(-2px);
        }
        .anki-rate-btn.hard {
            background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
            box-shadow: 0 4px 12px rgba(217, 119, 6, 0.2);
        }
        .anki-rate-btn.hard:hover {
            
            transform: translateY(-2px);
        }
        .anki-rate-btn.easy {
            background: linear-gradient(135deg, #10b981 0%, #047857 100%);
            box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
        }
        .anki-rate-btn.easy:hover {
            
            transform: translateY(-2px);
        }
        
        /* Adjustments for light theme (Nordic) */
        body.theme-nordic .anki-rate-btn {
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
        }

        /* Duel Mode Styles */
        #duelScreen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: #090a0f;
            z-index: 2000;
            display: none;
            flex-direction: column;
            overflow: hidden;
            font-family: 'Outfit', sans-serif;
            color: #ffffff;
            box-sizing: border-box;
            touch-action: manipulation;
            -webkit-user-select: none;
            user-select: none;
        }
        .duel-half {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            align-items: center;
            padding: 10px 16px;
            box-sizing: border-box;
            position: relative;
            width: 100%;
            height: 50vh;
            overflow: hidden;
        }
        #duelPlayer1 {
            transform: rotate(180deg);
            border-bottom: 2px dashed rgba(255, 255, 255, 0.2);
        }
        .duel-header {
            order: 3; /* Places score and round info at the very edge of the screen */
            width: 100%;
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 6px;
            margin-bottom: 0;
            max-width: 600px;
            padding: 0 10px;
            box-sizing: border-box;
        }
        .duel-score {
            font-size: 0.95rem;
            font-weight: 800;
            color: var(--accent-teal);
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--card-border);
            padding: 4px 14px;
            border-radius: 20px;
        }
        .duel-round-info {
            font-size: 0.8rem;
            color: var(--text-muted);
            font-weight: 600;
            letter-spacing: 0.3px;
        }
        .duel-question-box {
            order: 2; /* Question text stays in the middle */
            font-size: 0.9rem;
            font-weight: 600;
            text-align: center;
            margin-top: 6px;
            margin-bottom: 6px;
            line-height: 1.35;
            max-width: 600px;
            color: #ffffff;
            padding: 0 8px;
            box-sizing: border-box;
            word-wrap: break-word;
            overflow-wrap: anywhere;
            max-height: 24vh;
            overflow-y: auto;
            scrollbar-width: thin;
        }
        .duel-options-grid {
            order: 1; /* Duel buttons sit right next to the center division line */
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 8px;
            width: 100%;
            max-width: 600px;
            padding: 0 6px;
            box-sizing: border-box;
        }
        .duel-option-btn {
            background: rgba(255, 255, 255, 0.03);
            border: 1.5px solid var(--card-border);
            color: #e2e8f0;
            border-radius: 12px;
            padding: 10px 12px;
            font-size: 0.82rem;
            font-weight: 600;
            line-height: 1.3;
            font-family: inherit;
            cursor: pointer;
            transition: all 0.15s ease;
            outline: none;
            display: flex;
            align-items: center;
            justify-content: flex-start;
            text-align: left;
            width: 100%;
            box-sizing: border-box;
            min-height: 52px;
            touch-action: manipulation;
            -webkit-tap-highlight-color: transparent;
            overflow-wrap: anywhere;
            word-break: break-word;
        }
        .duel-option-btn:hover:not(.disabled) {
            background: rgba(255, 255, 255, 0.08);
            border-color: var(--accent-teal);
            transform: translateY(-1px);
        }
        .duel-option-btn.correct {
            background: rgba(52, 211, 153, 0.16) !important;
            border-color: var(--success) !important;
            color: #ffffff !important;
            box-shadow: 0 0 14px rgba(52, 211, 153, 0.35);
        }
        .duel-option-btn.incorrect {
            background: rgba(248, 113, 113, 0.16) !important;
            border-color: var(--error) !important;
            color: #ffffff !important;
            box-shadow: 0 0 14px rgba(248, 113, 113, 0.35);
        }
        .duel-option-btn.disabled {
            opacity: 0.45;
            cursor: not-allowed;
            pointer-events: none;
        }
        .duel-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(9, 10, 15, 0.72);
            backdrop-filter: blur(4px);
            -webkit-backdrop-filter: blur(4px);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 10;
            padding: 20px;
            box-sizing: border-box;
            text-align: center;
        }
        .duel-overlay-text {
            font-size: 1.4rem;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 1px;
            animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
        }
        .duel-overlay-text.win {
            color: var(--success);
            text-shadow: 0 0 15px rgba(16, 185, 129, 0.6);
        }
        .duel-overlay-text.lose {
            color: var(--error);
            text-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
        }
        .duel-overlay-text.info {
            color: var(--accent-teal);
            text-shadow: 0 0 15px rgba(0, 242, 254, 0.6);
        }
        
        /* End Screen Overlay */
        #duelEndScreen {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: #090a0f;
            z-index: 100;
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 30px 20px;
            box-sizing: border-box;
            text-align: center;
        }
        .duel-end-actions {
            display: flex;
            gap: 16px;
            flex-wrap: wrap;
            justify-content: center;
            align-items: center;
        }
        .duel-rematch-btn {
            background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
            border: none;
            color: #ffffff;
            font-weight: 800;
            padding: 14px 28px;
            border-radius: 14px;
            cursor: pointer;
            font-size: 0.95rem;
            transition: transform 0.2s, box-shadow 0.2s;
            outline: none;
            box-shadow: 0 4px 15px rgba(239, 68, 68, 0.35);
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }
        .duel-rematch-btn:hover {
            transform: scale(1.03);
            box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
        }
        .duel-exit-btn {
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: #ffffff;
            font-weight: 700;
            padding: 14px 24px;
            border-radius: 14px;
            cursor: pointer;
            font-size: 0.95rem;
            transition: transform 0.2s, background 0.2s;
            outline: none;
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }
        .duel-exit-btn:hover {
            background: rgba(255, 255, 255, 0.15);
            transform: scale(1.02);
        }
        
        @keyframes popIn {
            0% { transform: scale(0.8); opacity: 0; }
            100% { transform: scale(1); opacity: 1; }
        }

        /* Fix select option background and text color across different themes */
        select option {
            background-color: #161821;
            color: #ffffff;
        }
        body.theme-nordic select option,
        body.theme-samgmu-white select option,
        body.theme-medictest-white select option {
            background-color: #ffffff;
            color: #1e293b;
        }

        /* Mode buttons specific styling */
        .mode-btn.db-browser {
            background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
            border: none !important;
            box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25) !important;
        }
        .mode-btn.db-browser .mode-info h3 {
            color: #ffffff !important;
        }
        .mode-btn.db-browser .mode-info p {
            color: rgba(255, 255, 255, 0.85) !important;
        }
        .mode-btn.db-browser .mode-badge-num {
            background: rgba(255, 255, 255, 0.2) !important;
            color: #ffffff !important;
            border: none !important;
        }

        .mode-btn.duel-mode {
            background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%) !important;
            border: none !important;
            box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3) !important;
        }
        .mode-btn.duel-mode .mode-info h3 {
            color: #ffffff !important;
        }
        .mode-btn.duel-mode .mode-info p {
            color: rgba(255, 255, 255, 0.85) !important;
        }
        .mode-btn.duel-mode .mode-badge-num {
            background: rgba(255, 255, 255, 0.2) !important;
            color: #ffffff !important;
            border: none !important;
        }

        /* Adjustments for light theme (Nordic) to make text visible when buttons turn white */
        body.theme-nordic .mode-btn.db-browser,
        body.theme-nordic .mode-btn.duel-mode,
        body.theme-samgmu-white .mode-btn.db-browser,
        body.theme-samgmu-white .mode-btn.duel-mode,
        body.theme-medictest-white .mode-btn.db-browser,
        body.theme-medictest-white .mode-btn.duel-mode {
            background: #ffffff !important;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.03) !important;
            border: 1px solid var(--card-border) !important;
        }
        body.theme-nordic .mode-btn.db-browser .mode-info h3,
        body.theme-nordic .mode-btn.duel-mode .mode-info h3,
        body.theme-samgmu-white .mode-btn.db-browser .mode-info h3,
        body.theme-samgmu-white .mode-btn.duel-mode .mode-info h3,
        body.theme-medictest-white .mode-btn.db-browser .mode-info h3,
        body.theme-medictest-white .mode-btn.duel-mode .mode-info h3 {
            color: var(--text-main) !important;
        }
        body.theme-nordic .mode-btn.db-browser .mode-info p,
        body.theme-nordic .mode-btn.duel-mode .mode-info p,
        body.theme-samgmu-white .mode-btn.db-browser .mode-info p,
        body.theme-samgmu-white .mode-btn.duel-mode .mode-info p,
        body.theme-medictest-white .mode-btn.db-browser .mode-info p,
        body.theme-medictest-white .mode-btn.duel-mode .mode-info p {
            color: var(--text-muted) !important;
        }
        body.theme-nordic .mode-btn.db-browser .mode-badge-num,
        body.theme-nordic .mode-btn.duel-mode .mode-badge-num,
        body.theme-samgmu-white .mode-btn.db-browser .mode-badge-num,
        body.theme-samgmu-white .mode-btn.duel-mode .mode-badge-num,
        body.theme-medictest-white .mode-btn.db-browser .mode-badge-num,
        body.theme-medictest-white .mode-btn.duel-mode .mode-badge-num {
            background: rgba(0, 0, 0, 0.05) !important;
            color: var(--text-main) !important;
        }

    
        /* === BLOCK MODE STYLES === */
        
        .case-tab-btn {
            width: auto !important;
        }
.block-mode-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.7);
            z-index: 999;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
            animation: fadeInOverlay 0.2s ease;
        }
        @keyframes fadeInOverlay {
            from { opacity: 0; }
            to   { opacity: 1; }
        }
        .block-mode-panel {
            background: var(--bg-color);
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 20px;
            padding: 28px;
            width: 100%;
            max-width: 680px;
            max-height: 85vh;
            overflow-y: auto;
            box-shadow: 0 20px 60px rgba(0,0,0,0.5);
            animation: slideUpPanel 0.22s cubic-bezier(0.34,1.56,0.64,1);
        }
        @keyframes slideUpPanel {
            from { opacity: 0; transform: translateY(30px) scale(0.96); }
            to   { opacity: 1; transform: translateY(0) scale(1); }
        }
        .block-mode-panel h2 {
            font-family: 'Outfit', sans-serif;
            font-size: 1.4rem;
            font-weight: 800;
            margin-bottom: 6px;
            color: #0284c7;
            background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        body.theme-nordic .block-mode-panel,
        body.theme-samgmu-white .block-mode-panel,
        body.theme-medictest-white .block-mode-panel {
            background: #ffffff !important;
            border: 1px solid rgba(13, 118, 177, 0.15) !important;
            box-shadow: 0 20px 60px rgba(15, 23, 42, 0.15) !important;
        }
        body.theme-nordic .block-mode-panel h2,
        body.theme-samgmu-white .block-mode-panel h2,
        body.theme-medictest-white .block-mode-panel h2 {
            color: #0284c7 !important;
            background: none !important;
            -webkit-text-fill-color: #0284c7 !important;
        }
        body.theme-nordic .block-mode-panel .block-subtitle,
        body.theme-samgmu-white .block-mode-panel .block-subtitle,
        body.theme-medictest-white .block-mode-panel .block-subtitle {
            color: #475569 !important;
        }
        .block-mode-panel .block-subtitle {
            font-size: 0.8rem;
            color: var(--text-muted);
            margin-bottom: 18px;
        }
        .block-legend {
            display: flex;
            gap: 14px;
            flex-wrap: wrap;
            margin-bottom: 18px;
            padding: 10px 14px;
            background: rgba(255,255,255,0.02);
            border-radius: 10px;
            border: 1px solid var(--card-border);
        }
        .block-legend-item {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 0.72rem;
            color: var(--text-muted);
        }
        .block-legend-dot {
            width: 10px; height: 10px;
            border-radius: 50%;
        }
        .block-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
            gap: 8px;
            margin-bottom: 20px;
        }
        .block-btn {
            aspect-ratio: 1;
            border-radius: 10px;
            border: 1.5px solid var(--card-border);
            background: rgba(255,255,255,0.03);
            color: var(--text-muted);
            font-family: 'Outfit', sans-serif;
            font-weight: 700;
            font-size: 0.75rem;
            cursor: pointer;
            transition: all 0.15s ease;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 2px;
            position: relative;
        }
        .block-btn:hover {
            border-color: var(--accent-teal);
            background: rgba(0, 242, 254, 0.08);
            color: var(--accent-teal);
            transform: translateY(-2px);
        }
        .block-btn.done {
            border-color: rgba(0, 200, 83, 0.5);
            background: rgba(0, 200, 83, 0.08);
            color: #00c853;
        }
        .block-btn.in-progress {
            border-color: rgba(255, 171, 0, 0.5);
            background: rgba(255, 171, 0, 0.08);
            color: #ffab00;
        }
        .block-btn .block-num {
            font-size: 0.85rem;
            line-height: 1;
        }
        .block-btn .block-check {
            font-size: 0.65rem;
            opacity: 0.9;
        }
        .block-close-btn {
            width: 100%;
            padding: 12px;
            border-radius: 12px;
            border: 1px solid var(--card-border);
            background: transparent;
            color: var(--text-muted);
            font-family: 'Outfit', sans-serif;
            font-size: 0.9rem;
            cursor: pointer;
            transition: all 0.15s ease;
        }
        .block-close-btn:hover {
            border-color: var(--accent-teal);
            color: var(--text-main);
        }
        /* Topic color strips */
        .block-btn::after {
            content: attr(data-topic-color);
            position: absolute;
            bottom: 3px;
            left: 6px; right: 6px;
            height: 2px;
            border-radius: 2px;
            background: var(--strip-color, transparent);
        }

        .flying-tooth {
            --tooth-opacity: 0.25;
            position: fixed;
            top: 110vh;
            font-size: 3rem;
            opacity: var(--tooth-opacity, 0.25);
            pointer-events: none;
            user-select: none;
            animation: float-tooth 16s linear infinite;
            z-index: -10;
            filter: brightness(0) invert(1) drop-shadow(0 0 10px rgba(255, 255, 255, 0.35));
        }

        @keyframes float-tooth {
            0% {
                transform: translateY(0) translateX(0) rotate(0deg);
                opacity: 0;
            }
            10% {
                opacity: var(--tooth-opacity, 0.25);
            }
            90% {
                opacity: var(--tooth-opacity, 0.25);
            }
            100% {
                transform: translateY(-120vh) translateX(80px) rotate(360deg);
                opacity: 0;
            }
        }

        body.theme-nordic .flying-tooth, 
        body.theme-samgmu-white .flying-tooth, 
        body.theme-medictest-white .flying-tooth {
            --tooth-opacity: 0.15;
            filter: drop-shadow(0 0 8px rgba(13, 118, 177, 0.3)) brightness(0.55) sepia(1) hue-rotate(165deg) saturate(3.5);
        }
        
        /* Dynamic themed buttons for OSCE stations and PDF viewer */
        .pdf-tab-btn {
            padding: 4px 12px;
            border-radius: 6px;
            font-size: 0.78rem;
            font-weight: bold;
            cursor: pointer;
            color: var(--text-muted) !important;
            border: 1px solid var(--card-border) !important;
            background: var(--input-bg) !important;
            transition: all 0.2s ease;
        }
        .pdf-tab-btn:hover {
            color: var(--text-main) !important;
            border-color: var(--accent-teal) !important;
        }
        .pdf-tab-btn.active {
            color: #fff !important;
            border-color: var(--accent-teal) !important;
            background: var(--accent-teal) !important;
        }
        .pdf-download-btn {
            padding: 8px 14px;
            font-size: 0.82rem;
            background: rgba(2, 132, 199, 0.1) !important;
            color: var(--accent-teal) !important;
            border: 1px solid var(--accent-teal) !important;
            border-radius: 8px;
            text-decoration: none;
            font-weight: 600;
            transition: all 0.2s ease;
            display: inline-block;
        }
        .pdf-download-btn:hover {
            background: var(--accent-teal) !important;
            color: #fff !important;
        }
        .station-pdf-btn {
            padding: 10px;
            border-radius: 10px;
            background: rgba(2, 132, 199, 0.08) !important;
            color: var(--accent-teal) !important;
            border: 1px solid rgba(2, 132, 199, 0.25) !important;
            font-size: 0.85rem;
            font-weight: 600;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            transition: all 0.2s ease;
            width: 100%;
            box-sizing: border-box;
        }
        .station-pdf-btn:hover {
            background: rgba(2, 132, 199, 0.15) !important;
            border-color: var(--accent-teal) !important;
        }
        .station-start-btn {
            padding: 10px;
            border-radius: 10px;
            background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-teal) 100%) !important;
            color: #ffffff !important;
            border: 1px solid rgba(2, 132, 199, 0.2) !important;
            font-size: 0.85rem;
            font-weight: 700;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            transition: all 0.2s ease;
            width: 100%;
            box-sizing: border-box;
        }
        .station-start-btn:hover {
            opacity: 0.9 !important;
            transform: translateY(-1px) !important;
        }

        /* === OSCE Mode Selection Cards (Mandate 8d) === */
        .station-mode-card {
            padding: 16px;
            border-radius: 14px;
            background: var(--input-bg);
            border: 1px solid var(--card-border);
            text-align: left;
            cursor: pointer;
            transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
            display: flex;
            align-items: flex-start;
            gap: 14px;
            position: relative;
            outline: none;
            box-sizing: border-box;
            width: 100%;
        }
        .station-mode-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
        }
        .station-mode-card:focus-visible {
            outline: 2px solid var(--accent-teal);
            outline-offset: 2px;
        }

        body.theme-nordic .station-mode-card,
        body.theme-samgmu-white .station-mode-card,
        body.theme-medictest-white .station-mode-card {
            background: #ffffff !important;
            border: 1px solid #e2e8f0 !important;
            box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02) !important;
        }

        .station-mode-badge {
            width: 42px;
            height: 42px;
            border-radius: 11px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            transition: transform 0.18s ease;
        }
        .station-mode-card:hover .station-mode-badge {
            transform: scale(1.05);
        }

        /* 1. Пошаговый Симулятор (Sapphire Blue) */
        .station-mode-card.mode-simulator .station-mode-badge {
            background: rgba(37, 99, 235, 0.08);
            border: 1px solid rgba(37, 99, 235, 0.22);
            color: #2563eb;
        }
        .station-mode-card.mode-simulator:hover {
            border-color: rgba(37, 99, 235, 0.45) !important;
        }

        /* 2. Порядок действий (Emerald / Teal) */
        .station-mode-card.mode-reorder .station-mode-badge {
            background: rgba(16, 185, 129, 0.08);
            border: 1px solid rgba(16, 185, 129, 0.22);
            color: #059669;
        }
        .station-mode-card.mode-reorder:hover {
            border-color: rgba(16, 185, 129, 0.45) !important;
        }

        /* 3. Флешкарточки (Indigo / Purple) */
        .station-mode-card.mode-flashcards .station-mode-badge {
            background: rgba(124, 58, 237, 0.08);
            border: 1px solid rgba(124, 58, 237, 0.22);
            color: #7c3aed;
        }
        .station-mode-card.mode-flashcards:hover {
            border-color: rgba(124, 58, 237, 0.45) !important;
        }

        /* 4. Найди ошибку (Crimson / Coral Audit) */
        .station-mode-card.mode-find_error .station-mode-badge {
            background: rgba(225, 29, 72, 0.08);
            border: 1px solid rgba(225, 29, 72, 0.22);
            color: #e11d48;
        }
        .station-mode-card.mode-find_error:hover {
            border-color: rgba(225, 29, 72, 0.45) !important;
        }

        /* 5. Тренировка устной сдачи (Sky / Cyan / Voice) */
        .station-mode-card.mode-oral .station-mode-badge {
            background: rgba(2, 132, 199, 0.08);
            border: 1px solid rgba(2, 132, 199, 0.22);
            color: #0284c7;
        }
        .station-mode-card.mode-oral:hover {
            border-color: rgba(2, 132, 199, 0.45) !important;
        }

        /* Dark mode adjustments for badges */
        body:not(.theme-nordic):not(.theme-samgmu-white):not(.theme-medictest-white) .station-mode-card.mode-simulator .station-mode-badge {
            background: rgba(59, 130, 246, 0.15);
            border-color: rgba(59, 130, 246, 0.3);
            color: #60a5fa;
        }
        body:not(.theme-nordic):not(.theme-samgmu-white):not(.theme-medictest-white) .station-mode-card.mode-reorder .station-mode-badge {
            background: rgba(16, 185, 129, 0.15);
            border-color: rgba(16, 185, 129, 0.3);
            color: #34d399;
        }
        body:not(.theme-nordic):not(.theme-samgmu-white):not(.theme-medictest-white) .station-mode-card.mode-flashcards .station-mode-badge {
            background: rgba(168, 85, 247, 0.15);
            border-color: rgba(168, 85, 247, 0.3);
            color: #c084fc;
        }
        body:not(.theme-nordic):not(.theme-samgmu-white):not(.theme-medictest-white) .station-mode-card.mode-find_error .station-mode-badge {
            background: rgba(244, 63, 94, 0.15);
            border-color: rgba(244, 63, 94, 0.3);
            color: #fb7185;
        }
        body:not(.theme-nordic):not(.theme-samgmu-white):not(.theme-medictest-white) .station-mode-card.mode-oral .station-mode-badge {
            background: rgba(14, 165, 233, 0.15);
            border-color: rgba(14, 165, 233, 0.3);
            color: #38bdf8;
        }

        /* === Mode Titles Contrast Fixes === */
        .cases-mode-title {
            color: #ffb700 !important;
        }
        .osce-mode-title {
            color: #4facfe !important;
        }
        .blocks-mode-title {
            color: #38bdf8 !important;
            background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%) !important;
            -webkit-background-clip: text !important;
            -webkit-text-fill-color: transparent !important;
            display: inline-block;
        }
        .infinite-mode-title {
            color: #ff9f43 !important;
            background: linear-gradient(135deg, #ffffff 0%, #ff9f43 100%) !important;
            -webkit-background-clip: text !important;
            -webkit-text-fill-color: transparent !important;
            display: inline-block;
        }

        /* Light themes overrides for mode titles */
        body.theme-nordic .cases-mode-title,
        body.theme-samgmu-white .cases-mode-title,
        body.theme-medictest-white .cases-mode-title {
            color: #b45309 !important;
            background: none !important;
            -webkit-text-fill-color: #b45309 !important;
        }
        body.theme-nordic .osce-mode-title,
        body.theme-samgmu-white .osce-mode-title,
        body.theme-medictest-white .osce-mode-title {
            color: #0284c7 !important;
            background: none !important;
            -webkit-text-fill-color: #0284c7 !important;
        }
        body.theme-nordic .blocks-mode-title,
        body.theme-samgmu-white .blocks-mode-title,
        body.theme-medictest-white .blocks-mode-title {
            color: #0284c7 !important;
            background: none !important;
            -webkit-text-fill-color: #0284c7 !important;
        }
        body.theme-nordic .infinite-mode-title,
        body.theme-samgmu-white .infinite-mode-title,
        body.theme-medictest-white .infinite-mode-title {
            color: #d97706 !important;
            background: none !important;
            -webkit-text-fill-color: #d97706 !important;
        }

        .mode-btn.blocks-mode-btn {
            border-color: rgba(0, 210, 255, 0.3) !important;
            background: linear-gradient(135deg, rgba(0, 210, 255, 0.05) 0%, rgba(58, 123, 213, 0.05) 100%) !important;
        }
        body.theme-nordic .mode-btn.blocks-mode-btn,
        body.theme-samgmu-white .mode-btn.blocks-mode-btn,
        body.theme-medictest-white .mode-btn.blocks-mode-btn {
            border-color: rgba(2, 132, 199, 0.25) !important;
            background: #ffffff !important;
            box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
        }
        body.theme-nordic .mode-btn.blocks-mode-btn:hover,
        body.theme-samgmu-white .mode-btn.blocks-mode-btn:hover,
        body.theme-medictest-white .mode-btn.blocks-mode-btn:hover {
            border-color: #0284c7 !important;
            background: rgba(2, 132, 199, 0.04) !important;
        }

.station-mode-badge {
    padding: 6px 12px; border-radius: 20px; font-size: 0.78rem; font-weight: 600;
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer; transition: all 0.2s ease;
    border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.04); color: var(--text-main);
}
.flashcard-container { perspective: 1000px; width: 100%; min-height: 260px; margin: 20px 0; cursor: pointer; }
.flashcard-inner { 
    position: relative; 
    width: 100%; 
    height: 100%; 
    min-height: 260px; 
    text-align: center; 
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1); 
    transform-style: preserve-3d; 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); 
    border-radius: 18px; 
}
.flashcard-container.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-front, .flashcard-back { 
    position: absolute; 
    width: 100%; 
    height: 100%; 
    min-height: 260px; 
    -webkit-backface-visibility: hidden; 
    backface-visibility: hidden; 
    border-radius: 18px; 
    padding: 28px 24px; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    box-sizing: border-box; 
}

/* Light theme default / adaptive */
.flashcard-front { 
    background: #ffffff; 
    border: 1.5px solid #cbd5e1; 
    color: #0f172a; 
    box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.08);
}
.flashcard-front #fcFrontText {
    color: #0f172a !important;
}
.flashcard-back { 
    background: linear-gradient(145deg, #f0fdf4, #ffffff); 
    border: 1.5px solid #86efac; 
    color: #064e3b; 
    transform: rotateY(180deg); 
    box-shadow: 0 8px 24px -4px rgba(16, 185, 129, 0.12);
}
.flashcard-back #fcBackText {
    color: #0f172a !important;
}

/* Dark theme overrides */
body:not(.theme-samgmu-white):not(.theme-medictest-white):not(.theme-nordic) .flashcard-inner {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
body:not(.theme-samgmu-white):not(.theme-medictest-white):not(.theme-nordic) .flashcard-front { 
    background: linear-gradient(145deg, #1e293b, #0f172a); 
    border: 1px solid rgba(56, 189, 248, 0.35); 
    color: #f8fafc; 
}
body:not(.theme-samgmu-white):not(.theme-medictest-white):not(.theme-nordic) .flashcard-front #fcFrontText {
    color: #f8fafc !important;
}
body:not(.theme-samgmu-white):not(.theme-medictest-white):not(.theme-nordic) .flashcard-back { 
    background: linear-gradient(145deg, #064e3b, #0f172a); 
    border: 1px solid rgba(52, 211, 153, 0.4); 
    color: #f1f5f9; 
    transform: rotateY(180deg); 
}
body:not(.theme-samgmu-white):not(.theme-medictest-white):not(.theme-nordic) .flashcard-back #fcBackText {
    color: #f1f5f9 !important;
}
/* =========================================================
   SEQUENCE BUILDER (REORDER MODE) — MODERN VECTOR UI
   ========================================================= */

.reorder-header-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--card-border);
}

.reorder-title-box {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.reorder-icon-badge {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.12) 0%, rgba(14, 165, 233, 0.06) 100%);
    border: 1px solid rgba(2, 132, 199, 0.25);
    color: var(--accent-teal, #0284c7);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.1);
}

.reorder-title {
    color: var(--text-main);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.reorder-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.4;
}

.reorder-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    background: var(--input-bg, #ffffff);
    color: var(--text-muted);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.reorder-back-btn:hover {
    color: var(--text-main);
    border-color: var(--accent-teal, #0284c7);
    background: rgba(2, 132, 199, 0.05);
    transform: translateX(-2px);
}

.reorder-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 22px;
}

@media (max-width: 640px) {
    .reorder-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.reorder-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pool-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.pool-header-label {
    display: flex;
    align-items: center;
    gap: 7px;
}

.pool-source-header {
    color: #0284c7;
}

.pool-target-header {
    color: #059669;
}

.pool-counter-badge {
    font-size: 0.76rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
    letter-spacing: 0;
}

.pool-counter-badge.source {
    background: rgba(2, 132, 199, 0.1);
    color: #0284c7;
    border: 1px solid rgba(2, 132, 199, 0.22);
}

.pool-counter-badge.target {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.reorder-pool-container {
    min-height: 280px;
    max-height: 480px;
    overflow-y: auto;
    padding: 12px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
    transition: background-color 0.2s, border-color 0.2s;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.4) transparent;
}

.reorder-pool-container::-webkit-scrollbar {
    width: 6px;
}
.reorder-pool-container::-webkit-scrollbar-track {
    background: transparent;
}
.reorder-pool-container::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 9999px;
}
.reorder-pool-container::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.6);
}

.source-pool {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.02);
}

body.theme-nordic .source-pool,
body.theme-samgmu-white .source-pool,
body.theme-medictest-white .source-pool {
    background: #f8fafc !important;
    border: 1.5px solid #e2e8f0 !important;
}

.target-pool {
    background: linear-gradient(180deg, #f0fdf4 0%, #f8fafc 100%);
    border: 2px dashed #86efac;
}

body.theme-nordic .target-pool,
body.theme-samgmu-white .target-pool,
body.theme-medictest-white .target-pool {
    background: linear-gradient(180deg, #f0fdf4 0%, #f8fafc 100%) !important;
    border: 2px dashed #86efac !important;
}

/* Dark theme overrides for pools */
body:not(.theme-samgmu-white):not(.theme-medictest-white):not(.theme-nordic) .source-pool {
    background: rgba(15, 23, 42, 0.45);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
}

body:not(.theme-samgmu-white):not(.theme-medictest-white):not(.theme-nordic) .target-pool {
    background: rgba(16, 185, 129, 0.04);
    border: 2px dashed rgba(16, 185, 129, 0.35);
}

/* Empty Placeholders */
.pool-empty-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    min-height: 240px;
    gap: 10px;
    padding: 20px;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.4;
    user-select: none;
}

.pool-empty-placeholder.waiting svg {
    color: #10b981;
    opacity: 0.7;
    animation: gentleBounce 2s infinite ease-in-out;
}

.pool-empty-placeholder.done svg {
    color: #0284c7;
    opacity: 0.8;
}

@keyframes gentleBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

/* Step Items */
.reorder-item {
    padding: 12px 14px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    transition: all 0.18s cubic-bezier(0.2, 0, 0, 1);
    box-sizing: border-box;
    position: relative;
}

.source-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
}

body.theme-nordic .source-item,
body.theme-samgmu-white .source-item,
body.theme-medictest-white .source-item {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
}

body:not(.theme-samgmu-white):not(.theme-medictest-white):not(.theme-nordic) .source-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.source-item:hover {
    transform: translateY(-2px);
    border-color: #0284c7 !important;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.14) !important;
}

.source-item:hover .step-action-badge.add {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

.step-grip-icon {
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.source-item:hover .step-grip-icon {
    color: #0284c7;
}

.step-text {
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--text-main);
    font-weight: 500;
    flex: 1;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.step-action-badge {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.18s ease;
}

.step-action-badge.add {
    background: rgba(2, 132, 199, 0.08);
    color: #0284c7;
    border: 1px solid rgba(2, 132, 199, 0.2);
}

/* Selected Items (Sequence) */
.selected-item {
    background: #ffffff;
    border: 1.5px solid #10b981;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.12);
}

body.theme-nordic .selected-item,
body.theme-samgmu-white .selected-item,
body.theme-medictest-white .selected-item {
    background: #ffffff !important;
    border: 1.5px solid #10b981 !important;
}

body:not(.theme-samgmu-white):not(.theme-medictest-white):not(.theme-nordic) .selected-item {
    background: rgba(16, 185, 129, 0.08);
    border: 1.5px solid #10b981;
}

.selected-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.2) !important;
}

.step-order-badge {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 8px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(16, 185, 129, 0.3);
}

.step-action-badge.remove {
    background: rgba(100, 116, 139, 0.08);
    color: #64748b;
    border: 1px solid rgba(100, 116, 139, 0.15);
}

.selected-item:hover .step-action-badge.remove {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fca5a5;
    transform: scale(1.08);
}

/* Action Buttons */
.reorder-actions-bar {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.reorder-btn-check {
    flex: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
    transition: all 0.18s cubic-bezier(0.2, 0, 0, 1);
}

.reorder-btn-check:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
    filter: brightness(1.05);
}

.reorder-btn-check:active {
    transform: translateY(1px);
}

.reorder-btn-reset {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    background: var(--input-bg, #ffffff);
    color: var(--text-main);
    border: 1.5px solid var(--card-border, #cbd5e1);
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.2, 0, 0, 1);
}

.reorder-btn-reset:hover {
    background: var(--input-bg);
    border-color: var(--accent-teal);
    color: var(--accent-teal);
    transform: translateY(-1.5px);
}

.reorder-btn-reset:active {
    transform: translateY(1px);
}

/* Feedback Cards */
.reorder-feedback-area {
    margin-top: 16px;
}

.reorder-feedback-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 14px;
    line-height: 1.45;
}

.reorder-feedback-card.success {
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    color: #166534;
}

.reorder-feedback-card.error {
    background: #fef2f2;
    border: 1.5px solid #fca5a5;
    color: #991b1b;
}

body:not(.theme-samgmu-white):not(.theme-medictest-white):not(.theme-nordic) .reorder-feedback-card.success {
    background: rgba(16, 185, 129, 0.12) !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
    color: #34d399 !important;
}

body:not(.theme-samgmu-white):not(.theme-medictest-white):not(.theme-nordic) .reorder-feedback-card.error {
    background: rgba(239, 68, 68, 0.12) !important;
    border-color: rgba(239, 68, 68, 0.35) !important;
    color: #f87171 !important;
}

/* === Station Simulator & Common OSCE Interactive Components === */
.option-btn {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text-main);
    border: 1px solid var(--card-border);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.18s ease;
}
.option-btn:hover:not(:disabled) {
    border-color: var(--accent-teal);
    transform: translateY(-1px);
}
.option-btn.correct {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: #10b981 !important;
    color: var(--text-main) !important;
}
.option-btn.wrong {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: #ef4444 !important;
    color: var(--text-main) !important;
}

.station-start-btn {
    background: linear-gradient(135deg, #0d76b1 0%, #1e40af 100%) !important;
    color: #ffffff !important;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.station-start-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 118, 177, 0.35);
}

#oralTimerDisplay {
    color: #be185d;
    background: rgba(190, 24, 93, 0.12);
    border: 1px solid rgba(190, 24, 93, 0.3);
}
body:not(.theme-samgmu-white):not(.theme-medictest-white):not(.theme-nordic) #oralTimerDisplay {
    color: #f472b6 !important;
    background: rgba(244, 114, 182, 0.15) !important;
    border: 1px solid rgba(244, 114, 182, 0.35) !important;
}


.reorder-fb-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.reorder-fb-icon.success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.reorder-fb-icon.error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}
.error-audit-card { padding: 14px 18px; border-radius: 12px; background: var(--input-bg); border: 1px solid var(--card-border); margin-bottom: 10px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.error-audit-card:hover { border-color: rgba(255, 100, 100, 0.4); background: rgba(255,100,100,0.04); }
.error-audit-card.flagged { border-color: #ef4444; background: rgba(239, 68, 68, 0.15); }
.pdf-modal-backdrop { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.85); backdrop-filter: blur(8px); z-index: 10000; display: none; align-items: center; justify-content: center; padding: 20px; box-sizing: border-box; }
.pdf-modal-container { width: 100%; max-width: 950px; height: 90vh; background: #12141d; border: 1px solid rgba(255,255,255,0.12); border-radius: 20px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,0.7); }

        /* Responsive styles for clinical cases screen */
        .cases-play-container {
            flex: 1;
            display: flex;
            overflow: hidden;
            min-height: 0;
            flex-direction: row;
        }
        .cases-play-left-col {
            width: 42%;
            border-right: 1px solid var(--card-border);
            background: rgba(0,0,0,0.02);
            padding: 25px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 20px;
            min-height: 0;
        }
        .cases-play-right-col {
            width: 58%;
            padding: 25px 30px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 20px;
            min-height: 0;
            justify-content: flex-start;
        }

        @media (max-width: 900px) {
            .cases-play-container {
                flex-direction: column !important;
                overflow-y: auto !important;
            }
            .cases-play-left-col {
                width: 100% !important;
                border-right: none !important;
                border-bottom: 1px solid var(--card-border) !important;
                overflow-y: visible !important;
                min-height: auto !important;
                padding: 15px !important;
            }
            .cases-play-right-col {
                width: 100% !important;
                overflow-y: visible !important;
                min-height: auto !important;
                padding: 15px !important;
            }
        }

        /* Force Mobile Layout Styles (one column layout regardless of viewport width) */
        .cases-play-container.force-mobile {
            flex-direction: column !important;
            overflow-y: auto !important;
        }
        .cases-play-container.force-mobile .cases-play-left-col {
            width: 100% !important;
            border-right: none !important;
            border-bottom: 1px solid var(--card-border) !important;
            overflow-y: visible !important;
            min-height: auto !important;
            padding: 15px !important;
        }
        .cases-play-container.force-mobile .cases-play-right-col {
            width: 100% !important;
            overflow-y: visible !important;
            min-height: auto !important;
            padding: 15px !important;
        }

        /* Black text for AI responses in light themes (Nordic Frost, SamGMU White, MedicTest White) */
        body.theme-nordic #aiResponseText,
        body.theme-nordic #dbBrowserAiResponseText,
        body.theme-nordic #casesAiResponseText,
        body.theme-nordic .search-ai-response,
        body.theme-nordic .review-ai-res,
        body.theme-nordic #aiExplanationText,
        body.theme-nordic .ai-explanation,
        body.theme-nordic .ai-content,
        body.theme-nordic .ai-box,
        body.theme-nordic .modal-content #aiExplanationText,
        body.theme-samgmu-white #aiResponseText,
        body.theme-samgmu-white #dbBrowserAiResponseText,
        body.theme-samgmu-white #casesAiResponseText,
        body.theme-samgmu-white .search-ai-response,
        body.theme-samgmu-white .review-ai-res,
        body.theme-samgmu-white #aiExplanationText,
        body.theme-samgmu-white .ai-explanation,
        body.theme-samgmu-white .ai-content,
        body.theme-samgmu-white .ai-box,
        body.theme-samgmu-white .modal-content #aiExplanationText,
        body.theme-medictest-white #aiResponseText,
        body.theme-medictest-white #dbBrowserAiResponseText,
        body.theme-medictest-white #casesAiResponseText,
        body.theme-medictest-white .search-ai-response,
        body.theme-medictest-white .review-ai-res,
        body.theme-medictest-white #aiExplanationText,
        body.theme-medictest-white .ai-explanation,
        body.theme-medictest-white .ai-content,
        body.theme-medictest-white .ai-box,
        body.theme-medictest-white .modal-content #aiExplanationText,
        body.theme-nordic #aiResponseText *,
        body.theme-samgmu-white #aiResponseText *,
        body.theme-medictest-white #aiResponseText *,
        body.theme-nordic #dbBrowserAiResponseText *,
        body.theme-samgmu-white #dbBrowserAiResponseText *,
        body.theme-medictest-white #dbBrowserAiResponseText *,
        body.theme-nordic .search-ai-response *,
        body.theme-samgmu-white .search-ai-response *,
        body.theme-medictest-white .search-ai-response *,
        body.theme-nordic .review-ai-res *,
        body.theme-samgmu-white .review-ai-res *,
        body.theme-medictest-white .review-ai-res * {
            color: #0f172a !important;
        }

        body.theme-nordic .search-ai-response,
        body.theme-samgmu-white .search-ai-response,
        body.theme-medictest-white .search-ai-response,
        body.theme-nordic .review-ai-res,
        body.theme-samgmu-white .review-ai-res,
        body.theme-medictest-white .review-ai-res {
            background: rgba(2, 132, 199, 0.08) !important;
            border-left-color: #0284c7 !important;
        }


/* ==========================================================================
   COMPREHENSIVE BLACK TEXT OVERRIDES FOR LIGHT THEMES (Nordic Frost, Медицинская Белая, МедикТест Белая)
   ========================================================================== */
body.theme-nordic .explanation-box,
body.theme-nordic .explanation-text,
body.theme-nordic .explanation-academic,
body.theme-nordic .explanation-academic *,
body.theme-nordic .term-item,
body.theme-nordic .term-item *,
body.theme-nordic #explanationText,
body.theme-nordic #explanationText *,
body.theme-nordic #dbBrowserExplanationText,
body.theme-nordic #dbBrowserExplanationText *,
body.theme-nordic #aiResponseText,
body.theme-nordic #aiResponseText *,
body.theme-nordic #dbBrowserAiResponseText,
body.theme-nordic #dbBrowserAiResponseText *,
body.theme-nordic #casesAiResponseText,
body.theme-nordic #casesAiResponseText *,
body.theme-nordic .search-ai-response,
body.theme-nordic .search-ai-response *,
body.theme-nordic .review-ai-res,
body.theme-nordic .review-ai-res *,
body.theme-nordic #aiExplanationText,
body.theme-nordic #aiExplanationText *,
body.theme-nordic .ai-explanation,
body.theme-nordic .ai-explanation *,
body.theme-nordic .ai-content,
body.theme-nordic .ai-content *,
body.theme-nordic .ai-box,
body.theme-nordic .ai-box *,

body.theme-samgmu-white .explanation-box,
body.theme-samgmu-white .explanation-text,
body.theme-samgmu-white .explanation-academic,
body.theme-samgmu-white .explanation-academic *,
body.theme-samgmu-white .term-item,
body.theme-samgmu-white .term-item *,
body.theme-samgmu-white #explanationText,
body.theme-samgmu-white #explanationText *,
body.theme-samgmu-white #dbBrowserExplanationText,
body.theme-samgmu-white #dbBrowserExplanationText *,
body.theme-samgmu-white #aiResponseText,
body.theme-samgmu-white #aiResponseText *,
body.theme-samgmu-white #dbBrowserAiResponseText,
body.theme-samgmu-white #dbBrowserAiResponseText *,
body.theme-samgmu-white #casesAiResponseText,
body.theme-samgmu-white #casesAiResponseText *,
body.theme-samgmu-white .search-ai-response,
body.theme-samgmu-white .search-ai-response *,
body.theme-samgmu-white .review-ai-res,
body.theme-samgmu-white .review-ai-res *,
body.theme-samgmu-white #aiExplanationText,
body.theme-samgmu-white #aiExplanationText *,
body.theme-samgmu-white .ai-explanation,
body.theme-samgmu-white .ai-explanation *,
body.theme-samgmu-white .ai-content,
body.theme-samgmu-white .ai-content *,
body.theme-samgmu-white .ai-box,
body.theme-samgmu-white .ai-box *,

body.theme-medictest-white .explanation-box,
body.theme-medictest-white .explanation-text,
body.theme-medictest-white .explanation-academic,
body.theme-medictest-white .explanation-academic *,
body.theme-medictest-white .term-item,
body.theme-medictest-white .term-item *,
body.theme-medictest-white #explanationText,
body.theme-medictest-white #explanationText *,
body.theme-medictest-white #dbBrowserExplanationText,
body.theme-medictest-white #dbBrowserExplanationText *,
body.theme-medictest-white #aiResponseText,
body.theme-medictest-white #aiResponseText *,
body.theme-medictest-white #dbBrowserAiResponseText,
body.theme-medictest-white #dbBrowserAiResponseText *,
body.theme-medictest-white #casesAiResponseText,
body.theme-medictest-white #casesAiResponseText *,
body.theme-medictest-white .search-ai-response,
body.theme-medictest-white .search-ai-response *,
body.theme-medictest-white .review-ai-res,
body.theme-medictest-white .review-ai-res *,
body.theme-medictest-white #aiExplanationText,
body.theme-medictest-white #aiExplanationText *,
body.theme-medictest-white .ai-explanation,
body.theme-medictest-white .ai-explanation *,
body.theme-medictest-white .ai-content,
body.theme-medictest-white .ai-content *,
body.theme-medictest-white .ai-box,
body.theme-medictest-white .ai-box * {
    color: #0f172a !important;
}

body.theme-nordic .term-item,
body.theme-samgmu-white .term-item,
body.theme-medictest-white .term-item {
    background: rgba(2, 132, 199, 0.06) !important;
}

/* ==========================================================================
   THEME SELECTOR PREVIEW CARDS (WCAG AAA Contrast Guarantee in Modals)
   ========================================================================== */

/* Базовые стили карточки выбора темы */
.theme-select-btn {
    position: relative !important;
    border-radius: 12px !important;
    padding: 12px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    align-items: flex-start !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    outline: none !important;
    text-align: left !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* ТЕМНЫЕ ТЕМЫ: текст ВСЕГДА чистый белый с микро-тенью для идеальной читаемости */
.theme-select-btn[data-theme="deepspace"] span:first-child,
.theme-select-btn[data-theme="mint"] span:first-child,
.theme-select-btn[data-theme="amoled"] span:first-child,
.theme-select-btn[data-theme="sunset"] span:first-child,
.theme-select-btn[data-theme="forest"] span:first-child,
.theme-select-btn[data-theme="ocean"] span:first-child,
.theme-select-btn[data-theme="royal"] span:first-child,
.theme-select-btn[data-theme="samgmu"] span:first-child,
.theme-select-btn[data-theme="medictest"] span:first-child,
body.theme-nordic .modal-content .theme-select-btn[data-theme="deepspace"] span:first-child,
body.theme-nordic .modal-content .theme-select-btn[data-theme="mint"] span:first-child,
body.theme-nordic .modal-content .theme-select-btn[data-theme="amoled"] span:first-child,
body.theme-nordic .modal-content .theme-select-btn[data-theme="sunset"] span:first-child,
body.theme-nordic .modal-content .theme-select-btn[data-theme="forest"] span:first-child,
body.theme-nordic .modal-content .theme-select-btn[data-theme="ocean"] span:first-child,
body.theme-nordic .modal-content .theme-select-btn[data-theme="royal"] span:first-child,
body.theme-nordic .modal-content .theme-select-btn[data-theme="samgmu"] span:first-child,
body.theme-nordic .modal-content .theme-select-btn[data-theme="medictest"] span:first-child,
body.theme-samgmu-white .modal-content .theme-select-btn[data-theme="deepspace"] span:first-child,
body.theme-samgmu-white .modal-content .theme-select-btn[data-theme="mint"] span:first-child,
body.theme-samgmu-white .modal-content .theme-select-btn[data-theme="amoled"] span:first-child,
body.theme-samgmu-white .modal-content .theme-select-btn[data-theme="sunset"] span:first-child,
body.theme-samgmu-white .modal-content .theme-select-btn[data-theme="forest"] span:first-child,
body.theme-samgmu-white .modal-content .theme-select-btn[data-theme="ocean"] span:first-child,
body.theme-samgmu-white .modal-content .theme-select-btn[data-theme="royal"] span:first-child,
body.theme-samgmu-white .modal-content .theme-select-btn[data-theme="samgmu"] span:first-child,
body.theme-samgmu-white .modal-content .theme-select-btn[data-theme="medictest"] span:first-child,
body.theme-medictest-white .modal-content .theme-select-btn[data-theme="deepspace"] span:first-child,
body.theme-medictest-white .modal-content .theme-select-btn[data-theme="mint"] span:first-child,
body.theme-medictest-white .modal-content .theme-select-btn[data-theme="amoled"] span:first-child,
body.theme-medictest-white .modal-content .theme-select-btn[data-theme="sunset"] span:first-child,
body.theme-medictest-white .modal-content .theme-select-btn[data-theme="forest"] span:first-child,
body.theme-medictest-white .modal-content .theme-select-btn[data-theme="ocean"] span:first-child,
body.theme-medictest-white .modal-content .theme-select-btn[data-theme="royal"] span:first-child,
body.theme-medictest-white .modal-content .theme-select-btn[data-theme="samgmu"] span:first-child,
body.theme-medictest-white .modal-content .theme-select-btn[data-theme="medictest"] span:first-child {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45) !important;
}

/* СВЕТЛЫЕ ТЕМЫ: текст ВСЕГДА строгий темно-синий/графитовый */
.theme-select-btn[data-theme="nordic"] span:first-child,
.theme-select-btn[data-theme="samgmu-white"] span:first-child,
.theme-select-btn[data-theme="medictest-white"] span:first-child,
body.theme-nordic .modal-content .theme-select-btn[data-theme="nordic"] span:first-child,
body.theme-nordic .modal-content .theme-select-btn[data-theme="samgmu-white"] span:first-child,
body.theme-nordic .modal-content .theme-select-btn[data-theme="medictest-white"] span:first-child,
body.theme-samgmu-white .modal-content .theme-select-btn[data-theme="nordic"] span:first-child,
body.theme-samgmu-white .modal-content .theme-select-btn[data-theme="samgmu-white"] span:first-child,
body.theme-samgmu-white .modal-content .theme-select-btn[data-theme="medictest-white"] span:first-child,
body.theme-medictest-white .modal-content .theme-select-btn[data-theme="nordic"] span:first-child,
body.theme-medictest-white .modal-content .theme-select-btn[data-theme="samgmu-white"] span:first-child,
body.theme-medictest-white .modal-content .theme-select-btn[data-theme="medictest-white"] span:first-child {
    color: #1e293b !important;
    text-shadow: none !important;
}

/* Оформление карточек в белых темах — объем, чистый контраст и границы */
body.theme-samgmu-white .theme-select-btn,
body.theme-medictest-white .theme-select-btn,
body.theme-nordic .theme-select-btn {
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
    border: 1.5px solid rgba(15, 23, 42, 0.22) !important;
}

body.theme-samgmu-white .theme-select-btn[data-theme="nordic"],
body.theme-samgmu-white .theme-select-btn[data-theme="samgmu-white"],
body.theme-samgmu-white .theme-select-btn[data-theme="medictest-white"],
body.theme-medictest-white .theme-select-btn[data-theme="nordic"],
body.theme-medictest-white .theme-select-btn[data-theme="samgmu-white"],
body.theme-medictest-white .theme-select-btn[data-theme="medictest-white"],
body.theme-nordic .theme-select-btn[data-theme="nordic"],
body.theme-nordic .theme-select-btn[data-theme="samgmu-white"],
body.theme-nordic .theme-select-btn[data-theme="medictest-white"] {
    background: #ffffff !important;
    border: 1.5px solid rgba(13, 118, 177, 0.25) !important;
    box-shadow: 0 2px 6px rgba(13, 118, 177, 0.08), inset 0 1px 0 rgba(255, 255, 255, 1) !important;
}

/* Индикация активной темы (Active State) */
.theme-select-btn.active,
body.theme-samgmu-white .theme-select-btn[data-theme="samgmu-white"],
body.theme-medictest-white .theme-select-btn[data-theme="medictest-white"],
body.theme-nordic .theme-select-btn[data-theme="nordic"],
body.theme-samgmu .theme-select-btn[data-theme="samgmu"],
body.theme-medictest .theme-select-btn[data-theme="medictest"] {
    border-color: #0d76b1 !important;
    box-shadow: 0 0 0 3px rgba(13, 118, 177, 0.35), 0 4px 12px rgba(13, 118, 177, 0.2) !important;
    transform: translateY(-1px) scale(1.01) !important;
}

/* Точки-свотчи цветов */
.theme-select-btn div span {
    display: inline-block !important;
    flex-shrink: 0 !important;
}

/* ==========================================================================
   Milestone M3: Standalone License Key & Tariff Modal Styles (Mandate 8d)
   ========================================================================== */

/* --- License Input & Login Overlay Enhancements --- */
.auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent-teal);
    background: rgba(0, 242, 254, 0.08);
    border: 1px solid rgba(0, 242, 254, 0.25);
    border-radius: 20px;
    padding: 4px 12px;
    margin-bottom: 12px;
}

.login-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.paste-btn {
    background: none;
    border: none;
    color: var(--accent-teal);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s ease, color 0.15s ease;
}

.paste-btn:hover {
    background: rgba(0, 242, 254, 0.12);
}

#license-input {
    font-family: 'Outfit', 'Courier New', monospace;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
    font-size: 1.05rem;
    text-align: center;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(15, 23, 42, 0.7);
    border-radius: 10px;
    color: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
    box-sizing: border-box;
}

#license-input:focus {
    border-color: var(--accent-teal);
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.25);
}

.device-binding-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 4px 0 14px 0;
}

.auth-footer-divider {
    position: relative;
    text-align: center;
    margin: 18px 0 14px 0;
}

.auth-footer-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

.auth-footer-divider span {
    position: relative;
    background: #1e293b;
    padding: 0 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.buy-access-btn {
    width: 100%;
    padding: 11px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(0, 242, 254, 0.35);
    border-radius: 8px;
    color: var(--accent-teal);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.buy-access-btn:hover {
    background: rgba(0, 242, 254, 0.12);
    border-color: var(--accent-teal);
    transform: translateY(-1px);
}

.auth-support-link {
    margin-top: 14px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.auth-support-link a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s ease;
}

.auth-support-link a:hover {
    color: var(--accent-teal);
    text-decoration: underline;
}

/* --- Header Toolbar Button (Strict 36px, Mandate 8d) --- */
#headerTariffBtn {
    height: 36px;
    background: rgba(0, 242, 254, 0.08);
    border: 1px solid rgba(0, 242, 254, 0.3);
    border-radius: 8px;
    color: var(--accent-teal);
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

#pwaInstallBtn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    padding: 0 !important;
    justify-content: center !important;
    align-items: center !important;
}
#pwaInstallBtn:hover {
    background: rgba(0, 242, 254, 0.18);
    border-color: var(--accent-teal);
    transform: translateY(-1px);
}

#headerTariffBtn:hover {
    background: rgba(0, 242, 254, 0.18);
    border-color: var(--accent-teal);
    transform: translateY(-1px);
}

@media (max-width: 520px) {
    .tariff-label-text {
        display: none;
    }
    #headerTariffBtn {
        width: 36px;
        padding: 0;
        justify-content: center;
    }
}

/* --- Tariff Modal Styles --- */
.tariff-modal-content {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.tariff-card {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.tariff-card:hover {
    border-color: var(--accent-teal);
    transform: translateY(-2px);
}

.tariff-card.selected {
    border-color: var(--accent-teal) !important;
    box-shadow: 0 0 16px rgba(0, 242, 254, 0.15);
}

.select-tariff-btn {
    transition: all 0.2s ease;
}

.select-tariff-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

/* Light theme overrides for license and tariff modals */
body.theme-samgmu-white #license-input,
body.theme-medictest-white #license-input {
    background: #f8fafc;
    color: #0f172a;
    border-color: #cbd5e1;
}

body.theme-samgmu-white .auth-footer-divider span,
body.theme-medictest-white .auth-footer-divider span {
    background: #ffffff;
    color: #64748b;
}

body.theme-samgmu-white .tariff-card,
body.theme-medictest-white .tariff-card {
    background: #ffffff !important;
}

body.theme-samgmu-white #buyerEmail,
body.theme-samgmu-white #buyerTelegram,
body.theme-medictest-white #buyerEmail,
body.theme-medictest-white #buyerTelegram {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}

/* =========================================================
   DUOLINGO-STYLE 3D BUTTONS (Milestone 1)
   ========================================================= */

.btn-3d {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-weight: 700;
    border: none;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.08s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.08s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.15s ease;
    text-decoration: none;
    box-sizing: border-box;
}

.btn-3d:active {
    transform: translateY(3px) !important;
}

.btn-3d-primary {
    background: linear-gradient(180deg, #00d2ff 0%, #0088cc 100%);
    color: #ffffff !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 4px 0 #005f8c;
}

.btn-3d-primary:hover {
    filter: brightness(1.08);
}

.btn-3d-primary:active {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 0 #005f8c;
}

.btn-3d-emerald {
    background: linear-gradient(180deg, #10b981 0%, #059669 100%);
    color: #ffffff !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 0 #047857;
}

.btn-3d-emerald:hover {
    filter: brightness(1.08);
}

.btn-3d-emerald:active {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 0 #047857;
}

.btn-3d-amber {
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 4px 0 #b45309;
}

.btn-3d-amber:hover {
    filter: brightness(1.08);
}

.btn-3d-amber:active {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 0 #b45309;
}

.btn-3d-purple {
    background: linear-gradient(180deg, #a855f7 0%, #7c3aed 100%);
    color: #ffffff !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 0 #5b21b6;
}

.btn-3d-purple:hover {
    filter: brightness(1.08);
}

.btn-3d-purple:active {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 0 #5b21b6;
}

.btn-3d-secondary {
    background: linear-gradient(180deg, #242b38 0%, #171d28 100%);
    color: #f3f4f6 !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 4px 0 #0e121a;
}

.btn-3d-secondary:hover {
    filter: brightness(1.1);
}

.btn-3d-secondary:active {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 0 #0e121a;
}


