/*
 * FHC 視窗教室 － 學習中心、練習程式、教師控制台、引導教學的樣式
 */

/* ---------- 登入畫面（帳號登入） ---------- */
.login-users { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.login-user { text-decoration: none; min-width: 200px; }
.login-link { border: 0; background: none; color: #fff; text-decoration: underline; cursor: pointer; align-self: center; opacity: .85; }
.login-notice { max-width: 460px; padding: 10px 14px; border-radius: 8px; background: rgba(255, 248, 200, .95); color: #333; line-height: 1.6; white-space: pre-wrap; }

/* ---------- 通知 ---------- */
#toasts { position: fixed; right: 12px; bottom: calc(var(--tb-h) + 12px); z-index: 99000; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100% - 24px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px; background: var(--menu-bg); color: var(--menu-fg); border: 1px solid rgba(0,0,0,.2); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.3); animation: toastin .3s ease-out; transition: opacity .4s, transform .4s; }
.toast.out { opacity: 0; transform: translateX(40px); }
.toast-text { flex: 1; min-width: 0; line-height: 1.5; }
.toast-text b { display: block; margin-bottom: 2px; }
.toast-x { border: 0; background: none; cursor: pointer; font-size: 18px; line-height: 1; color: inherit; }
@keyframes toastin { from { opacity: 0; transform: translateX(40px); } }

/* ---------- 公告便利貼 ---------- */
.sticky { position: absolute; top: 12px; right: 12px; width: 240px; max-height: 50%; overflow: auto; padding: 10px 12px 12px; background: #fff59d; color: #333; box-shadow: 2px 4px 10px rgba(0,0,0,.35); transform: rotate(1deg); z-index: 1; line-height: 1.6; }
.sticky-head { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
.sticky-x { border: 0; background: none; cursor: pointer; font-size: 16px; }
.sticky-text { white-space: pre-wrap; word-break: break-word; }

/* ---------- 新手導覽 ---------- */
.tour-shade { position: fixed; inset: 0; z-index: 99500; background: rgba(0,0,0,.55); }
.tour-shade.clear { background: transparent; }
.tour-hole { position: fixed; z-index: 99501; border-radius: 8px; box-shadow: 0 0 0 9999px rgba(0,0,0,.55), 0 0 0 3px #ffd23f; pointer-events: none; transition: all .25s; }
.tour-tip { position: fixed; z-index: 99502; width: min(340px, calc(100% - 16px)); padding: 14px 16px; background: #fff; color: #222; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.4); line-height: 1.6; }
.tour-tip h3 { margin: 2px 0 6px; color: #1e6fd9; }
.tour-tip p { margin: 0 0 10px; white-space: pre-line; }
.tour-step { font-size: 12px; color: #888; }
.tour-btns { display: flex; justify-content: flex-end; gap: 6px; }

/* ---------- 任務面板 ---------- */
.mission { position: fixed; top: 64px; right: 12px; z-index: 98000; width: min(330px, calc(100% - 24px)); background: #fff; color: #222; border: 2px solid #ffb300; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.35); font-size: 13px; }
.mission-head { cursor: move; touch-action: none; display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: #fff3cd; border-radius: 8px 8px 0 0; }
.mission-head b { flex: 1; }
.mission-btn { border: 0; background: none; cursor: pointer; font-size: 16px; width: 24px; }
.mission-list { margin: 0; padding: 8px 10px 4px 10px; list-style: none; }
.mission-list li { display: flex; gap: 6px; padding: 4px 0; color: #777; }
.mission-list li.cur { color: #111; font-weight: bold; }
.mission-list li.ok { color: #2e7d32; text-decoration: line-through; }
.mission-chk { flex: none; width: 18px; height: 18px; border: 2px solid #bbb; border-radius: 4px; display: grid; place-items: center; font-size: 12px; }
.mission-list li.ok .mission-chk { background: #43a047; border-color: #43a047; color: #fff; }
.mission-list li.cur .mission-chk { border-color: #ffb300; }
.mission-foot { padding: 4px 10px 8px; font-size: 12px; color: #888; }
.mission.mini .mission-list, .mission.mini .mission-foot { display: none; }

/* ---------- 學習中心 ---------- */
.lc { display: flex; overflow: hidden; }
.lc-side { flex: none; width: 220px; overflow: auto; padding: 6px; background: #f3f6fb; border-right: 1px solid #d5dce8; }
.lc-unit { display: flex; align-items: center; gap: 6px; padding: 10px 6px 4px; font-weight: bold; color: #1e3a6e; }
.lc-lesson { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 4px; padding: 5px 8px 5px 14px; border: 0; border-radius: 4px; background: none; text-align: left; cursor: pointer; }
.lc-lesson:hover { background: #e3ecf9; }
.lc-lesson.on { background: #cfe0f8; }
.lc-lesson-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-stars { flex: none; color: #f9a825; font-size: 12px; letter-spacing: -1px; }
.lc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; background: #fff; }
.lc-main > .doc { overflow: auto; }
.lc-head { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 1px solid #e3e8ef; }
.lc-head h2 { margin: 0; font-size: 18px; }
.lc-code { font-size: 12px; color: #607d8b; }
.lc-pane { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.lc-page { flex: 1; font-size: 15px; }
.lc-page ul { margin: 4px 0 8px; padding-left: 22px; }
.lc-page li { margin: 3px 0; }
.lc-nav { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-top: 1px solid #e3e8ef; }
.lc-meter { max-width: 400px; height: 16px; }
.lc-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.lc-tool { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border: 1px solid #dde3ec; border-radius: 8px; background: #f8fafc; cursor: pointer; }
.lc-tool:hover { background: #e8f1fc; border-color: #9cc3ef; }
.qz { margin: 10px 0; padding: 10px 12px; border: 1px solid #e0e6ee; border-radius: 8px; }
.qz.right { border-color: #81c784; background: #f1f8f1; }
.qz.wrong { border-color: #e57373; background: #fdf1f1; }
.qz-q { font-weight: bold; margin-bottom: 6px; }
.qz-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.qz-opt { padding: 6px 10px; border: 1px solid #cfd8e3; border-radius: 6px; background: #fff; text-align: left; cursor: pointer; }
.qz-opt.on { background: #e3f0ff; border-color: #1e6fd9; }
.qz-opt.ans { outline: 2px solid #43a047; }
.qz-why { margin-top: 6px; font-size: 13px; color: #555; }
.qz-result { margin-top: 10px; font-size: 16px; font-weight: bold; }
@media (max-width: 699px) { .lc { flex-direction: column; } .lc-side { width: auto; max-height: 34%; border-right: 0; border-bottom: 1px solid #d5dce8; } }

/* ---------- 打字練習 ---------- */
.ty { display: flex; flex-direction: column; gap: 10px; padding-bottom: 10px; background: #f6f8fb; }
.ty-stats { margin-left: auto; font-variant-numeric: tabular-nums; }
.ty-target { margin: 0 14px; padding: 16px; min-height: 80px; background: #fff; border: 2px solid #cfd8e3; border-radius: 8px; font: 24px/1.7 Consolas, "Courier New", "Microsoft JhengHei", monospace; letter-spacing: 1px; word-break: break-all; outline: none; cursor: text; }
.ty-target:focus { border-color: #1e6fd9; box-shadow: 0 0 0 3px rgba(30,111,217,.2); }
.ty-ch { color: #9aa5b1; }
.ty-ch.ok { color: #2e7d32; }
.ty-ch.bad { color: #d32f2f; background: #ffebee; }
.ty-ch.cur { color: #111; background: #fff176; border-bottom: 3px solid #1e6fd9; }
.ty-ch.sp { color: #ccd; }
.ty-target:not(:focus) .ty-ch.cur { background: #eee; }
.ty-zh { margin: 0 14px; font-size: 20px; padding: 8px !important; }
.ty-hint { margin: 0 14px; min-height: 22px; color: #1e3a6e; font-weight: bold; }
.ty-kb { align-self: center; display: flex; flex-direction: column; gap: 4px; padding: 8px; background: #dfe5ec; border-radius: 8px; }
.ty-row { display: flex; gap: 4px; }
.ty-row1 { padding-left: 18px; } .ty-row2 { padding-left: 28px; } .ty-row3 { padding-left: 46px; }
.ty-key { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 5px; font: bold 13px Consolas, monospace; color: #333; box-shadow: 0 2px 0 rgba(0,0,0,.25); transition: transform .1s; }
.ty-space { width: 260px; margin-left: 150px; font-family: inherit; }
.ty-key.f0, .ty-key.f7 { background: #f8bbd0; } .ty-key.f1, .ty-key.f6 { background: #c5cae9; }
.ty-key.f2, .ty-key.f5 { background: #c8e6c9; } .ty-key.f3, .ty-key.f4 { background: #fff9c4; } .ty-key.f8 { background: #eceff1; }
.ty-key.next { outline: 3px solid #1e6fd9; transform: translateY(-2px); background: #fff; }
.ty-key.wrong { background: #ef5350 !important; color: #fff; }
.ty-best { margin: 0 14px; }
@media (max-width: 699px) { .ty-kb { display: none; } .ty-target { font-size: 18px; } }

/* ---------- 快捷鍵挑戰 ---------- */
.sc { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px; text-align: center; background: linear-gradient(#f0f6ff, #fff); outline: none; line-height: 1.6; }
.sc:focus { box-shadow: inset 0 0 0 3px rgba(30,111,217,.3); }
.sc-prog { color: #666; }
.sc-q { font-size: 30px; font-weight: bold; color: #1e3a6e; }
.sc-ask { color: #555; }
.sc-pressed { min-height: 30px; font-size: 18px; }
.sc-pressed.ok, .sc-opt.ok { color: #2e7d32; }
.sc-pressed.bad { color: #d32f2f; }
.sc-opt.ok { background: #c8e6c9; }
.sc-opt.bad { background: #ffcdd2; }
.sc-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: min(420px, 100%); }
.sc-opt { min-height: 44px; font-size: 16px; }
.sc-go { font-size: 18px; padding: 8px 24px; }

/* ---------- 滑鼠練習 ---------- */
.ms-info { flex: none; padding: 8px 12px; background: #e3f2fd; border-bottom: 1px solid #bbdefb; }
.ms-area { position: relative; flex: 1; min-height: 0; overflow: hidden; background: radial-gradient(circle at 30% 30%, #fff, #e8f0f8); touch-action: none; }
.ms-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 20px; }
.ms-target { position: absolute; width: 56px; height: 56px; border: 0; border-radius: 50%; background: radial-gradient(circle, #fffde7, #ffe082); box-shadow: 0 4px 10px rgba(0,0,0,.25); font-size: 28px; cursor: pointer; animation: pop .25s ease-out; }
.ms-target.half { box-shadow: 0 0 0 6px rgba(30,111,217,.4); }
@keyframes pop { from { transform: scale(.2); } }
.ms-flash { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); padding: 4px 12px; border-radius: 12px; background: #ffcdd2; }
.ms-folder { position: absolute; right: 24px; top: 50%; transform: translateY(-50%); width: 120px; padding: 10px; display: flex; flex-direction: column; align-items: center; border: 3px dashed #90a4ae; border-radius: 12px; background: rgba(255,255,255,.6); }
.ms-file { position: absolute; display: flex; flex-direction: column; align-items: center; font-size: 12px; cursor: grab; touch-action: none; user-select: none; }
.ms-file.drag { cursor: grabbing; z-index: 2; filter: drop-shadow(0 4px 6px rgba(0,0,0,.3)); }
.ms-scroll { position: absolute; inset: 20px; overflow: auto; background: #fff; border: 1px solid #ccd; border-radius: 8px; touch-action: pan-y; }
.ms-scroll-inner { padding: 10px 20px 20px; height: 1600px; position: relative; }
.ms-scroll-inner .ms-target { position: absolute; bottom: 20px; left: 40%; }

/* ---------- 二進位翻翻卡 ---------- */
.bn { display: flex; flex-direction: column; gap: 10px; background: #fafbff; }
.bn-head { padding: 0 14px; font-size: 18px; }
.bn-target { font-size: 34px; color: #1e6fd9; margin: 0 6px; }
.bn-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0 10px; }
.bn-card { width: 74px; height: 110px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 6px 4px; border: 2px solid #90a4ae; border-radius: 8px; background: #455a64; color: #fff; cursor: pointer; transition: transform .15s; }
.bn-card:hover { transform: translateY(-3px); }
.bn-card.on { background: #fff; color: #222; border-color: #1e6fd9; }
.bn-dots { font-size: 9px; line-height: 1.1; word-break: break-all; color: #e53935; min-height: 40px; }
.bn-v { font-weight: bold; font-size: 16px; }
.bn-bit { font: bold 22px Consolas, monospace; }
.bn-out { text-align: center; font: 16px Consolas, "Microsoft JhengHei", monospace; }
.bn-msg { text-align: center; color: #1e3a6e; min-height: 24px; }

/* ---------- 上課計時器 ---------- */
.tmr { container-type: inline-size; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px; background: #0f1724; color: #fff; outline: none; }
.tmr .btn { color: #222; }
.tm-modes { display: flex; gap: 4px; }
.tm-mode.on { background: #ffd23f; }
.tm-label { width: min(420px, 100%); text-align: center; font-size: 18px; background: transparent !important; color: #fff; border: 0 !important; border-bottom: 1px dashed #556 !important; box-shadow: none !important; }
.tm-big { font: 700 clamp(36px, 22cqw, 240px)/1 Consolas, "Courier New", monospace; font-variant-numeric: tabular-nums; letter-spacing: 2px; }
.tm-big.warn { color: #ff7043; }
.tm-bar { width: min(600px, 90%); height: 10px; border-radius: 5px; background: #2a3546; overflow: hidden; }
.tm-bar span { display: block; height: 100%; background: linear-gradient(90deg, #43a047, #ffd23f); transition: width .25s linear; }
.tm-pre, .tm-ctrl { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.tm-btn { min-width: 80px; min-height: 34px; font-size: 15px; }
.tmr.alarm { animation: alarm 1s steps(2) infinite; }
@keyframes alarm { 50% { background: #b71c1c; } }
.tmr:fullscreen { padding: 4vh; }

/* ---------- CPU 排程 ---------- */
.sch { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; background: #fff; }
.sch > :not(.app-toolbar) { margin: 0 12px; }
.sch-explain { padding: 8px 10px; background: #e8f4fd; border-radius: 6px; line-height: 1.6; }
.sch-num { width: 64px; }
.sch-q { width: 56px; }
.sch-sw { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: middle; }
.sch-title { font-weight: bold; margin: 4px 0; }
.sch-lane { position: relative; height: 40px; background: #f1f3f5; border: 1px solid #ccd; border-radius: 4px; }
.sch-bar { position: absolute; top: 0; bottom: 0; display: grid; place-items: center; color: #fff; font-weight: bold; border-right: 2px solid #fff; animation: grow .3s ease-out; transform-origin: left; overflow: hidden; }
.sch-bar.idle { background: repeating-linear-gradient(45deg, #ddd 0 6px, #eee 6px 12px); color: #777; }
@keyframes grow { from { transform: scaleX(0); } }
.sch-axis { position: relative; height: 18px; font-size: 11px; }
.sch-tick { position: absolute; transform: translateX(-50%); }
.sch-res .tbl, .sch-tbl .tbl { width: auto; }
.sch-hist { color: #444; }

/* ---------- 網路實驗室 ---------- */
.nl-pane { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; background: #fff; }
.nl-pane > :not(.app-toolbar) { margin-left: 12px; margin-right: 12px; }
.nl-msg { flex: 1; min-width: 120px; }
.nl-url { font-family: Consolas, monospace; }
.nl-tip { padding: 8px 10px; background: #f1f8e9; border-radius: 6px; line-height: 1.6; margin-top: 0; margin-bottom: 0; }
.nl-stage { position: relative; height: 230px; flex: none; background: linear-gradient(#eef5ff, #fff); border: 1px solid #d6e2f0; border-radius: 8px; overflow: hidden; }
.nl-node { position: absolute; transform: translate(-50%, -50%); z-index: 1; text-align: center; font-size: 11px; white-space: pre-line; line-height: 1.3; }
.nl-ico { font-size: 34px; line-height: 1.1; }
.nl-name { background: rgba(255,255,255,.85); border-radius: 4px; padding: 0 3px; }
.nl-line { position: absolute; height: 3px; background: #b0bec5; transform-origin: 0 50%; }
.nl-pkt { position: absolute; left: 0; top: 0; z-index: 2; width: 26px; height: 26px; border: 2px solid #fff; border-radius: 6px; color: #fff; font-weight: bold; cursor: pointer; padding: 0; box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.nl-pkt.lost { background: #d32f2f !important; }
.nl-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.nl-recv { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.nl-slot { padding: 2px 6px; border: 1px dashed #aaa; border-radius: 4px; color: #999; font-size: 12px; }
.nl-slot.ok { color: #fff; border-style: solid; }
.nl-enc { margin-top: 4px; font-size: 12px; }
.enc { padding: 4px 6px; border-radius: 4px; }
.enc > span { display: block; margin-bottom: 3px; }
.enc.l1 { background: #eceff1; } .enc.l2 { background: #e3f2fd; } .enc.l3 { background: #e8f5e9; } .enc.l4 { background: #fff8e1; }
.nl-log { font-size: 12px; color: #455a64; max-height: 120px; overflow: auto; }
.nl-steps { line-height: 1.9; }
.nl-steps li { animation: toastin .3s ease-out; }
.nl-out { line-height: 1.7; }
.nl-out .bad, .bad { color: #d32f2f; }
input.bad { border-color: #d32f2f !important; }
.nl-bin { display: flex; align-items: flex-end; gap: 4px; flex-wrap: wrap; }
.nl-oct { display: flex; flex-direction: column; align-items: center; padding: 4px 6px; background: #f3f6fb; border-radius: 4px; }
.nl-oct code { font-size: 13px; color: #1e6fd9; }
.nl-quiz { padding: 8px 10px; background: #fff8e1; border-radius: 6px; }
.nl-cheat { font-size: 12px; color: #555; }
.nl-urltbl td code { font-size: 13px; word-break: break-all; }
.nl-urltbl tr.u0 th { color: #c62828; } .nl-urltbl tr.u1 th { color: #1565c0; } .nl-urltbl tr.u2 th { color: #2e7d32; }
.nl-urltbl tr.u3 th { color: #6a1b9a; } .nl-urltbl tr.u4 th { color: #ef6c00; } .nl-urltbl tr.u5 th { color: #00838f; }
.nl-urltbl td { white-space: normal; }
@media (max-width: 699px) { .nl-bottom { grid-template-columns: 1fr; } }

/* ---------- 教師控制台 ---------- */
.tc-pane { flex: 1; min-height: 0; overflow: auto; background: #fff; }
.tc h3 { margin-top: 16px; }
.tc-foot { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 8px 12px; background: var(--face); border-top: 1px solid rgba(0,0,0,.15); }
.tc-status { margin-right: auto; font-size: 12px; color: var(--muted); }
.tc-status.warn { color: #d84315; font-weight: bold; }
.tc-big { display: flex; align-items: center; gap: 14px; width: 100%; max-width: 520px; padding: 14px 18px; border: 2px solid #cfd8e3; border-radius: 12px; background: #f8fafc; text-align: left; cursor: pointer; line-height: 1.5; }
.tc-big.on { border-color: #43a047; background: #e8f5e9; }
.tc-big-ico { font-size: 34px; }
.tc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; }
.tc-check { display: flex; align-items: center; gap: 6px; margin: 4px 0; flex-wrap: wrap; }
.tc-check small { flex-basis: 100%; padding-left: 22px; }
.tc-field { display: flex; flex-direction: column; gap: 3px; margin: 8px 0; }
.tc-field label { font-weight: bold; font-size: 13px; }
.tc-field input[type=text], .tc-field textarea, .tc-field select { width: 100%; max-width: 640px; }
.tc-mono { font-family: Consolas, "Microsoft JhengHei", monospace; }
.tc-files { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.tc-file { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border: 1px solid #e0e6ee; border-radius: 6px; }
.tc-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tc-editor { margin-top: 6px; }
.tc-site input[type=text] { width: 100%; min-width: 90px; }
.tc-site td { white-space: normal; vertical-align: middle; }
