/* 决策理论与方法 · 课程平台 —— SPA 通用样式（手机优先，桌面亦可） */
:root {
  --ink: #1f2430; --muted: #6b7280; --brand: #004B8D; --brand2: #15508f;
  --gold: #c4972a; --ok: #1a7f37; --warn: #b25900; --err: #b3261e;
  --soft: #eef3f9; --line: #e3e6ea; --bg: #f0f3f7;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink);
       font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
       font-size: 16px; line-height: 1.7; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- topbar ---------- */
.topbar { background: var(--brand); color: #fff; padding: 10px 16px;
          display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
          position: sticky; top: 0; z-index: 30; box-shadow: 0 1px 6px rgba(0,0,0,.18); }
.topbar img.logo { height: 30px; }
.topbar .brand { font-weight: 700; font-size: 17px; }
.topbar nav { margin-left: auto; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.topbar nav a { color: #dce9f7; font-size: 15px; }
.topbar nav a:hover { color: #fff; text-decoration: none; }
.topbar nav .who { color: #fff; font-size: 14px; }

.container { max-width: 980px; margin: 0 auto; padding: 18px 16px 60px; }
.container.narrow { max-width: 460px; }

h1 { font-size: 1.5rem; color: var(--brand); }
h2 { font-size: 1.2rem; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--err); background: #fdecea; border: 1px solid #f5c6c0;
       border-radius: 8px; padding: 8px 12px; }
.okmsg { color: var(--ok); background: #e9f5ec; border: 1px solid #bfe3c8;
         border-radius: 8px; padding: 8px 12px; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 12px;
        padding: 16px 18px; margin: 14px 0; box-shadow: 0 1px 3px rgba(16,35,61,.05); }
.card h2 { margin-top: 0; color: var(--brand); }
.card.click { cursor: pointer; transition: box-shadow .18s, border-color .18s; }
.card.click:hover { border-color: var(--brand2); box-shadow: 0 4px 14px rgba(16,35,61,.14); }

button, .btn { background: var(--brand); color: #fff; border: 0; border-radius: 8px;
        padding: 10px 22px; font-size: 15px; cursor: pointer; font-family: inherit;
        transition: filter .15s, transform .1s; }
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; display: inline-block; }
button:active { transform: scale(.97); }
button.secondary { background: #5c6b7d; }
button.danger { background: var(--err); }
button.big { font-size: 17px; padding: 13px 28px; }
button:disabled { opacity: .55; cursor: not-allowed; }

input[type=text], input[type=password], input[type=number], input[type=datetime-local],
textarea, select {
  width: 100%; padding: 10px 12px; font-size: 16px; font-family: inherit;
  border: 1px solid #b9c6d4; border-radius: 8px; background: #fff; color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
label { display: block; margin: 12px 0 5px; font-weight: 600; font-size: 14px; }

table.tbl { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 15px; }
.tbl th, .tbl td { border: 1px solid #ccd6e0; padding: 7px 10px; }
.tbl th { background: var(--soft); font-weight: 600; }
.tbl tr:nth-child(even) td { background: #fafcfe; }

.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px;
        background: var(--soft); color: var(--brand); border: 1px solid #c9d9ec; }
.pill.ok { background: #e9f5ec; color: var(--ok); border-color: #bfe3c8; }
.pill.warn { background: #fdf3e7; color: var(--warn); border-color: #eed3ae; }
.pill.err { background: #fdecea; color: var(--err); border-color: #f5c6c0; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

.empty { text-align: center; color: var(--muted); padding: 30px 0; }
.loginbox { max-width: 420px; margin: 30px auto; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.tabs a { background: #fff; border: 1px solid var(--line); border-radius: 999px;
          padding: 6px 16px; font-size: 14px; }
.tabs a.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- live (phone) ---------- */
.qcard { background: #fff; border: 1px solid var(--line); border-radius: 14px;
         padding: 18px; margin: 14px 0; }
.qcard .stem { font-size: 1.08rem; font-weight: 600; line-height: 1.75; }
.qcard .opts label { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0;
                     border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px;
                     font-weight: 400; cursor: pointer; transition: border-color .15s, background .15s; }
.qcard .opts input { width: 20px; height: 20px; margin-top: 4px; flex: none; }
.qcard .opts label.chosen { border-color: var(--brand); background: var(--soft); }
.qcard .opts label:hover { border-color: var(--brand2); }
.qcard .submitted-note { text-align: center; color: var(--ok); font-weight: 600; }
.result .agg { font-size: 15px; }
.result .explain { background: var(--soft); border-radius: 10px; padding: 10px 14px; margin-top: 10px; }

.wallpost { background: #fff; border: 1px solid var(--line); border-radius: 8px;
            padding: 9px 11px; margin: 7px 0; font-size: 15px;
            animation: fadeUp .35s ease both; }
.wallpost .who { color: var(--brand); font-weight: 600; margin-right: 6px; }
.wallpost.pinned { border-left: 4px solid var(--warn); background: #fff9f4; }

/* ---------- deck frames (learn / live deck browse / admin preview) ---------- */
.frame { background: #fff; border: 1px solid var(--line); border-radius: 12px;
         padding: 16px 18px; margin: 14px 0; }
.frame h3 { margin: 0 0 10px; color: var(--brand); font-size: 1.1rem;
            border-left: 4px solid var(--gold); padding-left: 10px; }
.frame .sec { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.frame ul, .frame ol { padding-left: 22px; }
.frame .tbl { font-size: 14px; }
.frame .ai { background: #f4f8fb; border: 1px dashed #9db8d4; border-radius: 10px;
             padding: 10px 14px; margin-top: 10px; }
.frame .ai b { color: var(--brand); }
.frame .note { background: #fdf8ec; border-left: 4px solid var(--gold);
               padding: 8px 12px; margin-top: 10px; border-radius: 0 8px 8px 0; }
.frame .warnbox { background: #fdf3e7; border-left: 4px solid var(--warn);
                  padding: 8px 12px; margin-top: 10px; border-radius: 0 8px 8px 0; }
.frame .part { font-size: 1.02em; color: var(--gold); font-weight: 600; letter-spacing: .03em; }
.frame .en { font-size: 1.1em; color: var(--muted); }
.frame .author { font-size: 1.2em; font-weight: 600; margin-top: 1.2em; }
.katex { font-size: 1.02em; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }

/* ---------- homework ---------- */
.hwq { background: #fff; border: 1px solid var(--line); border-radius: 12px;
       padding: 16px; margin: 16px 0; }
.hwq .pts { float: right; color: var(--muted); font-size: 13px; }
.hwq textarea { min-height: 150px; }
.feedback { background: var(--soft); border-radius: 10px; padding: 12px 16px; margin-top: 12px; }
.feedback .verdict { font-weight: 700; color: var(--brand); }
.feedback .score { float: right; font-size: 1.15rem; color: var(--ok); font-weight: 700; }
.feedback ul { margin: 6px 0; padding-left: 20px; }
.feedback .sug { color: var(--warn); }
.score-big { font-size: 2rem; font-weight: 700; color: var(--ok); }
.status-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; }
.status-chip.todo { background: #e8edf3; color: #445; }
.status-chip.grading, .status-chip.submitted { background: #fdf3e7; color: var(--warn); }
.status-chip.graded { background: #e9f5ec; color: var(--ok); }
.status-chip.failed { background: #fdecea; color: var(--err); }

/* ---------- animations（课件可用，作者在 body 的 class 上声明即可） ---------- */
@keyframes fadeUp   { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes popIn    { 0% { opacity: 0; transform: scale(.6); } 70% { transform: scale(1.06); } 100% { opacity: 1; transform: scale(1); } }
@keyframes growW    { from { width: 0; } }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
@keyframes floatY   { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.fadeUp   { animation: fadeUp .5s ease both; }
.popIn    { animation: popIn .45s cubic-bezier(.2,.9,.3,1.2) both; }
.floaty   { animation: floatY 3s ease-in-out infinite; }
.delay-1  { animation-delay: .15s; } .delay-2 { animation-delay: .3s; }
.delay-3  { animation-delay: .45s; } .delay-4 { animation-delay: .6s; }
.delay-5  { animation-delay: .75s; } .delay-6 { animation-delay: .9s; }
.delay-7  { animation-delay: 1.05s; } .delay-8 { animation-delay: 1.2s; }

/* 横向对比条（课件里做简易条形图）：<div class="hbar" style="--w:62%"><span>…</span></div> */
.hbar { background: #e8edf3; border-radius: 6px; height: 26px; margin: 6px 0;
        position: relative; overflow: hidden; }
.hbar > span:first-child { position: absolute; inset: 0 auto 0 0; width: var(--w, 50%);
        background: linear-gradient(90deg, #2f6cb3, var(--brand2)); border-radius: 6px;
        animation: growW 1s cubic-bezier(.2,.8,.3,1) both; }
.hbar > span:last-child { position: absolute; left: 10px; top: 0; line-height: 26px;
        color: #fff; font-size: 14px; text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.hbar.ok > span:first-child { background: linear-gradient(90deg, #2c9a55, var(--ok)); }
.hbar.warn > span:first-child { background: linear-gradient(90deg, #cf7a1f, var(--warn)); }

/* 贝叶斯交互模拟（deck 内 <div class="bysim" data-a data-b data-e data-prior data-la data-lb>，
   api.js wireBayesSim 负责构建滑块与饼图）：先验/似然三个滑块 → 后验饼图 */
.bysim { margin: 14px 0; padding: 12px 18px; background: #f4f8fb;
         border: 1.5px dashed #9db8d4; border-radius: 12px; }
.bysim .bs-row { display: flex; align-items: center; gap: 12px; margin: 6px 0; flex-wrap: wrap; }
.bysim .bs-row label { flex: 0 0 13em; }
.bysim input[type=range] { flex: 1 1 200px; accent-color: var(--brand); }
.bysim .bs-v { flex: 0 0 2.6em; text-align: right; font-variant-numeric: tabular-nums; }
.bysim .bs-out { display: flex; align-items: center; gap: 20px; margin-top: 10px; flex-wrap: wrap; }
.bysim .bs-pie { position: relative; width: 108px; height: 108px; border-radius: 50%; flex: none; }
.bysim .bs-pielabel { position: absolute; inset: 20px; background: #fff; border-radius: 50%;
                      display: flex; align-items: center; justify-content: center;
                      font-weight: 700; font-size: 1.1em; }
.bysim .bs-side { min-width: 240px; flex: 1; }
.bysim .bs-legend { margin-bottom: 6px; }
.bysim .bs-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px;
                 margin: 0 5px 0 12px; }
.bysim .bs-dot:first-child { margin-left: 0; }
.bysim .bs-a { background: var(--brand); }
.bysim .bs-b { background: #cbd5e1; }
.bysim .bs-formula { line-height: 1.8; }

/* SVG 描线动画：课件里给 path/line 加 class="draw" 即可 */
.draw { stroke-dasharray: 1200; stroke-dashoffset: 1200;
        animation: drawLine 1.4s ease-out .2s forwards; }

/* steps 逐条显示（教师端按 → 揭示；学生端 learn 直接全部显示） */
.stepr { opacity: 0; transform: translateY(10px); transition: opacity .4s ease, transform .4s ease; }
.stepr.shown { opacity: 1; transform: none; }


/* ---------- survey ---------- */
.survey-sec { color: var(--brand); border-bottom: 2px solid var(--soft);
              padding-bottom: 6px; margin-top: 26px; }
.survey-q { margin: 16px 0; }
.survey-q .stem { font-weight: 600; }
.survey-q .opts label.opt { display: inline-flex; gap: 8px; align-items: center;
  border: 1.5px solid var(--line); border-radius: 8px; padding: 6px 12px;
  margin: 4px 6px 4px 0; cursor: pointer; }
.survey-q .opts label.opt:has(input:checked) { border-color: var(--brand); background: var(--soft); }
.scale { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.scale-cell { width: 52px; justify-content: center; }

/* ---------- confidence slider ---------- */
.confrow { display: flex; gap: 12px; align-items: center; margin: 14px 0 4px; }
.confrow input[type=range] { flex: 1; accent-color: var(--brand); }

/* ---------- misc ---------- */
.card.dim { opacity: .45; }

/* ---------- live tabs ---------- */
.livetabs { display: flex; gap: 8px; margin: 6px 0 14px; }
.livetabs button { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.livetabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
