* { box-sizing: border-box; }
body { margin: 0; font-family: 'Malgun Gothic', system-ui, sans-serif; background: #f1f5f9; color: #0f172a; }
button { font: inherit; cursor: pointer; }

/* ===== 학생 위젯 (PiP 안/밖 공용) ===== */
.widget { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center;
  justify-content: center; background: #0f172a; color: #e2e8f0; container-type: size; overflow: hidden; }
body.pip { margin: 0; background: #0f172a; height: 100vh; }
.orb { width: 80cqmin; height: 80cqmin; border-radius: 50%; border: 0; color: #fff; font-weight: 700; font-size: max(13px, 11cqmin);
  background: #475569; box-shadow: 0 4px 14px rgba(0,0,0,.4); line-height: 1.2; padding: 6px; }
.orb.blink { animation: blink .9s infinite; }
.orb.done { background: #16a34a; }
@keyframes blink {
  0%, 100% { background: #e11d48; box-shadow: 0 0 0 0 rgba(225,29,72,.8); }
  50% { background: #fb923c; box-shadow: 0 0 0 16px rgba(225,29,72,0); }
}
.chatbtn { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: #334155; color: #fff; font-size: 16px; }
.badge { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; border-radius: 8px; background: #ef4444; font-size: 11px; line-height: 16px; padding: 0 4px; }
.badge:empty { display: none; }
.chatpanel { display: none; flex: 1; min-height: 0; width: 100%; flex-direction: column; padding: 6px 8px 8px; }
.widget.chat { justify-content: flex-start; padding-top: 8px; }
.widget.chat .orb { width: 56px; height: 56px; font-size: 11px; flex: none; }
.widget.chat .chatpanel { display: flex; }
.me { font-size: 12px; color: #94a3b8; text-align: center; margin: 2px 0 6px; }
.list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px; background: #1e293b; border-radius: 8px; }
.msg { background: #334155; border-radius: 8px; padding: 5px 8px; font-size: 13px; word-break: break-word; position: relative; }
.msg b { font-size: 11px; color: #93c5fd; display: block; }
.msg.teacher { background: #854d0e; } .msg.teacher b { color: #fde68a; }
.msg.dm { background: #6d28d9; border: 1px solid #c4b5fd; } .msg.dm b { color: #ede9fe; }
.tchat .msg.dm { background: #ede9fe; border-color: #8b5cf6; } .tchat .msg.dm b { color: #6d28d9; }
.dmbar { display: none; align-items: center; gap: 6px; background: #ede9fe; color: #5b21b6; border-radius: 8px; padding: 4px 8px; font-size: 13px; margin-top: 6px; }
.dmbar.on { display: flex; } .dmbar button { border: 0; background: none; color: #5b21b6; margin-left: auto; }
.chip .dmb { color: #7c3aed; }
.msg .reply { position: absolute; top: 3px; right: 6px; border: 0; border-radius: 6px; background: #7c3aed; color: #fff; font-size: 11px; padding: 1px 6px; }
.dmb .n { background: #ef4444; color: #fff; border-radius: 8px; font-size: 11px; padding: 0 5px; margin-left: 2px; }
.sendrow label.lock { background: #475569; user-select: none; }
.sendrow button.lock { background: #475569; }
.sendrow button.lock.on { background: #7c3aed; }
.msg a.file { color: #bae6fd; display: inline-block; margin-top: 2px; }
.msg a.link { color: #7dd3fc; text-decoration: underline; word-break: break-all; }
.tchat .msg a.link { color: #1d4ed8; }
.msg .del { position: absolute; top: 2px; right: 4px; border: 0; background: none; color: #fca5a5; }
.sendrow { display: flex; gap: 4px; margin-top: 6px; }
.sendrow input[type=text] { flex: 1; min-width: 0; border: 0; border-radius: 6px; padding: 6px 8px; }
.sendrow button, .sendrow label { border: 0; border-radius: 6px; background: #2563eb; color: #fff; padding: 6px 9px; cursor: pointer; }
.sendrow label { background: #475569; }
.sendrow input[type=file] { display: none; }
.err { color: #fca5a5; font-size: 12px; min-height: 14px; }

/* ===== 학생 메인 페이지 ===== */
.page { max-width: 520px; margin: 0 auto; padding: 24px 16px; }
.page h1 { font-size: 22px; margin: 0 0 4px; }
.card { background: #fff; border-radius: 12px; padding: 16px; margin-top: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.primary { background: #2563eb; color: #fff; border: 0; border-radius: 10px; padding: 12px 18px; font-size: 16px; }
.primary.red { background: #dc2626; } .primary.gray { background: #64748b; }
.dock { height: 460px; border-radius: 12px; overflow: hidden; margin-top: 14px; }
.muted-t { color: #64748b; font-size: 13px; }
.popup .page { padding: 0; max-width: none; }
.popup h1, .popup #status { display: none; }
.popup .dock { height: 100vh; margin: 0; border-radius: 0; }
.launch { position: fixed; inset: 0; width: 100%; border: 0; background: #0f172a; color: #fff; font-size: 22px; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; z-index: 10; }
.launch small { font-weight: 400; font-size: 13px; color: #94a3b8; }
.launch[hidden] { display: none; }

/* ===== 교수자 ===== */
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.grid { display: grid; grid-template-columns: 1fr 380px; gap: 14px; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
input.t, .page input { border: 1px solid #cbd5e1; border-radius: 8px; padding: 9px 10px; font: inherit; }
.big { font-size: 56px; font-weight: 800; line-height: 1; }
.bar { height: 16px; background: #e2e8f0; border-radius: 8px; overflow: hidden; margin: 10px 0; }
.bar > i { display: block; height: 100%; background: #16a34a; transition: width .3s; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #e2e8f0; border-radius: 16px; padding: 4px 10px; font-size: 13px; }
.chip.done { background: #bbf7d0; }
.chip.off { opacity: .55; }
.chip button { border: 0; background: none; padding: 0 0 0 4px; }
.tchat { display: flex; flex-direction: column; height: 560px; }
.tchat .list { background: #f1f5f9; }
.tchat .msg { background: #fff; color: #0f172a; } .tchat .msg b { color: #2563eb; }
.tchat .msg.teacher { background: #fef3c7; } .tchat .msg.teacher b { color: #92400e; }
.tchat .msg a.file { color: #1d4ed8; }
.tchat .sendrow input[type=text] { border: 1px solid #cbd5e1; }
