:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #171a2b;
  --ink-2: #4b5068;
  --ink-3: #8a8fa8;
  --line: #e7e8f0;
  --brand: #6d5dfc;
  --brand-2: #8b7dff;
  --brand-soft: #efecff;
  --teal: #14b8a6;
  --teal-soft: #e4f8f5;
  --orange: #f59e0b;
  --red: #e5484d;
  --red-soft: #fdecec;
  --green: #1f9d55;
  --green-soft: #e6f6ec;
  --shadow: 0 1px 2px rgba(20, 20, 50, .04), 0 4px 16px rgba(20, 20, 50, .05);
  --radius: 14px;
  --d1: #6d5dfc; --d2: #14b8a6; --d3: #f59e0b; --d4: #ec4899; --d5: #3b82f6;
  /* Pearson-style exam palette */
  --vue-bar: #1d3557;
  --vue-bar-2: #24426b;
  --vue-sub: #e9eef5;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
.hidden { display: none !important; }

#app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
#app.with-tutor { grid-template-columns: 240px 1fr 440px; }

/* ---------- sidebar ---------- */
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--brand), #4f46e5); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; letter-spacing: .5px; }
.brand-name { font-weight: 800; font-size: 16px; color: var(--brand); }
.brand-sub { font-size: 12px; color: var(--ink-3); }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 500; }
nav a:hover { background: var(--bg); }
nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
nav .ico { width: 18px; text-align: center; opacity: .8; }
.side-card { margin-top: auto; border-radius: var(--radius); padding: 16px; color: #fff; background: linear-gradient(140deg, #4f46e5, var(--brand) 60%, #a78bfa); }
.side-card-title { font-size: 12px; opacity: .85; }
.side-card-big { font-size: 28px; font-weight: 800; }
.side-card-big span { font-size: 14px; opacity: .8; font-weight: 500; }
.side-card-sub { font-size: 12px; opacity: .85; }

/* ---------- main ---------- */
#main { padding: 28px 32px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.3px; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g3, .g-2-1 { grid-template-columns: 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card h3 .sub { font-weight: 500; color: var(--ink-3); font-size: 12px; }
.stat { display: flex; gap: 14px; align-items: flex-start; }
.stat-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 18px; flex: none; }
.stat-label { color: var(--ink-2); font-size: 13px; }
.stat-val { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.stat-note { font-size: 12px; color: var(--ink-3); }
.stat.warn .stat-ico { background: var(--red-soft); color: var(--red); }
.stat.ok .stat-ico { background: var(--teal-soft); color: var(--teal); }

.bar-row { display: grid; grid-template-columns: 210px 1fr 48px; align-items: center; gap: 12px; margin: 10px 0; }
.bar-row .lbl { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .lbl small { color: var(--ink-3); font-weight: 400; }
.bar { height: 12px; background: #eef0f6; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width .6s; }
.bar-row .pct { text-align: right; font-weight: 600; }

.btn { border: 1px solid var(--line); background: var(--panel); padding: 9px 16px; border-radius: 10px; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.btn:hover { border-color: #cfd2e3; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #5b4bf0; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn.danger { color: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.lg { padding: 13px 22px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; cursor: pointer; width: 32px; height: 32px; border-radius: 8px; font-size: 16px; color: var(--ink-2); }
.icon-btn:hover { background: var(--bg); }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--ink-2); }
.pill.d1 { background: #efecff; color: var(--d1); } .pill.d2 { background: #e4f8f5; color: #0f8f81; }
.pill.d3 { background: #fff4df; color: #b86e00; } .pill.d4 { background: #fde8f3; color: #c0307a; }
.pill.d5 { background: #e6efff; color: #2563eb; }
.pill.right { background: var(--green-soft); color: var(--green); } .pill.wrong { background: var(--red-soft); color: var(--red); }
.pill.ai { background: #fff4df; color: #b86e00; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.input, select.input, textarea.input { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 12px; outline: none; width: 100%; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.spacer { flex: 1; }
.empty { text-align: center; color: var(--ink-3); padding: 40px 10px; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: #fafaff; }

/* practice mode cards */
.mode-card { display: flex; flex-direction: column; gap: 12px; }
.mode-card .mode-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; color: #fff; }
.mode-card h2 { margin: 0; font-size: 18px; }
.mode-card p { margin: 0; color: var(--ink-2); }
.chk-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; }
.chk-list label { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.chk-list label:hover { background: var(--bg); }
.chk-list .grp-block { border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px; margin-bottom: 8px; }
.chk-list .grp-head { background: var(--bg); font-size: 13px; gap: 10px; }
.chk-list .grp-head .muted { margin-left: auto; }
.chk-list .grp-item { padding-left: 28px; }
.sec-prog { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 12px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* question cards (bank / review) */
.qcard { border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-bottom: 12px; overflow: hidden; }
.qcard-head { display: flex; gap: 8px; align-items: center; padding: 10px 14px; background: #fafbff; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.qcard-body { padding: 14px 16px; }
.qtext { font-weight: 600; font-size: 15px; margin-bottom: 10px; white-space: pre-wrap; }
.opt { display: flex; gap: 10px; padding: 8px 10px; border-radius: 8px; margin: 4px 0; border: 1px solid transparent; }
.opt b { flex: none; width: 22px; }
.opt.correct { background: var(--green-soft); border-color: #bfe6cd; color: #145c33; font-weight: 600; }
.opt.chosen-wrong { background: var(--red-soft); border-color: #f5c2c3; color: #9b2226; }
.expl { margin-top: 12px; padding: 12px 14px; background: #f6f5ff; border-radius: 10px; border-left: 3px solid var(--brand); }
.expl-title { font-weight: 700; color: var(--brand); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.qcard-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* drop zone */
.drop { border: 2px dashed #cfcaf8; border-radius: var(--radius); background: #faf9ff; padding: 36px; text-align: center; cursor: pointer; transition: .15s; }
.drop.over { background: var(--brand-soft); border-color: var(--brand); }
.drop .big { font-size: 36px; }
.job { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.job:last-child { border-bottom: 0; }
.spin { width: 16px; height: 16px; border: 2px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* score */
.score-hero { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: center; }
.gauge { position: relative; width: 220px; height: 220px; }
.gauge svg { transform: rotate(-90deg); }
.gauge .g-num { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.gauge .g-num b { font-size: 44px; font-weight: 800; display: block; line-height: 1; }
.verdict { display: inline-block; padding: 6px 16px; border-radius: 99px; font-weight: 800; letter-spacing: 1px; }
.verdict.pass { background: var(--green-soft); color: var(--green); }
.verdict.fail { background: var(--red-soft); color: var(--red); }

/* tips / cheat sheet */
.tip { padding: 12px 14px; border-radius: 12px; background: #fafaff; border: 1px solid var(--line); }
.tip b { display: block; margin-bottom: 2px; }
.note-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.note-row:last-child { border-bottom: 0; }

/* ---------- tutor drawer ---------- */
.tutor { display: none; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); height: 100vh; position: sticky; top: 0; min-width: 0; }
#app.with-tutor .tutor { display: flex; }
.exam-open .tutor { position: fixed; right: 0; top: 0; width: 440px; z-index: 60; box-shadow: -10px 0 30px rgba(0,0,0,.12); }
.tutor-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px; border-bottom: 1px solid var(--line); }
.tutor-title { font-weight: 800; display: flex; align-items: center; gap: 8px; flex: 1; }
.tutor-dot { width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--teal)); }
.tutor-head select { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font-size: 12px; background: #fff; }
.tutor-context { padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafaff; font-size: 12px; color: var(--ink-2); max-height: 110px; overflow: auto; }
.tutor-context:empty { display: none; }
.tutor-context b { color: var(--ink); }
.tutor-msgs { flex: 1; overflow: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 100%; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; padding: 9px 13px; border-radius: 14px 14px 4px 14px; max-width: 88%; white-space: pre-wrap; }
.msg.user blockquote { margin: 0 0 6px; padding: 4px 8px; border-left: 3px solid rgba(255,255,255,.6); background: rgba(255,255,255,.12); border-radius: 4px; font-style: italic; }
.msg.bot { align-self: stretch; }
.msg.bot .who { font-size: 11px; color: var(--ink-3); font-weight: 600; margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.msg.bot .body { background: #f7f7fb; border: 1px solid var(--line); padding: 12px 14px; border-radius: 4px 14px 14px 14px; overflow-wrap: anywhere; }
.msg.bot .body p { margin: 0 0 8px; } .msg.bot .body p:last-child { margin-bottom: 0; }
.msg.bot .body h1, .msg.bot .body h2, .msg.bot .body h3, .msg.bot .body h4 { font-size: 14px; margin: 12px 0 6px; }
.msg.bot .body ul, .msg.bot .body ol { margin: 4px 0 8px; padding-left: 20px; }
.msg.bot .body code { background: #ecebf8; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.msg.bot .body pre { background: #1e1e2e; color: #e6e6f0; padding: 10px 12px; border-radius: 8px; overflow: auto; }
.msg.bot .body pre code { background: none; padding: 0; color: inherit; }
.msg.bot .body blockquote { margin: 6px 0; padding: 4px 10px; border-left: 3px solid var(--brand); color: var(--ink-2); }
.msg.bot .body table { border-collapse: collapse; margin: 6px 0; font-size: 12.5px; }
.msg.bot .body td, .msg.bot .body th { border: 1px solid var(--line); padding: 4px 8px; }
.msg-tools { display: flex; gap: 6px; margin-top: 6px; }
.status-line { font-size: 12px; color: var(--ink-3); display: flex; gap: 8px; align-items: center; }
.tutor-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 14px 0; }
.tutor-quote { margin: 8px 14px 0; padding: 6px 10px; background: var(--brand-soft); border-radius: 8px; font-size: 12px; display: flex; gap: 8px; align-items: flex-start; }
.tutor-quote span { flex: 1; font-style: italic; max-height: 54px; overflow: auto; }
.tutor-quote button { border: 0; background: none; cursor: pointer; color: var(--ink-3); }
.tutor-input { display: flex; gap: 8px; padding: 12px 14px; align-items: flex-end; }
.tutor-input textarea { flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: none; outline: none; max-height: 160px; }
.tutor-input textarea:focus { border-color: var(--brand); }
.web-toggle { font-size: 12px; display: flex; align-items: center; gap: 4px; color: var(--ink-2); cursor: pointer; user-select: none; }
.tok { font-size: 11px; color: var(--ink-3); font-weight: 500; }
.saved-banner { align-self: center; font-size: 11px; color: var(--green); background: var(--green-soft); padding: 3px 10px; border-radius: 99px; }
.tutor-welcome { color: var(--ink-2); font-size: 13px; background: #fafaff; border: 1px dashed #d9d5fb; border-radius: 12px; padding: 14px; }
.tutor-welcome b { color: var(--ink); }

.ask-sel { position: fixed; z-index: 100; background: var(--ink); color: #fff; border: 0; border-radius: 99px; padding: 7px 14px; font-weight: 600; font-size: 12px; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 200; box-shadow: 0 10px 30px rgba(0,0,0,.2); }

/* ---------- Pearson VUE style exam ---------- */
.exam { position: fixed; inset: 0; background: #fff; z-index: 50; display: flex; flex-direction: column; font-family: Arial, "Segoe UI", sans-serif; }
.exam-open .exam { right: 0; }
body.exam-open.tutor-on .exam { right: 440px; }
.vue-top { background: var(--vue-bar); color: #fff; display: flex; align-items: center; padding: 0 18px; height: 52px; gap: 18px; }
.vue-title { font-weight: 700; font-size: 15px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vue-meta { display: flex; gap: 22px; font-size: 13px; align-items: center; }
.vue-meta .lab { opacity: .75; margin-right: 6px; }
.vue-timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.vue-timer.low { color: #ffb4b4; }
.vue-sub { background: var(--vue-sub); border-bottom: 1px solid #cdd6e3; display: flex; align-items: center; padding: 8px 18px; gap: 16px; font-size: 13px; color: #24364f; }
.vue-flag { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-weight: 600; }
.vue-flag .flag-box { width: 18px; height: 18px; border: 2px solid #24364f; border-radius: 3px; display: grid; place-items: center; font-size: 12px; background: #fff; }
.vue-flag.on .flag-box { background: #f0b429; border-color: #b7791f; }
.vue-body { flex: 1; overflow: auto; padding: 30px 6vw 40px; }
.vue-q { max-width: 980px; margin: 0 auto; font-size: 16px; color: #111; }
.vue-scn { display: inline-block; font-size: 12px; font-weight: 700; color: #24426b; background: #e9eef5; padding: 3px 10px; border-radius: 4px; margin-bottom: 14px; letter-spacing: .3px; }
.vue-stem { font-size: 17px; line-height: 1.6; margin-bottom: 18px; white-space: pre-wrap; }
.vue-instr { font-size: 13px; color: #555; margin-bottom: 14px; font-style: italic; }
.vue-opt { display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; border: 1px solid #d6dbe3; border-radius: 4px; margin-bottom: 10px; cursor: pointer; background: #fff; transition: background .1s; }
.vue-opt:hover { background: #f3f6fa; }
.vue-opt.sel { background: #e3edf9; border-color: #3a6ea5; }
.vue-opt .radio { width: 20px; height: 20px; border: 2px solid #3a6ea5; border-radius: 50%; flex: none; margin-top: 2px; display: grid; place-items: center; background: #fff; }
.vue-opt .radio.sq { border-radius: 3px; }
.vue-opt.sel .radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #1d3557; }
.vue-opt.sel .radio.sq::after { border-radius: 1px; }
.vue-opt .letter { font-weight: 700; width: 18px; flex: none; }
.vue-opt.is-correct { background: #e6f6ec; border-color: #1f9d55; }
.vue-opt.is-wrong { background: #fdecec; border-color: #e5484d; }
.vue-opt.locked { cursor: default; }
.vue-feedback { margin-top: 18px; border-radius: 6px; padding: 16px 18px; border: 1px solid #d6dbe3; background: #f8fafc; font-family: Inter, system-ui, sans-serif; font-size: 14px; }
.vue-feedback .fb-head { font-weight: 800; font-size: 15px; margin-bottom: 6px; }
.vue-feedback.good .fb-head { color: var(--green); } .vue-feedback.bad .fb-head { color: var(--red); }
.vue-bottom { background: var(--vue-bar); display: flex; align-items: center; padding: 10px 18px; gap: 10px; }
.vbtn { background: var(--vue-bar-2); color: #fff; border: 1px solid #4a6a96; padding: 8px 18px; border-radius: 4px; cursor: pointer; font-weight: 700; font-size: 13px; display: inline-flex; gap: 8px; align-items: center; }
.vbtn:hover { background: #2f5687; }
.vbtn:disabled { opacity: .4; cursor: not-allowed; }
.vbtn.accent { background: #f0b429; border-color: #f0b429; color: #1d3557; }
.vbtn.accent:hover { background: #ffc94d; }
.vbtn.tutor-btn { background: var(--brand); border-color: var(--brand); }
.vue-review { max-width: 1000px; margin: 0 auto; font-size: 14px; }
.vue-review h2 { font-size: 20px; color: #1d3557; margin: 0 0 6px; }
.vue-review-legend { display: flex; gap: 18px; margin: 12px 0 16px; font-size: 13px; flex-wrap: wrap; }
.vue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.vue-cell { border: 1px solid #cdd6e3; border-radius: 4px; padding: 8px 10px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-size: 13px; background: #fff; }
.vue-cell:hover { background: #f3f6fa; }
.vue-cell.unans { background: #fff7e0; border-color: #f0b429; }
.vue-cell .st { font-size: 11px; color: #555; }
.vue-cell .fl { color: #b7791f; font-weight: 700; }
.modal-back { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 150; display: grid; place-items: center; }
.modal { background: #fff; border-radius: 8px; padding: 22px 24px; max-width: 460px; width: calc(100% - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal h3 { margin: 0 0 8px; color: #1d3557; }
.modal .row { justify-content: flex-end; margin-top: 18px; }

/* line chart */
.chart svg { width: 100%; height: 190px; display: block; }
.chart .axis { stroke: #eceef5; }
.chart text { font-size: 10px; fill: var(--ink-3); }

@media print {
  .sidebar, .tutor, .no-print { display: none !important; }
  #app { display: block; }
  .card { box-shadow: none; break-inside: avoid; }
}

.fc-draft { margin: 4px 0 6px; font-family: Inter, system-ui, sans-serif; }
.fc-answer { font-size: 15px; line-height: 1.6; padding: 8px 0; }

.plan-day { display: flex; gap: 12px; align-items: center; padding: 10px 8px; border-bottom: 1px solid var(--line); border-radius: 8px; }
.plan-day:last-child { border-bottom: 0; }
.plan-day.today { background: var(--brand-soft); }
.plan-day.done b { text-decoration: line-through; color: var(--ink-3); }
.plan-day .pd-date { width: 92px; flex: none; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.today-card { border-left: 4px solid var(--brand); }
.pill.tier-A { background: #e6f6ec; color: #1f9d55; }
.pill.tier-B { background: #e6efff; color: #2563eb; }
.pill.tier-C { background: #fff4df; color: #b86e00; }
.pill.tier-D { background: #fdecec; color: #e5484d; }

.learn-wrap { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.learn-toc { position: sticky; top: 16px; max-height: calc(100vh - 40px); overflow: auto; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.learn-toc a { color: var(--ink-2); padding: 3px 6px; border-radius: 6px; }
.learn-toc a:hover { background: var(--bg); }
.learn-toc a.sub { padding-left: 18px; font-size: 12px; }
.learn { padding: 24px 32px; line-height: 1.65; font-size: 15px; overflow-wrap: anywhere; }
.learn h1 { font-size: 26px; margin: 8px 0 12px; } .learn h2 { font-size: 20px; margin: 28px 0 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.learn h3 { font-size: 16px; margin: 18px 0 6px; color: var(--brand); }
.learn table { border-collapse: collapse; margin: 10px 0 16px; width: 100%; font-size: 13.5px; }
.learn th, .learn td { border: 1px solid var(--line); padding: 6px 10px; vertical-align: top; text-align: left; }
.learn th { background: #f4f3ff; }
.learn code { background: #efeef9; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.learn pre:not(.mermaid) { background: #1e1e2e; color: #e6e6f0; padding: 12px 14px; border-radius: 8px; overflow: auto; }
.learn pre:not(.mermaid) code { background: none; color: inherit; }
.learn pre.mermaid { background: #fafaff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-align: center; }
.learn blockquote { margin: 10px 0; padding: 8px 14px; border-left: 4px solid var(--brand); background: var(--brand-soft); border-radius: 0 8px 8px 0; }
@media (max-width: 1100px) { .learn-wrap { grid-template-columns: 1fr; } .learn-toc { position: static; max-height: 240px; } }

/* ---- Learn: learner-focused reading */
.learn-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 6px 0; }
.mm-card { margin-bottom: 14px; }
#mm text, #mm foreignObject { font-family: Inter, system-ui, sans-serif; font-size: 13px; cursor: pointer; }
#mm .mm-l.rel-high { color: #1f9d55; font-weight: 700; } #mm .mm-l.rel-medium { color: #b86e00; font-weight: 600; } #mm .mm-l.rel-none { color: #9aa0b5; }
.callout { border-radius: 12px; padding: 4px 16px 10px; margin: 14px 0; border: 1px solid var(--line); }
.callout h3 { margin-top: 10px !important; display: flex; align-items: center; gap: 8px; }
.c-key { background: #fcfcff; }
.c-key h3::before { content: "💡"; }
.c-video { background: #eef6ff; border-color: #c9dafc; } .c-video h3 { color: #2563eb !important; } .c-video h3::before { content: "🎬"; }
.c-exam { background: #fff5f5; border-color: #f5c2c3; } .c-exam h3 { color: #c0392b !important; } .c-exam h3::before { content: "🎯"; }
.c-remember { background: #fffbea; border-color: #f6e3a1; } .c-remember h3 { color: #a16207 !important; } .c-remember h3::before { content: "📌"; }
.c-check { background: #f1fbf5; border-color: #bfe6cd; } .c-check h3 { color: #1f9d55 !important; } .c-check h3::before { content: "✅"; }
.c-check .ans { display: block; margin-top: 4px; padding: 6px 10px; background: #fff; border-left: 3px solid #1f9d55; border-radius: 6px; }
.c-check .reveal { margin-left: 6px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; vertical-align: middle; }
.rel-high { background: #e6f6ec; color: #1f9d55; } .rel-medium { background: #fff4df; color: #b86e00; }
.rel-low { background: #eef0f6; color: #4b5068; } .rel-none { background: #f3f3f6; color: #9aa0b5; text-decoration: line-through; }
.learn h2 .studied { float: right; font-size: 12px; font-weight: 500; color: var(--ink-3); display: flex; gap: 4px; align-items: center; }
.learn .flash { animation: flash 1.6s; } @keyframes flash { 0% { background: #fff1a8; } 100% { background: transparent; } }
.learn pre.mermaid { background: linear-gradient(180deg, #fbfaff, #f5f3ff); }
body.focus .sidebar, body.focus .learn-toc, body.focus .mm-card { display: none !important; }
body.focus #app { grid-template-columns: 1fr; } body.focus .learn-wrap { grid-template-columns: 1fr; }
body.focus .learn { max-width: 860px; margin: 0 auto; font-size: 16.5px; }
/* ---- Exam map */
.map-wrap { display: grid; grid-template-columns: 1fr 360px; gap: 16px; }
#cy { height: calc(100vh - 190px); min-height: 520px; border-radius: 14px; background: radial-gradient(circle at 50% 40%, #ffffff, #f4f3fb); }
.map-panel { max-height: calc(100vh - 190px); overflow: auto; }
.map-panel h3 { margin: 12px 0 6px; font-size: 15px; }
.map-link { display: block; padding: 6px 8px; border-radius: 8px; color: var(--ink); font-size: 13px; }
.map-link:hover { background: var(--brand-soft); }
.map-panel p .map-link { display: inline; padding: 2px 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--ink-2); margin: 6px 0; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.legend i.ring { border-radius: 50%; border: 3px solid; background: #fff; }
@media (max-width: 1100px) { .map-wrap { grid-template-columns: 1fr; } }

/* ---- full-screen views */
#mmCard:fullscreen, #mmCard.pseudo-full { background: #fff; padding: 16px 20px; margin: 0; border-radius: 0; display: flex; flex-direction: column; }
#mmCard:fullscreen #mm, #mmCard.pseudo-full #mm { flex: 1; height: auto !important; min-height: 0; }
.pseudo-full { position: fixed !important; inset: 0; z-index: 300; overflow: auto; }
.map-wrap:fullscreen, .map-wrap.pseudo-full { background: var(--bg); padding: 12px; grid-template-columns: 1fr 380px; }
.map-wrap:fullscreen #cy, .map-wrap.pseudo-full #cy { height: calc(100vh - 24px); }
.map-wrap:fullscreen .map-panel, .map-wrap.pseudo-full .map-panel { max-height: calc(100vh - 24px); }
.learn pre.mermaid .diag-full { position: absolute; top: 8px; right: 8px; opacity: 0; transition: opacity .15s; }
.learn pre.mermaid:hover .diag-full { opacity: 1; }
.learn pre.mermaid:fullscreen { background: #fff; display: flex; align-items: center; justify-content: center; padding: 24px; overflow: auto; }
.learn pre.mermaid:fullscreen svg { width: 100% !important; height: 100% !important; max-width: none !important; }
.learn pre.mermaid:fullscreen .diag-full { opacity: 1; }

body.has-pseudo-full { overflow: hidden; }
#mmCard.pseudo-full, .map-wrap.pseudo-full, .learn pre.mermaid.pseudo-full { position: fixed !important; inset: 0; z-index: 400; border-radius: 0; margin: 0; }
.learn pre.mermaid.pseudo-full { background: #fff; display: flex; align-items: center; justify-content: center; }
.learn pre.mermaid.pseudo-full svg { width: 100% !important; height: 100% !important; max-width: none !important; }
.learn pre.mermaid.pseudo-full .diag-full { opacity: 1; }
#mmCard.pseudo-full #mm { height: calc(100vh - 70px) !important; }

/* floating exit button shown in every full-screen view */
.full-exit { position: absolute; top: 12px; right: 12px; z-index: 500; background: #1f2937; color: #fff; border-color: #1f2937; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.pseudo-full > .full-exit, :fullscreen > .full-exit { position: fixed; }
.map-wrap.pseudo-full > .full-exit, .map-wrap:fullscreen > .full-exit { right: 400px; }

/* ---- study plan: course lessons per day */
.pl-box { margin-top: 8px; padding: 8px 10px; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 8px; }
.pl-lesson { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; cursor: pointer; }
.pl-lesson a { flex: 1; color: inherit; }
.pl-lesson a:hover { color: #6d5dfc; text-decoration: underline; }
.pl-lesson.studied a { text-decoration: line-through; color: #9ca3af; }
.pl-kind { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.pl-kind.required { background: #fee2e2; color: #b91c1c; }
.pl-kind.optional { background: #fef3c7; color: #92400e; }
.pl-box details summary { cursor: pointer; margin-top: 4px; }

.pl-kind.review { background: #e0e7ff; color: #3730a3; }

/* ---- self-paced plan: coach card + free-time editor */
.coach { border-left: 4px solid #6d5dfc; }
.coach-next { margin-top: 12px; padding: 12px 14px; background: #f5f3ff; border-radius: 10px; }
.avail { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.avail label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: #6b7280; }
.avail select { padding: 4px; font-size: 13px; }
.plan-day.skipped { opacity: .5; }
.pill.ok { background: #dcfce7; color: #166534; }
.pill.warn { background: #fef3c7; color: #92400e; }
.pill.bad { background: #fee2e2; color: #b91c1c; }
details.pl-box > summary { cursor: pointer; }
@media (max-width: 700px) { .avail { grid-template-columns: repeat(4, 1fr); } }

/* ---- server version: accounts, admin, tutor hidden */
.user-box { display: flex; gap: 10px; align-items: center; margin: 12px 14px 14px; padding: 10px; border-radius: 10px; background: #f8fafc; border: 1px solid #e5e7eb; }
.user-ava { width: 34px; height: 34px; border-radius: 50%; background: #6d5dfc; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.user-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.form-grid { display: grid; gap: 10px; }
.form-grid label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.users-tbl td, .users-tbl th { vertical-align: top; padding: 8px 10px; text-align: left; }
.btn.danger { color: #b91c1c; border-color: #fecaca; }
body.no-tutor [data-act="explain"], body.no-tutor [data-act="tutor"], body.no-tutor #vTutor, body.no-tutor #tsTutor,
body.no-tutor #askSel, body.no-tutor #newChat, body.no-tutor #tutor, body.no-tutor .tutor-btn,
body.online nav a[data-route="chats"], body.online nav a[data-route="import"] { display: none !important; }

/* brand block links to the dashboard */
a.brand { text-decoration: none; color: inherit; cursor: pointer; }
a.brand:hover .brand-name { text-decoration: underline; }
.brand-logo { width: 40px; height: 40px; flex: none; }
.brand-sub { line-height: 1.3; }
