/* Plot Twist: ภารกิจพิชิตปัญหา */
:root {
  --ink: #1B2340; --ink-2: #3A4466; --muted: #6B7390; --line: #E3E1DA; --soft: #F6F5F1;
  --bg: #F7F4EE; --card: #FFFFFF;
  --primary: #FF5A4E; --primary-dark: #C9392F; --primary-soft: #FFE8E5;
  --accent: #FFC23D; --accent-dark: #D59A17; --accent-soft: #FFF4D6;
  --good: #1E9E6A; --good-soft: #DDF3E8; --mid: #E39A16; --mid-soft: #FFF1D2; --bad: #D9483B; --bad-soft: #FBE2DF;
  --info-soft: #EEF1F8;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(27,35,64,.06), 0 6px 20px rgba(27,35,64,.06);
  --head: 'Prompt', 'Sarabun', 'Leelawadee UI', 'Thonburi', system-ui, sans-serif;
  --body: 'Sarabun', 'Leelawadee UI', 'Thonburi', system-ui, sans-serif;
  --page-w: 1880px;
  --top-h: 64px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 18px; line-height: 1.6; }
body.is-teacher { font-size: 16px; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--head); font-weight: 600; line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; } h4 { font-size: .98rem; margin-top: 1em; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.wrap { max-width: var(--page-w); margin: 0 auto; padding: 24px 16px 72px; }
.wrap.narrow { max-width: 460px; }
@media (min-width: 900px) { .wrap { padding: 28px 24px 80px; } }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.grid2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 10px 16px; margin: 4px 0 16px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.back { display: inline-block; text-decoration: none; color: var(--muted); font-size: .92rem; margin-bottom: 8px; }
.back:hover { color: var(--ink); }

/* ---------- topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--ink); color: #fff; }
.topbar-in { max-width: var(--page-w); margin: 0 auto; min-height: 62px; padding: 9px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (min-width: 900px) { .topbar-in { padding: 9px 24px; } }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--primary); color: #fff;
  font-family: var(--head); font-weight: 700; letter-spacing: .5px; transform: rotate(-6deg); box-shadow: 3px 3px 0 var(--accent); flex: none; }
.brand-name { font-family: var(--head); font-weight: 700; font-size: 1.05rem; line-height: 1.1; }
.brand-sub { font-size: .76rem; opacity: .7; line-height: 1.2; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.who { font-size: .88rem; opacity: .85; white-space: nowrap; }
.timer { font-family: var(--head); font-weight: 600; font-size: .88rem; padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,.12); font-variant-numeric: tabular-nums; }
.timer.warn { background: var(--primary); }
.topbar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.3); background: transparent; }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.1); }
.tnav { display: flex; gap: 2px; flex-wrap: wrap; }
.tnav a { color: rgba(255,255,255,.78); text-decoration: none; font-family: var(--head); font-weight: 500; font-size: .9rem; padding: 6px 11px; border-radius: 8px; white-space: nowrap; }
.tnav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.tnav a.on { color: var(--ink); background: var(--accent); }
.room-switch { display: flex; gap: 3px; background: rgba(255,255,255,.1); border-radius: 10px; padding: 3px; }
.room-switch a { color: #fff; text-decoration: none; font-family: var(--head); font-weight: 600; font-size: .85rem; padding: 4px 10px; border-radius: 7px; opacity: .75; white-space: nowrap; }
.room-switch a.on { background: #fff; color: var(--ink); opacity: 1; }
.room-switch a .dot { width: 7px; height: 7px; margin: 0 0 1px 5px; }
@media (max-width: 980px) {
  .tnav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 560px) { .brand-sub, .who { display: none; } }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 18px; border-radius: 12px;
  border: 2px solid transparent; font-family: var(--head); font-weight: 600; font-size: .98rem; text-decoration: none; cursor: pointer;
  background: #fff; border-color: var(--line); color: var(--ink); transition: transform .08s ease, background .15s ease; }
.btn:hover { background: #F2F0EA; }
/* ช่องเลือกไฟล์ให้หน้าตาเหมือนปุ่มของระบบ */
input[type=file] { width: 100%; padding: 6px; border: 2px dashed var(--line); border-radius: 12px; background: #fff; color: var(--muted); font-size: .92rem; cursor: pointer; }
input[type=file]::file-selector-button { margin-right: 10px; padding: 6px 14px; border-radius: 10px; border: 2px solid var(--line); background: var(--soft);
  font-family: var(--head); font-weight: 600; color: var(--ink); cursor: pointer; }
input[type=file]:hover::file-selector-button { background: #F2F0EA; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 3px 0 var(--primary-dark); }
.btn-primary:hover { background: #F04A3E; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--ink); box-shadow: 0 3px 0 var(--accent-dark); }
.btn-accent:hover { background: #F5B526; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-2); }
.btn-danger { background: #fff; border-color: var(--bad); color: var(--bad); }
.btn-ghost { background: #fff; }
.btn-sm { min-height: 36px; padding: 4px 13px; font-size: .88rem; border-radius: 10px; }
.btn-xs { min-height: 30px; padding: 2px 10px; font-size: .8rem; border-radius: 8px; box-shadow: none; }
.btn-block { display: flex; width: 100%; margin-top: 18px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.btn-row.end { justify-content: flex-end; }

/* ---------- forms ---------- */
.field-label { display: block; font-weight: 700; margin: 14px 0 6px; }
.input, input[type=text], input[type=number], input[type=password], input:not([type]), select, textarea {
  width: 100%; padding: 10px 13px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font-size: 1rem; outline: none; }
.input:focus, input:focus, select:focus, textarea:focus { border-color: var(--ink-2); }
textarea { resize: vertical; min-height: 2.8em; }
.input-sm, .row select, .row input { width: auto; padding: 6px 10px; font-size: .92rem; border-radius: 10px; }
.w60 { width: 76px !important; }
.flash { background: #E4F5EC; color: #145C3F; padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; }
.flash.err { background: #FDECEA; color: #8E2A20; }
.flash.warn { background: var(--mid-soft); color: #7A5200; }
.err-text { color: var(--bad); margin: 10px 0 0; text-align: center; }

/* ---------- toast / modal ---------- */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; z-index: 300; box-shadow: 0 8px 30px rgba(0,0,0,.25); max-width: 90vw; font-weight: 600; }
.toast.ok { background: var(--good); } .toast.err { background: var(--bad); }
dialog.modal { border: 0; padding: 0; border-radius: 18px; width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(27,35,64,.35); background: var(--bg); color: var(--ink); overflow: hidden; }
dialog.modal.wide { width: min(1180px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(27,35,64,.55); }
.modal-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px 12px 20px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.modal-bar h2 { margin: 0; font-size: 1.08rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-x { border: 0; background: var(--soft); width: 36px; height: 36px; border-radius: 10px; font-size: 1.3rem; line-height: 1; cursor: pointer; flex: none; }
.modal-body { padding: 18px 20px 22px; overflow: auto; max-height: calc(100vh - 32px - 62px); }
.modal-body .card { box-shadow: none; border: 1px solid var(--line); }
.modal-loading { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- เข้าสู่ระบบ ---------- */
body.page-join { background: var(--ink); }
.join { min-height: 100vh; max-width: 1000px; margin: 0 auto; padding: 32px 18px; display: grid; gap: 30px; align-items: center; }
@media (min-width: 960px) { .join { grid-template-columns: 1.1fr 420px; gap: 64px; } }
@media (max-width: 959px) { .join { align-content: center; } .join-hero { text-align: center; } .join-hero .brand { justify-content: center; } .hero-steps { justify-content: center; } }
.join-hero { color: #fff; }
.hero-title { font-size: clamp(2.1rem, 6vw, 3.3rem); margin: 28px 0 12px; line-height: 1.2; }
.hero-title .hl { color: var(--accent); }
.hero-text { opacity: .75; margin: 0; }
.hero-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 0; margin: 26px 0 0; font-family: var(--head); font-weight: 500; font-size: .95rem; color: rgba(255,255,255,.85); }
.hero-steps li { display: flex; align-items: center; gap: 8px; }
.hero-steps b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: rgba(255,255,255,.1); color: var(--accent); font-size: .85rem; }
@media (max-width: 559px) { .hero-steps { display: none; } .hero-title { margin-top: 18px; } }
.join-card { position: relative; overflow: hidden; max-width: 420px; width: 100%; justify-self: center; margin: 0; padding: 30px 26px 22px; border-radius: 20px; box-shadow: 8px 8px 0 var(--accent); }
/* แถบสีของเป้าหมาย SDGs 17 ข้อ */
.sdg-strip { position: absolute; left: 0; right: 0; top: 0; height: 6px; background: linear-gradient(90deg, #E5243B 0 5.88%, #DDA63A 0 11.76%, #4C9F38 0 17.65%, #C5192D 0 23.53%, #FF3A21 0 29.41%, #26BDE2 0 35.29%, #FCC30B 0 41.18%, #A21942 0 47.06%, #FD6925 0 52.94%, #DD1367 0 58.82%, #FD9D24 0 64.71%, #BF8B2E 0 70.59%, #3F7E44 0 76.47%, #0A97D9 0 82.35%, #56C02B 0 88.24%, #00689D 0 94.12%, #19486A 0); }
.join-h { font-size: 1.3rem; margin: 0 0 4px; }
.join-card .field-label { margin-top: 16px; }
.join-card .btn-block { margin-top: 22px; min-height: 52px; font-size: 1.05rem; }
.room-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.room-chip { position: relative; }
.room-chip input { position: absolute; opacity: 0; pointer-events: none; }
.room-chip span { display: block; text-align: center; padding: 9px 4px 7px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; font-family: var(--head); font-weight: 600; line-height: 1.25; background: #fff; transition: border-color .12s, background .12s; }
.room-chip span small { display: block; font-size: .7rem; font-weight: 500; color: var(--muted); }
.room-chip.is-open span small { color: var(--good); }
.room-chip input:focus-visible + span { outline: 3px solid #A8C3E6; outline-offset: 1px; }
.room-chip input:checked + span { border-color: var(--primary) !important; border-style: solid !important; background: var(--primary-soft) !important; color: var(--primary-dark) !important; }
.room-chip input:checked + span small { color: var(--primary-dark) !important; }
.room-chip.off span { color: #A6A9B8; border-style: dashed; }
.big-input { font-size: 1.8rem !important; text-align: center; letter-spacing: 2px; font-family: var(--head); font-weight: 600; padding: 8px 12px !important; }
.teacher-link { display: block; text-align: center; margin-top: 14px; color: var(--muted); font-size: .85rem; }
.join-one { grid-template-columns: 1fr !important; max-width: 420px; justify-items: center; align-content: center; gap: 26px; }
.join-one .brand { color: #fff; }
@media (max-width: 420px) { .room-chip span small { font-size: .62rem; } .room-grid { gap: 5px; } .join-card { padding: 28px 18px 18px; box-shadow: 5px 5px 0 var(--accent); } }

/* ---------- หน้าหลักนักเรียน ---------- */
.today { display: flex; align-items: center; gap: 16px; margin: 4px 0 18px; }
.today-no { flex: none; width: 76px; height: 76px; border-radius: 20px; background: var(--ink); color: #fff; display: grid; place-content: center; text-align: center; font-family: var(--head); line-height: 1.1; box-shadow: 4px 4px 0 var(--accent); }
.today-no small { font-size: .75rem; opacity: .7; font-weight: 500; }
.today-no b { font-size: 1.9rem; font-weight: 700; }
.today h1 { margin: 0; font-size: 1.35rem; }
.today p { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }
.tasks { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }
.task { position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 16px 14px 20px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); border: 2px solid transparent; transition: transform .12s ease, border-color .12s ease; cursor: pointer; }
.task::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 5px; border-radius: 0 4px 4px 0; background: #C9C6BD; }
.task:hover { transform: translateY(-1px); border-color: #E7E4DC; }
.task.t-game::before { background: var(--primary); }
.task.t-sheet::before, .task.t-reflect::before { background: var(--ink-2); }
.task.t-test::before, .task.t-survey::before { background: var(--accent); }
.task-main { flex: 1; min-width: 0; }
.task-kind { font-family: var(--head); font-size: .76rem; font-weight: 600; color: var(--muted); }
.task-title { font-weight: 700; line-height: 1.4; }
.task-st { flex: none; font-family: var(--head); font-weight: 600; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.task-st.done { color: var(--good); } .task-st.draft { color: var(--mid); } .task-st.warn { color: var(--bad); }
.task.is-done { background: #FCFBF8; box-shadow: none; border-color: var(--line); }
.task.urgent { border-color: var(--primary); }
.section-title { font-family: var(--head); font-weight: 600; font-size: 1rem; color: var(--ink-2); margin: 26px 0 10px; }
details.past { margin-top: 26px; }
details.past > summary { cursor: pointer; font-family: var(--head); font-weight: 600; color: var(--ink-2); list-style: none; padding: 10px 0; border-top: 2px solid var(--line); }
details.past > summary::-webkit-details-marker { display: none; }
details.past > summary::after { content: ' +'; color: var(--muted); }
details.past[open] > summary::after { content: ' −'; }
.past-period { font-size: .85rem; color: var(--muted); margin: 14px 0 6px; font-family: var(--head); }
.groupline { margin-top: 26px; font-size: .92rem; color: var(--muted); }
.groupline a { color: var(--ink); font-weight: 700; }

/* ---------- เอกสาร (ใบความรู้ ใบงาน) ---------- */
.doc h1 { font-size: 1.35rem; }
.doc-meta { font-family: var(--head); font-size: .8rem; color: var(--primary); font-weight: 600; margin-bottom: 2px; }
.blk-h { margin: 1.4em 0 .5em; padding-bottom: 4px; border-bottom: 2px solid var(--line); }
.blk-p { margin: .5em 0; }
.blk-note { background: var(--info-soft); border-left: 4px solid var(--ink-2); padding: 10px 14px; border-radius: 0 10px 10px 0; margin: .8em 0; font-size: .97rem; }
.blk-ul, .blk-ol { padding-left: 1.4em; }
.blk-fig { margin: 1em 0; text-align: center; }
.blk-fig img { max-width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.blk-fig figcaption { font-size: .86rem; color: var(--muted); margin-top: 4px; }
.blk-fill { line-height: 2.5; }
.fld-inline { display: inline-block; width: auto !important; min-width: 9em; max-width: 100%; padding: .15em .5em !important; margin: 0 4px; border-width: 0 0 2px !important; border-radius: 4px !important; background: #FFFCF2 !important; }
textarea.fld { background: #FFFCF2; }
.ans-inline { display: inline-block; min-width: 4em; border-bottom: 2px dotted #CFC8B8; padding: 0 6px; margin: 0 4px; color: var(--ink-2); font-weight: 600; }
.ans-block { background: var(--soft); border-radius: 10px; padding: 10px 12px; min-height: 2.6em; color: var(--ink-2); }
.tbl-wrap { overflow-x: auto; margin: .6em 0; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: .95rem; background: #fff; }
.tbl th, .tbl td { border: 1px solid var(--line); padding: 7px 9px; vertical-align: top; text-align: left; }
.tbl th { background: var(--soft); font-family: var(--head); font-weight: 600; font-size: .9rem; }
.tbl td.lbl { background: #FCFBF8; }
.tbl td.ch, .tbl th.ch { text-align: center; width: 3.4em; }
.tbl .fld-cell { border: 0; border-radius: 6px; background: #FFFCF2; padding: .3em .45em; min-height: 2.2em; overflow: hidden; font-size: .95rem; }
.tbl select { padding: .3em .4em; }
.tbl.compact td, .tbl.compact th { padding: 6px 8px; }
.tbl.clean th, .tbl.clean td { border-width: 0 0 1px; }
.tbl tr.dim td { opacity: .45; }
.tbl tr.total td { font-weight: 700; background: var(--soft); }
.tbl tr.sub td { background: #FCFBF8; font-weight: 700; }
.tbl.num td { font-variant-numeric: tabular-nums; }
.radio { display: inline-grid; place-items: center; cursor: pointer; position: relative; }
.radio input { position: absolute; opacity: 0; }
.radio span { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #C9C6BD; display: block; }
.radio input:checked + span { background: var(--primary); border-color: var(--primary); box-shadow: inset 0 0 0 4px #fff; }
.tick { color: var(--primary); font-weight: 700; }
.flash-upd { animation: upd 1.4s; }
@keyframes upd { 0% { background: #FFF1C2; } 100% { background: #FFFCF2; } }
.sheet-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,.97); margin: 18px -22px -20px; padding: 12px 22px; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.save-state { font-size: .85rem; color: var(--muted); margin-right: auto; }
.save-state.err { color: var(--bad); } .save-state.ok { color: var(--good); }
.online { font-size: .84rem; color: var(--good); min-height: 1.3em; font-weight: 600; }
.status-note { padding: 10px 14px; border-radius: 12px; margin: 6px 0 12px; background: var(--good-soft); color: #145C3F; }
.status-note.warn { background: var(--mid-soft); color: #7A5200; }

/* ช่องวาดภาพ */
.box-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: .6em 0; }
.box-cell { border: 2px dashed #D6D2C8; border-radius: 14px; padding: 10px 12px; background: #FDFCF9; }
.box-label { font-weight: 700; font-size: .92rem; margin-bottom: 6px; }
.draw .thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { position: relative; display: block; width: 150px; height: 110px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #fff; cursor: zoom-in; transition: box-shadow .15s, transform .08s; }
.thumb:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.draw-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- หน้าต่างดูภาพ (คลิกภาพย่อ) ---------- */
.lb { width: min(1100px, 96vw); max-width: none; max-height: 94vh; padding: 0; border: 0; border-radius: var(--radius); overflow: hidden; background: var(--card); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.lb[open] { display: flex; flex-direction: column; }
.lb::backdrop { background: rgba(27, 35, 64, .7); }
.lb-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.lb-title { font-family: var(--head); font-weight: 600; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-n { color: var(--muted); font-size: .9rem; }
.lb-del { color: var(--bad); }
.lb-stage { position: relative; display: flex; align-items: center; justify-content: center; background: var(--soft); min-height: 0; }
.lb-stage img { display: block; max-width: 100%; max-height: calc(94vh - 64px); object-fit: contain; background: #fff; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(27,35,64,.65); color: #fff; font-size: 1.8rem; line-height: 1; cursor: pointer; }
.lb-nav.prev { left: 10px; } .lb-nav.next { right: 10px; }

/* ---------- หน้าต่างวาดภาพ ---------- */
.pad-dlg { width: min(1180px, 98vw); max-width: none; height: 98vh; max-height: 98vh; padding: 0; border: 0; border-radius: var(--radius); overflow: hidden; background: var(--card); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.pad-dlg[open] { display: flex; flex-direction: column; }
.pad-dlg::backdrop { background: rgba(27, 35, 64, .8); }
.pad-tools { display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; padding: 8px 12px; background: var(--soft); border-bottom: 1px solid var(--line); }
.pad-title { font-family: var(--head); font-weight: 600; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pad-group { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pad-group.end { margin-left: auto; }
.pad-wrap { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; background: var(--soft); padding: 6px; }
.pad-stage { position: relative; width: 100%; aspect-ratio: 1.4; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.pad-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pad-ink { touch-action: none; cursor: crosshair; }
.pad-ink[data-tool="text"] { cursor: text; }
.pad-ink[data-tool="erase"] { cursor: cell; }
.tool, .wd { min-width: 38px; height: 38px; padding: 0 6px; border-radius: 10px; border: 2px solid var(--line); background: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); font: inherit; font-size: 1.05rem; font-weight: 700; }
.pad-tools { flex-wrap: wrap; gap: 6px 8px; }
.pad-tools .tool { flex-direction: column; gap: 1px; min-width: 42px; height: 46px; padding: 3px 4px; }
.pad-tools .tool small { font-size: .62rem; font-weight: 600; line-height: 1; white-space: nowrap; }
.pad-tools .tool svg { display: block; }
.pad-tools .sw { width: 26px; height: 26px; }
.pad-tools .wd { min-width: 30px; height: 34px; padding: 0 3px; }
.pad-tools .pad-group { gap: 3px; }
.tool:hover, .wd:hover { background: #F2F0EA; }
.tool.on, .wd.on { border-color: var(--primary); background: var(--primary-soft); }
.wd i { display: block; border-radius: 50%; background: var(--ink); }
.sw { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px #ccc; cursor: pointer; padding: 0; }
.sw.on { box-shadow: 0 0 0 3px var(--primary); }
.sw-pick { position: relative; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.sw-pick input { position: absolute; inset: -8px; width: 150%; height: 150%; opacity: 0; cursor: pointer; }

/* ---------- เกม (จากเว็บ Plot Twist รุ่นเดิม) ---------- */
.play { max-width: 1500px; margin: 0 auto; }
.screen { animation: rise .25s ease; }
@media (min-width: 900px) { .screen { padding: 30px 34px; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen { animation: none; } }
.eyebrow { font-family: var(--head); font-weight: 600; font-size: .85rem; color: var(--primary); margin-bottom: 4px; }
.screen-title { font-size: 1.5rem; }
.story { font-size: 1.04rem; margin: 8px 0 14px; }
.section-label { font-size: .95rem; color: var(--muted); margin: 14px 0 8px; }
.conds { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.cond { background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; border-left: 4px solid var(--accent); }
.cond-label { font-size: .8rem; color: var(--muted); font-weight: 700; }
.cond-value { font-weight: 600; line-height: 1.4; }
.progress { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; color: var(--muted); margin-bottom: 10px; font-family: var(--head); }
.dots { display: flex; gap: 5px; }
.dots i { width: 22px; height: 6px; border-radius: 3px; background: var(--line); }
.dots i.done { background: var(--ink-2); } .dots i.now { background: var(--primary); }
.meters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 14px; }
@media (max-width: 480px) { .meters { grid-template-columns: 1fr; } }
.meter { background: var(--soft); border-radius: 10px; padding: 8px 10px; }
.meter-head { display: flex; justify-content: space-between; gap: 6px; font-size: .8rem; font-weight: 700; color: var(--ink-2); }
.meter-val { white-space: nowrap; }
.meter-bar { height: 8px; background: #E4E2DB; border-radius: 4px; margin-top: 4px; overflow: hidden; }
.meter-bar i { display: block; height: 100%; border-radius: 4px; transition: width .5s ease; }
.meter-hi .meter-bar i { background: var(--good); } .meter-mid .meter-bar i { background: var(--mid); } .meter-lo .meter-bar i { background: var(--bad); }
.delta { margin-left: 4px; font-size: .78rem; padding: 0 5px; border-radius: 6px; }
.delta.up { background: var(--good-soft); color: #146C48; } .delta.down { background: var(--bad-soft); color: #A1342A; }
.prompt { font-size: 1.28rem; margin: 4px 0 12px; }
.context { background: var(--info-soft); border-left: 4px solid var(--ink-2); border-radius: 10px; padding: 10px 14px; margin: 4px 0 12px; font-size: .97rem; color: var(--ink-2); }
.data-table-wrap { overflow-x: auto; margin: 4px 0 14px; border: 1px solid var(--line); border-radius: 12px; }
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th, .data-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table th { background: var(--soft); font-family: var(--head); font-weight: 600; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.options { display: grid; gap: 10px; }
.option { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; padding: 12px 14px; background: #fff; border: 2px solid var(--line); border-radius: 14px; cursor: pointer; line-height: 1.45; transition: border-color .12s ease, background .12s ease; }
.option:hover { border-color: #C9C6BD; }
.option.selected { border-color: var(--primary); background: var(--primary-soft); }
.opt-letter { flex: 0 0 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: #F2F0EA; font-family: var(--head); font-weight: 700; }
.option.selected .opt-letter { background: var(--primary); color: #fff; }
.opt-text { padding-top: 2px; }
.point-hint { color: var(--muted); font-size: .9rem; margin: -6px 0 12px; }
.cer-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 8px; margin: 8px 0; line-height: 1.4; }
.cer-line textarea.cer-pick { flex: 1 1 100%; resize: none; background: var(--soft, #f1f5f9); }
.cer-lead { font-weight: 700; }
.cer-line input.part { flex: 1 1 200px; min-width: 0; }
.part-label { display: block; font-weight: 700; font-size: .92rem; margin: 8px 0 3px; }
textarea.part { min-height: 0; }
.reason-eg { background: var(--soft, #f1f5f9); border-left: 4px solid var(--primary, #2563eb); border-radius: 8px; padding: 8px 12px; margin: 6px 0 8px; font-size: .88rem; line-height: 1.6; }
.reason-eg b { display: block; margin-bottom: 2px; }
.reason-meta { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-top: 4px; }
.counter.ok { color: var(--good); font-weight: 700; }
.picked { background: #F2F0EA; padding: 10px 12px; border-radius: 10px; font-weight: 600; margin: 6px 0 4px; }
.twist { background: var(--ink); color: #fff; text-align: center; padding: 32px 22px; }
.twist-badge { display: inline-block; padding: 6px 16px; border-radius: 999px; background: var(--accent); color: var(--ink); font-family: var(--head); font-weight: 700; font-size: 1.3rem; transform: rotate(-3deg); margin-bottom: 14px; animation: pop .45s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(.4) rotate(-12deg); opacity: 0; } to { transform: rotate(-3deg); opacity: 1; } }
.twist .story { text-align: left; }
.big-stars { text-align: center; }
.stars { color: var(--accent); letter-spacing: 2px; font-size: 1.15rem; text-shadow: 0 1px 0 var(--accent-dark); }
.big-stars .stars { font-size: 2.6rem; letter-spacing: 6px; }
.summary .screen-title { text-align: center; }
.sum-list { display: grid; gap: 10px; margin-top: 14px; }
.sum-point { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.sum-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.sum-prompt { font-weight: 700; margin-bottom: 4px; }
.sum-line { font-size: .95rem; }
.sum-line.best { color: #146C48; }
.sum-debrief { margin-top: 6px; font-size: .9rem; color: var(--ink-2); background: var(--accent-soft); border-radius: 8px; padding: 6px 10px; }
.dim-chip { display: inline-block; font-size: .75rem; font-weight: 700; padding: 1px 8px; border-radius: 6px; background: #E8EAF3; color: var(--ink-2); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-btn { min-height: 42px; padding: 6px 14px; border-radius: 10px; border: 2px solid var(--line); background: #fff; cursor: pointer; font-family: var(--head); font-weight: 600; font-size: .92rem; color: var(--ink-2); }
.seg-btn:hover { border-color: #C9C6BD; }
.seg-btn.on { border-color: var(--primary); background: var(--primary); color: #fff; }
.seg-num .seg-btn { min-width: 44px; padding: 6px 0; }
.match { display: grid; gap: 10px; }
.match-row { border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 10px; }
.match-row.done { border-color: #C9C6BD; background: #FCFBF8; }
.match-text { display: flex; gap: 10px; align-items: flex-start; line-height: 1.45; }
.match-no { flex: 0 0 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: #F2F0EA; font-family: var(--head); font-weight: 700; font-size: .85rem; }
@media (min-width: 760px) { .match-row { grid-template-columns: 1fr auto; align-items: center; } .match-row .seg { justify-content: flex-end; } }
.order { display: grid; gap: 14px; }
@media (min-width: 760px) { .order { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.order-items { display: grid; gap: 8px; }
.order-item { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 12px 14px; border: 2px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; line-height: 1.45; }
.order-item.on { border-color: var(--primary); background: var(--primary-soft); }
.order-no { flex: 0 0 30px; height: 30px; border-radius: 50%; border: 2px dashed #C9C6BD; display: grid; place-items: center; font-family: var(--head); font-weight: 700; }
.order-item.on .order-no { border: 0; background: var(--primary); color: #fff; }
.order-side { background: var(--soft); border-radius: 14px; padding: 12px 14px; }
.order-label { font-family: var(--head); font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.order-seq { margin: 0 0 10px; padding-left: 0; list-style: none; display: grid; gap: 4px; font-size: .95rem; }
.order-seq b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; font-size: .75rem; margin-right: 6px; }
.weights { display: grid; gap: 10px; }
.w-row { display: grid; grid-template-columns: 1fr 48px minmax(120px, 1.2fr) 48px; gap: 10px; align-items: center; border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.w-label { font-weight: 700; line-height: 1.3; } .w-label small { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; }
.w-btn { height: 44px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-size: 1.4rem; font-weight: 700; cursor: pointer; }
.w-val { font-family: var(--head); font-weight: 700; font-size: 1.15rem; text-align: center; }
.w-bar { height: 8px; background: #E4E2DB; border-radius: 4px; overflow: hidden; }
.w-bar i { display: block; height: 100%; background: var(--ink-2); border-radius: 4px; transition: width .2s; }
.w-total { text-align: right; font-family: var(--head); font-weight: 700; color: var(--bad); } .w-total.ok { color: var(--good); }
.w-used { font-size: .85rem; color: var(--ink-2); background: var(--info-soft); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.alts { display: grid; gap: 12px; }
@media (min-width: 760px) { .alts { grid-template-columns: 1fr 1fr; } }
.alt { border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.alt-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.alt-head b { font-family: var(--head); line-height: 1.35; }
.alt-score { font-size: .8rem; color: var(--muted); white-space: nowrap; font-family: var(--head); font-weight: 600; }
.alt-facts { margin: 0 0 8px; padding-left: 1.1em; font-size: .88rem; color: var(--ink-2); line-height: 1.5; }
.rate-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; border-top: 1px dashed var(--line); }
.rate-row > span { font-size: .88rem; font-weight: 600; }
.rate-row .seg { gap: 4px; flex-wrap: nowrap; }
.rate-row .seg-btn { min-width: 36px; min-height: 36px; padding: 2px 0; font-size: .85rem; }
.review { background: var(--soft); border-radius: 12px; padding: 12px 14px; margin: 6px 0 4px; }
.review-head { font-family: var(--head); font-weight: 600; margin-bottom: 6px; }
.review-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.review-list li { display: flex; gap: 10px; line-height: 1.45; } .review-list small { color: var(--muted); }
.review-list .mark { flex: 0 0 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: #fff; }
.review-list .ok .mark { background: var(--good); } .review-list .no .mark { background: var(--bad); }
.review-two { display: grid; gap: 12px; }
@media (min-width: 600px) { .review-two { grid-template-columns: 1fr 1fr; } }
.review-two ol { margin: 0; padding-left: 1.3em; } .review-two li.no { color: var(--bad); }
.w-review { display: grid; gap: 6px; }
.w-review > div { display: grid; grid-template-columns: 1fr 2fr 44px; gap: 10px; align-items: center; font-size: .9rem; }
.rank { margin: 0; padding-left: 1.3em; } .rank li span { margin-right: 8px; } .rank li b { font-family: var(--head); }
.mission-hero { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 18px 22px; margin-bottom: 16px; }
.mission-hero .eyebrow { color: var(--accent); }
.mission-hero h1 { margin: 0; }
.mission-hero p { margin: 4px 0 0; opacity: .75; font-size: .92rem; }

/* ---------- แบบวัด แบบสอบถาม ---------- */
.test-timer { position: sticky; top: 70px; z-index: 15; margin: 0 auto 12px; width: max-content; background: var(--ink); color: #fff; padding: 6px 18px; border-radius: 999px; font-family: var(--head); font-weight: 600; font-variant-numeric: tabular-nums; box-shadow: var(--shadow); }
.test-timer.warn { background: var(--primary); }
.q { padding: 14px 0; border-bottom: 1px solid var(--line); }
.q:last-child { border-bottom: 0; }
.q-stem { margin: .2em 0 .5em; }
.q .options, .opts { display: grid; gap: 8px; }
.q .option { padding: 10px 12px; }
label.option { position: relative; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.option:has(input:checked) .opt-letter { background: var(--primary); color: #fff; }
.likert { padding: 10px 0; border-bottom: 1px solid var(--line); }
.likert p { margin: 0 0 6px; }
.lk { display: flex; gap: 8px; }
.lk label { flex: 1; max-width: 70px; }
.lk input { position: absolute; opacity: 0; }
.lk span { display: block; text-align: center; padding: .45em 0; border: 2px solid var(--line); border-radius: 10px; font-family: var(--head); font-weight: 700; cursor: pointer; }
.lk input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- ครู ---------- */
.class-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.class-left { display: flex; gap: 16px; align-items: center; }
.class-left h1 { font-size: 1.3rem; margin: 0; }
.class-state { font-size: .9rem; color: var(--muted); margin-top: 2px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #C9C6BD; margin-right: 5px; vertical-align: middle; }
.dot.on { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { display: block; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; text-decoration: none; color: var(--ink); border: 2px solid transparent; }
a.stat:hover { border-color: var(--line); }
.stat-num { font-family: var(--head); font-weight: 700; font-size: 1.7rem; line-height: 1.2; }
.stat-num small { font-size: 1rem; color: var(--muted); font-weight: 600; }
.stat-label { color: var(--muted); font-size: .88rem; }
.list { display: grid; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 600; line-height: 1.4; }
.list-sub { font-size: .84rem; color: var(--muted); }
.list-row.off .list-title { color: var(--muted); }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; flex: none; }
.toggle input { position: absolute; opacity: 0; }
.toggle-ui { flex: 0 0 44px; height: 26px; border-radius: 13px; background: #D4D1C8; position: relative; transition: background .15s; }
.toggle-ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked + .toggle-ui { background: var(--good); }
.toggle input:checked + .toggle-ui::after { left: 21px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0 0 14px; }
.toolbar .spacer { flex: 1; }
.tabs { display: inline-flex; gap: 4px; background: #ECEAE4; border-radius: 12px; padding: 4px; flex-wrap: wrap; }
.tabs a, .tabs button { border: 0; background: transparent; padding: 6px 14px; border-radius: 9px; text-decoration: none; color: var(--ink-2); font-family: var(--head); font-weight: 600; font-size: .9rem; cursor: pointer; }
.tabs a.on, .tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(27,35,64,.12); }
.pick { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.pick button { min-width: 34px; height: 32px; padding: 0 9px; border-radius: 8px; border: 2px solid var(--line); background: #fff; cursor: pointer; font-family: var(--head); font-weight: 600; font-size: .85rem; color: var(--ink-2); }
.pick button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.pick.att button.on[data-v="มา"] { background: var(--good); border-color: var(--good); }
.pick.att button.on[data-v="สาย"] { background: var(--mid); border-color: var(--mid); }
.pick.att button.on[data-v="ขาด"] { background: var(--bad); border-color: var(--bad); }
.pick.att button.on[data-v="ลา"] { background: #5B6BC0; border-color: #5B6BC0; }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.att-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.att-no { font-family: var(--head); font-weight: 700; width: 28px; text-align: center; }
.att-name { flex: 1; min-width: 0; font-size: .86rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 5px; vertical-align: -1px; }
.grade-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.grade-side { position: sticky; top: 0; }
.rubric-pick { display: grid; gap: 6px; }
.rubric-pick label, .rubric-pick button { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 8px 10px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; font-size: .88rem; line-height: 1.45; }
.rubric-pick input { position: absolute; opacity: 0; }
.rubric-pick label:has(input:checked), .rubric-pick button.on { border-color: var(--primary); background: var(--primary-soft); }
.rubric-pick b { font-family: var(--head); color: var(--ink); font-size: 1.05rem; min-width: 14px; }
.score-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 4px; }
.score-pick input { position: absolute; opacity: 0; }
.score-pick span { display: block; text-align: center; padding: 6px 0; border: 2px solid var(--line); border-radius: 10px; font-family: var(--head); font-weight: 700; cursor: pointer; background: #fff; }
.score-pick input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.contrib { display: grid; grid-template-columns: 70px 1fr 56px; gap: 8px; align-items: center; font-size: .86rem; margin: 3px 0; }
.bar { height: 8px; border-radius: 4px; background: #E4E2DB; overflow: hidden; position: relative; }
.bar i { display: block; height: 100%; background: var(--ink-2); border-radius: 4px; }
details.key { margin-top: 12px; background: var(--soft); border-radius: 12px; padding: 8px 12px; font-size: .92rem; }
details.key summary { cursor: pointer; font-weight: 700; }
.saving { opacity: .55; } .saved { box-shadow: 0 0 0 3px #B7E3CC !important; } .tx-err { box-shadow: 0 0 0 3px #F2B8B1 !important; }
.dist { padding: 10px 0; border-top: 1px solid var(--line); }
.dist .bar { height: 10px; margin: 4px 0; }
.dist.s3 .bar i { background: var(--good); } .dist.s2 .bar i { background: var(--mid); } .dist.s1 .bar i, .dist.s0 .bar i { background: var(--bad); }
.reasons { margin: .3em 0; padding-left: 1.2em; } .reasons li { margin: .25em 0; }
.pp-bars .b2 { display: grid; grid-template-columns: 220px 1fr 1fr; gap: 8px; align-items: center; font-size: .86rem; margin: 6px 0; }
.pp-bars .bar { height: 18px; }
.pp-bars .bar i { background: #B9BCCB; } .pp-bars .bar.post i { background: var(--primary); }
.pp-bars .bar em { position: absolute; right: 6px; top: 0; font-size: .74rem; font-style: normal; line-height: 18px; }
.key-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: #B9BCCB; vertical-align: -1px; } .key-sw.post { background: var(--primary); }
.mc-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.mc { padding: 2px 9px; border-radius: 8px; background: var(--soft); font-size: .86rem; }
.mc.p3 { background: var(--good-soft); } .mc.p0 { background: var(--bad-soft); }
.gb input { width: 64px; padding: 4px 6px; }
.sum b { font-family: var(--head); }
.checks { list-style: none; padding: 0; } .checks .ok { color: var(--good); } .checks .bad { color: var(--bad); }
code { background: var(--soft); padding: 0 4px; border-radius: 4px; }

@media (max-width: 900px) {
  .grade-layout { grid-template-columns: 1fr; }
  .grade-side { position: static; }
  .pp-bars .b2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .card { padding: 16px; }
  .sheet-bar { margin: 14px -16px -16px; padding: 10px 16px; }
  .today-no { width: 62px; height: 62px; } .today-no b { font-size: 1.5rem; }
}
@media print { .topbar, .sheet-bar, .draw-btns, .toolbar { display: none; } body { background: #fff; } .card { box-shadow: none; } }

/* ---------- บัตรท้ายคาบ ---------- */
.ticket-q { font-size: 1.1rem; margin: .4em 0 .8em; }
.ticket-q b { color: var(--ink); background: var(--accent-soft); padding: 0 .3em; border-radius: 6px; margin: 0 .2em; }
.ticket-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ticket-opts .option { justify-content: center; text-align: center; padding: 16px 10px; font-family: var(--head); font-weight: 600; }
.ticket-opts .tk0:has(input:checked), .ticket-opts .tk0.selected { border-color: var(--good); background: var(--good-soft); }
.ticket-opts .tk1:has(input:checked), .ticket-opts .tk1.selected { border-color: var(--mid); background: var(--mid-soft); }
.ticket-opts .tk2:has(input:checked), .ticket-opts .tk2.selected { border-color: var(--bad); background: var(--bad-soft); }
@media (max-width: 520px) { .ticket-opts { grid-template-columns: 1fr; } }
/* คำตอบแบบวัดรายข้อ (ครู) */
.opt-key { list-style: none; padding: 0; margin: 4px 0; }
.opt-key li { padding: 4px 10px; border-radius: 8px; }
.opt-key li.picked { background: var(--primary-soft); font-weight: 600; }
/* ผลภารกิจของห้อง (ขึ้นจอ) */
.cls-point { padding: 12px 0; border-bottom: 1px solid var(--line); }
.cls-point:last-child { border-bottom: 0; }
.cls-bar { display: grid; grid-template-columns: minmax(0, 1fr) 160px 48px; gap: 10px; align-items: center; padding: 4px 0; }
.cls-bar .track { height: 12px; background: var(--soft); border-radius: 6px; overflow: hidden; }
.cls-bar .track i { display: block; height: 100%; background: var(--ink-2); }
.cls-bar.best .track i { background: var(--good); }
.cls-bar.low .track i { background: var(--bad); }
.cls-bar .lab { font-size: .95rem; }
.cls-bar .n { text-align: right; font-variant-numeric: tabular-nums; }
.tkdist { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--soft); min-width: 120px; }
.tkdist i { display: block; height: 100%; }
.tkdist .d0 { background: var(--good); } .tkdist .d1 { background: var(--mid); } .tkdist .d2 { background: var(--bad); }
.projector .cls-point h3 { font-size: 1.3rem; }
.projector .cls-bar .lab { font-size: 1.1rem; }
.ans-key { display: none; }
body.reveal .ans-key { display: block; }
body.reveal .cls-bar.best .lab { font-weight: 700; }
body:not(.reveal) .cls-bar.best .track i, body:not(.reveal) .cls-bar.low .track i { background: var(--ink-2); }
.low-flag { display: inline-block; font-size: .8rem; padding: 0 8px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); margin-left: 6px; vertical-align: middle; }
.fld-line { width: 100%; background: #FFFCF2; }

/* ---------- SweetAlert2 ให้เข้ากับธีม ---------- */
.swal2-container { z-index: 10000; font-family: var(--body); }
.swal2-popup.pt-swal { border-radius: var(--radius); padding: 1.4em 1.2em 1.2em; color: var(--ink); font-family: var(--body); }
.pt-swal .swal2-title { font-family: var(--head); font-weight: 600; font-size: 1.25rem; color: var(--ink); }
.pt-swal .swal2-html-container { color: var(--ink-2); font-size: 1rem; white-space: pre-line; }
.pt-swal-actions { gap: 10px; margin-top: 1.1em; }
.pt-swal-actions .btn { min-width: 96px; }
.pt-swal-input { font-family: var(--body) !important; border-radius: 10px !important; }
.swal2-popup.swal2-toast.pt-swal { padding: .6em .9em; box-shadow: var(--shadow); }
.swal2-toast.pt-swal .swal2-title { font-size: .98rem; margin: 0 .4em; }
.swal2-icon.swal2-question { border-color: var(--ink-2); color: var(--ink-2); }
.swal2-timer-progress-bar { background: var(--primary); }
.occ-line { background: var(--accent-soft); border-radius: 10px; padding: 8px 12px; margin: 4px 0 10px; font-size: .95rem; }
.occ-line a { font-weight: 700; }
/* ---------- แถบบนของครู: เลือกห้องและคาบ ---------- */
.top-sel { display: inline-flex; align-items: center; gap: 6px; font-family: var(--head); font-size: .8rem; color: rgba(255,255,255,.75); }
.top-sel select { width: auto; max-width: 290px; padding: 5px 30px 5px 10px; border-radius: 9px; border: 0; background: rgba(255,255,255,.12); color: #fff; font-family: var(--head); font-weight: 600; font-size: .88rem; }
.top-sel select option { color: var(--ink); background: #fff; }
.top-state { display: inline-flex; align-items: center; gap: 2px; text-decoration: none; color: #fff; font-family: var(--head); font-weight: 600; font-size: .82rem; padding: 5px 10px; border-radius: 9px; background: rgba(255,255,255,.08); white-space: nowrap; }
.top-state.on { background: rgba(30,158,106,.28); }
.room-chip span small { display: block; font-size: .72rem; font-weight: 500; color: var(--muted); }
.period-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.period-chip { position: relative; }
.period-chip input { position: absolute; opacity: 0; pointer-events: none; }
.period-chip span { display: flex; gap: 8px; align-items: flex-start; padding: 7px 10px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; height: 100%; }
.period-chip b { font-family: var(--head); font-size: 1.15rem; min-width: 22px; text-align: center; }
.period-chip em { font-style: normal; font-size: .8rem; line-height: 1.3; color: var(--ink-2); }
.period-chip input:checked + span { border-color: var(--primary); background: var(--primary-soft); }

/* ---------- เต็มจอ: ใช้พื้นที่กว้างให้เลื่อนน้อยที่สุด ---------- */
@media (min-width: 900px) { .wrap { padding: 20px 28px 48px; } }
.doc-narrow { max-width: 980px; margin-left: auto; margin-right: auto; }
.blk-d { margin: -.2em 0 .7em; font-size: .9rem; color: var(--ink-2); background: var(--soft); border-radius: 8px; padding: 6px 10px; }
.blk-d::before { content: '› '; font-weight: 700; color: var(--primary); }
.sheet-grid { display: grid; gap: 4px 24px; }
.sheet-main { min-width: 0; }
@media (min-width: 1100px) {
  .sheet-grid { grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); }
  .sheet-side { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 92px); overflow: auto; }
  .sheet-main > .blk-h:first-child, .sheet-main > .blk-p:first-child { margin-top: .2em; }
}
/* แบบวัด: สถานการณ์อยู่ซ้าย ข้อคำถามอยู่ขวา */
.test-grid { display: grid; gap: 4px 24px; }
.q-list { display: grid; gap: 0 28px; }
@media (min-width: 1100px) {
  .test-grid { grid-template-columns: minmax(300px, 1fr) minmax(0, 2fr); }
  .test-sit { position: sticky; top: 120px; align-self: start; max-height: calc(100vh - 140px); overflow: auto; }
}
@media (min-width: 1500px) { .q-list { grid-template-columns: 1fr 1fr; } .q-list .q:nth-last-child(2) { border-bottom: 0; } }
/* เกม: ข้อมูลอยู่ซ้าย ตัวเลือกและเหตุผลอยู่ขวา */
.pt-cols { display: grid; gap: 0 28px; }
@media (min-width: 1100px) {
  .pt-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; }
  .pt-left { position: sticky; top: 76px; }
  .pt-right .options, .pt-right .match, .pt-right .order, .pt-right .weights, .pt-right .alts { margin-top: 0; }
}

/* ---------- ศูนย์ควบคุมคาบ (teacher/index.php) ---------- */
.dash-wrap { padding-top: 14px !important; padding-bottom: 14px !important; }
.classbar { display: flex; align-items: center; gap: 14px 20px; flex-wrap: wrap; background: var(--ink); color: #fff; border-radius: var(--radius); padding: 12px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.cb-period { flex: none; width: 64px; height: 64px; border-radius: 16px; background: var(--accent); color: var(--ink); display: grid; place-content: center; text-align: center; font-family: var(--head); line-height: 1.05; }
.cb-period small { font-size: .7rem; font-weight: 600; } .cb-period b { font-size: 1.8rem; }
.cb-main { flex: 1 1 320px; min-width: 0; }
.cb-main h1 { font-size: 1.2rem; margin: 0 0 2px; color: #fff; }
.cb-state { font-size: .9rem; opacity: .9; }
.cb-state .dot:not(.on) { background: rgba(255,255,255,.4); }
.countdown { font-family: var(--head); font-variant-numeric: tabular-nums; padding: 1px 8px; border-radius: 8px; background: rgba(255,255,255,.14); }
.countdown.warn { background: var(--primary); }
.cb-stats { display: flex; gap: 8px; }
.cb-stat { display: grid; text-align: center; min-width: 78px; padding: 6px 10px; border-radius: 12px; background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
a.cb-stat:hover { background: rgba(255,255,255,.16); }
.cb-stat b { font-family: var(--head); font-size: 1.35rem; line-height: 1.1; } .cb-stat b small { font-size: .8rem; opacity: .7; }
.cb-stat span { font-size: .74rem; opacity: .75; }
.cb-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.classbar .btn:not(.btn-primary):not(.btn-danger) { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }
.classbar .btn-danger { background: transparent; color: #FFB4AC; border-color: #FFB4AC; }
.dash-grid { display: grid; gap: 14px; }
.dash-col { margin: 0; padding: 14px 16px; min-width: 0; }
.dc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.dc-head h2 { margin: 0; font-size: 1.05rem; }
.dash-col textarea { font-size: .9rem; padding: 7px 10px; }
.warn-t { color: var(--bad); font-weight: 600; }
.wlist { display: grid; gap: 8px; }
.witem { border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; background: #fff; }
.witem.off { background: #FAF9F6; } .witem.off .wi-title { color: var(--muted); }
.witem.t-game { border-left: 4px solid var(--primary); } .witem.t-test, .witem.t-survey { border-left: 4px solid var(--accent); }
.witem.t-sheet, .witem.t-reflect { border-left: 4px solid var(--ink-2); }
.wi-top { display: flex; gap: 10px; align-items: center; }
.wi-main { flex: 1; min-width: 0; }
.wi-title { font-weight: 700; font-size: .93rem; line-height: 1.35; }
.wi-sub { font-size: .78rem; color: var(--muted); }
.wi-bar { height: 5px; background: var(--soft); border-radius: 3px; margin-top: 4px; overflow: hidden; }
.wi-bar i { display: block; height: 100%; background: var(--good); }
.wi-act { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; flex: none; max-width: 46%; }
.wi-note { font-size: .8rem; color: var(--ink-2); margin-top: 6px; background: var(--soft); border-radius: 8px; padding: 5px 8px; }
.wi-note details summary { cursor: pointer; font-weight: 600; }
.witem .tkdist { margin-top: 6px; }
.gcells { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; padding-left: 54px; }
.gc { display: grid; place-items: center; min-width: 34px; height: 30px; padding: 0 4px; border-radius: 8px; background: #EFEDE7; color: #A9A69D; text-decoration: none; font-family: var(--head); font-weight: 700; font-size: .82rem; line-height: 1; }
.gc small { font-size: .62rem; font-weight: 600; }
.gc.draft { background: #fff; color: var(--muted); border: 1px dashed #C9C6BD; }
.gc.sub { background: var(--mid-soft); color: #7A5200; } .gc.graded { background: var(--good-soft); color: #146C48; } .gc.ret { background: var(--bad-soft); color: #A1342A; }
@media (max-width: 1500px) { body.is-teacher .brand-sub { display: none; } .top-sel select { max-width: 230px; } .tnav a { padding: 6px 8px; } }

/* ---------- กล่องวิธีทำ (ต้นใบงาน) ---------- */
.howto { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin: 6px 0 14px; }
.ht-head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; background: var(--ink); color: #fff; padding: 9px 14px; }
.ht-head b { font-family: var(--head); font-weight: 600; font-size: 1rem; }
.ht-head span { font-size: .78rem; opacity: .75; }
.ht-steps { list-style: none; margin: 0; padding: 12px 14px 4px; counter-reset: st; }
.ht-steps li { counter-increment: st; position: relative; padding: 0 0 12px 36px; font-size: .94rem; line-height: 1.5; }
.ht-steps li::before { content: counter(st); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-family: var(--head); font-weight: 700; font-size: .78rem; z-index: 1; }
.ht-steps li:not(:last-child)::after { content: ''; position: absolute; left: 11px; top: 26px; bottom: 2px; width: 2px; background: var(--primary-soft); }
.ht-tip { margin: 0; padding: 9px 14px 11px; background: var(--accent-soft); border-top: 1px solid #F2E2B3; font-size: .86rem; line-height: 1.5; color: #5C4508; }
.ht-tip b { font-family: var(--head); font-weight: 600; margin-right: 4px; }

/* ---------- แบบสังเกตในศูนย์ควบคุมคาบ ---------- */
@media (max-width: 1500px) { .og-items { grid-template-columns: 1fr; } }
.big-input::placeholder { color: #C9C6BD; font-size: 1.1rem; letter-spacing: 0; font-weight: 500; }
.hero-text { max-width: 30em; }

/* =====================================================================
   แถบด้านบน: นักเรียนและครูสูงเท่ากัน (64px) ทุกขนาดจอ
   ===================================================================== */
.topbar-in { max-width: none; height: var(--top-h); min-height: 0; padding: 0 24px; flex-wrap: nowrap; gap: 14px; position: relative; }
@media (max-width: 899px) { .topbar-in { padding: 0 12px; gap: 8px; } }
.brand { flex: none; }
.brand-mark { width: 38px; height: 38px; font-size: .95rem; }
.top-right { flex-wrap: nowrap; gap: 8px; min-width: 0; }
/* ครู */
.tnav { flex-wrap: nowrap; min-width: 0; }
.tnav a { font-size: .88rem; padding: 6px 9px; }
.tmenu-btn { display: none; flex: none; align-items: center; gap: 6px; border: 1px solid rgba(255,255,255,.25); background: transparent; color: #fff; border-radius: 9px; padding: 6px 12px; font-family: var(--head); font-weight: 600; font-size: .88rem; cursor: pointer; }
.tmenu-btn::before { content: ''; width: 14px; height: 10px; background: linear-gradient(#fff 0 2px, transparent 2px 4px, #fff 4px 6px, transparent 6px 8px, #fff 8px 10px); }
@media (max-width: 1599px) { .is-teacher .brand-name, .is-teacher .brand-sub { display: none; } .top-sel > span { display: none; } .top-sel select { max-width: 210px; } }
@media (max-width: 1099px) {
  .tmenu-btn { display: inline-flex; }
  .tnav { display: none; position: absolute; top: var(--top-h); left: 0; right: 0; z-index: 40; order: 0; width: auto; overflow: visible; flex-direction: column; gap: 2px; background: var(--ink); padding: 8px 12px 14px; box-shadow: 0 12px 24px rgba(0,0,0,.25); border-top: 1px solid rgba(255,255,255,.1); }
  body.tmenu-open .tnav { display: flex; }
  .tnav a { padding: 10px 12px; font-size: .95rem; }
  .top-sel select { max-width: 170px; }
}
@media (max-width: 699px) {
  .top-state { display: none; }
  .top-sel select { max-width: 120px; padding-right: 22px; font-size: .82rem; }
  .top-sel:first-of-type select { max-width: 84px; }
  .tmenu-btn { padding: 6px 9px; font-size: 0; gap: 0; }
  .brand-mark { width: 34px; height: 34px; font-size: .85rem; }
}
/* นักเรียน */
.crumb { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.crumb-home { flex: none; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; color: var(--ink); background: var(--accent); font-family: var(--head); font-weight: 600; font-size: .9rem; padding: 6px 13px 6px 10px; border-radius: 8px; }
.crumb-home span { font-size: 1.2rem; line-height: 1; margin-top: -2px; }
.crumb-home:hover { background: #F5B526; }
.crumb-cur { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgba(255,255,255,.72); font-size: .9rem; }
.who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; min-width: 0; opacity: 1; }
.who-name { font-family: var(--head); font-weight: 600; font-size: .92rem; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-sub { font-size: .74rem; opacity: .7; white-space: nowrap; }
@media (max-width: 1099px) { .is-student .brand-name, .is-student .brand-sub { display: none; } .crumb-cur { display: none; } }
@media (max-width: 560px) { .who { display: flex; } .who-sub { display: none; } .who-name { max-width: 110px; font-size: .84rem; } .crumb-home { padding: 6px 10px 6px 8px; font-size: .84rem; } .timer { padding: 3px 8px; } }
@media (max-width: 380px) { .who { display: none; } }

/* =====================================================================
   หน้าทำงาน (ใบงาน แบบวัด เกม): แถบข้างแคบ ส่วนทำงานกว้าง
   ===================================================================== */
.work { display: grid; gap: 16px; align-items: start; }
.work-side { min-width: 0; }
.work-main { min-width: 0; margin: 0; }
@media (min-width: 1100px) {
  .work { grid-template-columns: minmax(250px, 290px) minmax(0, 1fr); gap: 20px; }
  .work-side { position: sticky; top: calc(var(--top-h) + 16px); max-height: calc(100vh - var(--top-h) - 32px); overflow: auto; scrollbar-width: thin; padding-bottom: 4px; }
}
@media (min-width: 1600px) { .work { grid-template-columns: 310px minmax(0, 1fr); } }
.side-card { padding: 16px 16px 14px; margin-bottom: 12px; }
.side-title { font-size: 1.12rem; margin: 2px 0 4px; line-height: 1.35; }
.side-who { margin: 0 0 8px; font-size: .84rem; color: var(--ink-2); }
.side-lab { display: block; font-family: var(--head); font-weight: 600; font-size: .8rem; color: var(--muted); margin: 10px 0 6px; }
.side-card .status-note { margin: 6px 0; font-size: .9rem; }
.side-card .occ-line { margin: 8px 0 0; font-size: .88rem; }
.side-refs { display: grid; gap: 6px; }
.ref-btn { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font-size: .86rem; line-height: 1.35; font-weight: 600; }
.ref-btn:hover { border-color: var(--ink-2); background: #fff; }
.ref-btn i { flex: none; font-style: normal; font-size: .68rem; font-family: var(--head); background: var(--ink); color: #fff; border-radius: 6px; padding: 1px 6px; }
.side-card .online { margin-top: 8px; }
.work-side .howto { margin: 0 0 12px; }
.ht-intro { padding: 10px 14px 0; font-size: .9rem; color: var(--ink-2); }
.ht-intro p { margin: 0 0 8px; padding: 8px 10px; background: var(--info-soft); border-radius: 8px; line-height: 1.5; }
.ht-intro b { font-family: var(--head); color: var(--ink); }
.work-main.doc > .blk-h:first-child, .work-main.doc > .blk-p:first-child { margin-top: 0; }
.work-main .sheet-bar { margin: 18px -22px -20px; }
/* ช่องที่ระบบเติมให้ */
.auto-val { display: inline-flex; align-items: baseline; gap: 6px; margin: 0 4px; padding: 2px 10px; border-radius: 8px; background: var(--info-soft); color: var(--ink); font-weight: 600; line-height: 1.6; }
.auto-val small { font-weight: 500; font-size: .72rem; color: var(--muted); }
.auto-val.from { background: #EAF6EF; }
.fld-pick { min-width: 12em; padding: .2em .5em !important; }
/* ใบความรู้เปิดเป็นหน้าอ่าน */
.read-doc { max-width: 980px; margin-left: auto; margin-right: auto; }
.today .hello { margin: 0 0 2px; color: var(--ink-2); font-size: .95rem; }

/* ---------- Exit Ticket ---------- */
.ticket-card { max-width: 760px; margin: 8px auto 0; padding: 24px 26px 20px; }
.ticket-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; font-size: .88rem; }
.ticket-tag { background: var(--ink); color: #fff; font-family: var(--head); font-weight: 600; letter-spacing: .5px; border-radius: 8px; padding: 3px 10px; font-size: .82rem; }
.ticket-card h1 { font-size: 1.3rem; margin-bottom: 2px; }
.ticket-card .ticket-q { font-size: 1.12rem; margin: 18px 0 12px; line-height: 1.7; }
.ticket-card .ticket-opts .option { min-height: 64px; font-size: 1.02rem; }
.ticket-card .sheet-bar { margin: 20px -26px -20px; padding: 12px 26px; }
@media (max-width: 560px) { .ticket-card { padding: 18px 16px 16px; } .ticket-card .sheet-bar { margin: 16px -16px -16px; padding: 10px 16px; } }

/* ---------- แบบวัด: ทีละข้อ ---------- */
.test-intro { max-width: 760px; margin: 8px auto 0; padding: 26px 28px; }
.intro-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.intro-facts div { background: var(--soft); border-radius: 12px; padding: 12px; text-align: center; }
.intro-facts b { display: block; font-family: var(--head); font-size: 1.8rem; line-height: 1.1; }
.intro-facts span { font-size: .82rem; color: var(--muted); }
.intro-list { padding-left: 1.2em; color: var(--ink-2); margin: 0 0 18px; }
.btn-lg { min-height: 52px; padding: 10px 26px; font-size: 1.05rem; }
.test-side .test-timer { position: static; width: auto; margin: 8px 0 12px; display: flex; align-items: baseline; justify-content: space-between; border-radius: 12px; padding: 10px 14px; box-shadow: none; }
.test-side .test-timer small { font-size: .8rem; opacity: .75; font-weight: 500; }
.test-side .test-timer b { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.qmap { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.qm { height: 40px; border-radius: 10px; border: 2px solid var(--line); background: #fff; font-family: var(--head); font-weight: 700; font-size: 1rem; color: var(--ink-2); cursor: pointer; }
.qm.done { background: var(--good-soft); border-color: var(--good); color: #146C48; }
.qm.now { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink) inset; }
.qmap-note { margin: 8px 0 0; font-size: .82rem; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.qmap-note .save-state { margin: 0; }
.sit-head { font-family: var(--head); font-weight: 600; margin-bottom: 6px; }
.sit-head small { font-weight: 500; color: var(--muted); font-size: .78rem; margin-left: 4px; }
.sit-text { margin: 0; font-size: .95rem; line-height: 1.7; color: var(--ink-2); }
.sit-card[hidden] { display: none; }
.sit-sub { margin-top: 10px; font-size: .9rem; }
.sit-list { margin: 0; padding-left: 1.2em; font-size: .92rem; line-height: 1.65; color: var(--ink-2); }
.test-main { padding: 26px 30px 22px; }
.q1-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.q1-no { font-family: var(--head); font-weight: 700; font-size: 1.05rem; color: var(--primary); }
.q1-no small { color: var(--muted); font-weight: 500; }
.q1-stem { font-size: 1.22rem; font-weight: 600; line-height: 1.6; margin: 0 0 14px; }
.q1-opts { gap: 10px; }
.q1-opts .option { padding: 14px 16px; font-size: 1.04rem; }
.q1-opts .opt-letter { flex-basis: 34px; height: 34px; }
.q1-nav { display: flex; gap: 10px; justify-content: space-between; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.q1-nav #qNext, .q1-nav #sendTest { margin-left: auto; }
@media (max-width: 1099px) { .test-work .work-side { display: grid; gap: 0; } .sit-card .sit-text { font-size: .92rem; } }
@media (max-width: 560px) { .test-main { padding: 18px 16px 16px; } .q1-stem { font-size: 1.08rem; } .q1-nav .btn { flex: 1; padding: 8px 10px; } .intro-facts b { font-size: 1.4rem; } }

/* ---------- เกม: ข้อมูลภารกิจอยู่แถบข้าง ---------- */
.game-main { container-type: inline-size; }
.side-story { font-size: .9rem; line-height: 1.65; color: var(--ink-2); margin: 6px 0 8px; }
.side-conds { grid-template-columns: 1fr; gap: 6px; }
.side-conds .cond { padding: 7px 10px; }
.side-conds .cond-value { font-size: .9rem; }
.intro-hint { background: var(--info-soft); border-radius: 10px; padding: 10px 14px; }
@media (max-width: 1099px) { .game-side .side-story, .game-side .cond-card, .game-side .howto { display: none; } }
@media (min-width: 1100px) { .pt-cols { grid-template-columns: minmax(0, 1fr); } .pt-left { position: static; } }
@container (min-width: 860px) {
  .pt-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; }
  .pt-left { position: sticky; top: calc(var(--top-h) + 16px); }
}

/* ---------- ศูนย์ควบคุมคาบ: สรุปแบบสังเกต ---------- */

/* ---------- หน้าต่างแบบสังเกต ---------- */
details.howto > summary { list-style: none; cursor: pointer; }
details.howto > summary::-webkit-details-marker { display: none; }
details.howto > summary::after { content: '−'; margin-left: auto; font-family: var(--head); font-size: 1.1rem; line-height: 1; opacity: .8; }
details.howto:not([open]) > summary::after { content: '+ ดูวิธีทำ'; font-size: .8rem; }
details.howto:not([open]) > summary span { display: none; }
.ht-head { align-items: center; }
@media (min-width: 1100px) { details.howto > summary { pointer-events: none; } details.howto > summary::after { display: none; } }

/* =====================================================================
   v16: โลโก้ หน้าเข้าสู่ระบบ ส่วนท้าย และหน้าทำงานแบบเต็มจอไม่มีช่องว่าง
   ===================================================================== */
/* โลโก้ M3 + ชื่อ ชิดกันพอดี */
.brand { gap: 9px; align-items: center; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; font-size: .9rem; letter-spacing: .3px; transform: rotate(-6deg); box-shadow: 2px 2px 0 var(--accent); }
.brand-text { display: grid; gap: 1px; line-height: 1.1; }
.brand-name { font-size: 1.02rem; line-height: 1.1; }
.brand-sub { font-size: .72rem; line-height: 1.15; opacity: .7; }

/* ทั้งหน้าเป็นคอลัมน์: แถบบน / เนื้อหา / ส่วนท้าย */
body { min-height: 100vh; display: flex; flex-direction: column; }
body > main.wrap { flex: 1 0 auto; width: 100%; }
.site-foot { flex: none; text-align: center; font-size: .76rem; color: var(--muted); padding: 10px 16px 12px; line-height: 1.5; }
.site-foot a { color: var(--ink-2); }

/* หน้าเข้าสู่ระบบ: พื้นหลังเดียวกับหน้าในเว็บ การ์ดอยู่กลางจอ */
body.page-join { background: var(--bg); }
.join, .join-one { min-height: 0; flex: 1; max-width: 460px; width: 100%; margin: 0 auto; padding: 36px 16px 20px; display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 22px; grid-template-columns: none !important; }
.join-hero { color: var(--ink); text-align: center; }
.join-hero .brand { color: var(--ink); justify-content: center; }
.join-hero .brand-sub { opacity: .65; }
.join .hero-title { font-size: clamp(1.7rem, 5vw, 2.2rem); margin: 18px 0 6px; line-height: 1.25; }
.join .hero-title .hl { color: var(--primary); }
.join .hero-text { opacity: 1; color: var(--muted); margin: 0; font-size: .95rem; }
.join-card { max-width: none; justify-self: auto; }
.join .hero-steps { display: flex; justify-content: flex-start; gap: 6px 14px; margin: 4px 0 4px; color: var(--ink-2); font-size: .86rem; }
.join .hero-steps b { background: var(--soft); color: var(--primary); width: 22px; height: 22px; border-radius: 7px; font-size: .78rem; }
@media (max-width: 559px) { .join .hero-steps { display: flex; } }

/* หน้าทำงาน (ใบงาน แบบวัด เกม) บนจอกว้าง: ทั้งหน้าพอดีจอ แต่ละคอลัมน์เลื่อนของตัวเอง ไม่มีช่องว่างตอนเลื่อนสุด */
@media (min-width: 1100px) {
  body.is-work { height: 100vh; overflow: hidden; }
  body.is-work > main.wrap { flex: 1 1 auto; min-height: 0; padding: 16px 28px 10px; display: flex; flex-direction: column; }
  body.is-work .work { flex: 1; min-height: 0; height: 100%; align-items: stretch; }
  body.is-work .work-side { position: static; height: 100%; max-height: none; overflow: auto; }
  body.is-work .work-main { height: 100%; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  body.is-work .work-main.doc .sheet-bar { position: sticky; bottom: -20px; margin: 18px -22px -20px; }
  body.is-work .site-foot { padding: 4px 16px 8px; }
  body.is-work .pt-left { top: 0; }
}
/* จอเล็ก: ปุ่มส่งงานติดขอบล่างจอ */
@media (max-width: 1099px) {
  body.is-work .work-main.doc { padding-bottom: 84px; }
  body.is-work .work-main .sheet-bar { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; border-radius: 0; z-index: 25; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 16px rgba(27,35,64,.08); }
  body.is-work .site-foot { padding-bottom: 84px; }
}

/* แถบข้างกระชับ */
.side-title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.side-refs { display: grid; gap: 6px; margin-top: 10px; }
.ref-btn { justify-content: space-between; padding: 8px 12px; font-size: .88rem; }
.ref-btn span { font-size: .76rem; font-weight: 600; color: var(--primary); white-space: nowrap; }
.side-card { padding: 14px 16px; }
.ht-intro p { font-size: .88rem; }
.ht-steps li { font-size: .9rem; padding-bottom: 10px; }

/* Exit Ticket ใบความรู้ และบัตรข้อมูลอาชีพที่เปิดเป็นหน้าปกติ: เต็มความกว้างเหมือนหน้าอื่น */
.read-doc, .ticket-card, .test-intro { max-width: none; margin-left: 0; margin-right: 0; }
.ticket-card { margin-top: 0; }

/* ศูนย์ควบคุมคาบ: แบบสังเกตกระชับขึ้น และกล่องบันทึกหลังสอน */
@media (min-width: 1100px) {
  body.is-work .work-main.doc { display: flex; flex-direction: column; }
  body.is-work .work-main.doc > * { flex: none; }
  body.is-work .work-main.doc > .sheet-bar { margin-top: auto; }
  body.is-work .work-main.doc > .blk-h + .blk-d { margin-top: -.3em; }
}
.join .hero-title .hl { white-space: nowrap; }
.read-doc .blk-fig img { max-width: min(100%, 1100px); }

/* ---------- ผังห้องคอมพิวเตอร์ ---------- */
.seat-seg { display: inline-flex; gap: 2px; background: var(--soft); border-radius: 10px; padding: 3px; }
.seat-seg .seg-btn { min-height: 30px; padding: 2px 10px; border: 0; background: transparent; font-size: .8rem; border-radius: 8px; }
.seat-seg .seg-btn.on { background: var(--ink); color: #fff; }
/* ผังขนาดใหญ่ (หน้าต่างผังเต็ม) */

/* ---------- v18 หน้าเข้าสู่ระบบ: แบบเดิม พื้นหลังสีครีม ---------- */
.join.join-split { max-width: 1000px; padding: 32px 18px; display: grid; gap: 30px; align-items: center; align-content: center; justify-content: stretch; }
@media (min-width: 960px) { .join.join-split { grid-template-columns: 1.1fr 420px !important; gap: 64px; } }
.join-split .join-hero { text-align: left; }
.join-split .join-hero .brand { justify-content: flex-start; }
.join-split .hero-title { font-size: clamp(2.1rem, 6vw, 3.3rem); margin: 28px 0 12px; line-height: 1.2; }
.join-split .hero-title .hl { color: var(--primary); white-space: normal; }
.join-split .hero-text { color: var(--ink-2); font-size: 1rem; }
.join-split .hero-steps { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 26px 0 0; font-size: .95rem; color: var(--ink-2); }
.join-split .hero-steps b { width: 26px; height: 26px; border-radius: 8px; background: #fff; color: var(--primary); border: 1px solid var(--line); font-size: .85rem; }
@media (max-width: 959px) { .join-split .join-hero { text-align: center; } .join-split .join-hero .brand, .join-split .hero-steps { justify-content: center; } .join-split .hero-title { margin-top: 18px; } }
@media (max-width: 559px) { .join-split .hero-steps { display: none; } }
.join-split .join-card, .join-one .join-card { box-shadow: 8px 8px 0 var(--accent), var(--shadow); }
/* ครู: การ์ดเดียวกลางจอ */
.join.join-one { max-width: 420px; justify-content: center; align-items: stretch; gap: 22px; padding: 32px 16px; }
.join-one > .brand { justify-content: center; color: var(--ink); }

/* =====================================================================
   v18 ครู: ห้องเรียนพอดีจอ ผังห้อง ข้อมูลนักเรียน แบบสังเกตแบบตาราง
   ===================================================================== */
/* ห้องเรียน: จอกว้างไม่เลื่อนทั้งหน้า 3 คอลัมน์กว้างเท่ากัน แต่ละคอลัมน์เลื่อนเอง */
@media (min-width: 1200px) {
  body.is-dash { height: 100vh; overflow: hidden; }
  body.is-dash > main.wrap { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  body.is-dash .classbar { flex: none; }
  body.is-dash .dash-grid { flex: 1 1 auto; min-height: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.is-dash .dash-col { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}
@media (min-width: 800px) and (max-width: 1199px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } #dashSide { grid-column: 1 / -1; } }
.dc-head { margin-bottom: 8px; }
a.cb-stat.cb-warn b { color: #FFC23D; }
.att-count { margin: 0 0 8px; font-size: .82rem; color: var(--muted); }
.att-count b { font-family: var(--head); color: var(--ink); margin-left: 8px; }
.att-count b:first-child { margin-left: 0; }
.att-count b.c-in { color: var(--good); } .att-count b.c-late { color: var(--mid); } .att-count b.c-abs { color: var(--bad); } .att-count b.c-leave { color: #5B6BC0; }

/* ผังห้องคอมพิวเตอร์ */
.seatmap { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(6px, .4fr) repeat(4, minmax(0, 1fr)); gap: 4px; padding: 8px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; }
.seat-desk { background: var(--ink); color: #fff; font-family: var(--head); font-weight: 600; font-size: .72rem; text-align: center; border-radius: 6px; padding: 3px 0; }
.seat { position: relative; display: grid; place-items: center; align-content: center; min-width: 0; min-height: 32px; padding: 3px 0; border-radius: 8px; border: 2px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; line-height: 1.1; }
.seat b { font-family: var(--head); font-size: .88rem; }
a.seat:hover { border-color: var(--ink-2); }
.seat.st-in { background: var(--good-soft); border-color: var(--good); }
.seat.st-late { background: var(--mid-soft); border-color: var(--mid); }
.seat.st-abs { background: var(--bad-soft); border-color: var(--bad); }
.seat.st-leave { background: #E7EAFA; border-color: #5B6BC0; }
.seat.empty { border: 1.5px dashed #D6D2C8; background: transparent; cursor: pointer; }
.seat.empty b { font-size: .88rem; color: #9CA3AF; }
.seatmap.big .seat.empty b { font-size: 1.05rem; }
.seat.st-broken { background: #FEF2F2 !important; border-color: #EF4444 !important; color: #991B1B !important; }
.seat.st-broken b { color: #DC2626 !important; }
.seat.empty.st-broken { border: 1.5px dashed #EF4444; background: #FEF2F2; }
.seat-broken-tag { font-size: .62rem; color: #DC2626; font-weight: 700; line-height: 1; margin-top: 1px; }
.seat-empty-tag { font-size: .62rem; color: #9CA3AF; line-height: 1; margin-top: 1px; }
.seat-desk-tag { font-size: .62rem; color: var(--accent); font-weight: 600; line-height: 1; margin-top: 1px; background: rgba(13,148,136,0.1); padding: 0 4px; border-radius: 4px; }

/* การลากวางผังที่นั่ง */
.seat { cursor: grab; user-select: none; }
.seat:active { cursor: grabbing; }
.seat.is-dragging { opacity: 0.35; transform: scale(0.96); }
.seat.drag-over { outline: 3px solid #2563EB !important; outline-offset: 2px; background: #DBEAFE !important; }
.seat.hl { outline: 3px solid var(--accent); outline-offset: 1px; z-index: 1; }
.on-dot { position: absolute; top: 2px; right: 2px; width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 2px #fff; }
.seat-rest { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 6px; font-size: .76rem; color: var(--muted); }
.seat-rest .seat { width: 44px; }
.seatmap + .seat-rest .seat, .seat-rest .seat { flex: none; }
.seatmap.big ~ .seat-rest { gap: 8px; margin-top: 12px; padding: 10px 12px; background: #FFF8E6; border: 1px dashed #E5C26B; border-radius: 10px; font-size: .82rem; color: #7A5200; }
.seat-rest .seat { min-height: 44px; width: 52px; }
.seat-rest .seat .seat-name, .seat-rest .seat .seat-work, .seat-rest .seat .seat-desk-tag { display: none; }
.seatmap.big { gap: 6px; padding: 12px; }
.seatmap.big .seat-desk { font-size: .88rem; padding: 5px 0; }
.seatmap.big .seat { min-height: 64px; padding: 5px 4px; gap: 2px; border-radius: 10px; align-content: start; }
.seatmap.big .seat b { font-size: 1.05rem; }
.seatmap.big .on-dot { top: 5px; right: 5px; width: 8px; height: 8px; }
.seat-name { font-size: .7rem; color: var(--ink-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-work { display: flex; align-items: center; justify-content: center; gap: 0; }
@media (max-width: 600px) { .seatmap.big { gap: 3px; padding: 6px; } .seatmap.big .seat { min-height: 44px; } .seat-name { display: none; } }

/* หน้าต่างผังห้อง / เช็กชื่อ */
.seats-bar { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin-bottom: 10px; }
.seats-bar .att-count { margin: 0; flex: 1; }
.seat-key { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; color: var(--muted); margin: 10px 0 0; }
.seat-key b { color: var(--ink); }
.seat-key .k::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; background: #EFEDE7; }
.seat-key .k.done::before { background: var(--good); } .seat-key .k.doing::before { background: var(--mid); }

/* ข้อมูลนักเรียนรายคน */
.stu-head { display: flex; align-items: center; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.stu-id { flex: none; width: 52px; height: 52px; border-radius: 14px; background: var(--ink); color: #fff; display: grid; place-items: center; font-family: var(--head); font-size: 1.35rem; }
.stu-main { flex: 1; min-width: 0; }
.stu-main h2 { margin: 0; font-size: 1.12rem; }
.stu-main p { margin: 2px 0 0; font-size: .86rem; color: var(--muted); }
.stu-sec { padding: 12px 0; border-bottom: 1px solid var(--line); }
.stu-sec:last-of-type { border-bottom: 0; }
.stu-sec h3 { font-size: .92rem; margin: 0 0 8px; }
.pick.att-lg { gap: 6px; }
.pick.att-lg button { min-width: 74px; height: 42px; font-size: 1rem; border-radius: 10px; }
.stu-work { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.stu-work li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; background: var(--soft); font-size: .88rem; }
.stu-work li > i { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #C9C6BD; }
.stu-work li.w-done > i { background: var(--good); } .stu-work li.w-doing > i { background: var(--mid); } .stu-work li.w-wait > i { background: var(--ink-2); }
.stu-work li.w-none .sw-s { color: var(--bad); }
.sw-t { flex: 1; min-width: 0; font-weight: 600; }
.sw-t small { font-weight: 500; color: var(--muted); }
.sw-s { color: var(--ink-2); font-size: .84rem; text-align: right; }
.stu-foot { padding-top: 10px; }

/* กลุ่ม (ห้องเรียน) */
.gtab { width: 100%; border-collapse: collapse; font-size: .85rem; }
.gtab th { font-family: var(--head); font-weight: 600; font-size: .74rem; color: var(--muted); text-align: left; padding: 4px 6px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.gtab td { padding: 6px; border-bottom: 1px solid var(--soft); vertical-align: middle; }
.gtab tr[data-hl-g]:hover td { background: var(--soft); }
.gtab td:first-child { font-family: var(--head); width: 1%; }
.g-nos { color: var(--ink-2); }
.g-occ { font-size: .8rem; }
.g-ob { display: inline-block; min-width: 32px; text-align: center; padding: 1px 7px; border-radius: 7px; background: #EFEDE7; color: #A9A69D; font-family: var(--head); font-weight: 700; font-size: .82rem; text-decoration: none; }
.g-ob.has { background: var(--good-soft); color: #146C48; }
.g-ob:hover { outline: 2px solid var(--line); }
.g-note { font-style: normal; font-size: .68rem; margin-left: 4px; padding: 0 5px; border-radius: 5px; background: var(--accent-soft); color: #7A5200; cursor: help; }

/* บันทึกหลังสอน (พิมพ์ได้ในหน้าห้องเรียนเลย) */
.log-inline { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.log-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 6px; }
.log-tabs button { border: 1.5px solid var(--line); background: #fff; border-radius: 8px; padding: 3px 9px; font-size: .78rem; color: var(--ink-2); cursor: pointer; }
.log-tabs button.done::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--good); margin-right: 5px; vertical-align: 2px; }
.log-tabs button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.log-inline textarea { width: 100%; min-height: 110px; resize: vertical; }

/* รอตรวจ */
.pend-h { font-size: .95rem; margin: 14px 0 6px; }
.pend-h:first-child { margin-top: 0; }
.pend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pend-list a { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-decoration: none; font-size: .9rem; }
.pend-list a:hover { border-color: var(--ink-2); }
.pend-list b { flex: 1; min-width: 0; }
.pend-list span { color: var(--muted); font-size: .8rem; }
.pend-list em { font-style: normal; font-weight: 600; color: var(--primary); font-size: .85rem; }
.pend-foot { margin: 12px 0 0; font-size: .85rem; }

/* แบบสังเกตแบบตาราง */
.obs2-bar { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 10px; }
.obs2-bar > .btn:last-child { margin-left: auto; }
.obs2 .tbl-wrap { margin: 0; max-height: calc(100vh - 230px); overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.omx { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .86rem; }
.omx th { position: sticky; top: 0; z-index: 2; background: #fff; font-family: var(--head); font-weight: 600; font-size: .8rem; padding: 6px 4px; border-bottom: 2px solid var(--line); text-align: center; vertical-align: bottom; white-space: nowrap; }
.omx th span { display: block; font-size: .9rem; }
.omx td { padding: 4px; border-bottom: 1px solid var(--soft); text-align: center; }
.omx .omx-l { text-align: left; position: sticky; left: 0; z-index: 1; background: #fff; min-width: 240px; white-space: normal; line-height: 1.4; padding-left: 10px; }
.omx th.omx-l { z-index: 3; }
.omx td.omx-l small { display: block; font-size: .7rem; color: var(--muted); }
.omx th.omx-l small { font-weight: 500; color: var(--muted); }
.omx tbody tr:hover td { background: #FBFAF7; }
.omx-c { width: 36px; height: 30px; border-radius: 8px; border: 2px solid var(--line); background: #fff; cursor: pointer; padding: 0; }
.omx-c:hover { border-color: var(--ink-2); }
.omx-c.on { background: var(--good); border-color: var(--good); }
.omx-c.on::after { content: '✓'; color: #fff; font-weight: 700; }
.omx-note { display: block; margin: 4px auto 0; border: 1px dashed #C9C6BD; background: #fff; border-radius: 6px; padding: 0 7px; font-size: .7rem; color: var(--muted); cursor: pointer; }
.omx-note.has { border: 1px solid var(--mid); background: var(--mid-soft); color: #7A5200; }
.omx tr.omx-other td.omx-l { color: var(--ink-2); }
.omx-w .omx-l { min-width: 170px; }
.omx-w .omx-l b { font-family: var(--head); margin-right: 4px; }
.omx-w .omx-l small { display: inline; color: var(--muted); }
.omx-w tr.omx-g td { background: var(--soft); text-align: left; font-family: var(--head); font-weight: 600; font-size: .8rem; padding: 3px 10px; position: static; }
.omx td.sum { font-family: var(--head); min-width: 34px; }
.pick.ow3 { flex-wrap: nowrap; gap: 2px; }
.pick.ow3 button { min-width: 28px; height: 28px; padding: 0 6px; border-width: 1.5px; font-size: .8rem; }
.obs2 [data-obs-more] { margin-top: 8px; }

/* ใบงาน: ช่องที่โฟกัสไม่ถูกแถบส่งงานบัง */
body.is-work .work-main { scroll-padding-bottom: 96px; }
@media (max-width: 1099px) { html:has(body.is-work) { scroll-padding-bottom: 96px; } }
.seat-seg a.seg-btn { display: inline-flex; align-items: center; text-decoration: none; color: var(--ink-2); font-family: var(--head); font-weight: 600; }
.seat-seg a.seg-btn.on { color: #fff; }
a.att-name { text-decoration: none; color: var(--ink); }
a.att-name:hover { text-decoration: underline; }
/* หน้าเข้าสู่ระบบอยู่กลางจอ */
body.page-join > main.wrap { display: flex; flex-direction: column; padding: 0 16px; }
body.page-join .join { flex: 1 0 auto; margin: 0 auto; }
/* ผังในหน้าห้องเรียนใช้ความสูงที่มี */
.dash-col .seatmap .seat { min-height: clamp(32px, 4.3vh, 48px); }
/* ผังเต็ม: ทุกที่นั่งเรียงเหมือนกัน เลขที่ใหญ่ด้านบน ชื่อบรรทัดเดียวด้านล่าง ป้ายโต๊ะ/สถานะงานต่อท้าย */
.seatmap.big .seat { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 62px; padding: 6px 6px; }
.seatmap.big .seat b { line-height: 1.1; }
.seatmap.big .seat-name { flex: 0 1 auto; min-width: 0; max-width: 100%; font-size: .74rem; line-height: 1.2; }
.seatmap.big .seat-work { flex-basis: auto; }
.seatmap.big .seat-desk-tag { margin-top: 0; font-size: .66rem; padding: 0 6px; background: #FFF1C9; color: #8A5A00; border-radius: 6px; }
/* โต๊ะว่าง: เขียนว่า "โต๊ะ N" ให้ต่างจากเลขที่นักเรียน */
.seat.empty .seat-empty-desk { font-size: .62rem; color: #9CA3AF; line-height: 1; }
.seatmap:not(.big) .seat-empty-desk { display: none; }
.seatmap.big .seat.empty { min-height: 62px; }

.obs-gf { flex-wrap: wrap; }
.obs-gf button.seg-btn { min-height: 28px; padding: 0 9px; }

/* =====================================================================
   v19 ครู: ตารางงาน นาฬิกา บันทึกหลังสอนแบบช่อง หน้าต่างซ้อน
   ===================================================================== */
/* ตารางงานนักเรียน: สีตามสถานะ */
.matrix { border-collapse: separate; border-spacing: 3px; width: auto; min-width: 100%; }
.matrix th, .matrix td { border: 0; }
.matrix th { background: transparent; font-size: .78rem; text-align: center; vertical-align: bottom; color: var(--muted); padding: 2px 4px; white-space: nowrap; }
.matrix td.lbl { white-space: nowrap; padding: 4px 8px 4px 0; }
.matrix td.lbl small { display: block; font-size: .74rem; color: var(--muted); max-width: 18em; overflow: hidden; text-overflow: ellipsis; }
.matrix td.cell { padding: 0; text-align: center; }
.matrix td.cell a { display: block; min-width: 50px; padding: 8px 4px; border-radius: 8px; background: #EFEDE7; color: #A9A69D; text-decoration: none; font-family: var(--head); font-weight: 700; font-size: .88rem; border: 1.5px solid transparent; }
.matrix td.cell a:hover { border-color: var(--ink-2); }
.matrix td.draft a { background: #fff; color: var(--muted); border: 1.5px dashed #C9C6BD; }
.matrix td.sub a { background: var(--mid-soft); color: #7A5200; border-color: var(--mid); }
.matrix td.graded a { background: var(--good-soft); color: #146C48; }
.matrix td.ret a { background: var(--bad-soft); color: #A1342A; }
.tab-n { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 3px; border-radius: 10px; background: var(--primary); color: #fff; font-size: .74rem; line-height: 1.5; text-align: center; }

/* คอลัมน์กลาง: งานเลื่อนในตัว นาฬิกาอยู่ล่างสุดตรงกลาง */
.dash-mid { display: flex; flex-direction: column; }
.dash-scroll { flex: 1 1 auto; min-height: 0; }
@media (min-width: 1200px) { body.is-dash .dash-mid { overflow: hidden; } body.is-dash .dash-scroll { overflow: auto; scrollbar-width: thin; margin-right: -6px; padding-right: 6px; } }
.dash-clock { flex: none; text-align: center; padding: 12px 0 2px; margin-top: 12px; border-top: 1px solid var(--line); }
.clk-t { font-family: var(--head); font-weight: 700; font-size: clamp(2.4rem, 3.4vw, 3.4rem); line-height: 1.05; font-variant-numeric: tabular-nums; color: var(--ink); }
.clk-t small { font-size: .45em; color: var(--muted); font-weight: 600; margin-left: 2px; }
.clk-d { font-size: .95rem; color: var(--ink-2); margin-top: 2px; }

/* กลุ่ม: ชื่อกลุ่มที่นักเรียนตั้ง */
.g-name { display: block; font-family: var(--body); font-size: .7rem; color: var(--muted); font-weight: 500; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.omx-gn { display: block; font-family: var(--body); font-weight: 500; font-size: .68rem; color: var(--muted); max-width: 8em; margin: 0 auto; overflow: hidden; text-overflow: ellipsis; }
.omx.omx-one { width: auto; }
.omx.omx-one th:not(.omx-l), .omx.omx-one td:not(.omx-l) { min-width: 90px; }
.obs-gf a.seg-btn { min-height: 28px; padding: 0 9px; }

/* บันทึกหลังสอนเป็นช่อง 2 คอลัมน์ */
.log-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
.log-f { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.log-f > span { font-family: var(--head); font-weight: 600; font-size: .8rem; color: var(--ink-2); }
.log-f textarea { min-height: 76px; font-size: .86rem; padding: 6px 9px; resize: vertical; }
.log-f:last-child:nth-child(odd), .log-f.log-sum { grid-column: 1 / -1; }
.log-f.log-sum textarea { min-height: 96px; }
.log-f > span .btn { margin-left: 6px; vertical-align: middle; }
@media (max-width: 520px) { .log-grid { grid-template-columns: 1fr; } }
/* ข้อความตั้งต้นจากข้อมูลในคาบ */
.log-draft { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.log-draft li { display: flex; gap: 10px; align-items: flex-start; padding: 6px 8px 6px 10px; border-radius: 8px; background: var(--soft); font-size: .84rem; line-height: 1.45; color: var(--ink-2); }
.log-draft li span { flex: 1; min-width: 0; }
.log-draft .btn { flex: none; }
.log-draft .btn[disabled] { opacity: .55; }

/* นักเรียนที่อยู่ในระบบ */
.on-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.on-list li { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: .88rem; }
.on-list li > a { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; color: var(--ink); }
.on-list li > a b { font-family: var(--head); min-width: 24px; text-align: center; }
.on-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.on-g, .on-at { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.on-st { font-size: .74rem; font-weight: 600; padding: 0 7px; border-radius: 6px; background: #EFEDE7; color: var(--muted); white-space: nowrap; }
.on-st.st-in { background: var(--good-soft); color: #146C48; } .on-st.st-late { background: var(--mid-soft); color: #7A5200; } .on-st.st-abs { background: var(--bad-soft); color: #A1342A; } .on-st.st-leave { background: #E7EAFA; color: #3B4790; }
.on-gone { margin: 10px 0 0; }
@media (max-width: 560px) { .on-g, .on-at { display: none; } }

/* รอตรวจ: เลขที่ ชื่อ เรียงจากส่งล่าสุด */
.pend-list a { justify-content: space-between; }
.pend-list a::after { content: 'ตรวจ ›'; font-weight: 600; color: var(--primary); font-size: .85rem; }

/* หน้าต่างที่ซ้อนอยู่บนสุด */
dialog.modal2 { box-shadow: 0 20px 60px rgba(27,35,64,.35); }
dialog.modal2::backdrop { background: rgba(27,35,64,.25); }


/* =====================================================================
   ธีมเว็บ ม.1: ฟ้าและมิ้นต์ (ตั้งใน inc/site.php 'theme' => 'm1') ให้ต่างจากเว็บ ม.3 ชัดเจน
   ===================================================================== */
:root.theme-m1 {
  --ink: #12365C; --ink-2: #2D4B6E; --muted: #61738A; --line: #D9E2EC; --soft: #EFF4FA;
  --bg: #EDF3FA; --card: #FFFFFF;
  --primary: #2F7FE8; --primary-dark: #1A5EBF; --primary-soft: #E1EDFD;
  --accent: #34C6A3; --accent-dark: #1E9B7E; --accent-soft: #DCF5EE;
  --info-soft: #E8F0FA;
  --shadow: 0 1px 2px rgba(18,54,92,.07), 0 6px 20px rgba(18,54,92,.07);
}
.theme-m1 .ht-tip { border-top-color: #BFE9DC; color: #155C4B; }
.theme-m1 .ticket-q b, .theme-m1 .occ-line, .theme-m1 .sum-debrief { color: var(--ink); }
.theme-m1 .classbar .btn-danger { color: #FFC2BB; border-color: #FFC2BB; }

/* ---------- แบบฝึกหัดเลือกตอบ (เลือกแล้วเห็นคำอธิบายทันที) ---------- */
.mcq { margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.mcq-q { margin: 0 0 8px; font-weight: 600; }
.mcq-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 640px) { .mcq-opts { grid-template-columns: 1fr; } }
.mcq-opt { display: flex; align-items: flex-start; gap: 6px; padding: 9px 12px; border: 2px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; line-height: 1.45; font-size: .95rem; }
.mcq-opt { position: relative; }
.mcq-opt input { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; } /* ให้ช่องซ่อนอยู่ในกรอบตัวเลือกเสมอ ไม่งั้นเบราว์เซอร์เลื่อนหน้าไปหาช่องที่อยู่ต่ำกว่าตอนกดเลือก */
.mcq-opt b { font-family: var(--head); color: var(--ink-2); }
.mcq-opt:hover { border-color: var(--ink-2); }
.mcq-opt:has(input:checked) { border-color: var(--ink); }
.mcq-opt.right { border-color: var(--good); background: var(--good-soft); }
.mcq-opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.mcq-opt.picked { border-color: var(--ink); }
.mcq-why { margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--soft); font-size: .9rem; line-height: 1.5; color: var(--ink-2); }
.mcq-why b { font-family: var(--head); color: var(--good); margin-right: 4px; }
.mcq:not(.answered) .mcq-why { display: none; }
#sheet .mcq:not(.answered) .mcq-opt.right { border-color: var(--line); background: #fff; }
.ticket-open .blk-p { font-weight: 600; margin: 12px 0 4px; }
.ticket-open .blk-p:first-child { margin-top: 0; }

/* ---------- สไลด์สอน: คลังสไลด์ (ครู) ---------- */
.slide-live { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.slide-live .dot { margin-right: 4px; }
.slide-form { display: grid; gap: 0 16px; grid-template-columns: 2fr 1.4fr 2fr; }
@media (max-width: 760px) { .slide-form { grid-template-columns: 1fr; } }
.slide-form .field-label { margin-top: 10px; }
.slide-form input, .slide-form select { width: 100%; }
.slide-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.slide-item { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card); display: flex; flex-direction: column; transition: box-shadow .15s; }
.slide-item:hover { box-shadow: var(--shadow); }
.slide-item.is-on { border-color: var(--good); box-shadow: 0 0 0 2px var(--good-soft); }
.slide-thumb { display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9; background: var(--soft); border-bottom: 1px solid var(--line); }
.slide-thumb img { width: 100%; height: 100%; object-fit: contain; }
.slide-thumb.is-missing { color: var(--muted); font-size: .85rem; padding: 12px; text-align: center; }
.slide-meta { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.slide-name { font-family: var(--head); font-weight: 600; }
.slide-acts { margin-top: 8px; }
.slide-acts .btn-del { color: var(--bad); margin-left: auto; }

/* ---------- สไลด์สอน: นำเสนอเต็มจอ (ครู ขึ้นโปรเจกเตอร์) ---------- */
body.slide-show { background: #000; overflow: hidden; }
body.slide-show main.wrap { max-width: none; padding: 0; margin: 0; }
.ss { position: fixed; inset: 0; background: #000; display: flex; align-items: center; justify-content: center; user-select: none; }
.ss-img { max-width: 100vw; max-height: 100vh; width: 100%; height: 100%; object-fit: contain; }
.ss-hit { position: absolute; top: 0; bottom: 64px; width: 35%; background: none; border: 0; cursor: pointer; }
.ss-prev { left: 0; cursor: w-resize; } .ss-next { right: 0; cursor: e-resize; }
.ss-bar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px;
  background: rgba(20, 24, 34, .88); color: #fff; font-size: .9rem; white-space: nowrap; transition: opacity .3s; max-width: calc(100vw - 24px); overflow-x: auto; }
/* เต็มจอ (ขึ้นโปรเจกเตอร์) ไม่แสดงแถบควบคุมเลย ใช้ปุ่มลูกศร/คลิกเปลี่ยนหน้า กด Esc ออกจากเต็มจอแล้วแถบจะกลับมา */
.ss:fullscreen .ss-bar, .ss:fullscreen .ss-hint { display: none; }
.ss:fullscreen .ss-hit { bottom: 0; }
.ss.idle { cursor: none; }
.ss-title { max-width: 28vw; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.ss-pg { min-width: 64px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.ss-btn { color: #fff; background: rgba(255, 255, 255, .12); border: 0; border-radius: 9px; padding: 6px 12px; cursor: pointer; text-decoration: none; font: inherit; }
.ss-btn:hover { background: rgba(255, 255, 255, .24); }
.ss-live { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.ss-hint { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); padding: 8px 16px; border-radius: 99px; background: rgba(20, 24, 34, .88); color: #fff; font-size: .95rem; pointer-events: none; }

/* ---------- สไลด์สอน: หน้าต่างบนจอนักเรียน (ปิดเองไม่ได้ ปิดเมื่อครูหยุดแสดง) ---------- */
.slide-dlg { width: min(1200px, 94vw); max-width: none; max-height: 92vh; padding: 0; border: 0; border-radius: 18px; overflow: hidden;
  background: #0B0E14; color: #fff; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.slide-dlg::backdrop { background: rgba(10, 14, 22, .72); backdrop-filter: blur(2px); }
.slide-dlg[open] { display: flex; flex-direction: column; }
.slide-stage { display: flex; align-items: center; justify-content: center; background: #000; }
.slide-stage img { display: block; width: 100%; height: auto; max-height: 92vh; object-fit: contain; background: #fff; }

/* ---------- สไลด์สอน (ย่อ) ในหน้าหลักครู ---------- */
.dash-slides { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.ds-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.ds-row:hover { background: var(--soft); }
.ds-row img { width: 56px; height: 32px; object-fit: cover; border-radius: 5px; border: 1px solid var(--line); background: var(--soft); flex: none; }
.ds-row span { flex: 1 1 auto; min-width: 0; font-size: .88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-row b { flex: none; font-size: .78rem; color: var(--primary); font-family: var(--head); }


/* ---------- เกมในใบงาน (sheet_minigame.js) ---------- */
/* สไตล์: กระดานเกมแบบการ์ด ขอบหนาสีเข้ม เงาแข็ง ไอคอน SVG ไม่ใช้อีโมจิ ใช้สีธีมของเว็บ (เปลี่ยนตาม --primary/--accent) */
.gm { margin: 18px 0; border: 3px solid var(--ink); border-radius: 18px; overflow: hidden; background-color: var(--card);
  background-image: radial-gradient(var(--line) 1.2px, transparent 1.4px); background-size: 18px 18px; box-shadow: 5px 5px 0 var(--ink); }
.gm-intro { display: flex; align-items: center; gap: 16px; padding: 18px; flex-wrap: wrap; background: var(--card); }
.gm-badge { flex: none; width: 58px; height: 58px; border-radius: 14px; background: var(--primary); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); display: grid; place-items: center; transform: rotate(-4deg); }
.gm-badge svg { width: 28px; height: 28px; fill: #fff; }
.gm-txt { flex: 1 1 220px; min-width: 0; }
.gm-kicker { display: inline-block; font-size: .7rem; font-weight: 800; letter-spacing: .1em; color: #fff; background: var(--ink); padding: 1px 8px; border-radius: 6px; }
.gm-name { display: block; margin-top: 4px; font-family: var(--head); font-size: 1.15rem; line-height: 1.3; }
.gm-txt p { margin: 4px 0 8px; color: var(--ink-2); }
.gm-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.gm-pills span { font-size: .8rem; font-weight: 600; padding: 2px 10px; border: 2px solid var(--ink); border-radius: 99px; background: #fff; }
.gm-pills .note { border-style: dashed; color: var(--muted); }
.gm-done { display: flex; gap: 6px 14px; align-items: center; flex-wrap: wrap; margin-top: 10px; padding: 6px 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--soft); font-size: .88rem; }
.gm-stars { color: #F5A300; letter-spacing: 2px; font-size: 1.15em; line-height: 1; }
/* แถบสถานะ */
.gm-top { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; padding: 10px 14px 9px; background: var(--card); border-left: 4px solid var(--primary); }
.gm-top b { font-family: var(--head); font-size: 1.05rem; }
.gm-top p { flex-basis: 100%; margin: 2px 0 0; color: var(--ink-2); font-size: .92rem; }
.gm-top small { flex-basis: 100%; color: var(--muted); }
.gm-hud { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--ink); color: #fff; }
.gm-lv { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; flex: none; }
.gm-lv small { font-size: .7rem; letter-spacing: .05em; opacity: .65; }
.gm-lv b { font-family: var(--head); font-size: .95rem; }
.gm-pips { flex: 1 1 auto; display: flex; gap: 3px; align-items: center; }
.gm-pips i { flex: 1; height: 5px; width: auto; border-radius: 3px; background: rgba(255,255,255,.18); transition: background .25s; }
.gm-pips i.on { background: var(--accent); transform: none; }
.gm-sc { display: flex; align-items: center; gap: 5px; font-weight: 800; font-variant-numeric: tabular-nums; flex: none; }
.gm-sc svg { width: 18px; height: 18px; fill: var(--accent); }
.gm-combo { font-size: .74rem; font-weight: 800; padding: 2px 7px; border-radius: 6px; background: var(--accent); color: #111; animation: gmpop .25s; }
/* ข้อความตอบกลับ */
.gm-msg { display: flex; align-items: center; gap: 8px; margin: 10px 14px 0; padding: 7px 12px; min-height: 2.6em; border-radius: 10px; border: 1.5px solid var(--line); background: var(--soft); font-size: .9rem; }
.gm-msg.sel { background: var(--primary-soft); border-color: var(--primary); }
.gm-msg.good { background: var(--good-soft); border-color: var(--good); }
.gm-msg.bad { background: var(--bad-soft); border-color: var(--bad); }
.gm-ic { flex: none; width: 20px; height: 20px; }
/* การ์ด */
.gm-tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; padding: 12px 14px 6px; min-height: 60px; }
.gm-chip { padding: 12px 14px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; font: inherit; font-weight: 600; color: var(--ink); cursor: grab; touch-action: none; user-select: none; box-shadow: 0 4px 0 var(--ink); transition: transform .08s, box-shadow .08s, background .15s; display: flex; align-items: center; justify-content: center; text-align: center; min-height: 56px; line-height: 1.3; }
.gm-chip:nth-child(odd) { transform: none; }
.gm-chip:nth-child(even) { transform: none; }
.gm-chip:hover { background: var(--soft); transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.gm-chip.on { background: var(--primary-soft); border-color: var(--primary); box-shadow: 0 5px 0 var(--primary); transform: translateY(-3px); }
.gm-chip:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.gm-chip.lift { opacity: .35; }
.gm-chip.wrong { animation: gmshake .5s; border-color: var(--bad); background: var(--bad-soft); }
.gm-ghost { position: fixed; z-index: 700; pointer-events: none; transform: translate(-50%, -50%) rotate(-3deg) !important; box-shadow: 0 10px 0 var(--ink), 0 16px 24px rgba(0,0,0,.25); }
/* ช่อง (ถาด) */
.gm-bins { display: grid; gap: 10px; padding: 10px 14px 18px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 460px) { .gm-bins { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); } }
.gm-bin { --bc: var(--primary); display: flex; flex-direction: column; text-align: left; padding: 0; min-height: 110px; border: 2px solid var(--ink); border-radius: 12px; overflow: hidden; background: #fff; font: inherit; color: var(--ink); cursor: pointer; box-shadow: 0 4px 0 var(--ink); transition: transform .1s, box-shadow .1s; }
.gm-bin.c0 { --bc: #2F7FE8; } .gm-bin.c1 { --bc: #D98A00; } .gm-bin.c2 { --bc: #1E9B7E; } .gm-bin.c3 { --bc: #E0457B; } .gm-bin.c4 { --bc: #7C5CE0; }
.gm-bin-h { display: flex; flex-direction: column; padding: 8px 10px; background: var(--bc); color: #fff; }
.gm-bin-h b { font-family: var(--head); line-height: 1.25; }
.gm-bin-h small { font-size: .78rem; opacity: .92; }
.gm-got { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 4px; flex: 1; min-height: 40px; padding: 8px; background: repeating-linear-gradient(135deg, transparent 0 8px, rgba(0,0,0,.03) 8px 16px); }
.gm-tag { padding: 3px 8px; border-radius: 6px; background: var(--bc); color: #fff; font-size: .8rem; font-weight: 600; animation: gmpop .3s; }
.gm-bin:hover, .gm-bin.hot { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.gm-bin.hot { outline: 3px dashed var(--bc); outline-offset: 2px; }
.gm-bin.ok { animation: gmpop .35s; }
.gm-bin.wrong { animation: gmshake .5s; border-color: var(--bad); }
.gm-bin.hint { animation: gmpulse .8s 3; }
/* เกมเรียงขั้นตอน */
.gm-slots { list-style: none; margin: 12px 14px 18px; padding: 0; display: grid; gap: 8px; }
.gm-slots li { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 10px; border: 2px dashed var(--ink-2); border-radius: 12px; background: rgba(255, 255, 255, .75); }
.gm-slots li.ok { border: 2px solid var(--ink); background: #fff; box-shadow: 0 3px 0 var(--ink); animation: gmpop .3s; }
.gm-n { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--ink); color: #fff; font-weight: 800; }
.gm-slots li.ok .gm-n { background: var(--good); }
.gm-slots li { flex-wrap: wrap; cursor: pointer; }
.gm-slots li.filled { border-style: solid; border-color: var(--ink); background: #fff; box-shadow: 0 3px 0 var(--ink); }
.gm-slots li.hot { outline: 3px dashed var(--primary); outline-offset: 2px; }
.gm-slots li.no { border: 2px solid var(--bad); background: var(--bad-soft); box-shadow: 0 3px 0 var(--bad); }
.gm-slots li.no .gm-n { background: var(--bad); }
.gm-slots li.ok, .gm-slots li.no { cursor: default; }
.gm-slot-t { font-weight: 600; flex: 1 1 0; min-width: 0; }
.gm-why { flex-basis: 100%; padding-left: 40px; color: var(--ink-2); }
.gm-foot { padding: 0 14px 16px; }
.gm-foot:empty { display: none; }
/* สรุปผล */
.gm-result { text-align: center; padding: 22px 14px 20px; background: #fff; }
.gm-big { display: flex; justify-content: center; gap: 10px; }
.gm-big svg { width: 56px; height: 56px; fill: var(--line); stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; animation: gmstar .6s both; }
.gm-big svg.on { fill: #FFC23D; }
.gm-result h4 { margin: 10px 0 4px; font-size: 1.2rem; }
.gm-stat { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.gm-stat span { display: flex; flex-direction: column; min-width: 96px; padding: 8px 12px; border: 2px solid var(--ink); border-radius: 10px; background: var(--soft); box-shadow: 0 3px 0 var(--ink); font-size: .78rem; color: var(--ink-2); }
.gm-stat b { font-family: var(--head); font-size: 1.3rem; color: var(--ink); }
.gm-saved { margin: 6px 0; font-size: .85rem; color: var(--good); font-weight: 600; }
.gm-btns { margin-top: 10px; }
/* มุมมองครู (หน้าตรวจงาน) */
.gm-view { margin: 10px 0; padding: 10px 14px; border: 2px solid var(--ink); border-radius: 12px; background: var(--soft); }
.gm-view .gm-stars { margin: 0 4px; }
.gm-view details { margin-top: 6px; }
.gm-view ul { margin: 4px 0 0; padding-left: 20px; }
@keyframes gmshake { 0%, 100% { translate: 0; } 20% { translate: -7px; } 40% { translate: 7px; } 60% { translate: -5px; } 80% { translate: 5px; } }
@keyframes gmpop { 0% { scale: .9; } 60% { scale: 1.06; } 100% { scale: 1; } }
@keyframes gmpulse { 0%, 100% { box-shadow: 0 4px 0 var(--ink), 0 0 0 0 rgba(47, 127, 232, .55); } 50% { box-shadow: 0 4px 0 var(--ink), 0 0 0 8px rgba(47, 127, 232, 0); } }
@keyframes gmstar { 0% { scale: 0; rotate: -40deg; opacity: 0; } 70% { scale: 1.25; rotate: 8deg; opacity: 1; } 100% { scale: 1; rotate: 0deg; } }
@media (prefers-reduced-motion: reduce) { .gm *, .gm-ghost { animation: none !important; transition: none !important; } }
@media print { .gm { display: none; } }

/* ปุ่มสลับภาษา (หน้านักเรียน) */
.lang-sw { display: inline-flex; border: 2px solid var(--line); border-radius: 99px; overflow: hidden; background: #fff; flex: none; }
.lang-sw a { padding: 2px 10px; font-size: .78rem; font-weight: 700; color: var(--ink-2); text-decoration: none; line-height: 1.6; }
.lang-sw a.on { background: var(--primary); color: #fff; }
.lang-row { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.ai-brief { margin-top: 12px; border-top: 1px solid var(--line, #e3e6ea); padding-top: 8px; }
.ai-brief > summary { cursor: pointer; }
.ai-brief h4 { margin: 10px 0 2px; font-size: .82rem; color: var(--ink-2); }
.ai-pre { white-space: pre-wrap; word-break: break-word; font: inherit; font-size: .78rem; line-height: 1.5; margin: 0 0 6px; max-height: 340px; overflow: auto; background: var(--bg-soft, rgba(0,0,0,.03)); border-radius: 6px; padding: 6px 8px; }

.ai-chip { position: fixed; inset: auto 16px 16px auto; margin: 0; border: 0; z-index: 9999; display: flex; align-items: center; gap: 10px; max-width: min(92vw, 420px); padding: 10px 14px; border-radius: 12px; background: #1f2937; color: #fff; font-size: .88rem; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.ai-chip button { margin-left: auto; background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 8px; padding: 2px 10px; cursor: pointer; }
.ai-chip.idle .ai-spin, .ai-chip.idle button { display: none; }
.ai-spin { width: 16px; height: 16px; flex: none; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: ai-rot .8s linear infinite; }
@keyframes ai-rot { to { transform: rotate(360deg); } }
/* แบบฝึกหัดที่ยังไม่ส่ง: ข้อที่เลือกไว้เป็นสีเขียวให้เห็นชัด (ยังไม่บอกว่าถูกหรือผิด) */
.mcq[data-hold] .mcq-opt:has(input:checked) { border-color: var(--good); background: var(--good-soft); box-shadow: 0 0 0 2px rgba(30,158,106,.25); }
.mcq[data-hold] .mcq-opt:has(input:checked) b { color: var(--good); }
/* สถานะงานของนักเรียนแต่ละคน: จุดต่อกันเหมือนสถานะออนไลน์ เทา = ยังไม่เริ่ม ส้ม = กำลังทำ เขียว = เสร็จ */
.seat-work i { position: relative; flex: none; width: 9px; height: 9px; margin: 0 7px; padding: 0; border-radius: 50%; background: #D5D2C8; font-size: 0; line-height: 0; }
.seat-work i + i::before { content: ''; position: absolute; right: 100%; top: 50%; width: 14px; height: 2px; margin-top: -1px; background: #D5D2C8; }
.seat-work i.doing { background: var(--mid); }
.seat-work i.done { background: var(--good); }
.seat-work i.done + i::before { background: var(--good); }
.seat-work i.doing + i::before { background: var(--mid); }
/* ผังที่นั่ง: ไม่แสดงเลขโต๊ะ (ป้าย "โต๊ะ N" และเลขบนโต๊ะว่าง) ยังชี้เมาส์ดูเลขโต๊ะได้ และลากสลับโต๊ะได้ตามเดิม */
.seat-desk-tag, .seat.empty b, .seat.empty .seat-empty-desk { display: none !important; }
.seatmap.big .seat.empty .seat-empty-tag, .seatmap.big .seat.empty .seat-broken-tag { font-size: .8rem; margin-top: 0; }
/* ผังเต็ม: จุดสถานะงานอยู่มุมขวาบนของการ์ด (แบบจุดออนไลน์) จุดออนไลน์ย้ายไปมุมซ้ายบน */
.seatmap.big .seat-work { position: absolute; top: 7px; right: 7px; margin: 0; flex-basis: auto; }
.seatmap.big .seat-work i { width: 7px; height: 7px; margin: 0; }
.seatmap.big .seat-work i + i { margin-left: 5px; }
.seatmap.big .seat-work i + i::before { width: 5px; height: 2px; margin-top: -1px; }
.seatmap.big .on-dot { right: auto; left: 7px; top: 7px; }

/* ชื่อสไลด์แก้ตรงช่องได้ บันทึกอัตโนมัติ */
.slide-name-in { width: 100%; font-weight: 700; border: 1px solid transparent; background: transparent; padding: 2px 6px; margin-left: -6px; border-radius: 6px; }
.slide-name-in:hover { border-color: var(--line, #d6dbe3); }
.slide-name-in:focus { border-color: var(--brand, #2563eb); background: #fff; outline: none; }
.slide-name-in.saved { border-color: #22a355; }

/* กล่องถาม/แจ้งเตือน: ใช้เอฟเฟกต์ SweetAlert ตามเดิม แต่ให้พื้นกล่องทึบ กันภาพทะลุบนเครื่องเก่า */
.swal2-popup.pt-swal:not(.swal2-toast) { background: #fff !important; }

/* หน้าหลักนักเรียน: เลขลำดับงาน แถบความคืบหน้า และป้าย "ทำอันนี้ต่อ" */
.progress-line { margin: 0 0 12px; }
.progress-line p { margin: 6px 2px 0; font-size: .92rem; color: var(--muted); }
.progress-line p b { color: var(--ink); }
.pl-bar { height: 8px; border-radius: 99px; background: var(--line, #e7e4dc); overflow: hidden; }
.pl-bar i { display: block; height: 100%; background: var(--good, #22a355); border-radius: 99px; }
.task-no { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--head); font-weight: 700; font-size: .9rem; background: var(--line, #e7e4dc); color: var(--ink); }
.task-no.ok { background: var(--good, #22a355); color: #fff; }
.task-next { flex: none; font-family: var(--head); font-weight: 700; font-size: .8rem; color: #fff; background: var(--primary); padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.task:has(.task-next) { border-color: var(--primary); }

/* หน้าสไลด์ครู: แต่ละคาบเป็นคอลัมน์เรียงแนวนอน เลื่อนซ้าย-ขวาดูคาบอื่น */
.slide-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.slide-col { flex: 0 0 270px; min-width: 0; }
.slide-col .section-title { margin: 0 0 8px; font-size: .95rem; position: sticky; left: 0; }
.slide-col .slide-list { grid-template-columns: 1fr; }

/* ฟอร์มอัปโหลดสไลด์อยู่ในหัวหน้า */
.slide-head { flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; }
.slide-up { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.slide-up input:not([type=file]), .slide-up select { width: auto; min-width: 150px; max-width: 260px; }
.slide-up input[type=file] { max-width: 230px; }

/* โหมดทดลองของครู (เข้าเลขที่ 99) */
.demo-bar { background: #fff3cd; color: #5c4400; border-bottom: 2px solid #f0c24b; text-align: center; padding: 6px 12px; font-size: .9rem; }

/* เกมภารกิจ: ย้อนกลับไปแก้คำตอบข้อที่แล้ว */
.rev-note { background: #fff3cd; border: 1px solid #f0c24b; color: #5c4400; padding: 8px 12px; border-radius: 10px; font-size: .9rem; margin-bottom: 10px; }
.back-prev, .fix-prev { margin-top: 8px; }

/* งานกลุ่ม: รายชื่อสมาชิก (จุดเขียว = เปิดงานนี้อยู่) พร้อมจำนวนช่องที่เขียน */
.mates-title { font-family: var(--head); font-weight: 600; color: var(--muted); font-size: .78rem; margin-bottom: 4px; }
.mate { display: flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--muted); font-weight: 500; padding: 1px 0; }
.mate i { width: 9px; height: 9px; border-radius: 50%; background: #c9c6bd; flex: none; }
.mate.on { color: var(--ink); } .mate.on i { background: var(--good, #22a355); }
.mate span { margin-left: auto; font-size: .78rem; color: var(--muted); }

.lock-note { margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--soft, #f3f1ea); color: var(--muted); font-size: .88rem; line-height: 1.5; }

/* ช่องที่เลขาเสนอในแบบสังเกต: เส้นประ ยังไม่นับจนกว่าครูกดยืนยัน */
.omx-c.ai:not(.on) { border-style: dashed; border-color: var(--accent, #6b5bd6); background: var(--soft, #f3f1ea); }
.omx-c.ai:not(.on)::after { content: 'เลขา'; font-size: .62rem; font-weight: 700; color: var(--accent, #6b5bd6); }
.pick.ow3 button.ai:not(.on) { outline: 2px dashed var(--accent, #6b5bd6); outline-offset: -2px; }

/* ---------- เกมตอบคำถามสด (คาบ 3): ฝั่งนักเรียน .qz ฝั่งครู .qt ---------- */
:root { --qz-red: #D8283E; --qz-blue: #1E69C8; --qz-yellow: #D9A00B; --qz-green: #2A8C44; }
.qz { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; min-height: calc(100vh - 150px); }
.qz-top { display: flex; align-items: center; gap: 12px; font-family: var(--head); font-weight: 600; padding: 4px 2px 8px; }
.qz-me { color: var(--ink-2); } .qz-prog { margin-left: auto; color: var(--muted); } .qz-pts { background: var(--accent-soft); color: var(--ink); padding: 2px 12px; border-radius: 999px; } .qz-pts:empty { display: none; }
.qz-bar { height: 12px; background: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: 12px; }
.qz-bar i { display: block; height: 100%; width: 100%; background: var(--primary); border-radius: 99px; transition: width .25s linear; } .qz-bar i.low { background: var(--bad); }
.qz-stage { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.qz-wait { text-align: center; color: var(--muted); margin: 40px 0; }
.qz-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 24px; text-align: center; margin: auto 0; }
.qz-card h2 { font-size: 1.5rem; } .qz-big { font-family: var(--head); font-size: 1.7rem; font-weight: 700; margin: 8px 0; }
.qz-join { font-size: 1.4rem; padding: 14px 36px; margin: 10px 0; } .qz-pin { margin-top: 12px; text-align: left; } .qz-pin input { font-size: 1.3rem; width: 9em; padding: 8px 12px; border: 2px solid var(--line); border-radius: 10px; margin-top: 6px; }
.qz-q { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.qz-qt { font-family: var(--head); font-size: 1.45rem; font-weight: 600; margin: 0; line-height: 1.45; }
.qz-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; flex: 1; }
.qz-opt { display: flex; align-items: center; gap: 12px; border: 0; border-radius: 14px; color: #fff; text-align: left; padding: 16px 18px; min-height: 96px; cursor: pointer; font-size: 1.15rem; font-weight: 600; box-shadow: 0 4px 0 rgba(0,0,0,.22); transition: transform .08s, opacity .2s, filter .2s; }
.qz-opt:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.22); }
.qz-opt.red { background: var(--qz-red); } .qz-opt.blue { background: var(--qz-blue); } .qz-opt.yellow { background: var(--qz-yellow); } .qz-opt.green { background: var(--qz-green); }
.qz-sh { font-size: 1.8rem; line-height: 1; flex: none; width: 1.6em; text-align: center; } .qz-ot { flex: 1; line-height: 1.35; }
.qz-opt:disabled { cursor: default; } .qz-opts.locked .qz-opt:not(.chosen):not(.right):not(.wrong) { opacity: .55; }
.qz-opt.chosen { outline: 5px solid var(--ink); outline-offset: 2px; } .qz-opt.right { outline: 5px solid #fff; box-shadow: 0 0 0 9px var(--good); } .qz-opt.wrong { filter: grayscale(.6); outline: 4px solid var(--bad); } .qz-opt.dim { opacity: .35; }
.qz-note { text-align: center; font-weight: 700; color: var(--muted); margin: 4px 0; }
.qz-res { border-radius: 14px; padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; text-align: left; } .qz-res b { font-family: var(--head); font-size: 1.5rem; }
.qz-res.ok { background: var(--good-soft); color: #0F5A3B; } .qz-res.no { background: var(--bad-soft); color: #8A2A22; } .qz-res span { color: var(--ink); }
@media (max-width: 640px) { .qz-opts { grid-template-columns: 1fr; } .qz-opt { min-height: 72px; } }

.qt { max-width: 1500px; margin: 0 auto; }
.qt-ctl { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 16px; margin-bottom: 14px; }
.qt-btns { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.qt-screen { background: #F4F7FC; border-radius: 20px; padding: 28px 34px; min-height: calc(100vh - 220px); box-shadow: var(--shadow); font-size: 1.35rem; }
.qt-wait { text-align: center; color: var(--muted); }
.qt-big { text-align: center; padding: 26px 0; } .qt-big h1 { font-size: 3rem; }
.qt-pin { font-family: var(--head); font-weight: 700; font-size: 8rem; letter-spacing: .12em; color: var(--primary-dark); line-height: 1.1; }
.qt-join { font-size: 2rem; margin: 6px 0 14px; } .qt-join b { font-size: 3rem; color: var(--primary-dark); }
.qt-names { display: flex; flex-wrap: wrap; gap: 8px 10px; justify-content: center; max-width: 1200px; margin: 0 auto; } .qt-names span { background: #fff; padding: 4px 14px; border-radius: 999px; font-size: 1.05rem; box-shadow: var(--shadow); }
.qt-head { display: flex; align-items: center; gap: 24px; font-family: var(--head); font-weight: 600; } .qt-no { font-size: 1.6rem; color: var(--ink-2); }
.qt-time { font-size: 3.4rem; font-weight: 700; color: var(--primary-dark); min-width: 2.2em; text-align: center; } .qt-ans { margin-left: auto; font-size: 1.6rem; } .qt-ans b { font-size: 2.4rem; color: var(--primary-dark); }
.qt-bar { height: 14px; background: #D9E2EC; border-radius: 99px; overflow: hidden; margin: 6px 0 20px; } .qt-bar i { display: block; height: 100%; background: var(--primary); width: 100%; transition: width .25s linear; } .qt-bar i.low { background: var(--bad); }
.qt-q { font-size: 2.6rem; line-height: 1.35; margin: 8px 0 22px; text-align: center; }
.qt-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.qt-opt { display: flex; align-items: center; gap: 16px; color: #fff; border-radius: 16px; padding: 22px 26px; min-height: 130px; font-size: 1.9rem; font-weight: 600; position: relative; }
.qt-opt.red { background: var(--qz-red); } .qt-opt.blue { background: var(--qz-blue); } .qt-opt.yellow { background: var(--qz-yellow); } .qt-opt.green { background: var(--qz-green); }
.qt-sh { font-size: 2.6rem; flex: none; width: 1.4em; text-align: center; } .qt-ot { flex: 1; line-height: 1.3; }
.qt-opt.dim { opacity: .3; } .qt-opt.right { box-shadow: 0 0 0 8px #fff, 0 0 0 14px var(--good); }
.qt-cnt { flex: none; width: 70px; height: 90px; background: rgba(255,255,255,.25); border-radius: 10px; position: relative; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.qt-cnt i { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.55); } .qt-cnt b { position: relative; font-size: 1.8rem; padding-bottom: 4px; }
.qt-rev { display: grid; grid-template-columns: 1fr 330px; gap: 24px; align-items: start; } .qt-why { background: #fff; border-radius: 14px; padding: 14px 20px; margin-top: 16px; font-size: 1.5rem; }
.qt-board { list-style: none; background: #fff; border-radius: 16px; padding: 14px 18px; margin: 0; box-shadow: var(--shadow); } .qt-board h3 { font-size: 1.3rem; margin: 0 0 8px; }
.qt-board li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 1.15rem; } .qt-board li span { background: var(--accent); width: 1.7em; height: 1.7em; border-radius: 50%; text-align: center; font-weight: 700; flex: none; } .qt-board li b { flex: 1; } .qt-board li em { font-style: normal; font-weight: 700; color: var(--primary-dark); }
.qt-podium { display: flex; justify-content: center; align-items: flex-end; gap: 18px; margin: 30px 0; } .qt-pod { text-align: center; width: 230px; } .qt-pod b { display: block; font-size: 1.5rem; } .qt-pod em { display: block; font-style: normal; color: var(--ink-2); margin-bottom: 6px; }
.qt-stand { background: var(--primary); color: #fff; border-radius: 14px 14px 0 0; font-family: var(--head); font-size: 3rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.qt-pod.p1 .qt-stand { height: 190px; background: var(--accent-dark); } .qt-pod.p2 .qt-stand { height: 140px; } .qt-pod.p3 .qt-stand { height: 100px; background: var(--ink-2); } .qt-pod.p1 { order: 2; } .qt-pod.p2 { order: 1; } .qt-pod.p3 { order: 3; }
@media (max-width: 1000px) { .qt-opts, .qt-rev { grid-template-columns: 1fr; } .qt-pin { font-size: 5rem; } .qt-q { font-size: 1.7rem; } }
.quiz-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--primary); color: #fff; text-decoration: none; border-radius: 14px; padding: 14px 20px; margin: 0 0 14px; font-family: var(--head); font-size: 1.15rem; box-shadow: var(--shadow); animation: qbpulse 1.6s ease-in-out infinite; }
.quiz-banner span { background: rgba(255,255,255,.22); padding: 4px 14px; border-radius: 999px; }
@keyframes qbpulse { 50% { transform: scale(1.012); } }

/* ---------- ห้องทดลองวัสดุ (ม.1 คาบ 3) ---------- */
.lab { max-width: 1280px; margin: 0 auto; }
.lab-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.lab-tabs { display: flex; gap: 6px; background: var(--soft); padding: 4px; border-radius: 12px; }
.lab-tabs button { border: 0; background: transparent; padding: 8px 16px; border-radius: 9px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.lab-tabs button.on { background: var(--card); color: var(--primary-dark); box-shadow: var(--shadow); }
.lab-top .btn { margin-left: auto; }
.lab-note { background: var(--accent-soft); border-radius: 12px; padding: 8px 14px; font-size: .95rem; margin-bottom: 12px; }
.lab-shelf { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 12px; }
.lab-shelf .mat { background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 8px 6px 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: var(--shadow); font-size: .95rem; }
.lab-shelf .mat svg { width: 80px; height: 46px; } .lab-shelf .mat.on { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-3px); }
.lab-shelf .mat .dots { display: flex; gap: 4px; } .lab-shelf .mat .dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); } .lab-shelf .mat .dots i.on { background: var(--good); }
.lab-main { display: grid; grid-template-columns: 1fr 250px; gap: 14px; align-items: start; }
.lab-bench { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px 14px; position: relative; }
.lab-title { font-family: var(--head); font-weight: 600; font-size: 1.15rem; margin: 2px 4px 6px; }
.lab-svg { width: 100%; height: auto; display: block; border-radius: 12px; background: #EAF1F8; max-height: 52vh; }
.lab-thermo { position: absolute; right: 22px; top: 52px; display: flex; gap: 14px; background: rgba(255,255,255,.9); padding: 8px 12px; border-radius: 12px; box-shadow: var(--shadow); }
.lab-thermo .th { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .8rem; }
.lab-thermo .tube { width: 16px; height: 96px; background: #E5E9EE; border-radius: 8px; position: relative; overflow: hidden; border: 1px solid #C5CCD5; }
.lab-thermo .tube i { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(#FF5A4E, #FF9A4E); }
.lab-thermo b { font-family: var(--head); font-size: 1.15rem; }
.lab-cap { margin: 8px 4px 0; min-height: 3.2em; font-size: 1rem; color: var(--ink-2); }
.lab-seen span { font-weight: 700; color: var(--muted); font-size: .85rem; } .lab-seen ul { margin: 2px 0 0; padding-left: 1.2em; } .lab-seen li { margin: 2px 0; } .lab-seen .warn { color: #C9392F; font-weight: 700; }
.lab-tools { display: flex; flex-direction: column; gap: 10px; }
.lab-tools .tool { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; border: 2px solid var(--line); background: var(--card); border-radius: 14px; padding: 10px 12px; cursor: pointer; box-shadow: var(--shadow); }
.lab-tools .tool .ti { grid-row: 1 / 3; font-size: 1.9rem; text-align: center; } .lab-tools .tool small { color: var(--muted); }
.lab-tools .tool:hover:not(:disabled) { border-color: var(--primary); } .lab-tools .tool:disabled { opacity: .45; cursor: not-allowed; }
.lab-prog { background: var(--soft); border-radius: 12px; padding: 10px 12px; font-size: .95rem; }
.lab-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; } .lab-card { padding: 14px 16px; } .lab-card h3 { margin-top: 0; }
.lab-svg2 { width: 100%; height: auto; display: block; border-radius: 12px; background: #EAF1F8; }
.lab-range { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; font-weight: 600; } .lab-range input { flex: 1; height: 28px; accent-color: var(--primary); } .lab-range b { min-width: 2.4em; text-align: right; font-family: var(--head); font-size: 1.3rem; }
.lab-cap2 { margin: 6px 0 0; font-weight: 600; } .lab-force { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; } .lab-force span { background: var(--bad-soft); padding: 4px 12px; border-radius: 999px; }
.lab-sel { display: block; margin: 10px 0; font-weight: 600; } .lab-sel select { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font-size: 1.05rem; border: 2px solid var(--line); border-radius: 10px; background: #fff; }
.lab-gate { border: 0; border-radius: 18px; padding: 22px 26px; max-width: 520px; width: calc(100% - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.lab-gate::backdrop { background: rgba(18,54,92,.55); } .lab-gate h2 { margin-top: 0; }
.lab-gate .gq { margin: 12px 0; } .lab-gate .gq p { margin: 0 0 4px; } .lab-gate .gq label { display: block; padding: 8px 12px; border: 2px solid var(--line); border-radius: 10px; margin: 6px 0; cursor: pointer; } .lab-gate .gq label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.lab-gate .gwhy { color: #8A2A22; background: var(--bad-soft); border-radius: 8px; padding: 6px 10px; font-size: .95rem; } .lab-gate-msg { font-weight: 700; color: #8A2A22; }
@media (max-width: 900px) { .lab-main, .lab-two { grid-template-columns: 1fr; } .lab-shelf { grid-template-columns: repeat(3, 1fr); } .lab-tools { flex-direction: row; flex-wrap: wrap; } .lab-tools .tool { flex: 1 1 45%; } .lab-thermo { position: static; margin-top: 6px; justify-content: center; } }
.lab-tools .tool { height: auto; min-height: 72px; line-height: 1.3; overflow: visible; font-size: 1rem; }
.lab-tools .tool b, .lab-tools .tool small { display: block; }
.lab-thermo { left: 22px; right: auto; top: 56px; padding: 6px 8px; gap: 8px; } .lab-thermo .tube { height: 84px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--soft); font-weight: 700; } .pill.ok { background: var(--good-soft); color: #0F5A3B; } .pill.mid { background: var(--mid-soft); color: #7A4F00; }

/* ห้องทดลอง: ใช้เต็มความกว้างและความสูงของจอ (ปุ่ม เต็มจอ ซ่อนแถบด้านบนเพิ่มพื้นที่) */
body.lab-page > main.wrap { max-width: none; padding: 10px 18px 8px; }
body.lab-fs .topbar, body.lab-fs .crumb, body.lab-fs .site-foot { display: none; }
.lab { max-width: none; }
@media (min-width: 1000px) {
  body.lab-page { height: 100vh; overflow: hidden; }
  body.lab-page > main.wrap { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  body.lab-page .lab { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  body.lab-page .lab-pane:not([hidden]) { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  body.lab-page .lab-main { flex: 1; min-height: 0; grid-template-columns: 1fr 300px; }
  body.lab-page .lab-bench { height: 100%; display: flex; flex-direction: column; min-height: 0; }
  body.lab-page .lab-svg { flex: 1; min-height: 0; max-height: none; height: 100%; }
  body.lab-page .lab-cap { max-height: 22vh; overflow: auto; }
  body.lab-page .lab-tools { height: 100%; overflow: auto; }
  body.lab-page .lab-two { flex: 1; min-height: 0; }
  body.lab-page .lab-two .lab-card { height: 100%; display: flex; flex-direction: column; min-height: 0; }
  body.lab-page .lab-two .lab-svg2 { flex: 1; min-height: 0; height: 100%; }
  body.lab-page .lab-shelf .mat svg { width: 96px; height: 54px; }
  body.lab-page .lab-note { display: none; }
}
body.lab-page .lab { margin: 0; width: 100%; }

/* เกมตอบคำถาม: ใช้เต็มความกว้างและความสูงของจอ + โหมดเต็มจอ (เห็นแต่เกม) */
.qz-fs { margin-left: 8px; }
body.quiz-page > main.wrap { max-width: none; padding: 10px 18px 8px; }
.qz { max-width: none; width: 100%; margin: 0; }
.qz-qt { font-size: clamp(1.3rem, 2.4vw, 2.6rem); } .qz-opt { font-size: clamp(1.1rem, 1.9vw, 2rem); } .qz-sh { font-size: clamp(1.8rem, 2.6vw, 3rem); }
body.qz-fs-on .topbar, body.qz-fs-on .crumb, body.qz-fs-on .site-foot { display: none; }
@media (min-width: 1000px) {
  body.quiz-page { height: 100vh; overflow: hidden; }
  body.quiz-page > main.wrap { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  body.quiz-page .qz { flex: 1; min-height: 0; }
  body.quiz-page .qz-stage { min-height: 0; } body.quiz-page .qz-opts { min-height: 0; grid-auto-rows: 1fr; }
}
body.quiz-t > main.wrap { max-width: none; padding: 12px 18px 8px; }
body.quiz-t .qt { max-width: none; display: flex; flex-direction: column; min-height: calc(100vh - 100px); }
body.quiz-t .qt-screen { flex: 1; min-height: 0; overflow: auto; }
.qt-q { font-size: clamp(1.8rem, 3.2vw, 4rem); } .qt-opt { font-size: clamp(1.5rem, 2.4vw, 3rem); min-height: clamp(110px, 17vh, 200px); } .qt-sh { font-size: clamp(2.2rem, 3.2vw, 4rem); }
.qt-time { font-size: clamp(3rem, 5vw, 6rem); } .qt-pin { font-size: clamp(6rem, 12vw, 14rem); }
body.qt-fs .topbar, body.qt-fs .crumb, body.qt-fs .site-foot { display: none; }
body.qt-fs > main.wrap { padding: 8px 14px 6px; }
body.qt-fs .qt { min-height: calc(100vh - 14px); }
body.qt-fs .qt-ctl { order: 2; margin: 8px 0 0; padding: 6px 12px; opacity: .25; transition: opacity .2s; }
body.qt-fs .qt-ctl:hover, body.qt-fs .qt-ctl:focus-within { opacity: 1; }
body.qt-fs .qt-ctl > b, body.qt-fs .qt-ctl > .muted { display: none; }
body.qt-fs .qt-btns { margin-left: auto; }

/* หน้าครูของเกมตอบคำถาม: ความกว้างเท่าหน้าอื่น (ยกเลิกการขยายเต็ม) ขยายเต็มเฉพาะตอนกดเต็มจอ */
body.quiz-t > main.wrap { max-width: var(--page-w); padding: 20px 28px 48px; }
body.quiz-t .qt { max-width: none; min-height: calc(100vh - 170px); }
body.qt-fs > main.wrap { max-width: none; padding: 8px 14px 6px; }
.qt-host { font-size: clamp(2rem, 4vw, 4.5rem); line-height: 1.35; margin: 20px 0 26px; } .qt-host b { color: var(--primary-dark); }

/* ห้องทดลอง: สีเทอร์โมมิเตอร์ให้ตรงกับป้ายจุดวัด และบ้าน 3 มิติ */
.lab-thermo .th-f span { color: #E8590C; font-weight: 700; } .lab-thermo .th-b span { color: #1C7ED6; font-weight: 700; }
.lab-thermo .th-f .tube i { background: linear-gradient(#E8590C, #FF9A4E); } .lab-thermo .th-b .tube i { background: linear-gradient(#1C7ED6, #74C0FC); }
.house-cv { cursor: grab; touch-action: none; user-select: none; } .house-cv.grab { cursor: grabbing; }
.house-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 6px; }

/* เกมตอบคำถาม: แถบแจ้งเมื่อสัญญาณเน็ตขาดช่วง */
.qz-net { margin: 6px auto; padding: 6px 14px; max-width: 520px; text-align: center; background: #FFF3BF; color: #7A5A00; border-radius: 999px; font-weight: 700; font-size: .95rem; }
.qz-net[hidden] { display: none; }

/* งานกลุ่ม: ป้ายบอกว่าเพื่อนคนไหนกำลังพิมพ์ช่องนี้ */
.typing-tag { position: fixed; z-index: 100000; padding: 1px 8px; font-size: .74rem; font-weight: 700; color: #fff; border-radius: 6px 6px 0 0; pointer-events: none; white-space: nowrap; line-height: 1.5; }

/* ผังห้อง: ป้ายกลุ่มบนที่นั่ง (สีตามกลุ่ม) */
.seat-grp { display: block; font-size: .62rem; font-weight: 700; color: #fff; border-radius: 4px; padding: 0 4px; margin-top: 1px; line-height: 1.35; }
.sg0 { background: #868E96; } .sg1 { background: #E8590C; } .sg2 { background: #1C7ED6; } .sg3 { background: #2F9E44; } .sg4 { background: #AE3EC9; } .sg5 { background: #D6336C; } .sg6 { background: #0C8599; } .sg7 { background: #F08C00; }

/* เลือกอาชีพ: บัตรที่กลุ่มอื่นเลือกแล้วถูกขีดฆ่า */
.option .opt-text s { text-decoration: none; }
.option.taken { opacity: .6; cursor: not-allowed; background: #F3F1EA; }
.option.taken .opt-text s { text-decoration: line-through; text-decoration-thickness: 2px; color: #7A7568; }
.option .taken-by { margin-left: auto; align-self: center; font-weight: 700; color: #C0392B; white-space: nowrap; }
.fld-inline.fld-wide { width: min(100%, 360px) !important; }

/* ---------- เกมยิงเป็ด (คาบ 4): ส่วนประกอบเล็ก ๆ รอบสนาม (ตัวเกมอยู่ใน assets/quiz_duck_pond.js) ---------- */
.duck-hero { width: 110px; margin: 0 auto 6px; } .duck-hero .duck { width: 100%; height: auto; filter: drop-shadow(0 3px 2px rgba(0,60,100,.35)); animation: pbob 2.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes pbob { 0%, 100% { transform: rotate(-3deg) translateY(0); } 50% { transform: rotate(3deg) translateY(-4px); } }
.qz-snd { margin-left: 8px; } .qz-streak { color: #B45309; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .duck-hero * { animation: none !important; } }
.qz-demo { margin-left: 6px; font-size: .85rem; }

/* ---------- สนามยิงเป็ด (canvas): ตัวเกมอยู่ใน assets/quiz_duck_pond.js ---------- */
.pond-host { position: relative; flex: 1; min-height: 300px; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow), inset 0 0 0 3px rgba(255,255,255,.3); background: #4FB7E8; user-select: none; -webkit-user-select: none; }
.pond-cv { position: absolute; inset: 0; display: block; touch-action: none; }
.pond-host.teacher { flex: none; height: clamp(300px, 54vh, 680px); }
.qt-duckwrap { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; } .qt-duckwrap.noside { grid-template-columns: 1fr; }
@media (max-width: 1000px) { .qt-duckwrap { grid-template-columns: 1fr; } }
body.quiz-page .qz-stage .pond-host { min-height: 0; }
.qz-pop { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); z-index: 5; width: min(92%, 560px); padding: 14px 40px 14px 18px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,30,60,.4); display: flex; flex-direction: column; gap: 4px; text-align: left; cursor: pointer; animation: qzpop .35s cubic-bezier(.2,1.4,.4,1); transition: opacity .6s; }
.qz-pop b { font-family: var(--head); font-size: 1.5rem; } .qz-pop span { color: var(--ink); line-height: 1.4; }
.qz-pop.ok { background: #E6F8EE; color: #0F5A3B; border: 3px solid #2A8C44; } .qz-pop.no { background: #FDECEA; color: #8A2A22; border: 3px solid #D8283E; } .qz-pop.out { opacity: 0; pointer-events: none; }
.qz-pop-x { position: absolute; right: 8px; top: 6px; border: 0; background: none; font-size: 1.6rem; line-height: 1; color: inherit; cursor: pointer; }
@keyframes qzpop { from { transform: translateX(-50%) scale(.7); opacity: 0; } }
.qz-next-in { position: absolute; right: 14px; bottom: 10px; z-index: 6; font-size: 1.15rem; padding: 10px 26px; box-shadow: 0 4px 0 rgba(0,0,0,.3); }
.qz-hint { position: absolute; left: 50%; top: calc(10% + 10px); transform: translateX(-50%); z-index: 4; pointer-events: none; padding: 6px 16px; border-radius: 999px; background: rgba(20,70,110,.78); color: #fff; font-weight: 700; font-size: clamp(.85rem, 1.6vw, 1.1rem); white-space: nowrap; }
.qt-hist { margin-top: 18px; padding: 14px 18px; } .qt-hist h3 { margin: 0 0 2px; } .qt-ht { width: 100%; border-collapse: collapse; font-size: .95rem; } .qt-ht th, .qt-ht td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); } .qt-hrows { columns: 2; margin: 4px 0 8px; padding-left: 1.4em; } .qt-hrows li span { color: var(--muted); } body.qt-fs .qt-hist { display: none; }

/* ---------- game_fx: ลูกเล่นในภารกิจ 7–9 และหน้าสรุป 4–9 (ปิดได้ที่หน้าปฏิทินของครู) ---------- */
.fx-scene-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.fx-snd { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: .82rem; cursor: pointer; }
.fx-snd[aria-pressed="true"] { color: var(--ink); border-color: var(--accent-dark); background: var(--accent-soft); }
.fx-line { font-size: 1.25rem; line-height: 1.6; margin: 14px 0 18px; padding: 14px 16px; border-left: 5px solid var(--accent); background: var(--accent-soft); border-radius: 10px; color: var(--ink); }
.fx-bars { display: grid; gap: 12px; margin-bottom: 16px; }
.fx-bar-label { font-weight: 700; font-size: .95rem; margin-bottom: 4px; }
.fx-bar-track { height: 14px; background: #E4E2DB; border-radius: 7px; overflow: hidden; }
.fx-bar-track i { display: block; height: 100%; border-radius: 7px; transition: width 1.1s cubic-bezier(.2,.8,.2,1); background: var(--mid); }
.fx-hi .fx-bar-track i { background: var(--good); } .fx-lo .fx-bar-track i { background: var(--bad); }
.fx-skip { margin-top: 4px; }
.fx-phone { max-width: 340px; margin: 6px auto 14px; border: 6px solid var(--ink); border-radius: 28px; background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.fx-phone-bar { height: 18px; background: var(--ink); position: relative; }
.fx-phone-bar::after { content: ""; position: absolute; left: 50%; top: 5px; width: 54px; height: 7px; margin-left: -27px; background: #3A4466; border-radius: 4px; }
.fx-phone-screen { padding: 12px; }
.fx-phone-cap { font-size: .78rem; color: var(--muted); text-align: center; margin-bottom: 8px; }
.fx-phone .options { margin: 0; }
.fx-badge { animation: fxflip .8s ease both, fxshake .5s .8s ease; }
@keyframes fxflip { from { transform: rotateY(90deg) rotate(-3deg) scale(.6); opacity: 0; } to { transform: rotateY(0) rotate(-3deg) scale(1); opacity: 1; } }
@keyframes fxshake { 0%,100% { translate: 0 0; } 20% { translate: -6px 0; } 40% { translate: 6px 0; } 60% { translate: -4px 0; } 80% { translate: 4px 0; } }
.fx-call { text-align: center; }
.fx-phone-call { background: #1B2340; border-color: #0d1226; color: #fff; }
.fx-phone-call .fx-phone-screen { padding: 18px 16px 16px; }
.fx-call-label { font-size: .85rem; opacity: .75; }
.fx-call-avatar { width: 64px; height: 64px; margin: 10px auto; border-radius: 50%; background: #3A4466; display: grid; place-items: center; font-size: 1.9rem; animation: fxring 1s ease-in-out infinite; }
@keyframes fxring { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
.fx-call-name { font-size: 1.25rem; font-weight: 700; }
.fx-call-num { font-size: .85rem; opacity: .7; margin-bottom: 10px; }
.fx-call-say { text-align: left; font-size: .95rem; line-height: 1.55; background: rgba(255,255,255,.1); border-radius: 12px; padding: 10px 12px; margin: 8px 0 14px; }
.fx-call-btns { display: flex; gap: 12px; justify-content: center; }
.fx-call-btn { flex: 1; border: 0; border-radius: 999px; padding: 11px 10px; font: inherit; font-weight: 700; color: #fff; cursor: pointer; }
.fx-accept { background: #2E9E5B; } .fx-decline { background: #D6453D; }
.fx-call-note { font-size: .75rem; opacity: .65; margin: 10px 0 0; }
.fx-sum { margin: 18px 0; }
.fx-path { list-style: none; margin: 8px 0 0; padding: 0 0 0 16px; border-left: 3px solid var(--accent); }
.fx-path li { position: relative; margin: 0 0 14px; padding-left: 14px; }
.fx-path li::before { content: ""; position: absolute; left: -23px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; }
.fx-path-pick { font-weight: 700; }
.fx-path-line { color: var(--muted); font-size: .92rem; margin-top: 2px; }
.fx-class { margin: 10px 0 16px; }
.fx-class-q { font-weight: 700; margin-bottom: 6px; }
.fx-class-row { display: grid; grid-template-columns: 1fr 90px 42px; gap: 8px; align-items: center; font-size: .9rem; padding: 3px 0; }
.fx-class-row.mine { background: var(--accent-soft); border-radius: 8px; padding: 3px 6px; }
.fx-class-bar { height: 8px; background: #E4E2DB; border-radius: 4px; overflow: hidden; }
.fx-class-bar i { display: block; height: 100%; background: var(--ink-2); }
.fx-class-row b { text-align: right; }
@media (max-width: 520px) { .fx-class-row { grid-template-columns: 1fr 60px 38px; } }
.fx-next { margin: 18px 0 6px; padding: 12px 14px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 600; text-align: center; }
@media (prefers-reduced-motion: reduce) { .fx-badge, .fx-call-avatar { animation: none !important; } .fx-bar-track i { transition: none !important; } }

/* ---------- โมดูลถ่ายรูปจากกล้อง (sheet_camera.js) ---------- */
.cam-modal { width: min(94vw, 720px); max-width: 94vw; padding: 0; border: 0; border-radius: 14px; overflow: hidden; }
.cam-modal::backdrop { background: rgba(10, 16, 40, .6); }
.cam-body { padding: 12px 14px 16px; }
.cam-stage { position: relative; background: #0d1226; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; display: grid; place-items: center; }
.cam-video, .cam-still { width: 100%; height: 100%; object-fit: contain; background: #0d1226; }
.cam-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; color: #fff; text-align: center; font-size: .95rem; line-height: 1.6; }
.cam-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.cam-btns .btn[hidden] { display: none; }

/* หน้าเฉลย/อันดับรวมของเกมตอบคำถาม (โทนสว่างเดิม) */
.qx-side { display: grid; gap: 10px; align-content: start; }
.qx-board { position: relative; } .qx-board li { position: absolute; left: 18px; right: 18px; height: 54px; padding: 0; box-sizing: border-box; transition: top .9s cubic-bezier(.3,.8,.3,1); display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.qx-board h3 { height: 34px; }
.qx-board li b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qx-board li em { min-width: 3.2em; text-align: right; }
.qx-rk { width: 1.7em; height: 1.7em; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); font-weight: 700; flex: none; font-style: normal; }
.qt-board li span.qx-rk { background: var(--accent-soft); }
.qx-rk.r1 { background: var(--accent) !important; } .qx-rk.r2 { background: #D6DCE6 !important; } .qx-rk.r3 { background: #F0B58A !important; }
.qx-mv { font-style: normal; font-size: .8em; font-weight: 700; color: var(--ink-2); } .qx-mv.up { color: #1f9d52; } .qx-mv.down { color: var(--primary-dark); } .qx-mv.new { color: #2F6FED; }
.qx-gain { font-style: normal; font-size: .8em; font-weight: 700; background: #E3F6EA; color: #167a3d; border-radius: 999px; padding: 1px 8px; }
.qx-fast { margin: 0; background: var(--accent-soft); border-radius: 12px; padding: 8px 12px; font-size: 1.05rem; }
.qx-end { display: grid; grid-template-columns: 1fr minmax(0, 1fr); gap: 28px; align-items: start; padding-top: 6px; }
.qx-endL { text-align: center; } .qx-endL h1 { font-size: clamp(2rem, min(3.6vw, 6vh), 3.4rem); margin: 0; }
.qx-endL .qt-podium { margin: 18px 0 0; gap: 12px; } .qx-endL .qt-pod { width: auto; flex: 1; max-width: 210px; min-width: 0; } .qx-endL .qt-pod b { font-size: clamp(1rem, 1.6vw, 1.5rem); overflow-wrap: anywhere; }
.qx-medal { display: block; font-size: clamp(2.2rem, min(4vw, 7vh), 4rem); line-height: 1.1; }
.qx-endR { display: grid; gap: 12px; min-width: 0; }
.qx-card { background: #fff; border-radius: 16px; padding: clamp(10px, 1.6vh, 18px) 18px; box-shadow: var(--shadow); } .qx-card h3 { margin: 0 0 8px; font-size: 1.3rem; } .qx-card h4 { margin: 12px 0 6px; font-size: 1rem; color: var(--ink-2); }
.qx-list { list-style: none; margin: 0; padding: 0; } .qx-list li { display: flex; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: clamp(.9rem, min(1.2vw, 2.2vh), 1.2rem); }
.qx-list li b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .qx-list li small { color: var(--ink-2); } .qx-list li em { font-style: normal; font-weight: 700; color: var(--primary-dark); min-width: 3em; text-align: right; }
.qx-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .qx-stats div { background: var(--accent-soft); border-radius: 12px; text-align: center; padding: 6px; } .qx-stats b { display: block; font-family: var(--head); font-size: clamp(1.6rem, min(2.6vw, 4.5vh), 2.6rem); } .qx-stats span { font-size: .9rem; color: var(--ink-2); }
.qx-hard { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; } .qx-hard li { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: center; font-size: clamp(.85rem, min(1.1vw, 1.9vh), 1.1rem); } .qx-hard p { grid-column: 1 / -1; margin: 0; color: var(--ink-2); font-size: .85em; }
.qx-hb { height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; } .qx-hb i { display: block; height: 100%; background: var(--primary); }
.qx-foot { text-align: center; margin: 8px 0 0; }
@media (max-width: 1000px) { .qx-end { grid-template-columns: 1fr; } }
body.qt-fs .qx-end > * { min-width: 0; box-sizing: border-box; }
@media (max-height: 820px) { body.qt-fs .qx-hard li:nth-child(n+3), body.qt-fs .qx-hard p, body.qt-fs .qx-foot { display: none; } body.qt-fs .qx-medal { font-size: 2rem; } }

.qt-rev:has(.qx-side) { grid-template-columns: 1fr 390px; }
@media (max-width: 1000px) { .qt-rev:has(.qx-side) { grid-template-columns: 1fr; } }
.qx-board li { font-size: clamp(1.1rem, 1.45vw, 1.5rem); } .qx-board h3 { font-size: clamp(1.3rem, 1.6vw, 1.7rem); }

/* ภารกิจ: ช่องเขียนเหตุผล 3 ช่องแบบอ่านง่าย + แถบขั้นตอน + ปุ่มเริ่มติดล่างจอ */
.steps-strip { background: var(--info-soft, #eaf2fb); border-radius: 10px; padding: 8px 12px; margin: 0 0 12px; font-size: .9rem; line-height: 1.5; }
.meter-cap { color: var(--muted); font-size: .85rem; margin: -8px 0 12px; }
.lock-top { background: #fff3d6; color: #6b4b00; font-weight: 600; }
.cer-title { font-weight: 800; margin: 14px 0 6px; }
.cer-eg { margin: 0 0 10px; font-size: .88rem; color: var(--muted); }
.cer-eg summary { cursor: pointer; font-weight: 700; color: inherit; }
.cer-eg div { margin-top: 6px; padding: 8px 12px; border-radius: 10px; background: var(--soft, #f3f1ea); line-height: 1.6; }
.cer-steps { display: grid; gap: 12px; margin: 8px 0; }
.cer-step { display: grid; gap: 6px; }
.cer-q { display: flex; align-items: flex-start; gap: 8px; font-weight: 700; line-height: 1.4; }
.cer-no { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: var(--ink, #1b2340); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; }
.cer-step input.part, .cer-step textarea.cer-pick { width: 100%; }
.screen.intro > .btn-block[data-focus] { position: sticky; bottom: 12px; z-index: 5; box-shadow: 0 6px 18px rgba(0,0,0,.2); }

/* บทบาทในกลุ่มและตารางคะแนนของใบงานที่ 6 */
.role-card { padding: 12px 14px; margin-bottom: 12px; border-left: 4px solid var(--accent); }
.role-title { font-family: var(--head); font-weight: 600; font-size: .95rem; margin-bottom: 6px; }
.role-me { background: var(--accent-soft); border-radius: 10px; padding: 8px 10px; margin: 0 0 6px; }
.role-me b { display: block; }
.role-me span { display: block; font-size: .86rem; color: var(--ink-2); margin-top: 2px; line-height: 1.45; }
.role-none { font-size: .88rem; color: var(--muted); margin: 0 0 6px; line-height: 1.45; }
.role-all summary { cursor: pointer; font-size: .86rem; color: var(--muted); margin: 6px 0 4px; }
.role-tbl { width: 100%; border-collapse: collapse; font-size: .86rem; }
.role-tbl td { padding: 3px 6px; border-bottom: 1px dashed var(--line); }
.role-tbl td:last-child { text-align: right; white-space: nowrap; }
.role-tbl tr.me td { font-weight: 600; background: var(--accent-soft); }
.fld.role-off { background: var(--soft); color: var(--muted); cursor: not-allowed; }
td.role-num { white-space: nowrap; text-align: center; font-weight: 600; }
td.sc { text-align: center; white-space: nowrap; }
.sc-btns { display: inline-flex; gap: 6px; }
.sc-btn { cursor: pointer; position: relative; display: inline-flex; }
.sc-btn input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.sc-btn span { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; border: 2px solid var(--line); background: #fff; font-weight: 700; font-size: 1.05rem; color: var(--ink-2); }
.sc-btn:hover span { border-color: var(--accent-dark); }
.sc-btn input:checked + span { background: var(--accent); border-color: var(--accent-dark); color: var(--ink); }
.sc-btn input:focus-visible + span { outline: 3px solid var(--info-soft); outline-offset: 1px; }
td.sum { text-align: center; font-size: 1.15rem; background: #FCFBF8; }
/* เว้นที่ใต้ช่องสุดท้ายของใบงาน ไม่ให้ติดแถบส่งงาน */
.work-main.doc > .sheet-bar { margin-top: 28px; }
.work-main.doc > :nth-last-child(2) { margin-bottom: 14px; }
td.role-num b { display: block; }
.rn-st { display: block; font-size: .76rem; font-weight: 500; color: var(--muted); margin-top: 3px; }
.rn-st.ok { color: var(--good); font-weight: 600; }
.sc-btn input:disabled + span { opacity: .55; cursor: not-allowed; }
.sc-btn input:disabled:checked + span { opacity: 1; }
select.fld[data-role]:disabled { pointer-events: none; }

/* วงล้อสุ่มเลขที่ (หน้าครู) และป๊อปอัปบนจอนักเรียน: ใช้สีและปุ่มของเว็บเอง (กรมท่า ครีม ทอง) */
.wheel-page { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 330px); gap: 28px; align-items: center; justify-items: center; padding: 6px 4px 12px; }
.wh-board { position: relative; width: min(62vh, 520px, 100%); aspect-ratio: 1; }
.wh-board canvas { display: block; width: 100%; height: 100%; }
.wh-ptr { position: absolute; left: 50%; top: -18px; width: 44px; height: 56px; transform: translateX(-50%); transform-origin: 50% 12%; z-index: 3; pointer-events: none; }
.wh-side { display: flex; flex-direction: column; gap: 14px; width: 100%; }
.wh-scope .seg-btn { min-height: 38px; padding: 4px 12px; font-size: .88rem; }
.wh-scope .seg-btn.on { background: var(--ink); border-color: var(--ink); }
.wh-opts { display: flex; flex-direction: column; gap: 10px; font-size: .94rem; color: var(--ink-2); }
.wh-card { margin: 0; text-align: center; padding: 14px 18px 16px; }
.wh-lab { font: 600 .85rem var(--head); color: var(--muted); letter-spacing: .04em; }
.wh-num { font: 700 clamp(3.6rem, 9vh, 6rem) / 1.05 var(--head); color: var(--ink); min-height: 1.05em; }
.wh-num.wait { color: var(--muted); }
.wh-num.pop { animation: wh-in .3s ease-out; }
@keyframes wh-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.wh-sub { font-size: .9rem; color: var(--muted); min-height: 1.3em; }
.wh-go { min-height: 56px; border-radius: 999px; font-size: 1.12rem; letter-spacing: .02em; }
.wh-go:disabled { opacity: .65; }
.wh-info { font-size: .85rem; color: var(--muted); text-align: center; min-height: 1.2em; }
.wh-hist { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; min-height: 28px; }
.wh-chip { min-width: 34px; padding: 3px 10px; border-radius: 999px; border: 2px solid var(--ink); font: 600 .9rem var(--head); color: var(--ink); text-align: center; }
.wh-foot { display: flex; align-items: center; justify-content: space-between; }
.wh-icon { width: 38px; height: 38px; border-radius: 10px; border: 2px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.wh-icon.off { color: var(--muted); background: var(--soft); }
.wh-icon.off .wh-wave { display: none; }
.wh-link { background: none; border: 0; padding: 6px 2px; color: var(--muted); font: 500 .85rem var(--body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.wh-link:hover { color: var(--ink); }
.wh-link:disabled { opacity: .5; cursor: default; }
@media (max-width: 760px) { .wheel-page { grid-template-columns: 1fr; gap: 18px; } .wh-board { width: min(86vw, 460px); } }
dialog.wheel-pop { border: 0; padding: 0; background: transparent; max-width: 92vw; }
dialog.wheel-pop::backdrop { background: rgba(27,35,64,.6); }
.wp-card { width: min(340px, 88vw); background: #fff; border-radius: 18px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.35); text-align: center; animation: wp-rise .2s ease-out; }
.wp-head { display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--ink); color: var(--accent); padding: 14px 18px; font: 600 1.15rem var(--head); }
.wp-head svg { flex: none; }
.wp-body { padding: 18px 24px 22px; }
.wp-lab { font: 600 .85rem var(--head); color: var(--muted); letter-spacing: .04em; }
.wp-no { font: 700 5rem / 1.05 var(--head); color: var(--primary); }
.wp-msg { color: var(--ink-2); margin: 4px 0 16px; }
@keyframes wp-rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
/* แถบบนของผังห้อง: แถวแรก = มุมมอง + สรุปเช็กชื่อ + ปุ่มที่ใช้บ่อย · แถวสอง (จาง) = คำแนะนำและการตั้งค่าผัง */
.seats-bar { margin-bottom: 6px; }
.seats-bar .wh-ico, .top-actions .wh-ico, .btn .wh-ico { vertical-align: -3px; margin-right: 2px; }
.seats-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 12px; padding: 6px 2px 8px; border-bottom: 1px solid var(--line); font-size: .82rem; color: var(--muted); }
.seats-hint { margin-right: auto; }
.seat-lock { color: var(--good); font-weight: 600; }
.seats-quiet { background: none; border: 0; padding: 4px 2px; color: var(--muted); font: 500 .82rem var(--body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.seats-quiet:hover { color: var(--ink); }
/* ตารางให้คะแนนในภารกิจ: บอกสถานะความครบ และทำเครื่องหมายช่องที่ยังไม่ได้เลือก */
.rate-progress { margin: 10px 0 4px; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); font-size: .9rem; color: var(--ink-2); }
.rate-progress.ok { background: var(--good-soft); color: #145C3F; }
.rate-row.todo > span { color: var(--primary-dark); font-weight: 600; }
.rate-row.todo > span::before { content: '● '; color: var(--primary); }

/* ตารางบทบาททุกกลุ่ม (หน้าครู) */
.roles-ov { margin: 6px 0 0 54px; font-size: .82rem; }
.roles-ov summary { cursor: pointer; font-weight: 600; }
.roles-ov .tbl th, .roles-ov .tbl td { padding: 3px 6px; font-size: .78rem; }

/* หน้า ตามงานค้าง (งานนักเรียน) */
.chase td.cell2 { vertical-align: top; min-width: 130px; font-size: .8rem; border-radius: 8px; }
.chase td.cell2.bad { background: var(--bad-soft); }
.chase td.cell2.warn { background: var(--accent-soft); }
.chase td.cell2.good { background: var(--good-soft); }
.chase .ch-t { font-weight: 700; }
.chase .ch-s { font-size: .74rem; }
.chase td.cell2 input[type=number] { width: 5.5em; margin: 4px 4px 0 0; }

/* งานของฉัน (หน้านักเรียน) */
.mw-h { font-family: var(--head); font-weight: 700; font-size: 1.02rem; margin: 20px 0 8px; color: var(--ink); }
.mw-what { display: block; margin-top: 4px; font-size: .88rem; color: var(--ink-2); font-weight: 400; line-height: 1.5; }
.mw-ok { color: var(--good); font-weight: 700; }
.mw-info { margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; background: #F1F3F8; color: var(--ink-2); }
.task.urgent .task-st.warn { color: var(--bad); }
details.past .tbl-wrap { margin-top: 8px; }
.mw-top2 { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: flex-start; }
.mw-top2 .today { flex: 0 1 auto; }
.mw-attbox { flex: 0 1 auto; min-width: 0; margin: 4px 0 18px; }
.mw-atth { margin: 0 0 8px; font-family: var(--head); } .mw-atth span { margin-left: 8px; font-weight: 700; font-size: .9rem; } .mw-atth .ok { color: var(--good); } .mw-atth .bad { color: var(--bad); }
.mw-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mw-chip { display: grid; justify-items: center; gap: 1px; min-width: 52px; padding: 6px 8px; border-radius: 12px; background: var(--card); box-shadow: var(--shadow); font-family: var(--head); line-height: 1.2; }
.mw-chip small { font-size: .72rem; color: var(--muted); font-weight: 600; } .mw-chip b { font-size: .82rem; color: var(--good); white-space: nowrap; }
.mw-chip.bad { background: var(--bad-soft); } .mw-chip.bad b { color: var(--bad); } .mw-chip.late b { color: var(--mid); } .mw-chip.none b { color: var(--muted); }
.mw-bp { margin: 8px 0 0; font-size: .88rem; color: var(--bad); } .mw-bp b { font-family: var(--head); }
.mw-an { margin: 0 0 4px; font-size: .85rem; font-weight: 700; color: var(--bad); }
.mw-link { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 0 0 12px; padding: 10px 14px; border-radius: 14px; background: #fff; border: 1.5px solid var(--line); color: inherit; text-decoration: none; }
.mw-link.has { background: var(--accent-soft); border-color: var(--accent); }
.mw-link span { font-size: .88rem; color: var(--muted); }
.mw-card { margin: 12px 0; }
.mw-card h2 { margin-top: 0; font-size: 1.1rem; }
.mw-item { border-radius: 12px; padding: 10px 12px; margin: 8px 0; background: #fff; border: 1.5px solid var(--line); }
.mw-item.bad { background: var(--bad-soft); border-color: transparent; }
.mw-item.warn { background: var(--accent-soft); border-color: transparent; }
.mw-item.info { background: #F1F3F8; border-color: transparent; }
.mw-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.mw-tag { font-size: .78rem; color: var(--muted); }
.mw-what { margin: 6px 0 8px; }
.mw-ok { color: var(--good, #2d7a4f); font-weight: 700; }
.mw-att tr.mw-bad td { background: var(--bad-soft); }
.mw-row { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--line); }

/* สรุปเช็กชื่อ (งานนักเรียน) */
.att-sum td, .att-sum th { text-align: center; padding: 4px 6px; font-size: .82rem; white-space: nowrap; }
.att-sum td.lbl { text-align: left; }
.att-sum td.ac { min-width: 38px; font-weight: 600; }
.att-sum td.a-ok { background: var(--good-soft); }
.att-sum td.a-late { background: #FFF1B8; }
.att-sum td.a-abs { background: var(--bad-soft); }
.att-sum td.a-leave { background: #D9E6FF; }
.att-sum td.a-none { color: #A9A69D; }
.att-sum td.ac select { font-size: .8rem; padding: 1px 2px; min-width: 52px; background: transparent; border: 1px solid var(--line); border-radius: 6px; }

/* การ์ดเหตุการณ์ไม่คาดฝัน (ใบงานที่ 7) */
.cdraw { margin: 8px 0 14px; }
.cdraw .cd-card { display: flex; gap: 10px; align-items: baseline; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); border: 2px solid var(--accent); font-size: 1.05rem; }
.cdraw .cd-card b { white-space: nowrap; }
.cdraw .cd-btn { margin-top: 4px; }
.cdraw .cd-btn[data-other] { opacity: .55; }
.cdraw.drawn .cd-btn, .cdraw.drawn .cd-hint { display: none; }
.mp-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0 0 10px; padding: 8px 12px; background: var(--accent-soft); border-radius: 10px; font-size: .85rem; }
.mp-bar select { margin-left: 4px; }
.mp-chip { font: inherit; font-size: .72rem; padding: 2px 8px; border-radius: 999px; border: 1px dashed var(--muted, #888); background: transparent; color: inherit; cursor: pointer; margin-top: 4px; }
.mp-chip.on { border-style: solid; border-color: var(--good, #2a9d5c); background: var(--good-soft); font-weight: 700; }
.chase td.mp-row { min-width: 90px; vertical-align: middle; }
.mp-bar label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chase td.ch-cards { vertical-align: top; }
.ch-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.ch-card { min-width: 150px; max-width: 240px; padding: 8px 10px; border-radius: 10px; font-size: .8rem; }
.ch-card.bad { background: var(--bad-soft); }
.ch-card.warn { background: var(--accent-soft); }
.ch-card.good { background: var(--good-soft); }
.ch-card .ch-h { font-weight: 800; margin-bottom: 2px; }
.ch-card .ch-t { font-weight: 700; }
.ch-card .ch-s { font-size: .74rem; }
.ch-card input[type=number] { width: 5.5em; margin: 4px 4px 0 0; }
.cz { margin-bottom: 16px; }
.cz-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.cz-head h2 { margin: 0; font-size: 1.1rem; }
.cz-n { font-size: .8rem; font-weight: 600; color: var(--muted); margin-left: 6px; }
.cz-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .85rem; }
.cz-tools label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.cz-hint { margin: 6px 0 10px; }
.cz-row { display: grid; grid-template-columns: minmax(150px, 220px) 1fr auto; gap: 8px 14px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.cz-who { font-size: .9rem; }
.cz-items { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.cz-it { display: inline-flex; align-items: center; gap: 4px; }
.cz-chip { display: inline-flex; align-items: baseline; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; background: var(--soft); }
.cz-chip small { font-size: .72rem; opacity: .8; }
.cz-chip.bad { background: var(--bad-soft); color: var(--bad); }
.cz-chip.warn { background: var(--mid-soft); color: #8a5a00; }
.cz-chip.ok { background: var(--good-soft); color: var(--good); }
.cz-chip.ing { background: var(--soft); color: var(--muted); }
.cz-act { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.cz-act input[type=number] { width: 5.5em; }
.cz-warn { border-left: 4px solid var(--mid); }
.cz-b.made { opacity: .75; }
.cz-note summary { cursor: pointer; font-size: .88rem; }
.cz-note .cz-row { grid-template-columns: minmax(150px, 220px) 1fr; }
@media (max-width: 720px) { .cz-row { grid-template-columns: 1fr; } .cz-act { justify-content: flex-start; } }
.cz-top { margin: 0 0 8px; }
.cz-top .spacer { flex: 1 1 auto; }
.matrix td.cell .ct { display: block; width: 100%; min-width: 92px; padding: 7px 6px; border-radius: 8px; background: #EFEDE7; color: #A9A69D; font: 700 .84rem var(--head); text-align: center; border: 1.5px solid transparent; line-height: 1.25; }
.matrix td.cell .ct small { display: block; margin-top: 2px; font-size: .68rem; font-weight: 600; opacity: .85; }
.matrix td.cell button.ct { cursor: pointer; }
.matrix td.cell button.ct:hover { border-color: var(--ink-2); }
.matrix td.cell .ct input[type=number] { width: 4.8em; margin: 4px 3px 0 0; }
.matrix td.draft .ct { background: #fff; color: var(--muted); border: 1.5px dashed #C9C6BD; }
.matrix td.sub .ct { background: var(--mid-soft); color: #7A5200; border-color: var(--mid); }
.matrix td.graded .ct { background: var(--good-soft); color: #146C48; }
.matrix td.ret .ct { background: var(--bad-soft); color: #A1342A; }
.matrix.chase2 td.mp-row { white-space: nowrap; vertical-align: middle; }
.matrix.chase2 td.cell { height: 1px; }
.matrix.chase2 td.cell .ct { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; box-sizing: border-box; }
.matrix td.cell .ct-in { display: flex; gap: 4px; align-items: center; justify-content: center; margin-top: 4px; }
.matrix td.cell .ct-in input[type=number] { width: 4.4em; margin: 0; padding: 3px 4px; font-size: .8rem; }
.matrix td.cell .ct-in .btn { white-space: nowrap; }
.cz-help { margin: 0 0 8px; }
.cz-help summary { cursor: pointer; }
.chase3 td.a-ok { background: var(--good-soft); }
.chase3 td.act { background: transparent; }
.chase3 td.ac { min-width: 70px; }
.chase3 button.cb { font: inherit; font-weight: 600; background: transparent; border: 0; padding: 2px 4px; width: 100%; cursor: pointer; color: inherit; }
.chase3 button.cb:hover { text-decoration: underline; }
.chase3 td.ac input[type=number] { width: 4em; font-size: .8rem; padding: 1px 3px; margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.chase3 .cs { font-weight: 700; }
.chase3 small { font-weight: 400; }
.cz-line label { white-space: nowrap; }
.cz-line select { width: auto; display: inline-block; font-size: .8rem; padding: 2px 6px; }
.cz-line label { display: inline-flex; align-items: center; gap: 4px; }
.chase3 td.act { white-space: nowrap; }
.cz-line { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.chase3 a.cs-link { font-size: .78rem; font-weight: 700; text-decoration: underline; color: #146C48; }
.chase3 td.a-late .cb { font-size: .78rem; }
.chase3 a.cs-man { font-size: .72rem; opacity: .75; }
.chase3 td.ac span[hidden] { display: none; }
.btn.btn-pass { background: var(--good); border-color: var(--good); color: #fff; font-weight: 700; }
.btn.btn-pass:hover { filter: brightness(.92); }
.btn.btn-trash { color: var(--bad); border-color: var(--bad-soft); background: #fff; padding-left: 8px; padding-right: 8px; vertical-align: middle; }
.btn.btn-trash:hover { background: var(--bad); border-color: var(--bad); color: #fff; }
.msg-tbl .msg-cell { text-align: left; white-space: normal; font-size: .84rem; line-height: 1.5; min-width: 360px; }
.msg-tbl td.act { white-space: nowrap; vertical-align: top; }
.msg-tbl td.lbl { vertical-align: top; white-space: nowrap; }

.chase3 tbody tr { height: 42px; }
.chase3 td { vertical-align: middle; padding-top: 4px; padding-bottom: 4px; }
.chase3 td.act .btn { padding-top: 2px; padding-bottom: 2px; line-height: 1.2; }

.pt-ext { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 14px; }
.pt-ext span { font-weight: 600; }
