/* ============================================================
   Teaching Mode — Teacher Presentation Engine styles
   Design: high contrast, big touch targets (>=44px), IWB-friendly
   ============================================================ */

#teachView {
  position: fixed; inset: 0; z-index: 200;
  background: #0b1220;
  display: flex; flex-direction: column;
  color: #fff;
  font-family: "Noto Sans TC", -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
}
#teachView.hidden, #teachView .hidden { display: none !important; }
#teachView *, #teachView *::before, #teachView *::after { box-sizing: border-box; }

/* ---------- Top bar (overlay — the slide gets the whole screen) ---------- */
.tm-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  background: linear-gradient(to bottom, rgba(6,12,24,.88), rgba(6,12,24,.55) 65%, transparent);
  min-height: 56px;
  transition: opacity .3s;
}
/* idle: controls fade away so nothing covers the slide */
#teachView.tm-idle .tm-topbar,
#teachView.tm-idle .tm-bottombar { opacity: 0; pointer-events: none; }
.tm-title {
  font-size: 16px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-right: auto;
  color: rgba(255,255,255,.92);
}
.tm-btn {
  min-width: 48px; min-height: 48px;
  padding: 0 16px;
  border: none; border-radius: 12px;
  background: rgba(255,255,255,.12);
  color: #fff; font-size: 15px; font-weight: 700;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.tm-btn:hover { background: rgba(255,255,255,.24); }
.tm-btn:active { transform: scale(.96); }
.tm-btn.tm-active { background: #c19a3d; color: #0b1220; }
.tm-btn:disabled { opacity: .35; cursor: default; }
.tm-btn:disabled:hover { background: rgba(255,255,255,.12); }
.tm-btn-exit { background: rgba(192,57,43,.8); }
.tm-btn-exit:hover { background: rgba(192,57,43,1); }

/* ---------- Stage (fills the entire viewport; bars float above) ---------- */
.tm-main { position: absolute; inset: 0; display: flex; min-height: 0; }
.tm-stage {
  flex: 1; min-width: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  position: relative;
  cursor: default;
}
.tm-stage.tm-zoomed { overflow: auto; cursor: grab; }
.tm-stage.tm-zoomed.tm-panning { cursor: grabbing; }
.tm-canvas-wrap {
  display: flex; align-items: center; justify-content: center;
  margin: auto;
}
.tm-canvas-wrap canvas, .tm-canvas-wrap img {
  display: block;
  background: #fff;
  box-shadow: 0 6px 32px rgba(0,0,0,.55);
}
.tm-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  font-size: 16px; color: rgba(255,255,255,.85);
  background: rgba(11,18,32,.6);
  z-index: 5;
}
.tm-spinner {
  width: 46px; height: 46px;
  border: 4px solid rgba(255,255,255,.2);
  border-top-color: #c19a3d;
  border-radius: 50%;
  animation: tmspin .8s linear infinite;
}
@keyframes tmspin { to { transform: rotate(360deg); } }

/* Big side page-turn zones (invisible but tappable) */
.tm-turn {
  position: absolute; top: 0; bottom: 0; width: 88px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: transparent;
  font-size: 44px; cursor: pointer; z-index: 4;
  transition: background .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.tm-turn:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.75); }
.tm-turn-prev { left: 0; }
.tm-turn-next { right: 0; }
.tm-stage.tm-zoomed .tm-turn { display: none; }

/* ---------- Bottom bar (overlay) ---------- */
.tm-bottombar {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px 12px;
  background: linear-gradient(to top, rgba(6,12,24,.88), rgba(6,12,24,.55) 65%, transparent);
  transition: opacity .3s;
}
.tm-nav-btn { min-width: 96px; min-height: 52px; font-size: 17px; }
.tm-pageinfo {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 17px; font-weight: 700;
  padding: 0 10px; min-height: 52px;
  letter-spacing: .04em;
}
.tm-pageinfo input {
  width: 74px; min-height: 44px;
  text-align: center;
  font-size: 17px; font-weight: 700;
  border: 2px solid rgba(255,255,255,.3); border-radius: 10px;
  background: rgba(255,255,255,.1); color: #fff;
  padding: 4px;
}
.tm-pageinfo input:focus { outline: none; border-color: #c19a3d; }
.tm-sep { width: 1px; height: 34px; background: rgba(255,255,255,.18); margin: 0 4px; }

/* ---------- Thumbnails drawer (overlay on the left) ---------- */
.tm-thumbs {
  position: absolute; left: 0; top: 0; bottom: 0; z-index: 18;
  width: 210px;
  background: rgba(6,12,24,.94);
  overflow-y: auto;
  padding: 68px 12px 76px;
  display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin;
}
.tm-thumbs.hidden { display: none !important; }
.tm-thumb {
  border: 3px solid transparent; border-radius: 10px;
  padding: 3px; cursor: pointer;
  background: transparent; text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.tm-thumb canvas, .tm-thumb img {
  width: 100%; display: block; border-radius: 6px; background: #fff;
  min-height: 60px;
}
.tm-thumb .tm-thumb-num {
  font-size: 13px; font-weight: 700; color: rgba(255,255,255,.75);
  margin-top: 5px; display: block;
}
.tm-thumb.tm-current { border-color: #c19a3d; }
.tm-thumb.tm-current .tm-thumb-num { color: #c19a3d; }
.tm-thumb:hover { border-color: rgba(193,154,61,.5); }

/* ---------- Resume dialog ---------- */
.tm-resume {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6,12,24,.75);
}
.tm-resume-card {
  background: #14233c; border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px; padding: 34px 38px;
  text-align: center; max-width: 92vw;
  box-shadow: 0 18px 60px rgba(0,0,0,.5);
}
.tm-resume-card h3 { font-size: 19px; font-weight: 900; margin: 0 0 8px; color: #fff; }
.tm-resume-card p { font-size: 15px; color: rgba(255,255,255,.7); margin: 0 0 22px; }
.tm-resume-card .tm-btn { margin: 0 6px; min-height: 54px; font-size: 16px; }
.tm-resume-card .tm-btn-gold { background: #c19a3d; color: #0b1220; }
.tm-resume-card .tm-btn-gold:hover { background: #d5b055; }

/* ---------- One-shot touch hint (shown briefly on open) ---------- */
.tm-hint {
  position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%);
  z-index: 22; pointer-events: none;
  background: rgba(6,12,24,.85); color: #fff;
  padding: 12px 26px; border-radius: 99px;
  font-size: 16px; font-weight: 700; letter-spacing: .04em;
  white-space: nowrap;
  opacity: 0; transition: opacity .4s;
}
.tm-hint.tm-show { opacity: 1; }

/* ---------- Toast ---------- */
.tm-toast {
  position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: rgba(6,12,24,.92); color: #fff;
  padding: 10px 22px; border-radius: 99px;
  font-size: 15px; font-weight: 700;
  z-index: 12; pointer-events: none;
  opacity: 0; transition: opacity .25s;
}
.tm-toast.tm-show { opacity: 1; }

/* ---------- Small screens (1366×768 classroom PC keeps compact bars) ---------- */
@media (max-height: 800px) {
  .tm-topbar { min-height: 50px; padding: 6px 10px; }
  .tm-btn { min-width: 44px; min-height: 44px; font-size: 14px; padding: 0 12px; }
  .tm-nav-btn { min-width: 84px; min-height: 46px; font-size: 15px; }
  .tm-bottombar { padding: 7px 10px; gap: 8px; }
  .tm-thumbs { width: 170px; }
}
