/* ============================================================
   急腹症临床案例自主学习平台 · 应用样式
   主色 teal #00807F（取自客户版原型聚类）
   ============================================================ */

:root {
  --primary: #00807F;
  --primary-600: #006B6A;
  --primary-700: #005756;
  --primary-50: #E6F3F2;
  --primary-100: #CFE8E6;

  --bg: #F4F7F9;
  --card: #FFFFFF;
  --border: #E6EDF0;
  --border-strong: #D6E0E5;

  --text: #10262E;
  --text-2: #5B6E77;
  --text-3: #93A3AB;

  --orange: #E8930C;
  --orange-bg: #FFF5E3;
  --green: #23A26D;
  --green-bg: #E7F7EF;
  --blue: #3B7DE0;
  --blue-bg: #ECF2FD;
  --red: #D9503F;
  --red-bg: #FDEDEA;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16,38,46,.04), 0 4px 12px rgba(16,38,46,.04);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;

  /* 大屏等比放大系数（由断点覆盖）。#root 用它做整体缩放，
     字号、间距、卡片尺寸一起放大，避免 4K/2K 屏上「一片小字」。 */
  --ui-scale: 1;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
#root { height: 100%; zoom: var(--ui-scale); }
#toast, #wbModal { zoom: var(--ui-scale); }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; font-size: 14px;
}
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  height: 100%; display: flex; align-items: center; justify-content: center;
  background:
    linear-gradient(100deg, rgba(7,28,38,.94), rgba(8,35,46,.80) 42%, rgba(10,44,56,.55)),
    url("../assets/hero-ship.jpg") center right / cover no-repeat;
}
.login-card {
  width: 400px; background: #fff; border-radius: 14px; padding: 34px 32px 28px;
  box-shadow: 0 24px 60px rgba(4,20,28,.35);
}
.login-card .brand { padding: 0 0 22px; }
.login-card h2 { font-size: 19px; font-weight: 700; margin-bottom: 6px; }
.login-card .sub { font-size: 12.5px; color: var(--text-3); margin-bottom: 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; height: 40px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 0 12px; font-size: 13.5px; font-family: var(--font); color: var(--text); background: #fff;
  outline: none;
}
.field textarea { height: auto; padding: 10px 12px; line-height: 1.8; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.login-tabs { display: flex; gap: 6px; background: #F1F5F7; border-radius: 8px; padding: 4px; margin-bottom: 22px; }
.login-tabs button {
  flex: 1; height: 32px; border: 0; background: transparent; border-radius: 6px;
  font-size: 13px; color: var(--text-2); cursor: pointer; font-weight: 600;
}
.login-tabs button.on { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(16,38,46,.10); }
.login-hint { font-size: 11.5px; color: var(--text-3); line-height: 1.9; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border-strong); }
.login-hint b { color: var(--text-2); }

/* ---------------- 应用外壳 ---------------- */
.app { height: 100%; display: flex; overflow: hidden; }
.sidebar {
  width: 208px; flex: 0 0 208px; background: #fff; border-right: 1px solid var(--border);
  padding: 18px 12px 14px; display: flex; flex-direction: column;
}
.brand { display: flex; gap: 9px; align-items: center; padding: 0 6px 16px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(140deg, #0A8F8D, #00625F);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 700; flex: 0 0 auto;
}
.brand-text b { display: block; font-size: 13.5px; font-weight: 700; }
.brand-text span { display: block; font-size: 11px; color: var(--text-3); margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px;
  border-radius: var(--radius-sm); font-size: 13.5px; color: var(--text-2);
  position: relative; cursor: pointer; border: 0; background: transparent; width: 100%; text-align: left;
}
.nav-item:hover { background: #F5F9FA; }
.nav-item svg { width: 15px; height: 15px; opacity: .75; flex: 0 0 auto; }
.nav-item.active { background: var(--primary-50); color: var(--primary-700); font-weight: 600; }
.nav-item.active svg { opacity: 1; }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 9px; width: 3px; height: 20px;
  border-radius: 0 3px 3px 0; background: var(--primary);
}
.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #F04E3E; color: #fff; font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); line-height: 1.7; }
.sidebar-foot button { border: 0; background: transparent; color: var(--text-3); font-size: 11.5px; cursor: pointer; padding: 0; margin-top: 6px; text-decoration: underline; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 54px; flex: 0 0 54px; display: flex; align-items: center; gap: 14px;
  padding: 0 24px; background: #fff; border-bottom: 1px solid var(--border);
}
.crumb { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.crumb b { color: var(--text); font-weight: 600; }
.crumb .back { cursor: pointer; color: var(--primary); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.user-chip { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.net-badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: 11px; font-size: 11px; font-weight: 600; white-space: nowrap;
}
.net-badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.net-badge.on { background: var(--green-bg); color: var(--green); }
.net-badge.off { background: #EFF3F5; color: #77888F; }
@media (max-width: 860px) { .net-badge { display: none; } }
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(140deg, #7FB6C9, #3E6C80);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 600;
}
.page { flex: 1; overflow-y: auto; padding: 20px 24px 28px; }

/* ---------------- 组件 ---------------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: 15px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card-head h3 { font-size: 15px; font-weight: 700; }
.card-head .sub { font-size: 12px; color: var(--text-3); }

.btn {
  height: 34px; padding: 0 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; gap: 6px; background: var(--primary); color: #fff;
}
.btn:hover { background: var(--primary-600); }
.btn:disabled { background: #D7E5E4; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--primary); border-color: var(--primary-100); }
.btn.ghost:hover { background: var(--primary-50); }
.btn.neutral { background: #fff; color: var(--text-2); border-color: var(--border-strong); }
.btn.neutral:hover { background: #F7FAFB; }
.btn.danger { background: #fff; color: var(--red); border-color: #F7CFC8; }
.btn.danger:hover { background: var(--red-bg); }
.btn.sm { height: 28px; padding: 0 12px; font-size: 12.5px; border-radius: 5px; }
.btn.lg { height: 40px; padding: 0 22px; font-size: 14px; }
.btn.block { width: 100%; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: 11px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge.gray { background: #EFF3F5; color: #77888F; }
.badge.orange { background: var(--orange-bg); color: var(--orange); }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge .pip { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 11px; font-weight: 600; background: #F1F5F7; color: var(--text-2); }
.tag.teal { background: var(--primary-50); color: var(--primary-700); }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2); background: #F7FAFB; padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 14px; font-size: 13px; border-bottom: 1px solid #F0F4F6; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FAFCFD; }
.table .muted { color: var(--text-2); }
.table .num { font-variant-numeric: tabular-nums; }

.input {
  height: 34px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; padding: 0 12px; font-size: 13px; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.input input { border: 0; outline: none; flex: 1; font-size: 13px; font-family: var(--font); background: transparent; }
.select { height: 34px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; padding: 0 10px; font-size: 13px; color: var(--text-2); outline: none; }

.bar { height: 5px; border-radius: 3px; background: #E8EEF1; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--primary); transition: width .3s; }

.empty { padding: 44px 20px; text-align: center; color: var(--text-3); font-size: 13px; }
.empty b { display: block; font-size: 14px; color: var(--text-2); margin-bottom: 6px; }

/* ---------------- 首页 ---------------- */
.banner {
  height: 176px; border-radius: var(--radius); overflow: hidden; position: relative;
  display: flex; align-items: center; padding: 0 38px;
  background:
    linear-gradient(96deg, rgba(7,28,38,.94) 0%, rgba(8,35,46,.84) 34%, rgba(10,44,56,.40) 62%, rgba(12,52,64,.08) 100%),
    url("../assets/hero-ship.jpg") center right / cover no-repeat;
}
.banner .txt { color: #fff; }
.banner h1 { font-size: 28px; font-weight: 800; letter-spacing: 1px; }
.banner h2 { font-size: 17px; font-weight: 600; margin-top: 7px; opacity: .95; }
.banner p { font-size: 12.5px; margin-top: 9px; opacity: .72; }

.section-h { display: flex; align-items: baseline; gap: 10px; margin: 20px 2px 12px; }
.section-h h3 { font-size: 16px; font-weight: 700; }
.section-h span { font-size: 12px; color: var(--text-3); }

.cases { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.case-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.case-thumb { aspect-ratio: 16 / 10; min-height: 120px; position: relative; background: #0E2530; background-size: cover; background-position: center 34%; }
.case-thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(6,22,30,.30), transparent 40%, rgba(6,22,30,.52)); }
.case-thumb.t-a { background-image: url("../assets/case-a-engine.jpg"); }
.case-thumb.t-b { background-image: url("../assets/case-b-mess.png"); background-position: center 42%; }
.case-thumb.t-c { background-image: url("../assets/case-c-corridor.png"); background-position: center 38%; }
.case-thumb.t-d { background-image: url("../assets/case-d-exam.png"); background-position: center 30%; }
.case-thumb .scene { position: absolute; left: 10px; bottom: 9px; z-index: 2; color: rgba(255,255,255,.92); font-size: 11px; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.case-thumb .dur { position: absolute; right: 9px; bottom: 9px; z-index: 2; background: rgba(6,24,32,.72); color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 3px; }
.case-body { padding: 13px 14px 14px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.case-id { font-size: 11px; color: var(--text-3); letter-spacing: .4px; }
.case-name { font-size: 14.5px; font-weight: 700; }
.case-meta { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }

/* ---------------- 播放 ---------------- */
.steps { display: flex; align-items: center; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 12px 6px; margin-bottom: 16px; }
.step { flex: 1; display: flex; align-items: center; gap: 8px; padding: 0 14px; position: relative; }
.step i { width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto; background: #EDF2F4; color: var(--text-3); font-size: 11px; font-weight: 700; font-style: normal; display: flex; align-items: center; justify-content: center; }
.step span { font-size: 13px; color: var(--text-3); }
.step.done i { background: var(--primary-50); color: var(--primary); }
.step.done span { color: var(--primary); font-weight: 600; }
.step.now i { background: var(--primary); color: #fff; }
.step.now span { color: var(--primary-700); font-weight: 700; }
.step.now::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -13px; height: 2px; background: var(--primary); border-radius: 2px; }

.player-wrap { display: grid; grid-template-columns: 1fr 268px; gap: 16px; align-items: start; }
.player { background: #0B1B23; border-radius: var(--radius); overflow: hidden; position: relative; aspect-ratio: 16 / 9; cursor: pointer; }
.player .scene { position: absolute; inset: 0; background-size: cover; background-position: center 38%; background-repeat: no-repeat; }
.player .scene::after { content: ""; position: absolute; inset: 0; background: linear-gradient(165deg, rgba(8,26,34,.30), rgba(8,22,29,.52)); }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #05161d; }
.player.has-video .scene::after { display: none; }
.media-loading {
  position: absolute; left: 0; right: 0; bottom: 56px; text-align: center;
  color: #fff; font-size: 12.5px; opacity: .85; z-index: 2;
}
.player .big-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 58px; height: 58px; border-radius: 50%; background: rgba(255,255,255,.16);
  border: 1.5px solid rgba(255,255,255,.55); display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 17px; z-index: 3; backdrop-filter: blur(2px);
}
.player.playing .big-play { opacity: 0; }
.ctrl { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 14px 12px; background: linear-gradient(180deg, transparent, rgba(4,16,22,.85) 62%); display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.92); z-index: 3; }
.ctrl .track { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.26); position: relative; }
.ctrl .track i { position: absolute; left: 0; top: 0; bottom: 0; background: #fff; border-radius: 2px; }
.ctrl .time { font-size: 11px; font-variant-numeric: tabular-nums; }

/* ---------------- 答题 ---------------- */
.quiz-wrap { display: grid; grid-template-columns: 1fr 250px; gap: 16px; align-items: start; }
.q-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.q-idx { font-size: 15px; font-weight: 700; }
.q-idx em { font-style: normal; font-size: 12px; color: var(--text-3); font-weight: 400; }
.q-timer { margin-left: auto; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.stem { font-size: 14.5px; line-height: 1.9; padding: 14px 0 16px; }
.options { display: flex; flex-direction: column; gap: 9px; }
.opt { display: flex; align-items: center; gap: 11px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 12px 14px; font-size: 13.5px; background: #fff; cursor: pointer; transition: border-color .15s, background .15s; }
.opt:hover { border-color: var(--primary-100); background: #FAFDFD; }
.opt .k { width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto; border: 1.5px solid #C9D5DB; color: var(--text-3); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.opt.on { border-color: var(--primary); background: var(--primary-50); }
.opt.on .k { background: var(--primary); border-color: var(--primary); color: #fff; }
.opt.wrong { border-color: #F1C4BC; background: #FDF4F2; }
.opt.wrong .k { background: var(--red); border-color: var(--red); color: #fff; }
.opt.right { border-color: #B4E3CB; background: #F1FBF6; }
.opt.right .k { background: var(--green); border-color: var(--green); color: #fff; }
.opt .mark { margin-left: auto; font-size: 11.5px; font-weight: 600; }
.q-actions { display: flex; gap: 10px; margin-top: 22px; align-items: center; }

.pgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.pgrid b { height: 30px; border-radius: 5px; background: #F1F5F7; color: var(--text-3); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; cursor: pointer; border: 0; }
.pgrid b.on { background: var(--primary); color: #fff; }
.pgrid b.done { background: var(--primary-50); color: var(--primary-700); }
.legend { display: flex; flex-direction: column; gap: 8px; font-size: 11.5px; color: var(--text-2); margin-top: 14px; }
.legend div { display: flex; align-items: center; gap: 7px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: block; }

/* ---------------- 成绩 / 报告 ---------------- */
.score-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.state-ribbon { padding: 11px 18px; font-size: 12.5px; font-weight: 700; color: #fff; }
.state-ribbon.orange { background: #F2A22B; }
.state-ribbon.green { background: #21A66B; }
.state-body { padding: 22px 18px 20px; text-align: center; }
.state-body .ico-big { font-size: 34px; margin-bottom: 12px; }
.state-body h4 { font-size: 14.5px; font-weight: 700; margin-bottom: 8px; }
.state-body p { font-size: 12.5px; color: var(--text-2); line-height: 1.9; }
.score-num { font-size: 40px; font-weight: 800; color: var(--green); letter-spacing: -1px; }
.score-num small { font-size: 15px; font-weight: 700; margin-left: 3px; }
.meta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border-strong); text-align: left; }
.meta-row div span { display: block; font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
.meta-row div b { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

.report-top { display: grid; grid-template-columns: 170px 1fr; gap: 20px; align-items: center; }
.ring { width: 116px; height: 116px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto; position: relative; }
.ring::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: #fff; }
.ring div { position: relative; z-index: 2; text-align: center; }
.ring b { font-size: 28px; font-weight: 800; }
.ring span { display: block; font-size: 11px; color: var(--text-3); margin-top: 2px; }
.kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi div { background: #F8FBFC; border: 1px solid var(--border); border-radius: 8px; padding: 13px 14px; }
.kpi span { display: block; font-size: 11.5px; color: var(--text-3); margin-bottom: 6px; }
.kpi b { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi b small { font-size: 11px; color: var(--text-3); font-weight: 500; }

.qrow { display: grid; grid-template-columns: 62px 1fr 110px; gap: 14px; padding: 14px 18px; border-bottom: 1px solid #F0F4F6; }
.qrow:last-child { border-bottom: 0; }
.qno { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.qno em { display: block; font-style: normal; font-size: 10.5px; color: var(--text-3); font-weight: 400; margin-top: 3px; }
.qbody .t { font-size: 13.5px; font-weight: 600; margin-bottom: 6px; line-height: 1.7; }
.qbody .a { font-size: 12px; color: var(--text-2); line-height: 1.85; }
.qbody .a b { color: var(--green); font-weight: 600; }
.qbody .a i { color: var(--red); font-style: normal; font-weight: 600; }
.qbody .ana { margin-top: 8px; background: #F7FAFB; border-left: 3px solid var(--primary-100); padding: 9px 12px; border-radius: 0 5px 5px 0; font-size: 12px; color: var(--text-2); line-height: 1.85; }
.qscore { text-align: right; font-size: 13px; font-weight: 700; }
.qscore em { display: block; font-style: normal; font-size: 10.5px; color: var(--text-3); font-weight: 400; margin-top: 4px; }

/* ---------------- 留言 ---------------- */
.chat-layout { display: grid; grid-template-columns: 250px 1fr; height: calc(100vh - 154px); min-height: 460px; overflow: hidden; }
.threads { border-right: 1px solid var(--border); background: #FAFCFD; overflow-y: auto; }
.thread { padding: 13px 14px; border-bottom: 1px solid #EEF3F5; cursor: pointer; }
.thread:hover { background: #F4F9FA; }
.thread.on { background: var(--primary-50); border-left: 3px solid var(--primary); padding-left: 11px; }
.thread .n { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.thread .p { font-size: 11.5px; color: var(--text-3); margin-top: 5px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread .t { font-size: 10.5px; color: var(--text-3); margin-top: 5px; }
.chat { display: flex; flex-direction: column; min-width: 0; }
.chat-head { padding: 13px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.chat-head b { font-size: 13.5px; }
.msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; background: #FBFDFE; }
.msg { display: flex; gap: 9px; max-width: 78%; }
.msg .bub { background: #fff; border: 1px solid var(--border); border-radius: 10px 10px 10px 2px; padding: 10px 13px; font-size: 12.5px; line-height: 1.85; }
.msg .who { font-size: 10.5px; color: var(--text-3); margin-bottom: 5px; }
.msg.me { margin-left: auto; flex-direction: row-reverse; }
.msg.me .bub { background: var(--primary); border-color: var(--primary); color: #fff; border-radius: 10px 10px 2px 10px; }
.msg.me .who { text-align: right; }
.msg .bub .qref { display: block; margin-bottom: 7px; padding: 7px 9px; border-radius: 5px; background: #F4F8F9; border-left: 3px solid var(--primary-100); font-size: 11.5px; color: var(--text-2); }
.msg.me .bub .qref { background: rgba(255,255,255,.16); border-left-color: rgba(255,255,255,.5); color: rgba(255,255,255,.92); }
.composer { border-top: 1px solid var(--border); padding: 12px 16px; background: #fff; }
.composer textarea { width: 100%; border: 1px solid var(--border-strong); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; font-family: var(--font); line-height: 1.8; resize: none; height: 62px; outline: none; }
.composer textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.composer .row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.composer .hint { font-size: 11px; color: var(--text-3); margin-right: auto; }

/* ---------------- 提示条 ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 20px);
  background: #10262E; color: #fff; padding: 11px 20px; border-radius: 8px;
  font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s; z-index: 999;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.modal-mask { position: fixed; inset: 0; background: rgba(8,24,32,.45); display: flex; align-items: center; justify-content: center; z-index: 500; }
.modal { width: 460px; background: #fff; border-radius: 12px; box-shadow: 0 24px 60px rgba(0,0,0,.28); overflow: hidden; max-height: calc(100vh - 60px); display: flex; flex-direction: column; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); font-size: 15px; font-weight: 700; flex: 0 0 auto; }
.modal-body { padding: 20px; font-size: 13px; color: var(--text-2); line-height: 1.9; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 9px; flex: 0 0 auto; }

.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 14px; }
.stat-grid .card { padding: 14px 16px; }
.stat-grid .label { font-size: 11.5px; color: var(--text-3); margin-bottom: 7px; }
.stat-grid .value { font-size: 24px; font-weight: 800; }
.stat-grid .value small { font-size: 12px; font-weight: 500; color: var(--text-3); }

.rule-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.rule-grid .card { padding: 14px 16px; }
.rule-grid h4 { font-size: 12.5px; font-weight: 700; margin-bottom: 6px; }
.rule-grid p { font-size: 11.5px; color: var(--text-2); line-height: 1.9; }

/* ---------------- 训练模式 / 病例摘要 ---------------- */
.brief { padding: 16px 20px 20px; font-size: 13px; line-height: 2.05; color: var(--text-2); }
.brief b { color: var(--text); }
.qlock-hint { font-size: 11.5px; color: var(--text-3); margin-top: 12px; line-height: 1.8; }

.lockbar { margin-top: 16px; border-radius: 8px; padding: 12px 14px; font-size: 12.5px; line-height: 1.8; display: flex; flex-direction: column; gap: 4px; }
.lockbar.right { background: var(--green-bg); border: 1px solid #B9E4CE; color: #1B7F58; }
.lockbar.wrong { background: var(--red-bg); border: 1px solid #F3C9C2; color: #A93A2C; }
.lockbar b { font-size: 13px; }
.lockbar em { font-style: normal; font-weight: 600; }
.lockbar span { font-size: 11px; opacity: .72; }

/* 逐题解析（答完即可展开） */
.reveal-box { margin-top: 12px; }
.reveal-body {
  margin-top: 10px; border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; background: #F8FBFC; font-size: 12.5px; line-height: 1.95; color: var(--text-2);
}
.reveal-body .rv-line b { color: var(--text); font-weight: 700; }
.reveal-body .rv-line b.x { color: var(--red); }
.reveal-body .rv-warn { margin-top: 8px; color: #A93A2C; }
.reveal-body .rv-ana { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border-strong); }

.pgrid b.good { background: var(--green); color: #fff; }
.pgrid b.bad { background: var(--red); color: #fff; }
.pgrid b.on { outline: 2px solid rgba(0,128,127,.55); outline-offset: 1px; }
.legend i.good { background: var(--green); }

.modal.wide { width: 720px; max-width: calc(100vw - 40px); }
.modal-head.warn { background: linear-gradient(90deg, #FDF0ED, #FFF8F6); color: var(--red); display: flex; align-items: center; gap: 8px; }
.warn-msg { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.85; }
.warn-sub { margin-top: 12px; font-size: 12px; color: var(--text-3); line-height: 1.8; }
.ana.warn-ana { border-left-color: #F0BDB4; background: #FDF5F3; color: #A93A2C; }

/* ---------------- 教师端 · 题目编辑 / 批量导入 ---------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-label { display: block; font-size: 11.5px; color: var(--text-2); font-weight: 600; margin-bottom: 6px; }
.form-label i { font-style: normal; color: var(--red); margin-left: 2px; }
.ti { width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 11px; font-size: 13px; font-family: var(--font); color: var(--text); outline: none; background: #fff; }
.ti:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
textarea.ti { line-height: 1.8; resize: vertical; }
.opt-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.opt-row .letter { width: 24px; height: 24px; border-radius: 50%; background: #EDF2F4; color: var(--text-3); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; cursor: pointer; border: 1.5px solid transparent; }
.opt-row.correct .letter { background: var(--green); color: #fff; }
.opt-row input { flex: 1; }
.opt-row .del { border: 0; background: transparent; color: var(--text-3); cursor: pointer; font-size: 15px; padding: 0 4px; }
.opt-row .del:hover { color: var(--red); }
.imp-box { width: 100%; min-height: 220px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.85; }
.imp-hint { font-size: 11.5px; color: var(--text-3); line-height: 1.9; background: #F8FBFC; border: 1px dashed var(--border-strong); border-radius: 6px; padding: 10px 12px; margin-bottom: 12px; }
.imp-hint code { font-family: ui-monospace, monospace; color: var(--primary-700); background: var(--primary-50); padding: 1px 5px; border-radius: 3px; }

/* 病例封面选择 / 视频上传 */
.poster-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.poster-opt {
  width: 106px; padding: 0; background: #fff; cursor: pointer; overflow: hidden;
  border: 2px solid var(--border); border-radius: 8px;
}
.poster-opt .pv { display: block; height: 58px; background-size: cover; background-position: center 35%; }
.poster-opt .pl { display: block; font-size: 11.5px; color: var(--text-2); padding: 5px 0; text-align: center; }
.poster-opt:hover { border-color: var(--primary-100); }
.poster-opt.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.poster-opt.on .pl { color: var(--primary-700); font-weight: 700; }
.poster-opt.poster-add .pv {
  display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(45deg,#F6FAFB,#F6FAFB 6px,#EEF4F6 6px,#EEF4F6 12px);
  color: var(--text-3); font-size: 20px; font-weight: 300;
}
.poster-opt.poster-add .pv::after { content: "＋"; }
.poster-opt.poster-add .pv.has-img::after { content: ""; }
.poster-opt.poster-add .pv.has-img { background-size: cover; background-position: center 35%; }
.upl-hint { margin-top: 8px; }
input[type="file"].ti { height: auto; padding: 8px 10px; font-size: 12.5px; }

@media (max-width: 860px) {
  .form-grid { grid-template-columns: 1fr; }
}


@media (max-width: 1180px) {
  .cases { grid-template-columns: repeat(2, 1fr); }
  .player-wrap, .quiz-wrap { grid-template-columns: 1fr; }
  .score-pair, .report-top { grid-template-columns: 1fr; }
  .kpi { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   响应式
   ============================================================ */

/* 手机底部导航（桌面端隐藏） */
.m-nav { display: none; }
.m-logout { display: none; }

/* ---- 大屏整体放大：2K / 4K 屏不再是一屏小字 ---- */
@media (min-width: 1680px) { :root { --ui-scale: 1.1; } }
@media (min-width: 1920px) { :root { --ui-scale: 1.18; } }
@media (min-width: 2300px) { :root { --ui-scale: 1.3; } }
@media (min-width: 2700px) { :root { --ui-scale: 1.45; } }

/* ---- 平板 ---- */
@media (max-width: 1024px) {
  .chat-layout { grid-template-columns: 200px 1fr; }
}

/* ---- 手机 ---- */
@media (max-width: 860px) {
  :root { --ui-scale: 1; }
  .sidebar { display: none; }
  .app { flex-direction: column; }
  .cases { grid-template-columns: 1fr; }
  .page { padding: 14px 14px 84px; }
  .topbar { padding: 0 14px; height: 50px; flex: 0 0 50px; }
  .crumb { font-size: 12.5px; }
  .user-chip { font-size: 12px; }

  /* 底部导航 */
  .m-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: #fff; border-top: 1px solid var(--border);
    padding: 6px 2px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(16,38,46,.06);
  }
  .m-nav button {
    flex: 1 1 0; border: 0; background: transparent; padding: 4px 0 2px;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-size: 10.5px; color: var(--text-3); position: relative; cursor: pointer;
  }
  .m-nav button svg { width: 19px; height: 19px; }
  .m-nav button.on { color: var(--primary); font-weight: 700; }
  .m-nav .nav-badge { position: absolute; top: 0; right: 22%; margin: 0; }
  .m-logout { display: inline-flex !important; height: 28px; padding: 0 10px; font-size: 12px; }

  /* 卡片与表格 */
  .section-h { flex-wrap: wrap; gap: 2px 8px; margin: 16px 2px 10px; }
  .section-h h3 { white-space: nowrap; }
  .section-h span { flex: 1 1 100%; font-size: 11.5px; }
  .banner { height: 138px; padding: 0 20px; }
  .banner h1 { font-size: 21px; }
  .banner h2 { font-size: 13.5px; }
  .banner p { font-size: 11.5px; }
  .card { overflow-x: auto; }
  .table { min-width: 560px; }
  .qrow { grid-template-columns: 1fr; gap: 6px; position: relative; }
  .qscore { text-align: left; }
  .modal { width: calc(100vw - 24px); }
  .login-card { width: calc(100vw - 32px); padding: 26px 22px 22px; }
  .login-wrap { padding: 20px 0; height: auto; min-height: 100%; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { padding: 10px 4px; }
  .step { padding: 0 8px; gap: 6px; }
  .step span { font-size: 11.5px; }
  .opt { padding: 11px 12px; font-size: 13px; }
  .q-head { flex-wrap: wrap; gap: 7px; }
  .q-head .q-timer { margin-left: auto; }
  .tag { white-space: nowrap; }
  .quest-rules, .quiz-rules { grid-template-columns: 1fr !important; gap: 10px !important; }
  .q-layout, .review-layout { grid-template-columns: 1fr !important; }
  .q-layout > .card:first-child { order: 2; max-height: 46vh; overflow-y: auto; }
  .q-layout > .card:last-child { order: 1; }
  .q-actions { flex-wrap: wrap; }
  .chat-layout { grid-template-columns: 1fr; height: auto; }
  .threads { max-height: 180px; border-right: 0; border-bottom: 1px solid var(--border); }
}

/* ---- 小屏手机 ---- */
@media (max-width: 390px) {
  .page { padding: 12px 10px 84px; }
  .banner h1 { font-size: 19px; }
  .kpi { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
