/* Lớp học trực tuyến: trang chính và phòng học (dùng chung common.css) */
.wrap { max-width: 900px; }
.wrap.narrow { max-width: 420px; margin-top: 8vh; }
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.top h1 { margin: 0; font-size: 1.4rem; }
.tabrow { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 12px; }
.tabrow > button { margin: 0; padding: 9px 14px; background: transparent; color: inherit; border: 1px solid var(--line); }
.tabrow > button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tablewrap { overflow-x: auto; }
.atable { width: 100%; border-collapse: collapse; }
.atable th, .atable td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.atable tr.off { opacity: .55; }
.atable tr.live td { font-weight: 600; }
.acts > * { margin: 2px 4px 2px 0; }
.acts select { width: auto; min-width: 8em; padding: 5px 8px; }
input.num { width: 7em; }
input[type=datetime-local], input[type=month] { width: 100%; padding: 10px 14px; font: inherit; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: inherit; }
details > summary { cursor: pointer; margin: 8px 0; }
.warn { color: var(--warn); }
.pre { white-space: pre-wrap; }
.code { font: 600 1.2rem/1.2 ui-monospace, Consolas, monospace; letter-spacing: .12em; }
.agree { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin: 8px 0; }
.agree input { margin-top: 5px; flex: none; width: auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 10px 0; }
.stat { padding: 10px 12px; border-radius: 12px; background: var(--soft); }
.statn { font-size: 1.3rem; font-weight: 700; }
.wrapRow { flex-wrap: wrap; }
@media print { body > main > *:not(#view), #view > *:not(.codes), .codes .row, .codes .muted { display: none; } .card { border: 0; box-shadow: none; } }

/* ---------- phòng học ---------- */
body.room { margin: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: #10151c; color: #eef2f6; }
body.room .muted { color: #a9b4c0; }
.rTop { display: flex; gap: 12px; align-items: center; padding: 8px 12px; flex-wrap: wrap; }
.rRec { color: #ff6b6b; font-weight: 700; }
body.room .msg { margin: 0 12px 6px; }
.rMain { flex: 1; min-height: 0; display: flex; gap: 8px; padding: 0 8px; }
.rStage { flex: 1; min-width: 0; position: relative; background: #000; border-radius: 12px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.rStage video { width: 100%; height: 100%; object-fit: contain; }
.stScreen, .stCam { position: absolute; inset: 0; }
.stScreen:empty, .stCam:empty { display: none; }
.rStage.hasScreen .stCam { inset: auto 10px 10px auto; width: 22%; min-width: 120px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 10px #000a; z-index: 2; }
.rStage.hasScreen .stCam video { object-fit: cover; }
.rNote { position: relative; z-index: 1; margin: 0; padding: 12px; text-align: center; color: #c8d1db; }
.rSide { width: 300px; flex: none; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
body.teacher .rSide { width: 46%; max-width: 720px; }
.rSelf, .rTile { position: relative; background: #1d2530; border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 9; }
.rSelf { width: 160px; flex: none; }
body.teacher .rSelf { display: none; }
.rSelf video, .rTile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.rSelf video { transform: scaleX(-1); }
.rName { position: absolute; left: 4px; bottom: 3px; padding: 1px 6px; border-radius: 6px; background: #000a; font-size: .78rem; max-width: 94%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rTiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; overflow-y: auto; flex: none; max-height: 40%; }
body.teacher .rTiles { grid-template-columns: repeat(4, 1fr); max-height: none; flex: 1 1 auto; align-content: start; }
.rTiles:empty, .rHands:empty, .rPager:empty { display: none; }
.rHands { max-height: 24%; overflow-y: auto; flex: none; }
.rHands p { margin: 4px 0; }
.rChat { flex: 1 1 80px; min-height: 60px; overflow-y: auto; background: #1d2530; border-radius: 10px; padding: 6px 10px; font-size: .92rem; }
.rChat p { margin: 3px 0; overflow-wrap: anywhere; }
.rChat .mine { color: #9fd3ff; }
body.room input[type=text] { background: #1d2530; color: inherit; border-color: #3a4656; margin: 0; }
body.room form.row { margin: 0; align-items: center; }
.rBar { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 8px; }
.rBar button, .rBar .btn { margin: 0; width: auto; }
@media (max-width: 760px) {
  .rMain { flex-direction: column; }
  .rStage { flex: 1 1 45%; }
  .rSide, body.teacher .rSide { width: auto; max-width: none; flex: 1 1 55%; }
  body.teacher .rTiles { grid-template-columns: repeat(3, 1fr); }
  .rTiles { grid-template-columns: repeat(3, 1fr); }
}
