/* meow_dark_games.css — comprehensive dark-theme override for the game runtimes.
 * The gamehub/ultraset runtimes inject their own <style> with hard-coded light
 * colours (cream cards, dark text). Those are plain `.x` selectors (spec 0,1,0).
 * Here we prefix every rule with [data-theme="dark"] (spec 0,2,0) so we win over
 * the runtime base rule, but DELIBERATELY tie-lose to runtime state rules like
 * `.x.is-correct` (also 0,2,0, injected later) — so green/red answer feedback is
 * preserved. State backgrounds we DO want to darken use a higher-specificity
 * `[data-theme="dark"] .x.state` (0,3,0).
 *
 * Palette (matches the already-dark "Mix"/code games):
 *   page   #0f1115   card #1a1f2b   soft/elevated #232a38   raised #2a3346
 *   text   #eaecef (white)   muted #b6bcc6
 *   orange #f0c98d (text) / #d99a46 (border)      blue #74b9ff
 *   border #2a3142 / accent #3a4458
 *   correct(dark) bg #15352a brd #1fbf94 txt #4fe6b4
 *   wrong(dark)   bg #3a1f24 brd #ff6b6b txt #ff9aa2
 */

/* ============ FLASHCARDS ============ */
[data-theme="dark"] .gh-flash-card,
[data-theme="dark"] .gh-flash-self-check{background:#1a1f2b;border-color:#2a3142;box-shadow:0 14px 40px rgba(0,0,0,.45);color:#eaecef}
[data-theme="dark"] .gh-flash-question,
[data-theme="dark"] .gh-flash-front,
[data-theme="dark"] .gh-flash-back{color:#eaecef}
/* question box kept a light cream bg in dark mode (only color was overridden) -> darken it */
[data-theme="dark"] .gh-flash-question{background:#222938;border-color:#33405a}
[data-theme="dark"] .gh-flash-pill{background:#2a3346;color:#f0c98d;border-color:#3a4458}
[data-theme="dark"] .gh-flash-option{background:#222938;color:#eaecef;border-color:#33405a;box-shadow:0 8px 22px rgba(0,0,0,.35)}
[data-theme="dark"] .gh-flash-option:hover{border-color:#74b9ff;background:#26314a}
[data-theme="dark"] .gh-flash-mark{background:#2a3346;color:#f0c98d;border-color:#3a4458}
[data-theme="dark"] .gh-flash-input{background:#232a38;color:#eaecef;border-color:#3a4458}
[data-theme="dark"] .gh-flash-answer{background:#15352a;color:#9fe7c4}
[data-theme="dark"] .gh-flash-hint{background:#2a3346;color:#f0c98d}
[data-theme="dark"] .gh-flash-btn.ghost{background:#222938;color:#cdd6ff;border-color:#3a4458}
/* darken light state backgrounds, keep red/green identity */
[data-theme="dark"] .gh-flash-runtime.no-reveal .gh-flash-option.is-correct,
[data-theme="dark"] .gh-flash-runtime.no-reveal .gh-flash-option.is-wrong{background:#222938}
[data-theme="dark"] .gh-flash-input.correct{background:#15352a;border-color:#1fbf94}
[data-theme="dark"] .gh-flash-input.wrong{background:#3a1f24;border-color:#ff6b6b}

/* ============ MATCHING ============ */
[data-theme="dark"] .gh-match-card{background:#1a1f2b;border-color:#2a3142;box-shadow:0 14px 40px rgba(0,0,0,.45);color:#eaecef}
[data-theme="dark"] .gh-match-row{background:#222938;border-color:#33405a}
[data-theme="dark"] .gh-match-slot{background:#1f2735;border-color:#3a4458}
[data-theme="dark"] .gh-match-chip{background:#262f42;color:#eaecef;border-color:#3a4458;box-shadow:0 3px 10px rgba(0,0,0,.35)}
[data-theme="dark"] .gh-match-chip.in-slot{background:#2a3346}
[data-theme="dark"] .gh-match-explain{background:#2a3346;color:#f0c98d;border-color:#3a4458}
/* dark state versions (0,3,0 beats runtime 0,2,0) */
[data-theme="dark"] .gh-match-row.correct{background:#15352a;border-color:#1fbf94}
[data-theme="dark"] .gh-match-row.wrong{background:#3a1f24;border-color:#ff6b6b}
[data-theme="dark"] .gh-match-chip.correct{background:#15352a;border-color:#1fbf94;color:#4fe6b4}
[data-theme="dark"] .gh-match-chip.wrong{background:#3a1f24;border-color:#ff6b6b;color:#ff9aa2}

/* ============ CONCEPT GRAPH ============ */
[data-theme="dark"] .graph-card,
[data-theme="dark"] .gh-concept-runtime .cloud-zone{background:#1a1f2b;border-color:#2a3142;color:#eaecef}
[data-theme="dark"] .gh-concept-runtime .branch-check{background:#d99a46;color:#1a1206}
[data-theme="dark"] .gh-concept-runtime .mode-btn{background:#222938;color:#cdd6ff;border-color:#3a4458}

/* ============ ULTRASET WIDGETS (units / math choice / multiple choice / shuffle) ============ */
[data-theme="dark"] .gh-units-card,
[data-theme="dark"] .gh-math-choice,
[data-theme="dark"] .qm-standalone,
[data-theme="dark"] .gh-shuf-card{background:#1a1f2b;border-color:#2a3142;box-shadow:0 18px 44px rgba(0,0,0,.45);color:#eaecef}
[data-theme="dark"] .gh-units-prompt,
[data-theme="dark"] .gh-math-choice-prompt{background:#232a38;color:#eaecef;border-color:#3a4458}
[data-theme="dark"] .gh-units-option,
[data-theme="dark"] .gh-math-choice-option,
[data-theme="dark"] .mc-option-btn,
[data-theme="dark"] .options .option{background:#222938;color:#eaecef;border-color:#33405a;box-shadow:0 8px 18px rgba(0,0,0,.35)}
[data-theme="dark"] .gh-units-option:hover,
[data-theme="dark"] .gh-math-choice-option:hover,
[data-theme="dark"] .mc-option-btn:hover,
[data-theme="dark"] .options .option:hover{border-color:#74b9ff;background:#26314a}
[data-theme="dark"] .gh-math-choice-mark{background:#2a3346;color:#f0c98d;border-color:#3a4458}
/* selected / state */
[data-theme="dark"] .gh-math-choice-option.selected,
[data-theme="dark"] .gh-units-option.selected,
[data-theme="dark"] .mc-option-btn.selected,
[data-theme="dark"] .options .option.selected{border-color:#d99a46;background:#2c3550}
[data-theme="dark"] .gh-units-option.correct,
[data-theme="dark"] .gh-math-choice-option.correct,
[data-theme="dark"] .mc-option-btn.correct,
[data-theme="dark"] .options .option.correct{background:#15352a;border-color:#1fbf94;color:#4fe6b4}
[data-theme="dark"] .gh-units-option.wrong,
[data-theme="dark"] .gh-math-choice-option.wrong,
[data-theme="dark"] .mc-option-btn.wrong,
[data-theme="dark"] .options .option.wrong{background:#3a1f24;border-color:#ff6b6b;color:#ff9aa2}

/* ============ SWITCHED WORD ============ */
[data-theme="dark"] .gh-sw-shell{background:#161a23;border-color:#2a3142;box-shadow:0 28px 90px rgba(0,0,0,.6)}
[data-theme="dark"] .gh-sw-shell.embedded{background:#1a1f2b}
[data-theme="dark"] .gh-sw-head{background:#1f2735;border-color:#2a3142}
[data-theme="dark"] .gh-sw-shell.embedded .gh-sw-head{background:#222938;border-color:#3a4458}
[data-theme="dark"] .gh-sw-list{background:#161a23}
[data-theme="dark"] .gh-sw-card{background:#1a1f2b;border-color:#2a3142;color:#eaecef;box-shadow:0 12px 28px rgba(0,0,0,.4)}
[data-theme="dark"] .gh-sw-shell.embedded .gh-sw-card{background:#1f2735;border-color:#3a4458}
[data-theme="dark"] .gh-sw-launch{background:#1a1f2b;border-color:#2a3142;color:#eaecef}
[data-theme="dark"] .gh-sw-btn,
[data-theme="dark"] .gh-sw-btn.secondary,
[data-theme="dark"] .gh-sw-btn:hover{background:#2a3346;color:#f0c98d;border-color:#d99a46;box-shadow:0 3px 0 #0f172a,0 12px 22px rgba(0,0,0,.3)}
[data-theme="dark"] .gh-sw-close{background:#3a1f24;color:#ff9aa2;border-color:#ff6b6b}
[data-theme="dark"] .gh-sw-word:hover,
[data-theme="dark"] .gh-sw-word.selected{background:#2c3550;border-color:#74b9ff}
[data-theme="dark"] .gh-sw-shell.embedded .gh-sw-word:hover,
[data-theme="dark"] .gh-sw-shell.embedded .gh-sw-word.selected{background:#3a2c12;border-color:#d99a46}

/* ============ FORMULA CLOZE ============ */
[data-theme="dark"] .gh-formula-input,
[data-theme="dark"] .gh-formula-select{background:#232a38;color:#eaecef;border-color:#3a4458}
[data-theme="dark"] .gh-formula-preview,
[data-theme="dark"] .gh-formula-reveal,
[data-theme="dark"] .gh-formula-status{background:#222938;color:#eaecef;border-color:#33405a}
[data-theme="dark"] .gh-var-row,
[data-theme="dark"] .gh-var-summary-stat{background:#1f2735;border-color:#33405a;color:#eaecef}
[data-theme="dark"] .gh-var-options{background:#1a1f2b;border-color:#3a4458;box-shadow:0 14px 30px rgba(0,0,0,.5)}
[data-theme="dark"] .gh-var-option{background:#222938;color:#eaecef;border-color:#33405a}
[data-theme="dark"] .gh-var-option:hover{background:#26314a;border-color:#74b9ff}
[data-theme="dark"] .gh-formula-input.correct,
[data-theme="dark"] .gh-formula-select.correct,
[data-theme="dark"] .gh-formula-status.ok,
[data-theme="dark"] .gh-var-row.correct{background:#15352a;border-color:#1fbf94;color:#4fe6b4}
[data-theme="dark"] .gh-formula-input.wrong,
[data-theme="dark"] .gh-formula-select.wrong,
[data-theme="dark"] .gh-formula-status.bad,
[data-theme="dark"] .gh-var-row.wrong{background:#3a1f24;border-color:#ff6b6b;color:#ff9aa2}

/* ============ IMAGE HIDE ============ */
[data-theme="dark"] .pichide-preview{background:#1a1f2b;box-shadow:0 18px 46px rgba(0,0,0,.55)}
[data-theme="dark"] .pichide-missing{background:#1a1f2b;color:#b6bcc6}
[data-theme="dark"] .verify-panel{background:#222938;border-color:#3a4458;color:#eaecef}
[data-theme="dark"] .pichide-meta .pill{background:#2a3346;color:#f0c98d}

/* ============ LIBRARY PAGE (game-launch flow) ============ */
[data-theme="dark"] .library-toolbar{background:#1a1f2b;border-color:#2a3142;box-shadow:0 12px 28px rgba(0,0,0,.4)}
[data-theme="dark"] .library-search{background:#232a38;border-color:#3a4458;color:#b6bcc6}
[data-theme="dark"] .library-search input{color:#eaecef}
[data-theme="dark"] .library-filter-btn,
[data-theme="dark"] .library-sort{background:#222938;border-color:#3a4458;color:#cdd6e6}
[data-theme="dark"] .library-filter-btn.is-active{background:#3a2c12;color:#f0c98d;border-color:#d99a46}
[data-theme="dark"] .library-action-secondary{background:#2a3346;color:#f0c98d}
[data-theme="dark"] .file-card{background:#1a1f2b;border-color:#2a3142;color:#eaecef}
[data-theme="dark"] .file-card:hover{border-color:#3a4458}
[data-theme="dark"] .file-card.is-selected{border-color:#74b9ff;background:#1f2735}
[data-theme="dark"] .folder-icon,
[data-theme="dark"] .file-icon{background:#2a3346}
[data-theme="dark"] .files-grid{background:transparent}
[data-theme="dark"] #libFiltersToggle{background:#222938;border-color:#3a4458;color:#f0c98d}
[data-theme="dark"] .library-storage,
[data-theme="dark"] .storage-bar,
[data-theme="dark"] .library-quota,
[data-theme="dark"] .quota-bar,
[data-theme="dark"] .library-storage-row,
[data-theme="dark"] .library-usage{background:#1a1f2b;border-color:#2a3142;color:#eaecef}

/* ============ GENERIC MODALS (library launcher, move/rename, etc.) ============ */
[data-theme="dark"] .modal,
[data-theme="dark"] .modal-card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .move-modal,
[data-theme="dark"] .modal-overlay > div{background:#1a1f2b;color:#eaecef;border-color:#2a3142}
[data-theme="dark"] .modal-header,
[data-theme="dark"] .move-modal-footer,
[data-theme="dark"] .move-modal-body{border-color:#2a3142}
[data-theme="dark"] .modal-title,
[data-theme="dark"] .move-modal-title-block{color:#eaecef}
[data-theme="dark"] .move-modal-subtitle{color:#b6bcc6}
