/* Gaya untuk lobi, HUD bilik darjah dan panel guru. */
:root {
  --bg: #eef3f8;
  --card: #ffffff;
  --ink: #1d2733;
  --muted: #5f6b78;
  --line: #d6dee8;
  --primary: #1e5fbf;
  --primary-ink: #ffffff;
  --ok: #2e7d32;
  --err: #c62828;
  --warn: #ef6c00;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 16px/1.5 system-ui, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.2; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }

.wrap { max-width: 560px; margin: 0 auto; padding: 24px 16px 48px; }
.wrap.wide { max-width: 1000px; }
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.brand h1 { margin: 0; font-size: 1.8rem; }
.brand p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 16px; box-shadow: 0 2px 10px rgba(20, 40, 70, 0.06); }
.card h2 { margin-top: 0; }

label { display: block; font-weight: 600; margin: 14px 0 6px; }
input, select { width: 100%; padding: 11px 12px; font: inherit; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
input[type=file] { padding: 8px; }
input.code { text-transform: uppercase; letter-spacing: 0.25em; font-weight: 700; font-size: 1.2rem; }
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 16px 0; padding: 10px 14px 14px; }
legend { font-weight: 600; padding: 0 6px; }

.btn { display: inline-block; padding: 9px 16px; font: inherit; font-weight: 600; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(0.96); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.warn { background: #fff3e0; border-color: #ffcc80; }
.btn.danger { background: #ffebee; border-color: #ef9a9a; color: var(--err); }
.btn.ghost { background: transparent; }
.btn.big { width: 100%; padding: 14px; font-size: 1.05rem; margin-top: 8px; }
.btn.sm { padding: 5px 10px; font-size: 0.875rem; }
.btn.on { background: #c62828; color: #fff; border-color: #c62828; }
.btn.off { background: #c62828; color: #fff; border-color: #c62828; }

.notice { padding: 10px 14px; border-radius: 10px; margin: 10px 0; }
.notice.ok { background: #e8f5e9; color: var(--ok); }
.notice.err { background: #ffebee; color: var(--err); }
.notice.info { background: #e3f2fd; color: #0d47a1; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 3px var(--ink); }

#micPick { margin-top: 10px; }
#micPick label { font-weight: 400; margin: 0 0 4px; }
.meter { display: inline-block; vertical-align: middle; width: 120px; height: 10px; background: #dde3ea; border-radius: 5px; overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; background: #43a047; transition: width 0.08s; }

#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: rgba(20, 25, 32, 0.92); color: #fff; padding: 10px 16px; border-radius: 10px; max-width: min(92vw, 640px); opacity: 0; pointer-events: none; transition: opacity 0.25s; z-index: 50; text-align: center; }
#toast.show { opacity: 1; }

/* ---------- Bilik darjah ---------- */
body.room { overflow: hidden; background: #000; }
#app canvas { display: block; }
#overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(10, 20, 35, 0.6); padding: 16px; z-index: 40; }
#overlay .card { max-width: 520px; width: 100%; }
#hud { position: fixed; inset: 0; pointer-events: none; color: #fff; z-index: 10; }
#hud > * { pointer-events: auto; }
#topbar { position: absolute; top: 10px; left: 10px; right: 10px; max-width: max-content; background: rgba(15, 20, 28, 0.7); padding: 6px 12px; border-radius: 10px; font-size: 0.9rem; }
#netStatus { color: #ffcc80; margin-left: 8px; }
#people { position: absolute; top: 52px; right: 10px; margin: 0; padding: 8px 12px; list-style: none; background: rgba(15, 20, 28, 0.7); border-radius: 10px; font-size: 0.85rem; max-width: 220px; }
#people li { padding: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#people li b { color: #fdd835; font-size: 0.75rem; }
#people .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
#people .me { opacity: 0.85; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); pointer-events: none !important; }
#controls { position: absolute; left: 10px; right: 10px; bottom: 34px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
#controls .btn { padding: 8px 12px; font-size: 0.9rem; }
#teacherCtl { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; background: rgba(15, 20, 28, 0.55); padding: 4px 8px; border-radius: 12px; }
#teacherCtl[hidden] { display: none; }
#matSelect { width: auto; max-width: 240px; padding: 7px 8px; font-size: 0.85rem; }
#pageInfo { font-size: 0.85rem; min-width: 120px; text-align: center; }
#help { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; font-size: 0.75rem; color: rgba(255, 255, 255, 0.85); text-shadow: 0 1px 2px #000; padding: 0 10px; }

/* Pemain YouTube 2D (di atas bilik 3D) */
#yt { position: fixed; top: 48px; left: 50%; transform: translateX(-50%); width: min(92vw, 960px); z-index: 20; background: #000; border-radius: 12px; overflow: hidden; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); }
#yt .yt-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; background: #1b1f26; color: #fff; font-size: 0.85rem; }
#yt .yt-frame { aspect-ratio: 16 / 9; }
#yt iframe { width: 100%; height: 100%; border: 0; display: block; }
#yt.small { width: min(60vw, 340px); top: auto; bottom: 90px; left: auto; right: 10px; transform: none; }

/* ---------- Panel guru ---------- */
.topnav { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.topnav .who { color: var(--muted); font-size: 0.9rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.85rem; color: var(--muted); }
td form { display: inline; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 0.75rem; font-weight: 700; background: #e3e8ef; }
.tag.open { background: #e8f5e9; color: var(--ok); }
.tag.closed { background: #ffebee; color: var(--err); }
.tag.live { background: #fff3e0; color: var(--warn); }
.bigcode { font-size: 2.2rem; font-weight: 800; letter-spacing: 0.2em; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.table-scroll { overflow-x: auto; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
/* Skrin kecil: HUD padat supaya layar 3D tidak tertutup. */
@media (max-width: 760px), (max-height: 500px) {
  #help, #people { display: none; }
  #controls { bottom: 6px; gap: 4px; }
  #controls .btn { padding: 4px 8px; font-size: 0.75rem; }
  #teacherCtl { gap: 4px; padding: 2px 4px; }
  #matSelect { max-width: 150px; padding: 4px; font-size: 0.75rem; }
  #pageInfo { min-width: 0; font-size: 0.75rem; }
  #topbar { font-size: 0.75rem; padding: 4px 8px; }
  .meter { width: 60px; }
}
