@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700;900&display=swap");
/* ============================================================
 * 上課系統 — Live Classroom Monitor
 * ============================================================ */

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang TC", sans-serif;
  color: #3a2e23;
  background:
    radial-gradient(85% 40% at 50% 0%, rgba(245,158,11,.10) 0%, rgba(0,0,0,0) 60%),
    linear-gradient(165deg,#fdf9f2 0%, #faf2e6 55%, #f8ecd9 100%);
  background-attachment: fixed;
  -webkit-text-size-adjust: 100%;
}

button { font-family: inherit; }
input { font-family: inherit; }

/* === Layout === */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: #33281f; color: white;
  padding: 12px 18px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.topbar h1 { font-size: 17px; font-weight: 600; margin: 0; }
.topbar .meta { font-size: 13px; opacity: 0.8; }
.topbar .meta button {
  background: transparent; border: 1px solid rgba(255,255,255,0.4);
  color: white; padding: 4px 10px; border-radius: 6px; cursor: pointer;
  margin-left: 8px; font-size: 12px;
}
.topbar .meta button:hover { background: rgba(255,255,255,0.1); }
.topbar-link {
  color: white; text-decoration: none;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 4px 10px; border-radius: 6px;
  font-size: 12px; margin-right: 8px;
}
.topbar-link:hover { background: rgba(255,255,255,0.1); }

.main {
  max-width: 880px; margin: 0 auto; padding: 24px 18px;
}

/* === Login === */
.login-card {
  max-width: 420px; margin: 80px auto;
  background: white; border-radius: 14px;
  padding: 36px 28px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  text-align: center;
}
.login-card h1 { font-size: 22px; margin: 0 0 8px; }
.login-card p { color: #8a7460; font-size: 14px; margin: 0 0 24px; }
.login-card .gbtn {
  display: inline-flex; align-items: center; gap: 10px;
  background: white; color: #3a2e23;
  border: 1px solid #e3d3ba; border-radius: 10px;
  padding: 12px 22px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.login-card .gbtn:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.login-card .err {
  background: #fee2e2; color: #991b1b;
  padding: 10px 14px; border-radius: 8px;
  font-size: 13px; margin-bottom: 18px;
}

/* === Waiting screen === */
.waiting {
  background: white; border-radius: 14px;
  padding: 80px 28px; text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.waiting .big { font-size: 32px; margin: 0 0 12px; }
.waiting .small { color: #8a7460; font-size: 15px; }

/* === Part === */
.part-head {
  background: linear-gradient(135deg, #ea580c, #c2410c);
  color: white;
  padding: 22px 24px; border-radius: 14px;
  margin-bottom: 20px;
}
.part-head h2 { margin: 0; font-size: 22px; }
.part-head .part-sub { font-size: 14px; opacity: 0.9; margin-top: 4px; }

.part-body { display: flex; flex-direction: column; gap: 16px; }

/* === Question card === */
.q-card {
  background: white; border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.q-label {
  font-size: 13px; font-weight: 600;
  color: #ea580c; margin-bottom: 10px;
  letter-spacing: 0.02em;
}
.q-prompt { font-size: 16px; line-height: 1.6; margin-bottom: 16px; color: #3a2e23; }
.q-hint { font-size: 13px; color: #8a7460; margin-bottom: 10px; padding: 0 4px; }
.q-flash {
  font-size: 56px; font-weight: 700;
  text-align: center; padding: 24px 0;
  color: #c2410c; letter-spacing: 0.04em;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}

/* === Options === */
.q-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.q-options.col { grid-template-columns: 1fr; }
.opt-btn {
  background: #f8f0e3; color: #3a2e23;
  border: 2px solid transparent; border-radius: 10px;
  padding: 14px 16px; font-size: 15px;
  cursor: pointer; transition: all 0.12s;
  text-align: left;
}
.opt-btn:hover:not(:disabled):not(.is-off) {
  background: #ffedd5; border-color: #fed7aa;
}
.opt-btn:disabled { cursor: not-allowed; opacity: 0.7; }
/* label 版 opt-btn（scenario checkbox 選項）冇 :disabled 狀態，用 .is-off 對齊 disabled 觀感 */
label.opt-btn.is-off { cursor: not-allowed; opacity: 0.7; }
.opt-btn.chosen {
  background: #fed7aa; border-color: #ea580c;
  color: #7c2d12; font-weight: 600;
}
.opt-btn.correct {
  background: #dcfce7; border-color: #16a34a; color: #14532d;
}
.opt-btn.wrong {
  background: #fee2e2; border-color: #dc2626; color: #7f1d1d;
}

/* === Formula build === */
.q-eq {
  display: flex; align-items: center; gap: 14px;
  margin: 12px 0; font-size: 18px;
}
.q-eq-left { font-weight: 700; color: #c2410c; font-family: "SF Mono", Menlo, monospace; }
.q-slot {
  flex: 1; min-height: 50px;
  background: #fdf9f2; border: 2px dashed #e3d3ba;
  border-radius: 8px; padding: 8px 12px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.q-slot-hint { color: #b3a18c; font-size: 13px; }
.q-pool {
  display: flex; flex-wrap: wrap; gap: 8px;
  background: #f8f0e3; border-radius: 8px; padding: 10px;
  margin: 10px 0;
}
.q-tok {
  background: white; border: 2px solid #e3d3ba; color: #3a2e23;
  padding: 8px 14px; border-radius: 6px; cursor: pointer;
  font-size: 14px; font-weight: 600;
  transition: all 0.12s;
  white-space: normal; line-height: 1.4;
  max-width: 100%;
  text-align: left;
}
.q-tok:hover:not(:disabled) { background: #ffedd5; border-color: #ea580c; }
.q-tok.placed { background: #fed7aa; border-color: #ea580c; color: #7c2d12; }
.q-tok.placed.correct { background: #dcfce7; border-color: #16a34a; color: #14532d; }
.q-tok.placed.wrong { background: #fee2e2; border-color: #dc2626; color: #7f1d1d; }
.q-tok.locked { opacity: 0.4; cursor: not-allowed; }
.q-plus { color: #8a7460; font-weight: 700; }
.q-eq-locked { margin-top: 12px; padding-top: 12px; border-top: 1px solid #efe3cf; }
.q-sublabel { font-size: 13px; color: #8a7460; margin: 6px 0; }
/* tripleTag 每個 step 嘅小題 label(層級介乎 q-prompt 同選項之間) */
.q-step-label { font-size: 14px; font-weight: 600; color: #c2410c; margin: 10px 0 6px; }
.q-ctrl { display: flex; gap: 10px; margin-top: 14px; }

/* === Sort (機制排序) === */
.sort-slots { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.sort-slot {
  display: flex; align-items: center; gap: 10px;
  min-height: 46px; padding: 6px 12px;
  background: #fdf9f2; border: 2px dashed #e3d3ba; border-radius: 8px;
  cursor: pointer; transition: all 0.12s;
}
.sort-slot.filled { border-style: solid; border-color: #ea580c; background: #fff7ed; }
.sort-slot.slot-correct { background: #dcfce7; border: 2px solid #16a34a; cursor: default; }
.sort-slot.slot-wrong { background: #fee2e2; border: 2px solid #dc2626; }
.sort-slot.slot-reveal { background: #fef3c7; border: 2px solid #f59e0b; cursor: default; }
.sort-slot-num {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%;
  background: #ffedd5; color: #9a3412; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.sort-slot-text { font-size: 14px; font-weight: 600; color: #3a2e23; line-height: 1.4; }
.sort-msg { margin-top: 10px; font-size: 14px; font-weight: 600; color: #b45309; min-height: 1em; }

/* === Calc / MultiInput === */
.q-row { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.q-input-num {
  flex: 1;
  border: 2px solid #e3d3ba; border-radius: 8px;
  padding: 12px 14px; font-size: 18px; font-weight: 600;
  font-family: "SF Mono", Menlo, monospace;
  background: white; color: #3a2e23;
}
.q-input-num:focus { outline: none; border-color: #ea580c; }
.q-input-num:disabled { background: #f8f0e3; opacity: 1; }
.q-input-num.correct { background: #dcfce7; border-color: #16a34a; }
.q-input-num.wrong { background: #fee2e2; border-color: #dc2626; }

.q-multi-grid {
  display: grid;
  /* auto-fit: 容器寬就排多列、窄就自動 wrap；min 180px 防止 input 被擠到出界 */
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.q-multi-cell {
  background: #fdf9f2; border-radius: 10px; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  min-width: 0;   /* 防止 grid item 被內容撐爆出界 */
}
.q-multi-cell .q-input-num {
  width: 100%; min-width: 0; box-sizing: border-box;
}
.q-multi-label { font-size: 13px; font-weight: 600; color: #c2410c; }
.q-multi-answer { font-size: 12px; color: #16a34a; font-weight: 600; }

.q-data-wrap { margin-bottom: 18px; }
.q-data-caption { font-size: 12px; color: #8a7460; text-align: right; margin-bottom: 6px; }
.q-data-table {
  width: 100%; border-collapse: collapse;
  background: white; border-radius: 8px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.q-data-table td {
  padding: 10px 14px; border-bottom: 1px solid #efe3cf; font-size: 14px;
}
.q-data-table td.num {
  text-align: right; font-family: "SF Mono", Menlo, monospace;
  font-weight: 700; color: #3a2e23;
}
.q-data-table tr:last-child td { border-bottom: none; }

/* === Notes part (互動教科書) === */
.notes-body {
  background: white; border-radius: 12px;
  padding: 24px 28px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  font-size: 16px; line-height: 1.8; color: #3a2e23;
}
.notes-body h1, .notes-body h2, .notes-body h3, .notes-body h4 {
  color: #3a2e23; line-height: 1.4; margin-top: 24px; margin-bottom: 12px;
}
.notes-body h1 { font-size: 24px; border-bottom: 2px solid #efe3cf; padding-bottom: 8px; }
.notes-body h2 { font-size: 20px; color: #c2410c; }
.notes-body h3 { font-size: 17px; color: #9a3412; }
.notes-body h1:first-child, .notes-body h2:first-child, .notes-body h3:first-child { margin-top: 0; }
.notes-body p { margin: 10px 0; }
.notes-body ul, .notes-body ol { margin: 10px 0; padding-left: 28px; }
.notes-body li { margin: 6px 0; }
.notes-body strong { color: #3a2e23; font-weight: 700; }
.notes-body em { color: #6b543d; }
.notes-body code {
  background: #f8f0e3; padding: 2px 6px; border-radius: 4px;
  font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 14px;
  color: #9a3412;
}
.notes-body pre {
  background: #fdf9f2; padding: 14px 16px; border-radius: 8px;
  overflow-x: auto; font-size: 14px; line-height: 1.5;
  border-left: 3px solid #ea580c;
}
.notes-body blockquote {
  margin: 14px 0; padding: 12px 16px;
  background: #fef9c3; border-left: 4px solid #eab308;
  border-radius: 6px; color: #422006;
}
.notes-body table {
  border-collapse: collapse; width: 100%; margin: 14px 0;
  font-size: 14px;
}
.notes-body table th, .notes-body table td {
  border: 1px solid #efe3cf; padding: 8px 12px; text-align: left;
}
.notes-body table th { background: #f8f0e3; font-weight: 700; }
.notes-body hr { border: none; border-top: 1px solid #efe3cf; margin: 20px 0; }
.notes-body a { color: #c2410c; text-decoration: underline; }
.notes-body a:hover { color: #7c2d12; }
.notes-footer {
  text-align: center; margin-top: 16px; padding: 14px;
  background: #fff7ed; border-radius: 8px;
  color: #9a3412; font-size: 13px; font-weight: 600;
}

/* === Interactive part (iframe 嵌入) === */
.interactive-wrap {
  background: white; border-radius: 12px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.interactive-iframe {
  width: 100%; min-height: 720px;
  border: 0; display: block;
}
.interactive-intro { margin-bottom: 12px; }
.interactive-toolbar {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-bottom: 8px;
}
.interactive-fullscreen-btn {
  background: #ea580c; color: white; border: 0;
  padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.interactive-fullscreen-btn:hover { background: #c2410c; }

/* === Submit-mode hint (每 part 頂部) === */
.q-submit-hint {
  background: #fff7ed;
  border-left: 3px solid #ea580c;
  padding: 10px 14px; border-radius: 8px;
  font-size: 13px; color: #7c2d12;
  margin-bottom: 6px;
  line-height: 1.5;
}

/* === Submit-all button (打字題型底部) === */
.q-submit-all-wrap {
  margin-top: 18px; padding: 18px 20px;
  background: linear-gradient(135deg, #f0fdf4, #fff7ed);
  border: 2px dashed #ea580c; border-radius: 12px;
  text-align: center;
}
.q-submit-all {
  font-size: 16px !important;
  padding: 14px 32px !important;
  min-width: 240px;
}
.q-submit-all-hint {
  font-size: 12px; color: #8a7460; margin-top: 8px;
}

/* === Buttons === */
.btn-primary {
  background: #ea580c; color: white; border: none;
  padding: 12px 22px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background 0.12s;
}
.btn-primary:hover:not(:disabled) { background: #c2410c; }
.btn-primary:disabled { background: #e3d3ba; cursor: not-allowed; }
.btn-ghost {
  background: transparent; color: #8a7460; border: 1px solid #e3d3ba;
  padding: 12px 18px; border-radius: 8px;
  font-size: 14px; cursor: pointer;
}
.btn-ghost:hover:not(:disabled) { background: #f8f0e3; }
.btn-danger {
  background: #dc2626; color: white; border: none;
  padding: 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer;
}

/* === Ack / Explanation === */
.q-ack {
  display: inline-block;
  margin-top: 12px; color: #16a34a;
  font-size: 13px; font-weight: 600;
}
.q-ack-slot { min-height: 0; }
.q-explain {
  margin-top: 14px; padding: 14px 16px;
  background: #fef9c3; border-left: 4px solid #eab308;
  border-radius: 6px;
}
.q-explain-h { font-size: 13px; font-weight: 700; color: #854d0e; margin-bottom: 6px; }
.q-explain-body { font-size: 14px; line-height: 1.6; color: #422006; }
.q-explain-result { margin-top: 8px; font-size: 13px; font-weight: 600; }
.q-explain-result.ok { color: #16a34a; }
.q-explain-result.no { color: #dc2626; }

/* === Teacher dashboard === */
.t-controls {
  background: white; border-radius: 14px;
  padding: 20px 22px; margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.t-controls h2 { margin: 0 0 14px; font-size: 18px; }
.t-controls .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.t-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.t-pill {
  background: #ffedd5; color: #7c2d12;
  padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
}
.t-pill.active { background: #ea580c; color: white; }
.t-pill.revealed::after { content: ' 👁'; }

.t-grid {
  background: white; border-radius: 14px; padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  overflow-x: auto;
}
.t-grid table { border-collapse: collapse; width: 100%; font-size: 13px; }
.t-grid th, .t-grid td {
  border: 1px solid #efe3cf; padding: 8px 10px; text-align: center;
  white-space: nowrap;
}
.t-grid th {
  background: #f8f0e3; font-weight: 600; color: #6b543d;
  position: sticky; top: 0;
}
.t-grid th.s-name {
  text-align: left; position: sticky; left: 0; background: #f8f0e3; z-index: 1;
}
.t-grid td.s-name { text-align: left; font-weight: 600; position: sticky; left: 0; background: white; }
.t-cell {
  min-width: 56px; min-height: 32px;
  font-family: "SF Mono", Menlo, monospace; font-size: 14px;
}
.t-cell.empty { background: #fdf9f2; color: #b3a18c; font-weight: 500; }
.t-cell.ok {
  background: #fef08a;    /* 啱 = 黃色 (only in show mode) */
  color: #713f12;
  font-weight: 700;
}
.t-cell.no {
  background: #ef4444;    /* 錯 = 鮮紅 (only in show mode) */
  color: white;
  font-weight: 700;
}
.t-cell.submitted {
  background: #ffedd5;    /* 已交 = 中性藍色 (hide mode) */
  color: #7c2d12;
  font-weight: 600;
}

/* Clickable Q header */
.t-q-header { padding: 0; }
.t-q-btn {
  background: transparent; border: none;
  color: #6b543d; font-weight: 600;
  padding: 10px 12px; width: 100%;
  cursor: pointer; font-size: 13px;
  transition: background 0.12s;
}
.t-q-btn:hover { background: #ffedd5; color: #c2410c; }

/* === Question modal === */
.q-modal-back {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 100;
  align-items: center; justify-content: center;
  padding: 20px;
}
.q-modal-back.show { display: flex; }
.q-modal {
  background: white; border-radius: 14px;
  max-width: 720px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  padding: 28px 32px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.qm-close {
  position: absolute; top: 12px; right: 14px;
  background: transparent; border: none;
  font-size: 28px; line-height: 1; color: #b3a18c;
  cursor: pointer; padding: 4px 10px; border-radius: 6px;
}
.qm-close:hover { background: #f8f0e3; color: #3a2e23; }

.qm-head { margin-bottom: 18px; }
.qm-tag {
  display: inline-block;
  background: #ffedd5; color: #9a3412;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
  margin-bottom: 10px;
}
.qm-prompt {
  font-size: 18px; line-height: 1.6;
  color: #3a2e23; font-weight: 500;
}

.qm-data { margin-bottom: 18px; }
.qm-data table {
  width: 100%; border-collapse: collapse;
  background: #fdf9f2; border-radius: 8px; overflow: hidden;
  font-size: 13px;
}
.qm-data td {
  padding: 8px 12px; border-bottom: 1px solid #efe3cf;
}
.qm-data td.num {
  text-align: right; font-family: "SF Mono", Menlo, monospace;
  font-weight: 700;
}
.qm-data-cap { font-size: 11px; color: #b3a18c; text-align: right; margin-top: 4px; }

.qm-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.qm-opt {
  display: grid;
  grid-template-columns: 32px 1fr 140px 80px;
  gap: 10px; align-items: center;
  padding: 10px 14px;
  background: #fdf9f2; border-radius: 8px;
  border: 2px solid transparent;
}
.qm-opt-correct {
  background: #fef9c3; border-color: #facc15;
}
.qm-opt-letter {
  font-weight: 700; font-size: 16px;
  color: #9a3412; font-family: "SF Mono", Menlo, monospace;
}
.qm-opt-correct .qm-opt-letter { color: #854d0e; }
.qm-opt-text { font-size: 14px; line-height: 1.5; }
.qm-opt-bar {
  background: #efe3cf; height: 10px; border-radius: 5px; overflow: hidden;
}
.qm-opt-fill {
  height: 100%; background: #ea580c;
  transition: width 0.3s;
}
.qm-opt-correct .qm-opt-fill { background: #ca8a04; }
.qm-opt-count { font-size: 12px; color: #6b543d; text-align: right; font-weight: 600; }

.qm-answer { margin-top: 18px; padding: 14px 16px; background: #fef9c3; border-radius: 8px; }
.qm-ans-label { font-size: 12px; font-weight: 700; color: #854d0e; margin-bottom: 4px; }
.qm-ans-val { font-size: 18px; font-weight: 700; color: #422006; font-family: "SF Mono", Menlo, monospace; }

.qm-students { margin-top: 18px; }
.qm-sub-label { font-size: 13px; font-weight: 700; color: #6b543d; margin-bottom: 8px; }
.qm-students-list { display: flex; flex-wrap: wrap; gap: 6px; }
.qm-stu {
  padding: 4px 10px; border-radius: 6px;
  font-size: 12px;
  font-family: "SF Mono", Menlo, monospace;
}
.qm-stu.ok { background: #fef08a; color: #713f12; font-weight: 700; }
.qm-stu.no { background: #ef4444; color: white; font-weight: 700; }
.qm-stu.empty { background: #f8f0e3; color: #b3a18c; }
.qm-stats {
  margin-top: 10px; font-size: 12px; color: #8a7460;
  padding-top: 8px; border-top: 1px solid #efe3cf;
}

.qm-explain {
  margin-top: 18px; padding: 14px 16px;
  background: #fef9c3; border-left: 4px solid #eab308;
  border-radius: 6px;
}
.qm-ex-body { font-size: 14px; line-height: 1.6; color: #422006; }

@media (max-width: 720px) {
  .qm-opt { grid-template-columns: 28px 1fr; }
  .qm-opt-bar, .qm-opt-count { grid-column: 2; }
}

/* === Report pages === */
.report-header {
  background: linear-gradient(135deg, #ea580c, #c2410c);
  color: white; padding: 28px 28px;
  border-radius: 14px; margin-bottom: 20px;
}
.report-tag {
  display: inline-block;
  background: rgba(255,255,255,0.25); color: white;
  padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 700; margin-bottom: 10px;
}
.report-tag.teacher { background: rgba(20,184,166,0.95); }
.report-header h2 { margin: 0 0 6px; font-size: 24px; }
.report-sub { font-size: 14px; opacity: 0.9; }

.report-stat-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: white; border-radius: 12px; padding: 18px;
  border-top: 4px solid #ea580c;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  text-align: center;
}
.sc-label { font-size: 12px; color: #8a7460; font-weight: 600; margin-bottom: 6px; }
.sc-value { font-size: 26px; font-weight: 700; color: #3a2e23; font-family: "SF Mono", Menlo, monospace; }

.report-suggestion {
  background: #fef9c3; border-left: 4px solid #eab308;
  padding: 16px 20px; border-radius: 8px;
  margin-bottom: 20px;
}
.rs-h { font-size: 13px; font-weight: 700; color: #854d0e; margin-bottom: 6px; }
.rs-body { font-size: 14px; line-height: 1.7; color: #422006; }

.report-part {
  background: white; border-radius: 12px; padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.rp-head {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid #efe3cf; padding-bottom: 12px; margin-bottom: 14px;
}
.rp-title { font-size: 16px; font-weight: 700; color: #3a2e23; }
.rp-score {
  font-family: "SF Mono", Menlo, monospace; font-size: 18px; font-weight: 700;
  padding: 4px 12px; border-radius: 8px;
}
.rp-score.ok { background: #dcfce7; color: #14532d; }
.rp-score.mid { background: #fef3c7; color: #78350f; }
.rp-score.no { background: #fee2e2; color: #7f1d1d; }

.rp-qlist { display: flex; flex-direction: column; gap: 10px; }
.rp-q {
  padding: 12px 14px; border-radius: 8px;
  border-left: 3px solid #efe3cf;
  background: #fdf9f2;
}
.rp-q-ok { border-left-color: #16a34a; background: #f0fdf4; }
.rp-q-no { border-left-color: #dc2626; background: #fef2f2; }
.rp-q-empty { border-left-color: #b3a18c; }
.rp-q-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.rp-q-num { font-weight: 700; font-size: 13px; color: #6b543d; }
.rp-q-label {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
}
.rp-q-label-ok { background: #16a34a; color: white; }
.rp-q-label-no { background: #dc2626; color: white; }
.rp-q-label-empty { background: #b3a18c; color: white; }
.rp-q-prompt { font-size: 14px; line-height: 1.6; color: #3a2e23; margin-bottom: 6px; }
.rp-q-yours, .rp-q-correct {
  font-size: 13px; padding: 4px 0; color: #6b543d;
}
.rp-q-correct { color: #14532d; }
.rp-q-no .rp-q-yours { color: #7f1d1d; }
.rp-q-explain {
  margin-top: 8px; padding: 10px 12px;
  background: #fef9c3; border-radius: 6px;
  font-size: 13px; line-height: 1.6; color: #422006;
}

.report-footer { text-align: center; margin-top: 24px; padding: 16px; }
.report-footer a { display: inline-block; text-decoration: none; }

/* Class report extras */
.cr-part-bars { display: flex; flex-direction: column; gap: 10px; }
.cr-part-bar {
  display: grid; grid-template-columns: 1fr 200px auto;
  gap: 14px; align-items: center;
  padding: 8px 0;
}
.cr-pb-name { font-size: 14px; color: #3a2e23; }
.cr-pb-track {
  background: #efe3cf; height: 16px; border-radius: 8px; overflow: hidden;
}
.cr-pb-fill {
  height: 100%; background: linear-gradient(90deg, #ea580c, #c2410c);
  transition: width 0.3s;
}
.cr-pb-num { font-family: "SF Mono", Menlo, monospace; font-size: 13px; font-weight: 600; color: #6b543d; }

.cr-wrong-card {
  padding: 14px 16px; margin-bottom: 10px;
  background: #fef2f2; border-left: 4px solid #dc2626;
  border-radius: 8px;
}
.cr-wc-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.cr-wc-rank {
  font-weight: 700; color: #7f1d1d; font-size: 16px;
}
.cr-wc-meta { font-size: 12px; color: #8a7460; }
.cr-wc-prompt { font-size: 14px; line-height: 1.6; color: #3a2e23; margin-bottom: 10px; }
.cr-wc-correct {
  background: #fef9c3; padding: 8px 12px; border-radius: 6px;
  font-size: 13px; color: #422006; margin-bottom: 10px;
}
.cr-wc-dist { display: flex; flex-direction: column; gap: 5px; }
.cr-wc-opt {
  display: grid;
  grid-template-columns: 32px 1fr 140px 60px;
  gap: 10px; align-items: center;
  padding: 6px 10px;
  background: white; border-radius: 6px;
  font-size: 13px;
}
.cr-wc-opt.correct { background: #fef9c3; }
.cr-wc-letter { font-weight: 700; font-family: "SF Mono", Menlo, monospace; }
.cr-wc-opt-text { color: #3a2e23; }
.cr-wc-opt-bar {
  display: block; background: #efe3cf; height: 8px; border-radius: 4px;
  overflow: hidden;
}
.cr-wc-opt-fill {
  display: block; height: 100%; background: #b3a18c;
}
.cr-wc-opt.correct .cr-wc-opt-fill { background: #ca8a04; }
.cr-wc-opt-count { font-size: 12px; color: #6b543d; font-weight: 600; text-align: right; }

.cr-students-tbl {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.cr-students-tbl th, .cr-students-tbl td {
  padding: 10px; border-bottom: 1px solid #efe3cf; text-align: left;
}
.cr-students-tbl th { font-weight: 700; color: #6b543d; background: #fdf9f2; }
.cr-students-tbl td.ok { color: #16a34a; font-weight: 700; }
.cr-students-tbl td.mid { color: #ca8a04; font-weight: 700; }
.cr-students-tbl td.no { color: #dc2626; font-weight: 700; }
.cr-mini-btn {
  background: #ea580c; color: white; padding: 4px 10px;
  border-radius: 6px; font-size: 12px; text-decoration: none;
  font-weight: 600;
}
.cr-mini-btn:hover { background: #c2410c; }

@media (max-width: 720px) {
  .report-stat-cards { grid-template-columns: 1fr 1fr; }
  .cr-part-bar { grid-template-columns: 1fr; gap: 4px; }
  .cr-wc-opt { grid-template-columns: 28px 1fr; }
  .cr-wc-opt-bar, .cr-wc-opt-count { grid-column: 2; }
}

/* === Teacher hide/unhide student button === */
.t-hide-btn {
  background: transparent; border: 1px solid #efe3cf;
  color: #b3a18c;
  width: 22px; height: 22px;
  border-radius: 4px;
  font-size: 14px; line-height: 1; font-weight: 700;
  cursor: pointer; padding: 0; margin-right: 4px;
  transition: all 0.12s;
}
.t-hide-btn:hover {
  background: #fee2e2; border-color: #dc2626; color: #dc2626;
}
.s-hidden { opacity: 0.45; font-style: italic; }
.s-hidden .t-hide-btn { background: #ffedd5; border-color: #f97316; color: #9a3412; }
.s-hidden .t-hide-btn:hover { background: #fed7aa; }

.t-hidden-bar {
  display: flex; justify-content: space-between; align-items: center;
  background: #fef3c7; border: 1px solid #fbbf24;
  padding: 8px 14px; border-radius: 8px;
  margin-bottom: 12px;
  font-size: 13px; color: #78350f;
}
.t-hidden-bar button { font-size: 12px; padding: 4px 10px; }

/* === Star bar (home top) === */
.home-star-bar {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 2px solid #fbbf24;
  border-radius: 12px;
  padding: 14px 20px;
  margin-bottom: 22px;
  text-decoration: none; color: #78350f;
  transition: transform 0.15s, box-shadow 0.15s;
}
.home-star-bar:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(251,191,36,0.3);
}
.home-star-bar.teacher {
  background: linear-gradient(135deg, #ffedd5, #fed7aa);
  border-color: #ea580c; color: #7c2d12;
}
.hsb-icon { font-size: 28px; }
.hsb-text { flex: 1; font-size: 14px; line-height: 1.5; }
.hsb-text b { font-size: 16px; }
.hsb-go {
  background: rgba(255,255,255,0.7); color: inherit;
  padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 700; white-space: nowrap;
}

/* === Leaderboard === */
.lb-wrap {
  background: white; border-radius: 12px; padding: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.lb-row {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 16px; align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #f8f0e3;
  font-size: 15px;
}
.lb-row:last-child { border-bottom: none; }
.lb-row-me {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  border-radius: 6px;
}
.lb-medal { font-size: 28px; text-align: center; display: block; }
.lb-rank {
  font-family: "SF Mono", Menlo, monospace;
  font-weight: 700; color: #8a7460; font-size: 16px;
  text-align: center; display: block;
}
.lb-name { font-weight: 600; color: #3a2e23; }
.lb-you {
  display: inline-block; background: #f59e0b; color: white;
  padding: 2px 8px; border-radius: 999px; font-size: 11px;
  font-weight: 700; margin-left: 6px;
}
.lb-stars {
  font-family: "SF Mono", Menlo, monospace;
  font-size: 18px; font-weight: 700; color: #b45309;
}
.lb-ellipsis {
  text-align: center; color: #b3a18c;
  padding: 12px 0; font-size: 20px;
}

/* === Export to AI box === */
.cr-export-box {
  background: linear-gradient(135deg, #fff7ed, #fff7ed);
  border: 2px solid #ea580c;
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 20px;
  position: relative;
}
.cr-export-h {
  font-size: 15px; font-weight: 700; color: #9a3412;
  margin-bottom: 6px;
}
.cr-export-section-h {
  font-size: 13px; font-weight: 700; color: #6b543d;
  margin-bottom: 8px;
  padding-top: 4px;
}
.cr-export-sub {
  font-size: 13px; color: #6b543d; line-height: 1.6;
  margin-bottom: 12px;
}
.cr-export-btns {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.cr-toast {
  position: fixed; bottom: 30px; left: 50%;
  transform: translateX(-50%);
  background: #3a2e23; color: white;
  padding: 12px 24px; border-radius: 8px;
  font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s; z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.cr-toast.show { opacity: 1; }
#cr-preview-text {
  width: 100%; min-height: 260px;
  padding: 12px; margin-top: 8px;
  font-family: "SF Mono", Menlo, monospace; font-size: 12px;
  background: white; border: 1px solid #e3d3ba; border-radius: 6px;
  color: #3a2e23; line-height: 1.5;
  resize: vertical;
}

/* === Home / Lessons landing page === */
.home-section { margin-bottom: 32px; }
.home-section-h {
  font-size: 14px; font-weight: 700; color: #6b543d;
  letter-spacing: 0.04em; margin-bottom: 12px;
  text-transform: uppercase;
}

.home-hero {
  display: block; text-decoration: none; color: inherit;
  background: linear-gradient(135deg, #ea580c, #c2410c);
  border-radius: 16px; padding: 24px 28px;
  color: white;
  box-shadow: 0 4px 16px rgba(234,88,12,0.25);
  transition: transform 0.15s, box-shadow 0.15s;
  margin-bottom: 12px;
}
.home-hero:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(234,88,12,0.35);
}
.home-hero.dim {
  background: linear-gradient(135deg, #8a7460, #6b543d);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.home-hero-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.home-hero-date {
  font-size: 13px; opacity: 0.85; font-family: "SF Mono", Menlo, monospace;
}
.home-hero-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; line-height: 1.3; }
.home-hero-sub { font-size: 15px; opacity: 0.9; margin-bottom: 12px; }
.home-hero-desc { font-size: 14px; opacity: 0.85; line-height: 1.6; margin-bottom: 14px; }
.home-hero-meta {
  display: flex; gap: 16px; font-size: 13px; opacity: 0.85;
  border-top: 1px solid rgba(255,255,255,0.2);
  padding-top: 12px; margin-bottom: 10px;
}
.home-hero-go { text-align: right; font-weight: 700; font-size: 15px; }

.home-list { display: flex; flex-direction: column; gap: 8px; }
.home-row {
  background: white;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  border-left: 3px solid transparent;
  display: flex; align-items: center;
  overflow: hidden;
}
.home-row-today { border-left-color: #ea580c; background: #fff7ed; }
.home-row-future { border-left-color: #16a34a; }
.home-row-past { opacity: 0.75; }
.home-row-link {
  flex: 1;
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 16px; align-items: center;
  padding: 14px 18px;
  text-decoration: none; color: inherit;
  transition: background 0.12s;
}
.home-row-link:hover { background: #fdf9f2; }
.home-row-report {
  padding: 14px 18px;
  border-left: 1px solid #efe3cf;
  text-decoration: none;
  font-size: 13px; font-weight: 600;
  color: #ea580c; white-space: nowrap;
  transition: background 0.12s;
}
.home-row-report:hover { background: #fff7ed; }
.home-row-date {
  font-family: "SF Mono", Menlo, monospace;
  font-size: 13px; color: #6b543d; font-weight: 600;
}
.home-row-title { font-size: 15px; font-weight: 600; color: #3a2e23; }
.home-row-sub { font-size: 12px; color: #8a7460; margin-top: 2px; }

.home-badge {
  display: inline-block;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  background: #efe3cf; color: #6b543d;
}
.home-badge.indigo { background: rgba(255,255,255,0.25); color: white; }
.home-badge.teal { background: rgba(20,184,166,0.9); color: white; }
.home-badge.today { background: #ea580c; color: white; }
.home-badge.future { background: #16a34a; color: white; }
.home-badge.past { background: #efe3cf; color: #8a7460; }

.home-empty {
  background: white; padding: 20px;
  border-radius: 10px; color: #8a7460;
  text-align: center; font-size: 14px;
}
.home-teacher-hint {
  margin-top: 24px; padding: 12px 16px;
  background: #fef3c7; color: #78350f;
  border-radius: 8px; font-size: 13px;
  text-align: center;
}

/* === Preview student view modal (老師示範用) === */
.preview-modal-back {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.65);
  z-index: 110;
  align-items: flex-start; justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.preview-modal-back.show { display: flex; }
.preview-modal {
  background: #fdf9f2; border-radius: 14px;
  max-width: 860px; width: 100%;
  padding: 24px 28px 32px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  margin: auto;
}
.preview-modal.preview-modal--wide {
  max-width: 1320px;
}
.preview-modal-head {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px; padding-right: 40px;
  flex-wrap: wrap;
}
.preview-banner {
  background: #fef3c7; color: #78350f;
  padding: 6px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 600;
  border: 1px solid #fcd34d;
}
.preview-modal-body {
  background: transparent;
}
.t-status { font-size: 11px; }
.t-status.online::before { content: '●'; color: #16a34a; margin-right: 4px; }
.t-status.idle::before { content: '●'; color: #f59e0b; margin-right: 4px; }
.t-status.stale::before { content: '●'; color: #dc2626; margin-right: 4px; }
.t-row-stale td.s-name { color: #dc2626; }

/* === Mobile (iPad portrait & smaller) === */
@media (max-width: 720px) {
  .main { padding: 16px 12px; }
  .q-card { padding: 16px 14px; }
  .q-options { grid-template-columns: 1fr; }
  .q-multi-grid { grid-template-columns: 1fr; }
  .q-flash { font-size: 48px; }
  .part-head { padding: 18px 16px; }
  .part-head h2 { font-size: 19px; }
}

/* === Post-class free-roam (學生端) === */
.fr-banner {
  background: #fef3c7; border-left: 4px solid #f59e0b;
  padding: 14px 18px; border-radius: 10px;
  margin-bottom: 16px;
  color: #78350f; font-size: 14px; line-height: 1.55;
}
.fr-banner-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.fr-banner-sub { font-size: 13px; color: #92400e; }

.fr-pills {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 18px;
}
.fr-pill {
  padding: 7px 12px; border-radius: 16px;
  font-size: 12px; font-weight: 600;
  border: 1px solid #e3d3ba; background: white;
  cursor: pointer; color: #6b543d;
  display: inline-flex; align-items: center; gap: 5px;
}
.fr-pill:hover { background: #f8f0e3; }
.fr-pill.fr-pill-active {
  background: #ea580c; color: white; border-color: #ea580c;
}
.fr-pill.fr-pill-done { background: #dcfce7; border-color: #86efac; color: #166534; }
.fr-pill.fr-pill-done.fr-pill-active { background: #16a34a; color: white; border-color: #16a34a; }
.fr-pill.fr-pill-todo { background: white; color: #8a7460; border-style: dashed; }

/* === Retry button (post-class 已答題目重做) === */
.q-retry-btn {
  margin-top: 10px;
  background: #f8f0e3; color: #55432f;
  border: 1px solid #e3d3ba;
  padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.q-retry-btn:hover { background: #efe3cf; }

/* === Teacher 結束課堂 toggle === */
.t-end-lesson-btn { background: #16a34a; color: white; }
.t-end-lesson-btn:hover { background: #15803d; }
.t-restart-lesson-btn { background: #f8f0e3; color: #6b543d; border: 1px solid #e3d3ba; }

/* === Teacher post-class status banner === */
.t-postclass-banner {
  background: #ecfdf5; border-left: 4px solid #10b981;
  padding: 12px 16px; border-radius: 10px;
  color: #065f46; font-size: 14px; font-weight: 500;
  margin: 12px 0 16px;
}

/* === Teacher 學生 row 補做中 chip === */
.t-catchup-chip {
  display: inline-block;
  background: #fed7aa; color: #9a3412;
  border: 1px solid #fdba74;
  padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
  margin-left: 6px;
}

/* === DSE-style multi-step calc === */
.dse-q-card {
  background: white; border-radius: 12px;
  padding: 24px 26px; margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.dse-q-head {
  font-size: 14px; font-weight: 700; color: #c2410c;
  letter-spacing: 0.02em; margin-bottom: 12px;
}
.dse-q-stem {
  font-size: 15px; line-height: 1.65; color: #3a2e23;
  margin-bottom: 14px;
}
.dse-q-stem p:first-child { margin-top: 0; }
.dse-q-stem p:last-child { margin-bottom: 0; }

/* Balance sheet table */
.dse-bsheet {
  width: 100%; border-collapse: collapse;
  border: 1px solid #e3d3ba; border-radius: 8px;
  margin: 14px 0; overflow: hidden;
  font-size: 14px; background: #fdf9f2;
}
.dse-bsheet thead th {
  background: #ffedd5; color: #7c2d12; font-weight: 700;
  padding: 8px 14px; border-bottom: 1px solid #fed7aa;
  text-align: left;
}
.dse-bsheet td {
  padding: 8px 14px; border-bottom: 1px solid #efe3cf;
}
.dse-bsheet td:nth-child(2),
.dse-bsheet td:nth-child(4) {
  text-align: right; font-family: "SF Mono", Menlo, monospace;
  font-weight: 600;
}
.dse-bsheet-note {
  font-size: 13px; color: #6b543d;
  margin-top: 6px; padding-left: 4px;
}

/* Sub-part section */
.dse-subpart {
  border-top: 1px solid #efe3cf;
  padding: 18px 0 6px;
  margin-top: 12px;
}
.dse-subpart:first-of-type { border-top: 0; padding-top: 0; }
.dse-subpart-label {
  font-size: 14px; font-weight: 700; color: #6b543d;
  margin-bottom: 12px;
}

/* Calculation card */
.dse-calc {
  background: #fdf9f2; border-radius: 10px;
  padding: 14px 16px; margin-bottom: 12px;
}
.dse-calc-title {
  font-size: 13px; font-weight: 700; color: #c2410c;
  margin-bottom: 10px;
}
.dse-calc-title::before { content: "📐 "; }

/* Step row inside a calculation */
.dse-step {
  display: flex; align-items: center; gap: 8px;
  margin: 6px 0; font-size: 14px;
  flex-wrap: wrap;
}
.dse-step-label {
  min-width: 48px; font-size: 12px; font-weight: 700;
  color: #8a7460;
}
.dse-step-lhs {
  font-weight: 600; color: #3a2e23;
  font-family: "SF Mono", Menlo, monospace;
}
.dse-step-eq { color: #ea580c; font-weight: 700; }

/* Formula tokens / slots (Step 1) */
.dse-slot {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 80px; min-height: 32px;
  background: white; border: 2px dashed #e3d3ba;
  border-radius: 6px; padding: 4px 10px;
  font-size: 13px; color: #b3a18c;
  cursor: pointer;
}
.dse-slot.filled {
  border-style: solid; border-color: #ea580c;
  background: #fed7aa; color: #7c2d12; font-weight: 600;
}
.dse-slot.correct { background: #dcfce7; border-color: #16a34a; color: #14532d; }
.dse-slot.wrong { background: #fee2e2; border-color: #dc2626; color: #7f1d1d; }
.dse-op-slot {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; min-height: 32px;
  background: white; border: 2px dashed #e3d3ba;
  border-radius: 6px;
  font-size: 16px; font-weight: 700; color: #b3a18c;
  cursor: pointer;
}
.dse-op-slot.filled {
  border-style: solid; border-color: #ea580c;
  background: #ffedd5; color: #9a3412;
}
.dse-op-slot.correct { background: #dcfce7; border-color: #16a34a; color: #14532d; }
.dse-op-slot.wrong { background: #fee2e2; border-color: #dc2626; color: #7f1d1d; }

/* Number input (Step 2 & 3) */
.dse-num {
  width: 110px; padding: 6px 10px;
  border: 2px solid #e3d3ba; border-radius: 6px;
  font-size: 14px; font-weight: 600;
  font-family: "SF Mono", Menlo, monospace;
  background: white;
}
.dse-num:focus { outline: none; border-color: #ea580c; }
.dse-num:disabled { background: #f8f0e3; }
.dse-num.correct { background: #dcfce7; border-color: #16a34a; }
.dse-num.wrong { background: #fee2e2; border-color: #dc2626; }

/* Operator dropdown (Step 2) */
.dse-op-select {
  width: 56px; padding: 6px 4px;
  border: 2px solid #e3d3ba; border-radius: 6px;
  background: white; font-size: 14px; font-weight: 700;
  text-align: center; text-align-last: center;
}
.dse-op-select:focus { outline: none; border-color: #ea580c; }
.dse-op-select:disabled { background: #f8f0e3; }
.dse-op-select.correct { background: #dcfce7; border-color: #16a34a; }
.dse-op-select.wrong { background: #fee2e2; border-color: #dc2626; }

/* Per-step explanation (shown after submit when wrong or revealed) */
.dse-step-explain {
  font-size: 12px; color: #6b543d;
  padding: 6px 10px; margin: 4px 0 0 56px;
  background: #fef3c7; border-left: 3px solid #f59e0b;
  border-radius: 4px;
  white-space: pre-wrap;
}
.dse-step-correct-ans {
  font-size: 12px; color: #047857; font-weight: 600;
  margin-left: 56px;
}

/* Calc summary line (after submit) */
.dse-calc-summary {
  font-size: 12px; font-weight: 600;
  margin-top: 8px; padding: 4px 10px; border-radius: 4px;
  display: inline-block;
}
.dse-calc-summary.all-ok { background: #dcfce7; color: #14532d; }
.dse-calc-summary.partial { background: #fef3c7; color: #78350f; }
.dse-calc-summary.all-wrong { background: #fee2e2; color: #7f1d1d; }

/* Token pool (shared across question) */
.dse-pool {
  display: flex; flex-wrap: wrap; gap: 8px;
  background: #f8f0e3; border: 1px solid #efe3cf;
  border-radius: 10px; padding: 12px;
  margin: 18px 0;
}
.dse-pool-label {
  width: 100%; font-size: 12px; font-weight: 700;
  color: #8a7460; margin-bottom: 4px;
}
.dse-pool-tok {
  background: white; border: 2px solid #e3d3ba;
  padding: 6px 12px; border-radius: 6px;
  font-size: 13px; font-weight: 600; color: #3a2e23;
  cursor: pointer; transition: all 0.12s;
}
.dse-pool-tok:hover:not(:disabled) {
  background: #ffedd5; border-color: #ea580c;
}
.dse-pool-tok:disabled { opacity: 0.4; cursor: not-allowed; }
.dse-pool-tok.used { opacity: 0.4; }

/* Inline (per-calculation) pool — sits inside .dse-calc card; compact */
.dse-pool-inline {
  margin: 8px 0 4px;
  padding: 8px 10px;
  background: #fff7ed;
  border-color: #fed7aa;
}
.dse-pool-inline .dse-pool-label {
  font-size: 11px; color: #9a3412; margin-bottom: 2px;
}
.dse-pool-inline .dse-pool-tok {
  padding: 4px 9px; font-size: 12px;
}

/* Big submit "交卷" button */
.dse-submit-wrap {
  text-align: center; margin: 22px 0 8px;
}
.dse-submit-btn {
  background: #ea580c; color: white;
  border: 0; padding: 14px 36px; border-radius: 10px;
  font-size: 16px; font-weight: 700;
  cursor: pointer; box-shadow: 0 2px 6px rgba(234,88,12,0.3);
}
.dse-submit-btn:hover:not(:disabled) { background: #c2410c; }
.dse-submit-btn:disabled {
  background: #e3d3ba; cursor: not-allowed; box-shadow: none;
}
.dse-submit-hint {
  font-size: 13px; color: #8a7460; margin-top: 8px;
}

/* Overall question status after submit */
.dse-q-overall {
  text-align: center; padding: 10px;
  background: #ecfdf5; border-radius: 8px;
  font-weight: 600; color: #065f46;
  margin-top: 14px;
}

/* === Teacher grid: dseCalc sub-part summary cells === */
.t-cell-dse { font-size: 11px; padding: 4px 6px; text-align: center; }
.t-cell-dse.t-cell-ok { background: #dcfce7; color: #14532d; }
.t-cell-dse.t-cell-empty { background: #f8f0e3; color: #b3a18c; }
.t-cell-dse.t-cell-partial { background: #fef3c7; color: #78350f; font-weight: 700; }

/* === Report: dseCalc step lines === */
.rp-q-step { font-size: 13px; padding: 4px 18px; }
.rp-q-step-ok { color: #14532d; }
.rp-q-step-no { color: #7f1d1d; }
.rp-q-step-empty { color: #b3a18c; }

/* === Home page sections (revision + classroom split) === */
.home-section {
  margin-bottom: 32px;
}
.home-section-h {
  font-size: 20px; font-weight: 700; color: #3a2e23;
  margin: 24px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #efe3cf;
}
.home-section-revision .home-section-h { color: #ea580c; }
.home-section-classroom .home-section-h { color: #16a34a; }

.book-section {
  margin-bottom: 22px;
}
.book-section-h {
  font-size: 14px; font-weight: 700; color: #6b543d;
  margin: 12px 0 10px;
  letter-spacing: 0.02em;
}

/* === Lesson card coming-soon state === */
.lesson-card.coming-soon {
  background: #f8f0e3;
  border: 1px dashed #e3d3ba;
  color: #8a7460;
  cursor: not-allowed;
  opacity: 0.85;
  text-decoration: none;
  display: block;
  padding: 16px 18px;
  border-radius: 10px;
}
.lesson-card.coming-soon:hover {
  background: #efe3cf;
  transform: none;
}
.lesson-card.coming-soon .lc-icon {
  font-size: 22px; margin-bottom: 6px;
}
.lesson-card.coming-soon .lc-title {
  font-size: 14px; font-weight: 600; color: #6b543d;
  margin-bottom: 8px;
  line-height: 1.4;
}
.lesson-card.coming-soon .lc-status {
  font-size: 11px; color: #b3a18c; font-weight: 600;
}

/* === Toast notification (home page) === */
.home-toast {
  position: fixed; bottom: 32px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #33281f; color: white;
  padding: 10px 20px; border-radius: 24px;
  font-size: 14px; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.home-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* === DebitDash 極速二選一 (dd- prefix) === */
.dd-wrap {
  background: #2a1f16; border-radius: 12px;
  padding: 16px; color: #f0e5d8;
}
.dd-wrap .q-ack { color: #4ade80; }
.dd-start { text-align: center; padding: 8px 4px; }
.dd-start-title { font-size: 18px; font-weight: 800; margin-bottom: 12px; }
.dd-rules {
  text-align: left; max-width: 460px; margin: 0 auto 16px;
  padding-left: 20px; font-size: 14px; line-height: 1.8; color: #ddcbb0;
}
.dd-btn-start {
  background: #f8b13c; color: #241a12; border: none; border-radius: 12px;
  padding: 14px 40px; font-size: 16px; font-weight: 800;
  cursor: pointer; font-family: inherit;
}
.dd-btn-start:active { transform: scale(0.97); }
.dd-hud { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.dd-lives { font-size: 16px; letter-spacing: 2px; padding-top: 4px; }
.dd-score-wrap { text-align: right; }
.dd-score { font-size: 26px; font-weight: 900; line-height: 1.1; }
.dd-combo { font-size: 13px; font-weight: 800; color: #f8b13c; min-height: 17px; }
.dd-timer-track {
  height: 8px; border-radius: 4px;
  background: rgba(255,255,255,0.12); overflow: hidden; margin-bottom: 10px;
}
.dd-timer-fill { height: 100%; width: 100%; border-radius: 4px; background: #4ade80; }
.dd-timer-fill.low { background: #f97316; }
.dd-progress { font-size: 12px; color: #b3a18c; text-align: center; margin-bottom: 6px; }
.dd-item-card {
  background: #1d1510; border: 1px solid #3a2c1e; border-radius: 12px;
  min-height: 96px; display: flex; align-items: center; justify-content: center;
  padding: 20px 16px; text-align: center;
  font-size: 18px; font-weight: 700; line-height: 1.5;
}
.dd-feedback { min-height: 22px; text-align: center; font-size: 14px; font-weight: 800; margin: 8px 0 4px; }
.dd-feedback.ok { color: #4ade80; }
.dd-feedback.bad { color: #f87171; }
.dd-choices { display: flex; gap: 10px; margin-top: 4px; }
.dd-choice {
  flex: 1; padding: 18px 8px; border-radius: 12px;
  font-size: 16px; font-weight: 800; cursor: pointer;
  background: transparent; border: 2px solid; font-family: inherit;
}
.dd-choice-left { border-color: #fb923c; color: #fb923c; }
.dd-choice-right { border-color: #fb923c; color: #fb923c; }
.dd-choice:active { transform: scale(0.97); }
.dd-choice.correct-flash { background: rgba(74,222,128,0.18); border-color: #4ade80; color: #4ade80; }
.dd-key-hint { text-align: center; color: #b3a18c; font-size: 12px; margin-top: 10px; }
.dd-result-banner {
  border-radius: 10px; padding: 12px 14px; font-weight: 800; font-size: 15px;
  margin: 10px 0; text-align: center;
}
.dd-result-banner.pass { background: rgba(74,222,128,0.12); border: 1px solid rgba(74,222,128,0.5); color: #4ade80; }
.dd-result-banner.fail { background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.5); color: #f87171; }
.dd-result-stats { display: flex; gap: 10px; }
.dd-stat {
  flex: 1; background: #1d1510; border: 1px solid #3a2c1e;
  border-radius: 10px; padding: 10px 6px; text-align: center;
}
.dd-stat-num { font-size: 20px; font-weight: 900; }
.dd-stat-label { font-size: 12px; color: #b3a18c; margin-top: 2px; }
.dd-wrong-list { margin-top: 12px; }
.dd-wrong-title { font-size: 13px; font-weight: 700; color: #f87171; margin-bottom: 6px; }
.dd-wrong-item {
  background: #1d1510; border-left: 3px solid #f87171; border-radius: 8px;
  padding: 8px 10px; margin-top: 6px; font-size: 13px; line-height: 1.5;
}
.dd-wrong-none { margin-top: 12px; font-weight: 800; color: #4ade80; text-align: center; }
