/* ============================================
   classroom.css — mschool Classroom UI
   Dark theme, RTL, mobile-first
   ============================================ */

:root {
    --bg: #0b0919;
    --surface: #141028;
    --card: #1c1838;
    --card-hover: #241f48;
    --card-active: #2c2658;
    --border: #2a2555;
    --border-light: #352f65;
    --border-active: #6c5ce7;
    --text: #ffffff;
    --text-secondary: #d0cce5;
    --text-muted: #c8c3de;
    --text-dim: #4a4570;
    --primary: #6c5ce7;
    --primary-hover: #7d6ff0;
    --primary-bg: rgba(108, 92, 231, 0.12);
    --gold: #f0c040;
    --gold-bg: rgba(240, 192, 64, 0.1);
    --green: #2ecc71;
    --green-bg: rgba(46, 204, 113, 0.1);
    --green-border: rgba(46, 204, 113, 0.25);
    --red: #e74c3c;
    --red-bg: rgba(231, 76, 60, 0.1);
    --orange: #f39c12;
    --blue: #5b9bf5;
    --blue-bg: rgba(91, 155, 245, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 5px;
    --max-width: 720px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

body {
    font-family: 'Heebo', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ── */
.cr-header { padding: 1.8rem 0 1rem; text-align: center; }
.cr-logo { font-size: 1.6rem; font-weight: 900; letter-spacing: -0.5px; margin-bottom: 0.15rem; }
.cr-logo span { color: var(--gold); }
.cr-tagline { font-size: 0.88rem; color: var(--text-secondary); font-weight: 300; }

/* ── Screens ── */
.cr-screen { display: none; flex-direction: column; }
.cr-screen.active { display: flex; }
@keyframes crFadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================
   Upload Screen
   ============================================ */

.cr-source-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.2rem; }
.cr-source-tab {
    flex: 1; padding: 0.7rem; background: var(--card); border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); text-align: center; cursor: pointer;
    transition: all 0.2s var(--ease); font-size: 0.88rem; font-weight: 500; color: var(--text-secondary);
}
.cr-source-tab:hover { border-color: var(--border-light); background: var(--card-hover); }
.cr-source-tab.active { border-color: var(--primary); background: var(--primary-bg); color: var(--text); }
.cr-source-tab .tab-icon { display: block; font-size: 1.4rem; margin-bottom: 0.25rem; }

/* Dropzone */
.cr-dropzone {
    border: 2px dashed var(--border); border-radius: var(--radius); padding: 2.5rem 1.5rem;
    text-align: center; cursor: pointer; transition: all 0.25s var(--ease);
    background: var(--surface); position: relative; overflow: hidden;
}
.cr-dropzone:hover, .cr-dropzone.dragover { border-color: var(--primary); background: var(--primary-bg); }
.cr-dropzone.dragover { transform: scale(1.01); }
.cr-dropzone.has-file { border-color: var(--green-border); background: var(--green-bg); border-style: solid; }
.cr-drop-icon { font-size: 2.8rem; margin-bottom: 0.5rem; display: block; opacity: 0.7; }
.cr-drop-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.3rem; }
.cr-drop-subtitle { font-size: 0.82rem; color: var(--text-muted); }

.cr-file-info { display: none; align-items: center; gap: 0.6rem; justify-content: center; }
.cr-dropzone.has-file .cr-drop-placeholder { display: none; }
.cr-dropzone.has-file .cr-file-info { display: flex; }
.cr-file-name { font-weight: 500; font-size: 0.9rem; color: var(--green); }
.cr-file-size { font-family: 'IBM Plex Mono', monospace; font-size: 0.78rem; color: var(--text-muted); }
.cr-file-remove { background: none; border: none; color: var(--red); cursor: pointer; font-size: 1.1rem; padding: 0.2rem; opacity: 0.7; transition: opacity 0.2s; }
.cr-file-remove:hover { opacity: 1; }
.cr-file-input { display: none; }

/* Options */
.cr-options { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.8rem; }
.cr-option-group { display: flex; flex-direction: column; gap: 0.35rem; }
.cr-option-label { font-size: 0.82rem; color: var(--text-secondary); font-weight: 500; }
.cr-num-pills { display: flex; gap: 0.4rem; }
.cr-num-pill {
    flex: 1; padding: 0.55rem; background: var(--card); border: 1.5px solid var(--border);
    border-radius: var(--radius-xs); text-align: center; cursor: pointer;
    font-size: 0.88rem; font-weight: 500; color: var(--text-secondary); transition: all 0.2s;
}
.cr-num-pill:hover { border-color: var(--border-light); }
.cr-num-pill.active { border-color: var(--primary); background: var(--primary-bg); color: var(--text); }

.cr-title-input {
    width: 100%; padding: 0.6rem 0.8rem; background: var(--card); border: 1.5px solid var(--border);
    border-radius: var(--radius-xs); color: var(--text); font-family: 'Heebo', sans-serif;
    font-size: 0.88rem; outline: none; transition: border-color 0.2s; direction: rtl;
}
.cr-title-input::placeholder { color: var(--text-dim); }
.cr-title-input:focus { border-color: var(--primary); }

/* Generate Button */
.cr-generate-btn {
    margin-top: 1.2rem; padding: 0.85rem;
    background: linear-gradient(135deg, var(--primary) 0%, #8b7cf0 100%);
    border: none; border-radius: var(--radius-sm); color: #fff;
    font-family: 'Heebo', sans-serif; font-size: 1rem; font-weight: 700;
    cursor: pointer; transition: all 0.2s var(--ease); position: relative; overflow: hidden;
}
.cr-generate-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(108, 92, 231, 0.35); }
.cr-generate-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.cr-generate-btn .btn-spinner {
    display: none; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff; border-radius: 50%; animation: crSpin 0.7s linear infinite;
    margin-left: 0.5rem; vertical-align: middle;
}
.cr-generate-btn.loading .btn-text { opacity: 0.7; }
.cr-generate-btn.loading .btn-spinner { display: inline-block; }
@keyframes crSpin { to { transform: rotate(360deg); } }

/* ============================================
   Loading Screen
   ============================================ */

.cr-loading {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1.5rem; padding: 3rem 1rem; text-align: center;
}
.cr-loading-spinner { width: 56px; height: 56px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: crSpin 0.8s linear infinite; }
.cr-loading-title { font-size: 1.15rem; font-weight: 700; }
.cr-loading-status { font-size: 0.88rem; color: var(--text-secondary); min-height: 1.4em; }
.cr-loading-steps { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; width: 100%; max-width: 320px; }
.cr-loading-step { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; color: var(--text-dim); transition: color 0.3s; }
.cr-loading-step.active { color: var(--text-secondary); }
.cr-loading-step.done { color: var(--green); }
.cr-loading-step .step-icon { width: 20px; text-align: center; flex-shrink: 0; }

/* ============================================
   Results Screen — Success + Mode Grid
   ============================================ */

/* ── Success Banner ── */
.cr-success-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem 1.3rem;
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.08) 0%, rgba(46, 204, 113, 0.03) 100%);
    border: 1px solid var(--green-border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    animation: crFadeIn 0.5s var(--ease);
}

.cr-success-check {
    width: 44px;
    height: 44px;
    background: var(--green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
    animation: crPop 0.4s var(--ease) 0.2s both;
}

@keyframes crPop {
    0% { transform: scale(0); }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.cr-success-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.cr-success-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.1rem;
}

/* ── Stats Row ── */
.cr-stats-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
}

.cr-stat {
    flex: 1;
    text-align: center;
    padding: 0.6rem 0.4rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.cr-stat-num {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--gold);
    line-height: 1.2;
}

.cr-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
    display: block;
}

/* ── Mode Section ── */
.cr-mode-section {
    margin-bottom: 1.2rem;
}

.cr-mode-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.7rem;
    text-align: center;
    color: var(--text);
}

.cr-mode-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
}

.cr-mode-card {
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 0.9rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    position: relative;
    overflow: hidden;
}

.cr-mode-card:hover:not(.locked) {
    border-color: var(--primary);
    background: var(--card-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(108, 92, 231, 0.15);
}

.cr-mode-card.selected {
    border-color: var(--primary);
    background: var(--primary-bg);
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.3);
}

.cr-mode-card.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.cr-mode-icon {
    font-size: 2rem;
    margin-bottom: 0.3rem;
    display: block;
}

.cr-mode-name {
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.cr-mode-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.cr-mode-lock {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    font-size: 0.65rem;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    color: var(--text-dim);
}

/* ── Bottom Actions ── */
.cr-bottom-actions {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
    padding-top: 0.5rem;
}

.cr-text-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: 'Heebo', sans-serif;
    font-size: 0.82rem;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-xs);
    transition: all 0.2s;
}

.cr-text-btn:hover {
    color: var(--text);
    background: var(--card);
}

/* ============================================
   Question Editor (collapsible)
   ============================================ */

.cr-questions-editor {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s var(--ease);
    border-top: 1px solid transparent;
    margin-top: 0;
}

.cr-questions-editor.open {
    max-height: none; overflow-y: auto;
    border-top-color: var(--border);
    margin-top: 1rem;
    padding-top: 1rem;
}

.cr-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}

.cr-editor-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.cr-editor-close {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.cr-editor-close:hover {
    color: var(--text);
    border-color: var(--border-light);
    background: var(--card);
}

/* ── Type tabs ── */
.cr-type-tabs { display: flex; gap: 0.35rem; margin-bottom: 0.8rem; overflow-x: auto; }
.cr-type-tab {
    padding: 0.4rem 0.7rem; background: var(--card); border: 1.5px solid var(--border);
    border-radius: var(--radius-xs); font-size: 0.78rem; font-weight: 500;
    color: var(--text-secondary); cursor: pointer; white-space: nowrap; transition: all 0.2s;
}
.cr-type-tab:hover { border-color: var(--border-light); }
.cr-type-tab.active { border-color: var(--primary); background: var(--primary-bg); color: var(--text); }
.cr-type-tab .tab-count { font-family: 'IBM Plex Mono', monospace; font-size: 0.7rem; margin-right: 0.3rem; opacity: 0.7; }

/* ── Question Cards ── */
.cr-questions-list {
    display: flex; flex-direction: column; gap: 0.5rem; }

.cr-qcard {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 0.85rem 1rem; transition: all 0.2s; position: relative;
}
.cr-qcard:hover { border-color: var(--border-light); background: var(--card-hover); }

.cr-qcard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.4rem; }
.cr-qcard-num { font-family: 'IBM Plex Mono', monospace; font-size: 0.7rem; color: var(--text-dim); background: var(--surface); padding: 0.12rem 0.35rem; border-radius: 3px; flex-shrink: 0; }
.cr-qcard-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }

.cr-qcard-btn {
    background: none; border: 1px solid transparent; color: var(--text-dim);
    cursor: pointer; font-size: 0.8rem; padding: 0.15rem 0.3rem; border-radius: 4px; transition: all 0.15s;
}
.cr-qcard-btn:hover { color: var(--text); border-color: var(--border); background: var(--surface); }
.cr-qcard-btn.delete:hover { color: var(--red); border-color: rgba(231,76,60,0.3); }

.cr-qcard-question { font-size: 0.88rem; font-weight: 500; line-height: 1.5; margin-bottom: 0.5rem; }

.cr-qcard-options { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 0.4rem; }
.cr-qcard-option {
    display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--text-secondary);
    padding: 0.25rem 0.45rem; border-radius: var(--radius-xs); background: var(--surface);
}
.cr-qcard-option.correct { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.cr-qcard-option .opt-letter { font-family: 'IBM Plex Mono', monospace; font-weight: 500; font-size: 0.72rem; opacity: 0.6; width: 1.1em; flex-shrink: 0; }

.cr-qcard-tf-badge { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 0.12rem 0.45rem; border-radius: 4px; margin-bottom: 0.35rem; }
.cr-qcard-tf-badge.true { background: var(--green-bg); color: var(--green); }
.cr-qcard-tf-badge.false { background: var(--red-bg); color: var(--red); }

.cr-qcard-match { display: flex; align-items: baseline; gap: 0.5rem; }
.cr-qcard-concept { font-weight: 600; color: var(--gold); font-size: 0.88rem; flex-shrink: 0; }
.cr-qcard-definition { font-size: 0.82rem; color: var(--text-secondary); }

.cr-qcard-difficulty { font-size: 0.68rem; padding: 0.08rem 0.35rem; border-radius: 3px; font-weight: 500; margin-right: 0.3rem; }
.cr-qcard-difficulty.easy { background: var(--green-bg); color: var(--green); }
.cr-qcard-difficulty.medium { background: rgba(243,156,18,0.1); color: var(--orange); }
.cr-qcard-difficulty.hard { background: var(--red-bg); color: var(--red); }

.cr-qcard-explain { font-size: 0.78rem; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 0.4rem; margin-top: 0.4rem; line-height: 1.45; }
.cr-qcard-explain::before { content: '💡 '; font-size: 0.72rem; }

/* ── Error ── */
.cr-error { background: var(--red-bg); border: 1px solid rgba(231, 76, 60, 0.25); border-radius: var(--radius-sm); padding: 0.8rem 1rem; margin-bottom: 1rem; display: none; }
.cr-error.visible { display: block; }
.cr-error-text { font-size: 0.88rem; color: var(--red); }

/* ============================================
   Responsive — App-Quality Mobile Experience
   ============================================ */

/* ── Base mobile enhancements ── */
html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

/* Prevent iOS zoom on input focus (needs 16px minimum) */
input, select, textarea {
    font-size: max(0.88rem, 16px);
}

/* Safe area padding for notch devices */
body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Respect motion preferences */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Touch-friendly base rules ── */
button, .cr-source-tab, .cr-num-pill, .cr-mode-card, .cr-text-btn,
.cr-type-tab, .cr-qcard-btn, .cr-subject-option {
    -webkit-tap-highlight-color: transparent;
}

/* Active states for touch (replaces hover on mobile) */
@media (hover: none) {
    .cr-source-tab:active { border-color: var(--border-light); background: var(--card-hover); }
    .cr-num-pill:active { border-color: var(--border-light); }
    .cr-mode-card:active:not(.locked) {
        border-color: var(--primary);
        background: var(--card-hover);
        transform: scale(0.97);
    }
    .cr-mode-card:hover:not(.locked) { transform: none; box-shadow: none; }
    .cr-text-btn:active { color: var(--text); background: var(--card); }
    .cr-type-tab:active { border-color: var(--border-light); }
    .cr-generate-btn:hover:not(:disabled) { transform: none; box-shadow: none; }
    .cr-generate-btn:active:not(:disabled) { transform: scale(0.98); }
}

/* ── Small phones (up to 480px) ── */
@media (max-width: 480px) {
    #app {
        padding: 0 0.75rem;
        padding-bottom: env(safe-area-inset-bottom, 0.5rem);
    }

    /* Header */
    .cr-header { padding: 1rem 0 0.6rem; }
    .cr-logo { font-size: 1.3rem; }
    .cr-tagline { font-size: 0.82rem; }

    /* Upload source tabs */
    .cr-source-tabs { gap: 0.4rem; }
    .cr-source-tab {
        padding: 0.75rem 0.5rem;
        font-size: 0.82rem;
        min-height: 44px;
    }
    .cr-source-tab .tab-icon { font-size: 1.2rem; }

    /* Dropzone */
    .cr-dropzone { padding: 1.8rem 1rem; }
    .cr-drop-icon { font-size: 2.2rem; }
    .cr-drop-title { font-size: 0.92rem; }

    /* Number pills */
    .cr-num-pills { gap: 0.35rem; }
    .cr-num-pill {
        padding: 0.65rem 0.3rem;
        font-size: 0.85rem;
        min-height: 44px;
    }

    /* Generate button */
    .cr-generate-btn {
        padding: 0.95rem;
        font-size: 1rem;
        min-height: 50px;
        border-radius: var(--radius);
    }

    /* Stats row */
    .cr-stats-row { gap: 0.35rem; }
    .cr-stat { padding: 0.5rem 0.3rem; }
    .cr-stat-num { font-size: 1.15rem; }
    .cr-stat-label { font-size: 0.68rem; }

    /* Mode grid */
    .cr-mode-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    .cr-mode-card {
        padding: 0.9rem 0.6rem;
        min-height: 100px;
    }
    .cr-mode-icon { font-size: 1.5rem; }
    .cr-mode-name { font-size: 0.85rem; }
    .cr-mode-desc { font-size: 0.68rem; }

    /* Bottom actions */
    .cr-bottom-actions { gap: 0.8rem; }
    .cr-text-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
        min-height: 44px;
    }

    /* Question cards */
    .cr-qcard { padding: 0.7rem 0.8rem; }
    .cr-qcard-question { font-size: 0.85rem; }
    .cr-qcard-option { padding: 0.35rem 0.5rem; font-size: 0.78rem; }
    .cr-qcard-actions { gap: 0.15rem; }
    .cr-qcard-btn {
        padding: 0.3rem 0.4rem;
        font-size: 0.85rem;
        min-width: 32px;
        min-height: 32px;
    }

    /* Type tabs horizontal scroll */
    .cr-type-tabs {
        gap: 0.3rem;
        padding-bottom: 0.3rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .cr-type-tabs::-webkit-scrollbar { display: none; }
    .cr-type-tab {
        padding: 0.5rem 0.7rem;
        min-height: 38px;
    }

    /* Editor */
    .cr-editor-close {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }

    /* Paste area */
    .cr-paste-textarea { min-height: 160px; }

    /* Subject banner */
    .cr-subject-options { gap: 0.35rem; }
    .cr-subject-option {
        padding: 0.55rem 0.9rem;
        font-size: 0.82rem;
        min-height: 40px;
    }

    /* Error */
    .cr-error { padding: 0.7rem 0.85rem; }

    /* Loading */
    .cr-loading { padding: 2rem 1rem; gap: 1.2rem; }
    .cr-loading-spinner { width: 48px; height: 48px; }
    .cr-loading-title { font-size: 1.05rem; }
}

/* ── Regular phones / small tablets (481-767px) ── */
@media (min-width: 481px) and (max-width: 767px) {
    .cr-mode-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
    .cr-mode-card { min-height: 110px; }
    .cr-generate-btn { min-height: 48px; }
    .cr-num-pill { min-height: 44px; }
    .cr-text-btn { min-height: 44px; }
}

/* ── Tablets and up (768px+) ── */
@media (min-width: 600px) {
    .cr-mode-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
    .cr-source-tabs { gap: 0.6rem; }
    .cr-source-tab { padding: 0.8rem 0.7rem; }
    .cr-stats-row { gap: 0.6rem; }
    .cr-stat { padding: 0.7rem 0.5rem; }
}

/* ── Subject Confirmation Banner ── */
.cr-subject-banner {
    background: rgba(108, 92, 231, 0.08);
    border: 1px solid rgba(108, 92, 231, 0.25);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    text-align: center;
}
.cr-subject-msg {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.75);
    margin-bottom: 0.5rem;
}
.cr-subject-msg strong {
    color: var(--primary, #6c5ce7);
}
.cr-subject-options {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}
.cr-subject-option {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 0.2s;
}
.cr-subject-option:hover {
    border-color: var(--primary, #6c5ce7);
    color: #fff;
}
.cr-subject-option.active {
    background: var(--primary, #6c5ce7);
    border-color: var(--primary, #6c5ce7);
    color: #fff;
    font-weight: 600;
}

/* ── Question list scroll fix ── */
.cr-questions-editor.open .cr-questions-list {
    max-height: 70vh;
    overflow-y: auto;
    padding-bottom: 2rem;
    -webkit-overflow-scrolling: touch;
}


/* ============================================
   Paste Text Area
   ============================================ */

.cr-paste-area {
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 1rem;
    transition: border-color 0.2s;
}

.cr-paste-area:focus-within {
    border-color: rgba(108, 92, 231, 0.5);
    background: rgba(108, 92, 231, 0.03);
}

.cr-paste-textarea {
    width: 100%;
    min-height: 200px;
    max-height: 400px;
    background: transparent;
    border: none;
    outline: none;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    line-height: 1.7;
    resize: vertical;
    font-family: inherit;
    direction: inherit;
}

.cr-paste-textarea::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.cr-paste-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.cr-paste-count {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    font-variant-numeric: tabular-nums;
}

.cr-paste-count.ok {
    color: rgba(46, 204, 113, 0.7);
}

.cr-paste-count.over {
    color: rgba(231, 76, 60, 0.9);
    font-weight: 600;
}

.cr-paste-hint {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.2);
}

/* RTL adjustments */
[dir="rtl"] .cr-paste-textarea {
    text-align: right;
}

[dir="rtl"] .cr-paste-footer {
    flex-direction: row-reverse;
}
