/* 学习任务单互动系统 —— 共用样式 */
:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #1f2933;
  --muted: #6b7684;
  --line: #e3e8ef;
  --brand: #2f6fed;
  --brand-weak: #e8f0fe;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}
.wrap { max-width: 860px; margin: 0 auto; padding: 16px 16px 80px; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--brand); color: #fff;
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.topbar .wrap { padding: 0 4px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; flex: 1; min-width: 200px; }
.topbar .sub { font-size: 13px; opacity: .85; }
.progress {
  height: 6px; background: rgba(255,255,255,.25); border-radius: 3px; overflow: hidden;
  flex-basis: 100%;
}
.progress i { display: block; height: 100%; background: #ffd166; width: 0; transition: width .3s; }

/* 卡片 */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-top: 16px;
}
.card > h2 {
  margin: 0 0 6px; font-size: 16px; color: var(--brand);
  padding-left: 10px; border-left: 4px solid var(--brand); line-height: 1.4;
}
.card .note { color: var(--muted); font-size: 14px; margin: 0 0 10px; }
.card img.task-img { max-width: 100%; border-radius: 8px; margin: 8px 0; border: 1px solid var(--line); }

/* 题目项 */
.item { margin: 16px 0 4px; }
.item > .q-label { font-weight: 600; margin-bottom: 8px; display: block; }

/* 勾选 */
.opt {
  display: flex; align-items: center; gap: 10px;
  border: 1.5px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin: 8px 0; cursor: pointer; transition: .15s;
  background: #fff; user-select: none;
}
.opt:hover { border-color: var(--brand); }
.opt.on { border-color: var(--brand); background: var(--brand-weak); }
.opt .box {
  width: 22px; height: 22px; border: 2px solid #b6c2d2; border-radius: 6px;
  flex: none; display: grid; place-items: center; color: #fff; font-size: 14px;
}
.opt.on .box { background: var(--brand); border-color: var(--brand); }
.opt input.other-input {
  flex: 1; border: none; border-bottom: 1.5px dashed var(--line);
  font-size: 15px; padding: 2px 4px; outline: none; background: transparent;
}
.opt input.other-input:focus { border-bottom-color: var(--brand); }

/* 星级 */
.stars { display: flex; gap: 6px; align-items: center; }
.stars .star {
  font-size: 30px; line-height: 1; cursor: pointer; color: #d7dee8;
  background: none; border: none; padding: 2px; transition: transform .1s;
}
.stars .star.on { color: #f5a623; }
.stars .star:active { transform: scale(1.2); }
.stars .val { color: var(--muted); font-size: 14px; margin-left: 6px; }

/* 输入框 */
input[type=text], input[type=number], textarea, select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 15px; font-family: inherit; outline: none;
  background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); }
textarea { resize: vertical; min-height: 80px; }
.short { max-width: 240px; }
.inline-num { display: flex; align-items: center; gap: 8px; }
.inline-num input { max-width: 140px; }
.inline-num .unit { color: var(--muted); }

/* 步骤列表 */
.list-rows .row { display: flex; gap: 8px; margin: 8px 0; align-items: center; }
.list-rows .idx {
  width: 28px; height: 28px; border-radius: 50%; background: var(--brand-weak);
  color: var(--brand); display: grid; place-items: center; font-size: 14px; font-weight: 600; flex: none;
}
.list-rows input { flex: 1; }
.btn-mini {
  border: 1.5px solid var(--line); background: #fff; border-radius: 8px;
  padding: 6px 12px; cursor: pointer; font-size: 14px; color: var(--muted);
}
.btn-mini:hover { border-color: var(--brand); color: var(--brand); }

/* 排序 / 连线 */
.pair-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.pair-row .left {
  flex: 1; background: var(--brand-weak); border-radius: 10px; padding: 10px 12px;
  font-weight: 600;
}
.pair-row select { max-width: 90px; flex: none; }
.pair-row .right { flex: 2.2; color: var(--muted); font-size: 14px; }
.order-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.order-row .txt { flex: 1; background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.order-row select { max-width: 90px; flex: none; }

/* 按钮 */
.btn {
  display: inline-block; border: none; border-radius: 12px; cursor: pointer;
  background: var(--brand); color: #fff; font-size: 17px; font-weight: 600;
  padding: 14px 32px; transition: .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }
.btn.big { width: 100%; }
.btn:disabled { background: #b9c6dd; cursor: not-allowed; }

/* 登录遮罩 */
.login-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 50;
  display: grid; place-items: center; padding: 16px;
}
.login-box {
  background: #fff; border-radius: 16px; padding: 26px; width: 100%; max-width: 380px;
}
.login-box h2 { margin: 0 0 4px; font-size: 19px; }
.login-box p { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.login-box input { margin-bottom: 12px; }
.login-box .err { color: var(--danger); font-size: 14px; min-height: 20px; }

/* 提示 */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: #111827; color: #fff; border-radius: 10px; padding: 12px 22px;
  font-size: 15px; z-index: 99; opacity: 0; transition: opacity .25s; pointer-events: none;
  max-width: 90%;
}
.toast.show { opacity: .95; }
.tip-bar {
  background: #fff7e6; border: 1px solid #ffe1a8; color: #8a5b00;
  border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-top: 16px;
}

/* 课程列表 */
.lesson-card {
  display: flex; align-items: center; gap: 14px; background: #fff;
  border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
  margin-top: 12px; cursor: pointer; transition: .15s; text-decoration: none; color: inherit;
}
.lesson-card:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(47,111,237,.12); }
.lesson-card .no {
  width: 44px; height: 44px; border-radius: 12px; background: var(--brand-weak);
  color: var(--brand); display: grid; place-items: center; font-weight: 700; flex: none;
}
.lesson-card .t { font-weight: 600; }
.lesson-card .d { color: var(--muted); font-size: 13px; }

/* 教师端 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; margin-top: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat b { display: block; font-size: 26px; color: var(--brand); }
.stat span { color: var(--muted); font-size: 13px; }
table.grid { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; }
table.grid th, table.grid td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
table.grid th { background: #f0f4fa; font-weight: 600; white-space: nowrap; }
table.grid tr:nth-child(even) td { background: #fafbfe; }
.rate-bar { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 14px; }
.rate-bar .lbl { flex: 1; }
.rate-bar .track { flex: 1.4; height: 10px; background: #eef1f6; border-radius: 5px; overflow: hidden; }
.rate-bar .track i { display: block; height: 100%; background: #f5a623; }
.rate-bar .v { width: 70px; text-align: right; color: var(--muted); }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 0; }
.tab {
  border: 1.5px solid var(--line); background: #fff; border-radius: 999px;
  padding: 8px 18px; cursor: pointer; font-size: 15px; color: var(--muted);
}
.tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.search-box { max-width: 280px; margin: 12px 0; }
textarea.answer-view {
  background: #fafbfe; font-size: 14px; min-height: 60px; margin: 4px 0;
}
.muted { color: var(--muted); font-size: 13px; }
.drop-zone {
  border: 2px dashed #c3cfe0; border-radius: 12px; padding: 22px; text-align: center;
  color: var(--muted); font-size: 14px; margin-top: 12px; background: #fafcff;
}
.drop-zone.drag { border-color: var(--brand); background: var(--brand-weak); }

/* ===== 课程卡片上的游戏入口 ===== */
.game-chip {
  margin-left: auto;
  padding: 8px 14px;
  border-radius: 999px;
  background: #ff9f43;
  color: #fff !important;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(255, 159, 67, .35);
  transition: transform .15s;
}
.game-chip:hover { transform: scale(1.06); }
