        :root {
            --bg-dark: #1E1E1E;
            --bg-gray: #525252;
            --accent-brown: #614000;
            --accent-gold: #D39B05;
            --accent-bright: #FEAE02;
        }
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
            background: var(--bg-dark);
            min-height: 100vh;
            color: #e0e0e0;
        }

        .app-wrap {
            display: flex;
            min-height: 100vh;
        }

        /* Collapsible sidebar (hamburger menu) */
        .sidebar {
            width: 260px;
            background: var(--bg-dark);
            border-right: 1px solid var(--bg-gray);
            flex-shrink: 0;
            transition: width 0.25s ease, transform 0.25s ease;
            overflow: hidden;
            display: flex;
            flex-direction: column;
        }
        .sidebar.collapsed {
            width: 0;
            min-width: 0;
            border-right: none;
            overflow: hidden;
        }

        .sidebar-header {
            padding: 16px;
            display: flex;
            align-items: center;
            gap: 12px;
            border-bottom: 1px solid var(--bg-gray);
            flex-shrink: 0;
        }
        .hamburger-btn {
            width: 44px;
            height: 44px;
            border: none;
            border-radius: 8px;
            background: var(--bg-gray);
            color: var(--accent-bright);
            cursor: pointer;
            font-size: 1.4em;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            transition: background 0.2s;
        }
        .hamburger-btn:hover {
            background: var(--accent-brown);
            color: var(--accent-bright);
        }
        .sidebar-title {
            font-size: 1.1em;
            font-weight: 600;
            color: var(--accent-bright);
            white-space: nowrap;
        }

        .sidebar-nav {
            flex: 1;
            padding: 12px 0;
            overflow-y: auto;
        }
        .sidebar-nav .tab {
            display: block;
            width: 100%;
            padding: 14px 20px;
            text-align: left;
            cursor: pointer;
            background: transparent;
            border: none;
            font-size: 1em;
            font-weight: 500;
            color: #b0b0b0;
            transition: all 0.2s;
            border-left: 3px solid transparent;
        }
        .sidebar-nav .tab:hover {
            background: var(--bg-gray);
            color: var(--accent-bright);
        }
        .sidebar-nav .tab.active {
            color: var(--accent-bright);
            border-left-color: var(--accent-bright);
            background: rgba(254, 174, 2, 0.08);
        }

        .main-area {
            flex: 1;
            display: flex;
            flex-direction: column;
            min-width: 0;
            min-height: 100vh;
            background: var(--bg-gray);
        }

        .hamburger-float {
            position: fixed;
            left: 12px;
            top: 12px;
            z-index: 102;
            width: 44px;
            height: 44px;
            border: none;
            border-radius: 8px;
            background: var(--accent-gold);
            color: var(--bg-dark);
            cursor: pointer;
            font-size: 1.4em;
            display: none;
            align-items: center;
            justify-content: center;
            box-shadow: 0 2px 8px rgba(0,0,0,0.3);
        }
        .hamburger-float:hover {
            background: var(--accent-bright);
        }
        .sidebar.collapsed ~ .main-area .hamburger-float {
            display: flex;
        }

        .container {
            flex: 1;
            margin: 0;
            background: var(--bg-gray);
            border-radius: 0;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            min-height: 0;
        }

        .header {
            background: var(--accent-brown);
            color: #f0e6d2;
            padding: 20px 24px;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .header-top {
            display: flex;
            justify-content: flex-end;
            align-items: center;
            min-height: 24px;
        }

        #userBar {
            font-size: 0.95em;
            text-align: right;
            word-break: break-word;
            overflow-wrap: anywhere;
            max-width: 100%;
        }

        .header-main {
            text-align: center;
        }

        .header h1 {
            font-size: 1.8em;
            margin-bottom: 6px;
        }

        .header p {
            opacity: 0.9;
            font-size: 0.95em;
        }

        .stats-bar {
            display: flex;
            justify-content: space-around;
            align-items: stretch;
            flex-wrap: wrap;
            gap: 12px;
            padding: 16px;
            background: var(--bg-dark);
            border-bottom: 1px solid var(--bg-gray);
        }

        .stat-item {
            text-align: center;
        }

        .stat-value {
            font-size: 1.6em;
            font-weight: bold;
            color: var(--accent-bright);
        }

        .stat-label {
            color: #a0a0a0;
            font-size: 0.85em;
            margin-top: 4px;
        }

        .tabs {
            display: none;
        }

        .tab-content {
            display: none;
            padding: 24px;
            flex: 1;
            min-height: 0;
            overflow: auto;
            background: var(--bg-gray);
            color: #e0e0e0;
        }

        .tab-content.active {
            display: block;
        }

        #tab1.tab-content {
            padding: 20px;
            min-height: 0;
            overflow: hidden;
            display: none;
        }
        #tab1.tab-content.active {
            display: flex;
            flex-direction: column;
        }

        /* Download Status Tab */
        .search-box {
            margin-bottom: 16px;
            padding: 12px 14px;
            border: 1px solid var(--bg-gray);
            background: var(--bg-dark);
            color: #e0e0e0;
            border-radius: 8px;
            font-size: 1em;
            width: 100%;
        }

        .status-filters {
            display: flex;
            gap: 10px;
            margin-bottom: 16px;
            flex-wrap: wrap;
        }

        .filter-btn {
            padding: 8px 14px;
            border: 1px solid var(--bg-gray);
            background: var(--bg-dark);
            color: #c0c0c0;
            border-radius: 20px;
            cursor: pointer;
            transition: all 0.2s;
            font-size: 0.9em;
        }

        .filter-btn:hover {
            border-color: var(--accent-gold);
            color: var(--accent-bright);
        }

        .filter-btn.active {
            background: var(--accent-gold);
            color: var(--bg-dark);
            border-color: var(--accent-gold);
        }

        .videos-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 16px;
        }

        .videos-table th {
            background: var(--bg-dark);
            padding: 12px 14px;
            text-align: left;
            font-weight: 600;
            color: var(--accent-bright);
            border-bottom: 1px solid var(--bg-gray);
        }

        .videos-table td {
            padding: 12px 14px;
            border-bottom: 1px solid rgba(82,82,82,0.6);
            color: #d0d0d0;
        }

        .videos-table tr:hover {
            background: rgba(254, 174, 2, 0.06);
        }

        .status-badge {
            display: inline-block;
            padding: 4px 10px;
            border-radius: 16px;
            font-size: 0.85em;
            font-weight: 600;
        }

        .status-completed {
            background: rgba(211, 155, 5, 0.3);
            color: var(--accent-bright);
        }

        .status-pending {
            background: rgba(254, 174, 2, 0.2);
            color: #e0c060;
        }

        .status-failed {
            background: rgba(220, 53, 69, 0.25);
            color: #e88;
        }

        .status-skipped {
            background: var(--bg-gray);
            color: #a0a0a0;
        }

        .file-indicator {
            display: inline-block;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            margin-right: 6px;
        }

        .file-exists {
            background: var(--accent-bright);
        }

        .file-missing {
            background: #a04040;
        }

        /* Transcriptions Tab - split: left scrolls, right fixed */
        .transcriptions-split {
            display: flex;
            gap: 20px;
            flex: 1;
            min-height: 0;
            overflow: hidden;
            align-items: flex-start;
        }
        .transcriptions-left {
            flex: 1;
            min-width: 0;
            min-height: 0;
            max-height: calc(100dvh - 260px);
            overflow-y: auto;
            overflow-x: hidden;
        }
        .transcriptions-left-hint {
            margin: 0 0 12px 0;
            color: #a0a0a0;
        }
        .transcriptions-right {
            flex: 0 0 50%;
            width: 50%;
            max-width: 50%;
            min-width: 0;
            display: flex;
            flex-direction: column;
            background: var(--bg-dark);
            border-radius: 8px;
            overflow: hidden;
            border: 1px solid var(--bg-gray);
            min-height: 0;
            height: auto;
            align-self: flex-start;
            --video-aspect-ratio: 16 / 9;
            position: sticky;
            top: 12px;
        }
        .transcriptions-right-placeholder {
            width: 100%;
            aspect-ratio: var(--video-aspect-ratio);
            height: auto;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #808080;
            font-size: 1em;
            padding: 24px;
            text-align: center;
        }
        .transcription-youtube-wrap {
            width: 100%;
            aspect-ratio: var(--video-aspect-ratio);
            height: auto;
            background: #000;
            display: flex;
            align-items: stretch;
            margin: 0 auto;
        }
        .transcription-youtube-wrap iframe {
            width: 100%;
            height: 100%;
            border: none;
            flex: 1;
        }
        .transcription-list {
            display: flex;
            flex-direction: column;
            gap: 15px;
            /* no flex:1 or overflow - natural height so items are always visible and clickable */
        }

        .transcription-item {
            border: 1px solid var(--bg-gray);
            border-radius: 8px;
            overflow: hidden;
            transition: all 0.2s;
            background: var(--bg-dark);
        }

        .transcription-item:hover {
            border-color: var(--accent-gold);
            box-shadow: 0 2px 8px rgba(254, 174, 2, 0.15);
        }

        .transcription-header {
            padding: 16px 20px;
            background: var(--bg-dark);
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            user-select: none;
            border-bottom: 1px solid transparent;
        }

        .transcription-header:hover {
            background: rgba(82, 82, 82, 0.4);
        }

        .transcription-title {
            font-weight: 600;
            font-size: 1.05em;
            color: #e0e0e0;
        }

        .transcription-meta {
            display: flex;
            gap: 12px;
            align-items: center;
            color: #a0a0a0;
            font-size: 0.9em;
        }

        .transcription-toggle {
            font-size: 1.3em;
            color: var(--accent-bright);
            transition: transform 0.3s;
        }

        .transcription-item.expanded .transcription-toggle {
            transform: rotate(180deg);
        }

        .transcription-content {
            display: none;
            padding: 16px 20px;
            background: var(--bg-gray);
            max-height: 600px;
            overflow-y: auto;
            white-space: pre-wrap;
            font-family: 'Courier New', monospace;
            font-size: 0.95em;
            line-height: 1.6;
            color: #d0d0d0;
        }

        .transcription-item.expanded .transcription-content {
            display: block;
        }

        .transcription-chunk {
            margin-bottom: 12px;
            padding: 12px;
            background: var(--bg-dark);
            border-left: 4px solid var(--accent-gold);
            border-radius: 4px;
            color: #d0d0d0;
        }

        .transcription-chunk-header {
            font-weight: 600;
            color: var(--accent-bright);
            margin-bottom: 6px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.95em;
        }

        .chunk-actions {
            display: flex;
            gap: 6px;
        }

        .edit-btn, .delete-btn {
            background: var(--accent-gold);
            color: var(--bg-dark);
            border: none;
            padding: 4px 10px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 0.85em;
            transition: background 0.2s;
        }

        .edit-btn:hover {
            background: var(--accent-bright);
        }

        .delete-btn {
            background: #8b4040;
            color: #f0d0d0;
        }

        .delete-btn:hover {
            background: #a05050;
        }

        .chunk-content {
            white-space: pre-wrap;
            word-wrap: break-word;
            line-height: 1.5;
            margin-top: 5px;
        }

        .chunk-editor {
            margin-top: 5px;
        }

        .chunk-edit-textarea {
            width: 100%;
            min-height: 100px;
            max-height: 300px;
            padding: 8px;
            border: 1px solid var(--accent-gold);
            background: var(--bg-dark);
            color: #e0e0e0;
            border-radius: 4px;
            font-family: inherit;
            font-size: 0.9em;
            resize: vertical;
            box-sizing: border-box;
            line-height: 1.4;
        }

        .chunk-edit-actions {
            margin-top: 6px;
            display: flex;
            gap: 6px;
        }

        .chunk-edit-actions .btn {
            padding: 6px 12px;
            font-size: 0.85em;
        }

        /* GraphRAG Tab */
        .query-container {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        .nl-query-input {
            font-size: 1em;
            transition: border-color 0.3s;
        }

        .nl-query-input:focus {
            outline: none;
            border-color: var(--accent-gold);
            box-shadow: 0 0 0 2px rgba(254, 174, 2, 0.2);
        }

        .query-input-wrapper {
            position: relative;
        }

        .query-input {
            min-height: 200px;
            padding: 15px;
            border: 1px solid var(--bg-gray);
            border-radius: 8px;
            font-family: 'Courier New', monospace;
            font-size: 1em;
            resize: vertical;
            background: var(--bg-dark);
            color: #d4d4d4;
            tab-size: 2;
        }

        .query-input:focus {
            outline: none;
            border-color: var(--accent-gold);
        }

        /* Cypher syntax highlighting colors */
        .query-input::selection {
            background: #264f78;
        }

        .query-actions {
            display: flex;
            gap: 10px;
        }

        .btn {
            padding: 12px 24px;
            border: none;
            border-radius: 8px;
            font-size: 1em;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
        }

        .btn-primary {
            background: var(--accent-gold);
            color: var(--bg-dark);
        }

        .btn-primary:hover {
            background: var(--accent-bright);
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(254, 174, 2, 0.3);
        }

        .btn-secondary {
            background: var(--bg-gray);
            color: #e0e0e0;
            border: 1px solid var(--accent-brown);
        }

        .btn-secondary:hover {
            background: var(--accent-brown);
            color: var(--accent-bright);
        }

        .query-results {
            margin-top: 20px;
            padding: 20px;
            border: 1px solid var(--bg-gray);
            border-radius: 8px;
            background: var(--bg-dark);
            min-height: 400px;
            max-height: 800px;
            overflow: hidden;
            position: relative;
            color: #d0d0d0;
        }

        .query-results.empty {
            color: #808080;
            text-align: center;
            padding: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .query-results pre {
            background: var(--bg-dark);
            color: #d4d4d4;
            padding: 15px;
            border-radius: 4px;
            overflow-x: auto;
            font-family: 'Courier New', monospace;
            font-size: 0.9em;
            line-height: 1.5;
        }

        /* Graph container and related styles removed - no longer using graph visualization */

        .loading {
            display: inline-block;
            width: 20px;
            height: 20px;
            border: 3px solid var(--bg-gray);
            border-top: 3px solid var(--accent-bright);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin-right: 10px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .error-message {
            background: rgba(200, 80, 80, 0.2);
            color: #e8a0a0;
            padding: 15px;
            border-radius: 8px;
            margin-top: 10px;
            border: 1px solid #8b4040;
        }

        .success-message {
            background: rgba(211, 155, 5, 0.2);
            color: var(--accent-bright);
            padding: 15px;
            border-radius: 8px;
            margin-top: 10px;
            border: 1px solid var(--accent-gold);
        }

        .refresh-btn {
            position: fixed;
            bottom: 24px;
            right: 24px;
            min-width: 120px;
            height: 48px;
            border-radius: 999px;
            background: var(--accent-gold);
            color: var(--bg-dark);
            border: none;
            font-size: 1em;
            cursor: pointer;
            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
            transition: all 0.2s;
            z-index: 100;
            display: none;
            align-items: center;
            justify-content: center;
            gap: 8px;
            padding: 0 14px;
            font-weight: 700;
        }

        .refresh-btn:hover {
            background: var(--accent-bright);
            transform: scale(1.05);
            box-shadow: 0 4px 16px rgba(254, 174, 2, 0.4);
        }

        .refresh-btn .refresh-icon {
            font-size: 1.2em;
            line-height: 1;
        }

        @media (max-width: 900px) {
            .header {
                padding: 14px 12px;
            }
            .header-top {
                justify-content: center;
            }
            #userBar {
                text-align: center;
                font-size: 0.9em;
            }
            .header h1 {
                font-size: 1.2em;
                line-height: 1.3;
            }
            .header p {
                font-size: 0.85em;
            }
            .stats-bar {
                justify-content: center;
                padding: 10px;
                gap: 10px;
            }
            .stat-item {
                min-width: 130px;
            }
            .tab-content {
                padding: 12px;
            }
            .transcriptions-split {
                flex-direction: column;
            }
            .transcriptions-right {
                width: 100%;
                max-width: 100%;
                min-height: 220px;
                max-height: 45vh;
                position: static;
                top: auto;
            }
            .transcriptions-left { max-height: none; }
            .refresh-btn {
                right: 12px;
                bottom: 12px;
                min-width: 104px;
                height: 42px;
                font-size: 0.92em;
            }
        }

        @media (max-height: 760px) {
            .header {
                padding-top: 12px;
                padding-bottom: 12px;
                gap: 6px;
            }
            .header h1 {
                font-size: 1.25em;
                margin-bottom: 2px;
            }
            .header p {
                font-size: 0.85em;
            }
            .stats-bar {
                padding-top: 8px;
                padding-bottom: 8px;
            }
            .stat-value {
                font-size: 1.2em;
            }
            .tab-content {
                padding-top: 10px;
                padding-bottom: 10px;
            }
        }
        /* ── Quiz styles ─────────────────────────────────── */
        .quiz-wrap { max-width: 720px; margin: 0 auto; padding: 24px 16px; }
        .quiz-section { margin-bottom: 20px; }
        .quiz-section label { display: block; font-weight: 600; color: var(--accent-bright); margin-bottom: 8px; font-size: 0.9em; text-transform: uppercase; letter-spacing: 0.05em; }
        .quiz-opts { display: flex; flex-wrap: wrap; gap: 8px; }
        .quiz-opt { padding: 8px 16px; border: 1px solid var(--bg-gray); background: var(--bg-dark); color: #c0c0c0; border-radius: 20px; cursor: pointer; font-size: 0.9em; transition: all 0.15s; }
        .quiz-opt:hover { border-color: var(--accent-gold); color: var(--accent-bright); }
        .quiz-opt.active { background: var(--accent-gold); color: var(--bg-dark); border-color: var(--accent-gold); font-weight: 600; }
        .quiz-counts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
        .quiz-count-badge { padding: 4px 10px; border-radius: 12px; font-size: 0.8em; background: var(--bg-gray); color: #a0a0a0; }
        .quiz-count-badge.has-q { color: #6fcf97; background: rgba(111,207,151,0.12); }
        .quiz-count-badge.no-q { color: #eb5757; background: rgba(235,87,87,0.12); }
        .quiz-start-btn { margin-top: 8px; width: 100%; padding: 14px; font-size: 1.05em; font-weight: 700; border-radius: 10px; }

        .quiz-progress-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; font-size: 0.9em; color: #a0a0a0; }
        .quiz-progress-dots { display: flex; gap: 5px; }
        .quiz-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bg-gray); transition: background 0.2s; }
        .quiz-dot.done-right { background: #6fcf97; }
        .quiz-dot.done-wrong  { background: #eb5757; }
        .quiz-dot.current { background: var(--accent-gold); }

        .quiz-card { background: var(--bg-dark); border: 1px solid var(--bg-gray); border-radius: 12px; padding: 24px; }
        .quiz-q-text { font-size: 1.1em; color: #e0e0e0; line-height: 1.6; margin-bottom: 20px; }
        .quiz-options-grid { display: flex; flex-direction: column; gap: 10px; }
        .quiz-opt-btn { padding: 12px 16px; border: 1px solid var(--bg-gray); background: rgba(255,255,255,0.03); color: #d0d0d0; border-radius: 8px; cursor: pointer; text-align: left; font-size: 0.95em; transition: all 0.15s; }
        .quiz-opt-btn:hover:not(:disabled) { border-color: var(--accent-gold); color: var(--accent-bright); background: rgba(254,174,2,0.05); }
        .quiz-opt-btn.correct { border-color: #6fcf97 !important; background: rgba(111,207,151,0.12) !important; color: #6fcf97 !important; }
        .quiz-opt-btn.wrong   { border-color: #eb5757 !important; background: rgba(235,87,87,0.12) !important; color: #eb5757 !important; }
        .quiz-opt-btn:disabled { cursor: default; }

        .quiz-feedback { margin-top: 16px; padding: 12px 14px; border-radius: 8px; font-size: 0.9em; line-height: 1.5; }
        .quiz-feedback.correct { background: rgba(111,207,151,0.1); border-left: 3px solid #6fcf97; color: #a8e6c1; }
        .quiz-feedback.wrong   { background: rgba(235,87,87,0.1);  border-left: 3px solid #eb5757; color: #f0a0a0; }
        .quiz-next-btn { margin-top: 16px; width: 100%; padding: 12px; border-radius: 8px; font-weight: 600; }

        .quiz-summary-card { background: var(--bg-dark); border: 1px solid var(--bg-gray); border-radius: 12px; padding: 32px; text-align: center; }
        .quiz-final-score { font-size: 3em; font-weight: 700; color: var(--accent-bright); margin: 12px 0; }
        .quiz-final-label { color: #a0a0a0; font-size: 0.95em; }
        .quiz-stars { font-size: 1.6em; margin: 8px 0; }
        .quiz-summary-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }

        .quiz-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 16px 0; }
        .quiz-stat-box { background: var(--bg-gray); border-radius: 8px; padding: 14px; text-align: center; }
        .quiz-stat-val { font-size: 1.5em; font-weight: 700; color: var(--accent-bright); }
        .quiz-stat-lbl { font-size: 0.78em; color: #909090; margin-top: 2px; }

        .quiz-add-form { background: var(--bg-dark); border: 1px solid var(--bg-gray); border-radius: 10px; padding: 20px; margin-top: 24px; }
        .quiz-add-form h4 { margin-bottom: 14px; color: var(--accent-bright); }
        .quiz-field { margin-bottom: 12px; }
        .quiz-field label { display: block; font-size: 0.85em; color: #a0a0a0; margin-bottom: 4px; }
        .quiz-field input, .quiz-field textarea, .quiz-field select { width: 100%; padding: 8px 10px; background: #1a1a1a; border: 1px solid var(--bg-gray); border-radius: 6px; color: #e0e0e0; font-size: 0.9em; box-sizing: border-box; }
        .quiz-field textarea { resize: vertical; min-height: 70px; }

        .quiz-admin-list { margin-top: 24px; }
        .quiz-pending-item { border: 1px solid var(--bg-gray); border-radius: 8px; padding: 14px; margin-bottom: 10px; }
        .quiz-pending-item .q-text { font-weight: 500; margin-bottom: 6px; }
        .quiz-pending-item .q-meta { font-size: 0.8em; color: #909090; margin-bottom: 8px; }
        .quiz-pending-item .q-actions { display: flex; gap: 8px; }

        /* ---------- Mobile: tables scroll, controls stack, targets stay tappable ---------- */
        @media (max-width: 860px) {
            /* 6-column video table can't shrink — let it scroll inside its own box. */
            #tab0 { overflow-x: auto; -webkit-overflow-scrolling: touch; }
            .videos-table { min-width: 720px; }

            .status-filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
            .status-filters .filter-btn { flex-shrink: 0; }
            #sortDateBtn { margin-left: 0 !important; }

            .search-box { font-size: 16px; }  /* iOS: <16px zooms the page on focus */

            .quiz-wrap { padding: 12px 4px; }
            .quiz-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
            .quiz-opt { width: 100%; }
            .quiz-opt-btn { padding: 14px 14px; min-height: 48px; }
            .quiz-add-form > div[style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
            .quiz-field input, .quiz-field textarea, .quiz-field select { font-size: 16px; }
            .quiz-summary-actions .btn { flex: 1 1 140px; }
        }

        @media (max-width: 520px) {
            .quiz-opts { grid-template-columns: 1fr; }
            .quiz-final-score { font-size: 2.2em; }
        }

        /* ---------- Quiz: episode hint, source links, quit button ---------- */
        .quiz-hint {
            font-size: 0.82em;
            color: #8a8a8a;
            margin: -6px 0 14px;
        }
        .quiz-quit-btn {
            margin-left: 12px;
            background: transparent;
            border: 1px solid var(--bg-gray);
            color: #909090;
            border-radius: 6px;
            padding: 4px 10px;
            font-size: 0.78em;
            cursor: pointer;
            transition: color 0.15s, border-color 0.15s;
        }
        .quiz-quit-btn:hover { color: #eb5757; border-color: #eb5757; }

        .quiz-source {
            margin-top: 14px;
            padding: 12px 14px;
            border: 1px solid var(--bg-gray);
            border-radius: 8px;
            background: rgba(255,255,255,0.02);
        }
        .quiz-source .qsrc-title {
            font-size: 0.85em;
            color: #c0c0c0;
            margin-bottom: 8px;
            word-break: break-word;
        }
        .quiz-source .qsrc-links { display: flex; flex-wrap: wrap; gap: 10px; }
        .quiz-source .qsrc-links a {
            font-size: 0.82em;
            color: var(--accent-bright);
            text-decoration: none;
            border: 1px solid var(--bg-gray);
            border-radius: 6px;
            padding: 5px 10px;
        }
        .quiz-source .qsrc-links a:hover { border-color: var(--accent-gold); background: rgba(254,174,2,0.06); }

        /* ---------- Question feedback (flag dubious / suggest edit) ---------- */
        .quiz-source .qsrc-links .qsrc-flag {
            font-size: 0.82em;
            color: #b0b0b0;
            background: transparent;
            border: 1px solid var(--bg-gray);
            border-radius: 6px;
            padding: 5px 10px;
            cursor: pointer;
            margin-left: auto;
        }
        .quiz-source .qsrc-links .qsrc-flag:hover { border-color: #eb5757; color: #eb5757; }
        .quiz-source .qsrc-links { align-items: center; }

        .fb-overlay {
            position: fixed; inset: 0; z-index: 9998;
            background: rgba(0,0,0,0.55);
            display: none; align-items: center; justify-content: center;
            padding: 20px;
        }
        .fb-overlay.open { display: flex; }
        .fb-panel {
            width: min(460px, 100%);
            background: #1c1c22;
            border: 1px solid var(--bg-gray);
            border-radius: 12px;
            padding: 20px 22px;
        }
        .fb-panel h3 { margin-bottom: 10px; color: var(--accent-bright); }
        .fb-qtext {
            font-size: 0.86em; color: #c8c8c8;
            background: rgba(255,255,255,0.03);
            border-radius: 8px; padding: 10px 12px; margin-bottom: 14px;
            line-height: 1.5;
        }
        .fb-label { display: block; font-size: 0.82em; color: #a0a0a0; margin: 10px 0 4px; }
        .fb-panel textarea {
            width: 100%; box-sizing: border-box;
            background: #14141a; border: 1px solid var(--bg-gray);
            border-radius: 6px; color: #e0e0e0; padding: 8px 10px;
            font-size: 0.9em; font-family: inherit; resize: vertical;
        }
        .fb-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
        @media (max-width: 520px) {
            .fb-panel textarea { font-size: 16px; }
        }
