/* 課堂即時頁：版面照 10/17 咖啡對話小聚活動頁（上：階段列＋人物舞台；下：會後分析） */
:root { --ink: #24392f; --muted: #536758; --paper: #faf7ef; --border: #d5dccb; --green: #346048; --lime: #d2ec9a; --wood: #cf9e6b; --gold: #b8872f; --card: #fffdf8; --warn: #c07a3a; --chalk: #f7f3e8; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif; font-size: 18px; line-height: 1.55; }
button, select { font: inherit; cursor: pointer; }
.in { max-width: 1240px; margin: 0 auto; padding: 0 18px; }
.pxbox { background: var(--card); border: 1px solid var(--border); border-radius: 14px; }
.pxbtn { min-height: 44px; border: 1px solid var(--border); background: #fffdf7; padding: 8px 16px; border-radius: 9px; font-weight: 650; color: var(--ink); }
.pxbtn:hover { border-color: var(--green); background: #eff3e5; }
.pxbtn.on, .pxbtn.go { background: var(--green); color: #fff; border-color: var(--green); }
.sp { flex: 1; }

/* 頁首與階段列（黏在上方） */
.hdr { position: sticky; top: 0; z-index: 40; }
.top { background: #243d30; color: #fff; }
.top .in { padding: 12px 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.top .mark { width: 44px; height: 44px; display: grid; place-items: center; background: var(--lime); border: 3px solid #102118; box-shadow: 3px 3px 0 #102118; font-size: 24px; flex: none; }
.top h1 { margin: 0; font-size: 1.35rem; }
.top .sub { font-size: .9rem; opacity: .85; }
.top .badge { background: #fff2; border: 1px solid #fff5; border-radius: 999px; padding: 4px 14px; font-weight: 700; }
.top .pxbtn { min-height: 40px; padding: 4px 14px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #9c9; display: inline-block; margin-right: 6px; }
.dot.off { background: #d88; }
.chapters { background: #fffdf8; border-bottom: 1px solid var(--border); overflow-x: auto; white-space: nowrap; }
.chapters .in { padding: 10px 18px; display: flex; gap: 8px; align-items: center; }
.chapters button { flex: none; min-height: 40px; border: 1px solid var(--border); background: #fffdf7; border-radius: 9px; padding: 4px 12px; font-size: .92rem; font-weight: 650; color: var(--ink); max-width: 20em; overflow: hidden; text-overflow: ellipsis; }
.chapters button .t { color: var(--muted); margin-right: 6px; font-weight: 500; }
.chapters button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chapters button.on .t { color: #cfe0c8; }
.chapters .act { color: var(--green); font-size: .8rem; font-weight: 750; margin: 0 2px 0 8px; }

/* 這一題 */
main.wrap { max-width: 1240px; margin: 0 auto; padding: 18px 18px 10px; }
.stagehead { display: flex; gap: 16px; align-items: stretch; flex-wrap: wrap; margin-bottom: 18px; }
.stagehead .pxbox { padding: 16px 20px; flex: 1; min-width: 280px; }
.stagehead .kicker { font-size: .9rem; color: var(--green); font-weight: 750; letter-spacing: .06em; }
.stagehead h2 { margin: 2px 0 6px; font-size: 1.8rem; line-height: 1.25; }
.stagehead .do { font-size: 1.05rem; }
.stagehead .note { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.stagebig { flex: none; width: 190px; background: var(--lime); border: 3px solid #102118; box-shadow: 4px 4px 0 #102118; border-radius: 6px; display: grid; place-items: center; text-align: center; padding: 14px; }
.stagebig b { font-size: 2rem; display: block; line-height: 1.1; }
.stagebig span { font-size: .95rem; color: var(--muted); }

/* 教室舞台 */
.office { position: relative; border: 6px solid #4d4737; border-radius: 5px; background: #efe3cf; box-shadow: 0 6px 0 #b8a47a; }
.officebar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; background: #f7e5b0; border-bottom: 4px solid #644b38; }
.officebar .pxbtn, .officebar select { min-height: 38px; padding: 4px 12px; font-size: .95rem; }
.officebar select { border: 1px solid var(--border); border-radius: 9px; background: #fffdf7; max-width: 13em; }
.officebar .sign { font-weight: 850; letter-spacing: .06em; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #efe3cf; touch-action: none; }
.office:fullscreen { border: 0; border-radius: 0; box-shadow: none; display: flex; flex-direction: column; background: #efe3cf; }
.office:fullscreen .stage { flex: 1; aspect-ratio: auto; }
.world { position: absolute; inset: 0; transform-origin: 0 0; background: #efe3cf url("classroom-bg.jpg") center / cover no-repeat; cursor: grab; }
.world.panning { cursor: grabbing; }
.board { position: absolute; left: 26.5%; top: 4.5%; width: 51.5%; height: 30.5%; z-index: 2; color: var(--chalk); display: flex; flex-direction: column; padding: 1.4% 1.6%; overflow: hidden; }
.board .tag { font-size: clamp(11px, 1.1vw, 18px); opacity: .85; letter-spacing: .08em; }
.board h1 { margin: .2em 0 .35em; font-size: clamp(15px, 2.1vw, 34px); line-height: 1.25; font-weight: 700; }
.board .idle { font-size: clamp(13px, 1.5vw, 24px); opacity: .9; }
.bars { display: flex; flex-direction: column; gap: 3%; flex: 1; justify-content: center; }
.bar { display: grid; grid-template-columns: 1.4em 1fr auto; align-items: center; gap: .6em; font-size: clamp(11px, 1.15vw, 19px); }
.bars.many .bar { font-size: clamp(10px, .95vw, 16px); }
.bars.many { gap: 2%; }
.board.many h1 { font-size: clamp(14px, 1.8vw, 28px); margin-bottom: .2em; }
.bar .n { font-weight: 800; text-align: center; }
.bar .track { position: relative; height: 1.3em; background: rgba(255,255,255,.14); border-radius: 999px; overflow: hidden; }
.bar .fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #f0c987, #e9a96a); border-radius: 999px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.bar .lab { position: absolute; left: .7em; top: 50%; transform: translateY(-50%); color: #3b2a1e; font-weight: 700; white-space: nowrap; font-size: .9em; }
.bar .cnt { min-width: 3em; text-align: right; font-weight: 800; }
.ticker { flex: 1; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: .3em; font-size: clamp(11px, 1.15vw, 19px); }
.teacher { position: absolute; left: 16.5%; top: 17%; width: 7.5%; z-index: 3; text-align: center; }
.teacher img { width: 100%; image-rendering: pixelated; filter: drop-shadow(0 6px 6px rgba(0,0,0,.18)); }
.teacher .nm { font-size: clamp(10px, .9vw, 15px); font-weight: 700; background: #fffbf4ee; border-radius: 999px; padding: 1px 8px; display: inline-block; }
.teacher .say { position: absolute; right: 108%; top: 0; width: 180%; min-width: 120px; background: #fffbf4f2; border-radius: 12px; padding: .4em .7em; font-size: clamp(10px, .95vw, 16px); box-shadow: 0 4px 12px #0003; text-align: left; color: #3b2a1e; animation: rise .3s ease-out; }
.seats { position: absolute; left: 4%; right: 4%; top: 52%; bottom: 2%; z-index: 3; display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: center; gap: 1% 1%; }
.kid { position: relative; width: 8.5%; min-width: 48px; text-align: center; cursor: pointer; animation: enter .6s cubic-bezier(.2,.9,.3,1.3); }
.kid svg { width: 72%; display: block; margin: 0 auto; filter: drop-shadow(0 4px 4px rgba(0,0,0,.15)); }
.kid .nm { font-size: clamp(9px, .85vw, 14px); font-weight: 700; background: #fffbf4ee; border-radius: 999px; padding: 0 6px; display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kid .vote { position: absolute; right: 2%; top: 0; width: 1.6em; height: 1.6em; border-radius: 50%; background: var(--warn); color: #fff; font-weight: 800; font-size: clamp(10px, 1vw, 16px); display: grid; place-items: center; box-shadow: 0 3px 8px #0003; animation: pop .3s ease-out; }
.kid .cnt { position: absolute; left: 2%; top: 0; font-size: clamp(9px, .8vw, 13px); background: #fffbf4ee; border-radius: 999px; padding: 0 5px; color: var(--muted); }
.kid .bub { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); width: 240%; min-width: 120px; background: #fffbf4f2; border-radius: 10px; padding: .3em .6em; font-size: clamp(10px, .9vw, 15px); box-shadow: 0 4px 12px #0003; z-index: 5; text-align: left; color: #3b2a1e; animation: pop .3s ease-out; }
.kid .bub::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: #fffbf4f2; }
.kid.talk { z-index: 10; } .kid.dragging { cursor: grabbing; z-index: 12; } .kid.hl svg { filter: drop-shadow(0 0 10px #f6c46a); }
.kid.moved { outline: 2px dashed rgba(142,90,54,.35); outline-offset: 4px; border-radius: 12px; }
@keyframes enter { from { opacity: 0; transform: translateY(40px) scale(.6); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateX(-50%) scale(.7); } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.feed { padding: 8px 14px; background: #fff7dfb8; border-top: 2px solid #e8dcb8; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.help { padding: 6px 14px 8px; background: #f7e5b0; font-size: .85rem; color: var(--muted); text-align: center; }
.hostbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 12px; background: #fffdf8; border-bottom: 2px solid #e8dcb8; }
.hostbar .pxbtn { min-height: 38px; padding: 4px 12px; font-size: .95rem; }
.hostbar .note { color: var(--muted); font-size: .85rem; }
.replaybar { display: none; align-items: center; gap: 10px; padding: 8px 14px; background: #fffdf8; border-top: 2px solid #e8dcb8; flex-wrap: wrap; }
.replaybar.on { display: flex; }
.replaybar .pxbtn { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
.rp-prog { position: relative; flex: 1; min-width: 200px; height: 30px; background: #efe5c8; border-radius: 8px; cursor: pointer; overflow: hidden; }
.rp-prog i { position: absolute; left: 0; top: 0; bottom: 0; background: #e0a52666; }
.rp-prog span { position: absolute; top: 5px; left: 8px; font-size: 13px; color: #5b4a2a; white-space: nowrap; }
.feed { white-space: normal; }
.feed .lnk { border: 0; background: none; color: var(--green); font-weight: 700; font-size: .9rem; padding: 0 4px; }
.feed .hist { display: none; margin-top: 6px; max-height: 220px; overflow: auto; font-size: .9rem; border-top: 1px dashed #e8dcb8; padding-top: 6px; }
.feed .hist.on { display: block; }
.feed .hist div { padding: 2px 0; }
.matrix { width: 100%; border-collapse: collapse; font-size: .9rem; }
.matrix th, .matrix td { border: 1px solid var(--border); padding: 4px 8px; text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix td.y { background: #e5efcf; font-weight: 700; color: var(--green); }
.tblwrap { overflow-x: auto; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.steps .st { background: #f0f3e8; border-radius: 10px; padding: 10px 12px; font-size: .92rem; }
.steps .st b { display: block; margin-bottom: 2px; }
.steps .st.hl { background: #fff0c9; }

/* 指令框 */
.stagecmd { margin-top: 14px; border: 2px solid var(--green); border-radius: 12px; padding: 10px 14px; background: #f4f8ec; }
.stagecmd-h { font-weight: 800; margin-bottom: 6px; }
.stagecmd-r { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.stagecmd .cmd { background: #fff; border: 2px dashed #b9a867; border-radius: 8px; padding: 5px 12px; font-weight: 800; font-size: 1.05rem; }
.stagecmd .note { color: var(--muted); font-size: .9rem; }

/* 分析 */
.ana { max-width: 1240px; margin: 0 auto; padding: 10px 18px 60px; scroll-margin-top: 130px; }
.ana-band { background: #243d30; color: #fff; border-radius: 14px; padding: 18px 22px; border: 3px solid #102118; box-shadow: 4px 4px 0 #102118; }
.ana-band h2 { margin: 0 0 6px; font-size: 1.5rem; }
.ana-band p { margin: 0; opacity: .9; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0 0; }
.stats .k { padding: 12px 16px; }
.stats .k b { font-size: 1.8rem; display: block; line-height: 1.1; }
.stats .k span { color: var(--muted); font-size: .9rem; }
.sec { padding: 16px 20px; margin-top: 16px; }
.sec h3 { margin: 0 0 4px; font-size: 1.25rem; }
.cap { margin: 0 0 8px; color: var(--muted); font-size: .96rem; }
.howread { background: #f0f3e8; border-left: 4px solid #90a56a; padding: 8px 12px; font-size: .94rem; margin: 8px 0 14px; border-radius: 0 8px 8px 0; }
.chipg { display: inline-block; font-size: .8rem; background: #fff0c9; border: 1px solid #dfc98d; color: #754e15; border-radius: 6px; padding: 0 8px; margin-left: 6px; vertical-align: middle; font-weight: 600; }
.nmb { display: inline-block; border: 1px solid var(--border); background: #f0f3e8; border-radius: 6px; padding: 0 8px; font-size: .85rem; min-height: 28px; line-height: 28px; font-weight: 600; margin: 2px 4px 2px 0; cursor: pointer; }
.nmb:hover { border-color: var(--green); }
.round { padding: 12px 0; border-top: 1px dashed var(--border); }
.round:first-of-type { border-top: 0; }
.round h4 { margin: 0 0 8px; font-size: 1.1rem; }
.brow { display: grid; grid-template-columns: minmax(120px, 28%) 1fr auto; gap: 10px; align-items: center; margin: 6px 0; }
.brow .lab { font-weight: 650; }
.brow .track { height: 18px; background: #eee9da; border-radius: 4px; overflow: hidden; }
.brow .fill { height: 100%; background: var(--green); border-radius: 4px; transition: width .5s; }
.brow .cnt { font-weight: 750; min-width: 3.5em; text-align: right; }
.brow .who { grid-column: 2 / 4; }
.said { margin: 6px 0 0; padding-left: 0; list-style: none; }
.said li { margin: 4px 0; }
.theme { padding: 10px 0; border-top: 1px dashed var(--border); }
.theme:first-of-type { border-top: 0; }
.theme b { font-size: 1.05rem; }
.theme .sum { color: var(--muted); font-size: .95rem; }
.theme.solved { opacity: .55; } .theme.solved b { text-decoration: line-through; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.pcard { padding: 12px 14px; cursor: pointer; }
.pcard .h { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.pcard .h svg { width: 36px; height: 43px; }
.pcard .h b { font-size: 1.05rem; }
.pcard .h small { color: var(--muted); }
.pcard .l { font-size: .92rem; margin: 2px 0; }
.pcard .l .v { color: var(--warn); font-weight: 700; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: zoom-in; }
.anatext { white-space: pre-wrap; font-size: 1.02rem; }
.empty { color: var(--muted); font-size: .95rem; }

/* 點小人：抽屜 */
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: min(440px, 92vw); background: var(--paper); z-index: 60; box-shadow: -8px 0 24px rgba(0,0,0,.18); transform: translateX(105%); transition: transform .3s; padding: 20px; overflow: auto; }
.drawer.open { transform: none; }
.drawer h3 { margin: 0 0 4px; font-size: 1.4rem; }
.drawer .meta { color: var(--muted); font-size: .95rem; margin-bottom: 12px; }
.drawer .r { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.drawer .r .t { font-weight: 700; }
.drawer .r .v { color: var(--warn); font-weight: 700; }
.drawer .x { position: absolute; right: 14px; top: 10px; font-size: 26px; border: 0; background: none; color: var(--muted); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.8); z-index: 70; display: none; place-items: center; }
.lightbox.open { display: grid; } .lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 10px; }

@media (max-width: 760px) {
  html { font-size: 16px; }
  .stagebig { width: 100%; }
  .officebar .canvas-only { display: none; }
  .help { display: none; }
  .kid .bub, .teacher .say { display: none; }
  .brow { grid-template-columns: 1fr auto; } .brow .track { grid-column: 1 / 3; } .brow .who { grid-column: 1 / 3; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
