/* ==========================================================================
   Lớp học ngoại ngữ với giáo viên (language-class.mjs): bảng lớp học bên phải màn hình (game vẫn hiện bên trái)
   + phụ đề lời giáo viên ở giữa đáy màn hình.
   ========================================================================== */

.swc { position: fixed; inset: 0; z-index: 60; pointer-events: none; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
.swc * { box-sizing: border-box; }
.swc [hidden] { display: none !important; }

.swc-panel { pointer-events: auto; position: absolute; top: 72px; right: 16px; bottom: 16px; width: min(400px, calc(100vw - 32px)); display: flex; flex-direction: column;
  background: rgba(13, 20, 33, .92); color: #e8eef7; border: 1px solid rgba(255, 255, 255, .1); border-radius: 18px; overflow: hidden;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .65); backdrop-filter: blur(10px); animation: swc-in .22s ease-out; }
@keyframes swc-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

.swc-hd { flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid rgba(255, 255, 255, .08); background: linear-gradient(180deg, rgba(255, 255, 255, .05), transparent); }
.swc-ava { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #f59e0b, #b45309); box-shadow: 0 0 0 0 rgba(245, 158, 11, .6); flex: none; }
.swc.is-speaking .swc-ava { animation: swc-pulse 1.1s ease-out infinite; }
@keyframes swc-pulse { 0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .55); } 100% { box-shadow: 0 0 0 12px rgba(245, 158, 11, 0); } }
.swc-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.swc-who b { font-size: 14.5px; }
.swc-who span { font-size: 12px; color: #93a4bd; }
.swc-lang { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; background: rgba(255, 255, 255, .08); border-radius: 999px; padding: 4px 6px 4px 10px; }
.swc-lang button { border: 0; background: rgba(255, 255, 255, .14); color: #fff; font: inherit; font-size: 11.5px; border-radius: 999px; padding: 2px 8px; cursor: pointer; }
.swc-x { border: 0; background: none; color: #93a4bd; font-size: 16px; cursor: pointer; width: 30px; height: 30px; border-radius: 8px; }
.swc-x:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.swc-log { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.swc-msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.55; word-wrap: break-word; }
.swc-msg.is-teacher { align-self: flex-start; background: rgba(255, 255, 255, .07); border-top-left-radius: 4px; }
.swc-msg.is-me { align-self: flex-end; background: #2563eb; color: #fff; border-top-right-radius: 4px; }
.swc-msg.is-error { background: rgba(220, 38, 38, .16); color: #fecaca; }
.swc-msg a { color: #93c5fd; }
.swc-msg span + span { margin-left: .25em; }
.swc-fl { color: #fcd34d; font-weight: 650; }
.swc-via { font-style: normal; margin-right: 4px; opacity: .8; }
.swc-dots { display: inline-flex; gap: 4px; padding: 4px 0; }
.swc-dots i { width: 6px; height: 6px; border-radius: 50%; background: #93a4bd; animation: swc-dot 1s infinite ease-in-out; }
.swc-dots i:nth-child(2) { animation-delay: .15s; }
.swc-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes swc-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.swc-ft { flex: none; padding: 12px 14px 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
.swc-langs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.swc-langs button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .04); color: #e8eef7; cursor: pointer; font: inherit; transition: background .12s, border-color .12s, transform .12s; }
.swc-langs button:hover { background: rgba(37, 99, 235, .18); border-color: #3b82f6; transform: translateY(-1px); }
.swc-langs .f, .swc-lang .g { display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 70% 52%), hsl(calc(var(--h) + 30) 70% 38%)); }
.swc-langs .f { width: 36px; height: 36px; font-size: 16px; margin-bottom: 4px; }
.swc-lang .g { width: 20px; height: 20px; border-radius: 6px; font-size: 10.5px; }
.swc-langs b { font-size: 13.5px; }
.swc-langs small { font-size: 11px; color: #93a4bd; }

.swc-tabs { display: flex; gap: 6px; background: rgba(255, 255, 255, .05); border-radius: 12px; padding: 4px; margin-bottom: 10px; }
.swc-tabs button { flex: 1; border: 0; border-radius: 9px; padding: 7px; background: none; color: #93a4bd; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.swc-tabs button.is-on { background: rgba(255, 255, 255, .12); color: #fff; }

.swc-mic { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06); color: #e8eef7; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s; }
.swc-mic .ico { font-size: 20px; }
.swc-mic:hover { background: rgba(255, 255, 255, .1); }
.swc-mic.is-on { background: rgba(225, 29, 72, .16); border-color: rgba(244, 63, 94, .5); color: #fecdd3; }
.swc.is-recording .swc-mic.is-on { animation: swc-rec 1.2s ease-in-out infinite; }
@keyframes swc-rec { 50% { background: rgba(225, 29, 72, .3); } }
.swc-meter { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .08); margin-top: 8px; overflow: hidden; }
.swc-meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22c55e, #facc15); transition: width .08s linear; }

.swc-chat { display: flex; gap: 8px; }
.swc-chat input { flex: 1; min-width: 0; height: 42px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); color: #fff; padding: 0 12px; font: inherit; font-size: 14px; outline: none; }
.swc-chat input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, .25); }
.swc-send { width: 42px; height: 42px; border-radius: 12px; border: 0; background: #2563eb; color: #fff; font-size: 16px; cursor: pointer; }
.swc-send:hover { background: #1d4ed8; }

.swc-status { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 12px; color: #93a4bd; min-height: 16px; }
.swc-quota { color: #64748b; white-space: nowrap; }

/* Phụ đề lời giáo viên (đọc kèm khi cô nói) */
/* căn giữa phần màn hình bên trái bảng lớp học (bảng rộng 400px + lề 16px) */
.swc-sub { pointer-events: none; position: absolute; left: calc((100vw - 432px) / 2); bottom: 84px; transform: translateX(-50%); width: min(720px, calc(100vw - 480px)); min-width: 300px;
  background: rgba(8, 12, 20, .82); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 17px; line-height: 1.55; text-align: center;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .6); }
.swc-sub b { display: block; font-size: 12px; color: #fbbf24; letter-spacing: .3px; text-transform: uppercase; margin-bottom: 2px; }
.swc-sub span + span { margin-left: .25em; }
@media (max-width: 900px) { .swc-sub { left: 16px; transform: none; width: calc(100vw - 448px); min-width: 0; } }
