/* ===== Nebula Palette ===== */
:root {
  --bg: #0a0b10;
  --surface: #13151f;
  --surface2: #1a1d2a;
  --surface3: #22263a;
  --border: #2a2e44;
  --text: #dde1f7;
  --text-muted: #7b82a8;
  --accent-violet: #7c4dff;
  --accent-violet-light: #9c6fff;
  --accent-cyan: #00e5ff;
  --neon-red: #ff1744;
  --orange: #ff9100;
  --green: #00e676;
  --yellow: #ffd600;
  --sans: 'Segoe UI', system-ui, sans-serif;
  --mono: 'Courier New', monospace;
  --radius: 14px;
  --shadow: 0 8px 32px rgba(0,0,0,0.55);
}
body.light-mode {
  --bg: #f0f2ff; --surface: #ffffff; --surface2: #eef0ff; --surface3: #e0e4f8;
  --border: #c5caee; --text: #111328; --text-muted: #5a6085;
  --green: #00a84f; --neon-red: #d50032; --orange: #e65100;
  --accent-cyan: #007aad; --shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); display: flex; flex-direction: column; font-size: 15px; transition: background 0.25s, color 0.25s; }

/* ===== Pacing Bar ===== */
#pacing-bar-container { height: 4px; background: var(--surface2); flex-shrink: 0; }
#pacing-bar { height: 100%; width: 0%; transition: width 0.5s linear, background 0.4s; }
.pace-green  { background: var(--green) !important; }
.pace-yellow { background: var(--yellow) !important; }
.pace-orange { background: var(--orange) !important; }
.pace-red    { background: var(--neon-red) !important; }
.pace-flash  { background: var(--neon-red) !important; animation: pacingFlash 0.4s steps(1) infinite; }
@keyframes pacingFlash { 0%,100%{opacity:1} 50%{opacity:0.15} }

/* ===== Focus Exit ===== */
#focus-exit {
  display: none; position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 9999; background: var(--neon-red); color: #fff; border: none;
  border-radius: 20px; padding: 7px 22px; cursor: pointer; font-weight: 700; font-size: 0.82rem;
  font-family: var(--sans);
}
body.focus-mode #focus-exit { display: block; }
body.focus-mode #top-bar { height: 0; padding: 0; overflow: hidden; border: none; opacity: 0; }
body.focus-mode #main-layout { height: 100vh; }

/* ===== Top Bar ===== */
#top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--border);
  flex-shrink: 0; gap: 8px; z-index: 200; transition: opacity 0.3s, height 0.3s;
}
#app-title { font-weight: 900; font-size: 0.95rem; color: var(--accent-violet); white-space: nowrap; letter-spacing: 0.3px; }
#top-bar-center { display: flex; align-items: center; gap: 10px; }
#top-bar-actions { display: flex; align-items: center; gap: 4px; }
#correct-counter { font-size: 0.8rem; font-weight: 700; white-space: nowrap; cursor: default; }
#wrong-counter { font-size: 0.8rem; font-weight: 700; white-space: nowrap; cursor: default; color: var(--neon-red); }
#streak-counter { font-size: 0.8rem; font-weight: 700; white-space: nowrap; cursor: pointer; color: var(--accent-cyan); }
#streak-counter.streak-hot { animation: streakPulse 1.4s ease-in-out infinite; }
@keyframes streakPulse { 0%,100%{opacity:1} 50%{opacity:0.6} }
#stopwatch { font-size: 0.82rem; font-weight: 700; font-family: var(--mono); color: var(--accent-cyan); background: var(--surface2); border: 1px solid var(--border); padding: 3px 8px; border-radius: 6px; min-width: 54px; text-align: center; }

/* ===== Streak Popup ===== */
#streak-wrap { position: relative; }
#streak-popup {
  display: none; position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; width: 240px; z-index: 9000; box-shadow: var(--shadow);
  pointer-events: none;
}
#streak-popup.open { display: block; pointer-events: all; }
.streak-popup-title { font-size: 0.7rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
#streak-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.streak-day { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.sd-count { width: 26px; height: 26px; border-radius: 7px; background: var(--surface3); display: flex; align-items: center; justify-content: center; font-size: 0.68rem; font-weight: 700; color: var(--text-muted); border: 1px solid var(--border); }
.streak-day.active .sd-count { background: var(--accent-violet); color: #fff; border-color: var(--accent-violet); }
.sd-name { font-size: 0.6rem; color: var(--text-muted); }
#streak-totals { margin-top: 10px; font-size: 0.75rem; color: var(--text-muted); text-align: center; border-top: 1px solid var(--border); padding-top: 8px; }

/* ===== Layout ===== */
#main-layout { flex: 1; display: flex; overflow: hidden; }
#split-pane { display: flex; flex: 1; overflow: hidden; }

/* ===== Panels ===== */
#left-panel { display: flex; flex-direction: column; overflow: hidden; padding: 12px; gap: 10px; min-width: 280px; }
#right-panel { flex: 1; min-width: 300px; display: flex; padding: 12px 12px 12px 0; }
#calculator { flex: 1; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-height: 300px; }

/* ===== Resizer ===== */
#resizer { width: 5px; cursor: col-resize; background: var(--border); flex-shrink: 0; transition: background 0.15s; }
#resizer:hover { background: var(--accent-violet); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  background: var(--surface2); color: var(--text); border: 1px solid var(--border);
  border-radius: 9px; padding: 6px 12px; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s; white-space: nowrap; font-family: var(--sans);
}
.btn:hover { background: var(--surface3); border-color: var(--accent-violet); }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--accent-violet); color: #fff; border-color: var(--accent-violet); }
.btn-primary:hover { background: var(--accent-violet-light); border-color: var(--accent-violet-light); }
.btn-danger { background: none; color: var(--neon-red); border-color: var(--neon-red); }
.btn-danger:hover { background: var(--neon-red); color: #fff; }
.btn-violet { background: #5c2dcc; color: #fff; border-color: #5c2dcc; }
.btn-violet:hover { background: var(--accent-violet); border-color: var(--accent-violet); }
.btn-icon { padding: 6px 9px; font-size: 0.95rem; border-radius: 8px; }
.btn.active { background: var(--accent-violet); color: #fff; border-color: var(--accent-violet); }

/* ===== Toggle Buttons ===== */
.toggle-btn { min-width: 52px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.5px; padding: 5px 10px; }
.toggle-btn.on { background: var(--accent-violet); color: #fff; border-color: var(--accent-violet); }
.toggle-btn.off { background: var(--surface3); color: var(--text-muted); border-color: var(--border); }

/* ===== Cards ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
#question-card { flex-shrink: 0; max-height: 52%; overflow-y: auto; }
#answer-area { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }

/* ===== Question Header ===== */
#question-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
#question-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#question-actions { display: flex; gap: 5px; flex-shrink: 0; }
#question-box { font-size: 0.97rem; line-height: 1.7; min-height: 48px; white-space: pre-wrap; }

/* ===== Badges ===== */
.badge { padding: 2px 9px; border-radius: 10px; font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.8px; background: var(--surface3); color: var(--text-muted); }
.badge.easy { background: rgba(0,230,118,0.15); color: var(--green); }
.badge.medium { background: rgba(255,214,0,0.15); color: var(--yellow); }
.badge.hard { background: rgba(255,23,68,0.15); color: var(--neon-red); }
#current-category-title { font-size: 0.72rem; font-weight: 700; color: var(--accent-violet); text-transform: uppercase; letter-spacing: 0.6px; }

/* ===== Copy numbers ===== */
.copyable-num { cursor: pointer; text-decoration: underline dotted var(--accent-cyan); text-underline-offset: 3px; border-radius: 3px; transition: background 0.1s; position: relative; }
.copyable-num:hover { background: rgba(0,229,255,0.12); }
.copy-tooltip { position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%); background: var(--accent-violet); color: #fff; font-size: 0.7rem; padding: 2px 7px; border-radius: 4px; white-space: nowrap; pointer-events: none; z-index: 10; animation: fadeOut 1.2s forwards; }
@keyframes fadeOut { 0%,70%{opacity:1} 100%{opacity:0} }

/* ===== Pacing Summary ===== */
#pacing-summary { font-size: 0.78rem; padding: 7px 12px; border-radius: 9px; background: var(--surface2); border: 1px solid var(--border); display: none; margin-top: 8px; }
#pacing-summary.fast { border-color: var(--accent-cyan); color: var(--accent-cyan); background: rgba(0,229,255,0.07); }
#pacing-summary.slow { border-color: var(--neon-red); color: var(--neon-red); background: rgba(255,23,68,0.07); }

/* ===== Answer Area ===== */
#answer-row { display: flex; gap: 8px; align-items: center; }
#answer-box { flex: 1; font-size: 0.95rem; font-family: var(--mono); padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); transition: border-color 0.2s, box-shadow 0.2s; outline: none; }
#answer-box:focus { border-color: var(--accent-violet); box-shadow: 0 0 0 2px rgba(124,77,255,0.2); }
#answer-box.correct { border-color: var(--green); box-shadow: 0 0 0 2px rgba(0,230,118,0.2); }
#answer-box.incorrect { border-color: var(--neon-red); }
.answer-preview { min-height: 20px; font-size: 0.9rem; color: var(--text-muted); padding: 2px 0; }
.answer-preview.invalid { color: var(--orange); font-size: 0.78rem; }
#result { font-weight: 700; font-size: 0.92rem; min-height: 20px; }
#result.correct { color: var(--green); }
#result.incorrect { color: var(--neon-red); }
#hint-text { font-size: 0.82rem; color: var(--orange); display: none; padding: 7px 11px; border-radius: 8px; background: var(--surface2); border-left: 3px solid var(--orange); }
#attempt-dots { display: flex; gap: 5px; align-items: center; min-height: 12px; }
.attempt-dot { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface2); transition: background 0.2s; }
.attempt-dot.used { background: var(--neon-red); border-color: var(--neon-red); }

/* ===== Controls Row ===== */
#controls-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== Tips Section ===== */
#tips-section { margin-top: 2px; }
.tips-toggle-btn { font-size: 0.77rem; padding: 4px 11px; width: 100%; justify-content: flex-start; color: var(--text-muted); }
.tips-toggle-btn:hover { color: var(--accent-violet); }
#tips-panel { background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; padding: 10px 14px; margin-top: 5px; }
#tips-list { list-style: none; display: flex; flex-direction: column; gap: 5px; }
#tips-list li { font-size: 0.79rem; color: var(--text-muted); display: flex; gap: 7px; line-height: 1.45; }
#tips-list li::before { content: '→'; color: var(--accent-violet); flex-shrink: 0; }

/* ===== MC Grid ===== */
#mc-grid { display: none; grid-template-columns: 1fr 1fr; gap: 8px; }
.mc-btn { display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; border: 1.5px solid var(--border); border-radius: 11px; background: var(--surface2); color: var(--text); cursor: pointer; font-family: var(--sans); font-size: 0.88rem; font-weight: 500; transition: all 0.15s; text-align: left; line-height: 1.5; }
.mc-btn:hover:not(:disabled) { border-color: var(--accent-violet); background: rgba(124,77,255,0.1); transform: translateY(-1px); }
.mc-btn:disabled { opacity: 0.55; cursor: default; }
.mc-label { font-size: 0.72rem; font-weight: 900; color: var(--accent-violet); background: rgba(124,77,255,0.15); border-radius: 5px; padding: 2px 6px; flex-shrink: 0; min-width: 22px; text-align: center; }
.mc-val { flex: 1; }
.mc-btn.mc-correct { border-color: var(--green); background: rgba(0,230,118,0.08); }
.mc-btn.mc-correct .mc-label { color: var(--green); background: rgba(0,230,118,0.15); }
.mc-btn.mc-wrong { border-color: var(--neon-red); background: rgba(255,23,68,0.07); }
.mc-btn.mc-wrong .mc-label { color: var(--neon-red); background: rgba(255,23,68,0.15); }
.mc-crossed { text-decoration: line-through; opacity: 0.4; }

/* ===== Cheat Drawer ===== */
#cheat-drawer { position: fixed; top: 0; right: 0; width: 320px; max-width: 92vw; height: 100vh; background: var(--surface); border-left: 1px solid var(--border); z-index: 2500; display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.25s ease; box-shadow: -4px 0 24px rgba(0,0,0,0.5); }
#cheat-drawer.open { transform: translateX(0); }
#cheat-header { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; border-bottom: 1px solid var(--border); flex-shrink: 0; font-weight: 800; color: var(--accent-violet); font-size: 0.88rem; }
#cheat-search { margin: 9px 14px; padding: 7px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); font-size: 0.84rem; outline: none; font-family: var(--sans); width: calc(100% - 28px); }
#cheat-search:focus { border-color: var(--accent-violet); }
#cheat-list { flex: 1; overflow-y: auto; padding: 0 14px 14px; display: flex; flex-direction: column; gap: 9px; }
.cheat-item { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px; }
.cheat-title { font-size: 0.72rem; font-weight: 700; color: var(--accent-violet); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.4px; }
.cheat-latex { font-size: 0.95rem; min-height: 26px; }

/* ===== Modal Base ===== */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 3000; align-items: center; justify-content: center; backdrop-filter: blur(8px); }
.modal-overlay.open { display: flex; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 26px; max-height: 90vh; overflow-y: auto; position: relative; box-shadow: var(--shadow); width: min(560px, 94vw); }
.modal-box h3 { font-size: 1.05rem; font-weight: 800; color: var(--accent-violet); margin-bottom: 14px; }
.modal-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 8px; line-height: 1.5; }
.close-btn { position: fixed; top: 14px; right: 20px; font-size: 1.9rem; color: #ccc; cursor: pointer; line-height: 1; z-index: 3001; }
.close-btn:hover { color: var(--neon-red); }
.modal-close-x { position: absolute; top: 12px; right: 12px; z-index: 1; }
#explanation-modal-content { max-width: 90vw; max-height: 88vh; border-radius: var(--radius); box-shadow: var(--shadow); }
.section-label { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin: 14px 0 8px; }

/* ===== Settings Modal ===== */
.settings-box { width: min(620px, 95vw) !important; max-height: 88vh; }
.settings-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.settings-title { font-weight: 800; color: var(--accent-violet); font-size: 1rem; }

/* Tab Bar */
.tab-bar { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab-btn { background: none; border: none; border-bottom: 2.5px solid transparent; padding: 8px 14px; cursor: pointer; font-size: 0.79rem; font-weight: 700; color: var(--text-muted); transition: all 0.15s; white-space: nowrap; font-family: var(--sans); margin-bottom: -1px; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent-violet); border-bottom-color: var(--accent-violet); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Diff Filter */
.diff-filter-section { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.diff-filter-label { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px; }
.diff-filter-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.diff-filter { font-size: 0.77rem; padding: 4px 11px; }
.diff-filter.active { background: var(--surface3); border-color: var(--accent-violet); color: var(--accent-violet); }
.diff-filter[data-diff="easy"].active { background: rgba(0,230,118,0.1); border-color: var(--green); color: var(--green); }
.diff-filter[data-diff="medium"].active { background: rgba(255,214,0,0.1); border-color: var(--yellow); color: var(--yellow); }
.diff-filter[data-diff="hard"].active { background: rgba(255,23,68,0.1); border-color: var(--neon-red); color: var(--neon-red); }
.cat-controls { display: flex; gap: 6px; flex-wrap: wrap; }

/* Category Selection */
#category-selection { display: flex; flex-direction: column; gap: 4px; max-height: 310px; overflow-y: auto; padding-right: 3px; }
.cat-item { display: flex; align-items: center; gap: 10px; padding: 7px 11px; background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; cursor: pointer; transition: border-color 0.15s; }
.cat-item:hover { border-color: var(--accent-violet); }
.cat-item input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent-violet); cursor: pointer; flex-shrink: 0; }
.cat-item label { font-size: 0.82rem; cursor: pointer; flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cat-diff-tag { font-size: 0.63rem; font-weight: 800; padding: 1px 6px; border-radius: 6px; text-transform: uppercase; flex-shrink: 0; }
.cat-diff-tag.easy { background: rgba(0,230,118,0.15); color: var(--green); }
.cat-diff-tag.medium { background: rgba(255,214,0,0.15); color: var(--yellow); }
.cat-diff-tag.hard { background: rgba(255,23,68,0.15); color: var(--neon-red); }

/* Mode List */
.mode-list { display: flex; flex-direction: column; }
.mode-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.mode-row:last-child { border-bottom: none; }
.mode-name { font-weight: 700; font-size: 0.86rem; margin-bottom: 2px; }
.mode-desc { font-size: 0.72rem; color: var(--text-muted); line-height: 1.4; }

/* History Tab */
.history-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.section-note { font-size: 0.75rem; color: var(--text-muted); }
#history-list-full { display: flex; flex-direction: column; gap: 5px; max-height: 400px; overflow-y: auto; padding-right: 2px; }
.hist-item-full { background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; }
.hist-cat { font-weight: 700; color: var(--accent-violet); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; }
.hist-q { color: var(--text); font-size: 0.8rem; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-meta { color: var(--text-muted); font-size: 0.7rem; display: flex; gap: 10px; flex-wrap: wrap; }
.hist-correct-tag { color: var(--green); font-weight: 700; }
.hist-wrong-tag { color: var(--neon-red); font-weight: 700; }
.hist-giveup-tag { color: var(--orange); font-weight: 700; }

/* Flagged Tab */
#flagged-list { display: flex; flex-direction: column; gap: 5px; max-height: 380px; overflow-y: auto; padding-right: 2px; }
.flagged-item { background: var(--surface2); border: 1px solid var(--border); border-left: 3px solid var(--orange); border-radius: 9px; padding: 8px 12px; font-size: 0.8rem; }
.flagged-item .fl-cat { font-size: 0.7rem; font-weight: 700; color: var(--orange); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; }
.flagged-item .fl-q { color: var(--text); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Reference Sheet Modal */
.ref-box { width: min(780px, 95vw) !important; max-height: 92vh; }
#ref-sheet-img { width: 100%; border-radius: 9px; margin: 10px 0; border: 1px solid var(--border); }
.ref-note { background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; padding: 12px 14px; font-size: 0.8rem; }
.ref-note ul { padding-left: 18px; margin-top: 6px; display: flex; flex-direction: column; gap: 4px; color: var(--text-muted); }
.ref-note strong { color: var(--text); }
.ref-note code { background: var(--surface3); padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: 0.82rem; color: var(--accent-cyan); }

/* Analytics Modal */
#analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 8px; }
.analytics-cell { border: 1px solid var(--border); border-radius: 10px; padding: 13px; }
.ac-title { font-size: 0.7rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.ac-mastery { font-size: 0.82rem; font-weight: 700; margin-bottom: 4px; }
.ac-stats, .ac-count { font-size: 0.68rem; color: var(--text-muted); }
.ac-count { margin-top: 2px; }

/* Report Card */
#rc-grade { font-size: 4.5rem; font-weight: 900; line-height: 1; margin: 10px 0 6px; }
#rc-label { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 16px; }
.rc-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 0.82rem; }
.rc-row:last-child { border-bottom: none; }
#rc-action { font-size: 0.82rem; color: var(--text-muted); background: var(--surface2); border-radius: 9px; padding: 10px 13px; text-align: left; margin: 12px 0 18px; line-height: 1.5; }

/* Help Modal */
.kbd-grid { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; font-size: 0.82rem; align-items: center; }
.kbd-grid code { background: var(--surface2); border: 1px solid var(--border); padding: 2px 7px; border-radius: 5px; font-size: 0.77rem; font-family: var(--mono); color: var(--accent-cyan); white-space: nowrap; }
.kbd-grid span { color: var(--text-muted); }
.help-lineage { display: flex; flex-direction: column; gap: 5px; margin-top: 7px; }
.help-lineage-item { font-size: 0.8rem; color: var(--text-muted); padding: 6px 10px; background: var(--surface2); border-radius: 7px; }
.help-lineage-item a { color: var(--accent-cyan); text-decoration: none; }
.help-lineage-item a:hover { text-decoration: underline; }

/* Spotlight */
#spotlight-overlay { position: fixed; inset: 0; z-index: 9999; pointer-events: all; }
#spotlight-hole { position: absolute; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0,0,0,0.82); pointer-events: none; transition: all 0.3s ease; }
#spotlight-tooltip { position: absolute; width: 320px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
#spotlight-title { font-size: 0.95rem; font-weight: 800; color: var(--accent-violet); margin-bottom: 7px; }
#spotlight-desc { font-size: 0.84rem; color: var(--text-muted); line-height: 1.55; margin-bottom: 14px; }
#spotlight-nav { display: flex; justify-content: space-between; align-items: center; }
#spotlight-dots { display: flex; gap: 5px; }
#spotlight-dots .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--surface3); border: 1px solid var(--border); }
#spotlight-dots .dot.active { background: var(--accent-violet); border-color: var(--accent-violet); }

/* Hard Mode indicator */
body.hard-mode #question-card { border-color: var(--neon-red); }

/* Cross-out */
#question-box.crossout-mode .crossout-word { cursor: pointer; }
#question-box.crossout-mode .crossout-word:hover { background: rgba(124,77,255,0.14); border-radius: 2px; }
.crossout-word.crossed { text-decoration: line-through; color: var(--text-muted); opacity: 0.6; }
#flag-btn.flagged { color: var(--neon-red); border-color: var(--neon-red); }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Settings Guide Buttons ===== */
.settings-guide-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.settings-guide-btns .btn { font-size: 0.8rem; }

/* ===== Language Tab ===== */
.lang-tab-content { padding: 4px 0; }
.lang-tab-title { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 14px; }
.lang-options { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.lang-opt-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 20px; border: 2px solid var(--border); border-radius: 12px;
  background: var(--surface2); cursor: pointer; transition: all 0.18s;
  font-family: var(--sans); color: var(--text); min-width: 130px;
}
.lang-opt-btn:hover { border-color: var(--accent-violet); background: rgba(124,77,255,0.07); }
.lang-opt-btn.active { border-color: var(--accent-violet); background: rgba(124,77,255,0.13); color: var(--accent-violet); }
.lang-flag { font-size: 1.8rem; line-height: 1; }
.lang-name { font-size: 0.84rem; font-weight: 700; }

/* ===== Onboarding Wizard ===== */
#onboarding-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.88); backdrop-filter: blur(10px);
  z-index: 9998; align-items: center; justify-content: center;
}
#onboarding-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 28px 30px;
  width: min(560px, 94vw); max-height: 88vh;
  overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  position: relative;
}
.ob-step { animation: obFadeIn 0.22s ease; }
@keyframes obFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.ob-logo { font-size: 3rem; text-align: center; margin-bottom: 8px; }
.ob-title { font-size: 1.4rem; font-weight: 900; color: var(--accent-violet); text-align: center; margin-bottom: 6px; }
.ob-subtitle { font-size: 0.9rem; color: var(--text-muted); text-align: center; margin-bottom: 22px; }
.ob-section-title { font-size: 0.88rem; font-weight: 800; color: var(--accent-violet); margin-bottom: 10px; }
.ob-desc { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 10px; }

/* Onboarding language grid */
.ob-lang-grid { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 26px; }
.ob-lang-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 28px; border: 2px solid var(--border); border-radius: 14px;
  background: var(--surface2); cursor: pointer; transition: all 0.18s;
  font-family: var(--sans); color: var(--text); min-width: 140px;
  font-size: 0.9rem; font-weight: 700;
}
.ob-lang-btn:hover { border-color: var(--accent-violet); background: rgba(124,77,255,0.1); }
.ob-lang-btn.active { border-color: var(--accent-violet); background: rgba(124,77,255,0.16); color: var(--accent-violet); box-shadow: 0 0 0 3px rgba(124,77,255,0.2); }
.ob-lang-flag { font-size: 2.2rem; line-height: 1; }

/* Onboarding diff filter */
.ob-diff-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.ob-diff-btn { font-size: 0.77rem; padding: 4px 11px; }
.ob-diff-btn.active { background: var(--surface3); border-color: var(--accent-violet); color: var(--accent-violet); }
.ob-diff-btn[data-diff="easy"].active { background: rgba(0,230,118,0.1); border-color: var(--green); color: var(--green); }
.ob-diff-btn[data-diff="medium"].active { background: rgba(255,214,0,0.1); border-color: var(--yellow); color: var(--yellow); }
.ob-diff-btn[data-diff="hard"].active { background: rgba(255,23,68,0.1); border-color: var(--neon-red); color: var(--neon-red); }
.ob-cat-actions { display: flex; gap: 6px; margin-bottom: 8px; }
.ob-cat-grid { display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow-y: auto; padding-right: 3px; margin-bottom: 4px; }
.ob-cat-item { display: flex; align-items: center; gap: 10px; padding: 7px 11px; background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; cursor: pointer; }
.ob-cat-item:hover { border-color: var(--accent-violet); }
.ob-cat-item input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent-violet); cursor: pointer; flex-shrink: 0; }
.ob-cat-item label { font-size: 0.82rem; cursor: pointer; flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* Onboarding modes grid */
.ob-modes-grid { display: flex; flex-direction: column; }
.ob-mode-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.ob-mode-row:last-child { border-bottom: none; }
.ob-mode-name { font-weight: 700; font-size: 0.86rem; margin-bottom: 2px; }
.ob-mode-desc { font-size: 0.72rem; color: var(--text-muted); }

/* Onboarding shortcut choice */
.ob-shortcut-choice { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 20px; }
.ob-sc-opt {
  flex: 1; min-width: 140px; padding: 16px 14px; border: 2px solid var(--border);
  border-radius: 12px; background: var(--surface2); cursor: pointer;
  transition: all 0.18s; text-align: center;
}
.ob-sc-opt:hover { border-color: var(--accent-violet); background: rgba(124,77,255,0.07); }
.ob-sc-opt.active { border-color: var(--accent-violet); background: rgba(124,77,255,0.14); }
.ob-sc-icon { font-size: 1.5rem; margin-bottom: 7px; }
.ob-sc-label { font-weight: 700; font-size: 0.85rem; color: var(--text); margin-bottom: 4px; }
.ob-sc-sub { font-size: 0.72rem; color: var(--text-muted); line-height: 1.4; }

/* Onboarding nav */
.ob-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; }
.ob-btn-back { background: none; border-color: var(--border); color: var(--text-muted); }
.ob-btn-next { min-width: 110px; }
.ob-step-indicator { display: flex; justify-content: center; gap: 6px; margin-top: 14px; }
.ob-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--surface3); border: 1px solid var(--border); }
.ob-dot.active { background: var(--accent-violet); border-color: var(--accent-violet); }

/* sm-btn helper */
.sm-btn { font-size: 0.75rem; padding: 4px 10px; }

/* Mobile */
@media (max-width: 760px) {
  #app-title { font-size: 0.8rem; }
  #split-pane { flex-direction: column; overflow-y: auto; }
  #left-panel { width: 100% !important; min-width: unset; padding: 10px; overflow-y: visible; }
  #question-card { max-height: none; }
  #resizer { display: none; }
  #right-panel { min-width: unset; padding: 0 10px 10px; height: 45vh; flex-shrink: 0; }
  #mc-grid { grid-template-columns: 1fr; }
  #cheat-drawer { width: 100%; }
  #spotlight-tooltip { width: 90vw; }
  .settings-box { padding: 16px !important; }
}
