/* Live lesson: pre-join + room. Astrid's purple/yellow, dark stage. */
body.bare { background: #1b1328; color: #f6f1ff; min-height: 100vh; }
.lv { min-height: 100vh; display: flex; flex-direction: column; }
body.bare:has(.room:not([hidden])) { overflow: hidden; } body.bare:has(.room:not([hidden])) .lv { height: 100vh; height: 100dvh; }
.lv-top { display: flex; align-items: center; gap: .8rem; padding: .55rem 1rem; background: #241838; border-bottom: 3px solid var(--yellow); }
.lv-logo img { height: 30px; display: block; filter: brightness(0) invert(1); }
.lv-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.lv-title strong { color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-sub { font-size: .8rem; color: #cbb8ea; }
.lv-clock { font-weight: 800; color: var(--yellow); font-variant-numeric: tabular-nums; }
.lv-round { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px; padding: .5rem .6rem; border-radius: 14px; border: 0;
  background: #35264f; color: #fff; font: inherit; font-size: .72rem; font-weight: 700; cursor: pointer; }
.lv-round .ico { font-size: 1.25rem; line-height: 1; }
.lv-round:hover { background: #45336a; }
.lv-round:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.lv-round.is-off { background: #5b2340; }
.lv-round.is-active { background: var(--yellow); color: var(--purple-deep); }
.lv-round.leave { background: #c7334d; }
.lv-round.leave:hover { background: #e03d59; }
.lv-round[hidden] { display: none; }

/* Pre-join */
.pj { flex: 1; width: min(1100px, 100%); margin: 0 auto; padding: 1.2rem 1rem 2rem; }
.pj[hidden] { display: none; }
.pj-h { color: var(--yellow); font-size: clamp(1.3rem, 3vw, 1.9rem); margin: .2rem 0 1rem; }
.pj-grid { display: grid; gap: 1.2rem; grid-template-columns: 1fr; }
@media (min-width: 860px) { .pj-grid { grid-template-columns: 1.5fr 1fr; align-items: start; } }
.pj-video { position: relative; aspect-ratio: 16/9; background: #0e0a16; border-radius: 18px; overflow: hidden; border: 2px solid #3a2a56; }
.pj-video video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.pj-avatar { position: absolute; inset: 0; margin: auto; width: 96px; height: 96px; border-radius: 50%; display: none; place-items: center;
  background: var(--yellow); color: var(--purple-deep); font-weight: 900; font-size: 2.2rem; }
.pj-video.cam-off video { visibility: hidden; }
.pj-video.cam-off .pj-avatar { display: grid; }
.pj-name { position: absolute; left: .7rem; bottom: .7rem; background: rgba(20,12,32,.7); padding: .2rem .6rem; border-radius: 8px; font-weight: 700; font-size: .85rem; }
.pj-meter { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(255,255,255,.08); }
.pj-meter span { display: block; height: 100%; width: 0; background: var(--yellow); transition: width .06s linear; }
.pj-toggles { display: flex; justify-content: center; gap: .7rem; margin-top: .8rem; }
.pj-toggles .lv-round:not(.is-on) { background: #5b2340; }
.pj-status { text-align: center; color: #d8c9f2; margin: .7rem 0 0; }
.pj-status.warn { color: var(--yellow); }
.pj-panel { background: #f9f5ff; color: var(--ink); border-radius: 18px; padding: 1.2rem; }
.pj-panel .field { margin-bottom: .9rem; }
.pj-row { display: flex; gap: .5rem; align-items: center; }
.pj-row select { flex: 1; }
.pj-row select[hidden] + button { display: none; }
.pj-join { width: 100%; font-size: 1.1rem; padding: .9rem; }
.pj-small { margin: .7rem 0 0; font-size: .8rem; }

/* Room */
.room { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.room[hidden] { display: none; }
.room-main { flex: 1; display: flex; min-height: 0; }
.room-stage { flex: 1; position: relative; min-width: 0; display: flex; flex-direction: column; }
.room-meet { flex: 1; position: relative; background: #0e0a16; }
.room-meet iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.room-meet .meet-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 1rem; color: #d8c9f2; }
.room.board-on .room-meet { flex: 0 0 auto; height: 150px; }
.room-board { display: none; flex: 1; min-height: 0; }
.room.board-on .room-board { display: flex; }
.room-panel { width: 340px; max-width: 100%; background: #f9f5ff; color: var(--ink); display: flex; flex-direction: column; border-left: 3px solid var(--yellow); }
.room-panel[hidden] { display: none; }
@media (max-width: 760px) { .room-panel { position: absolute; inset: 0 0 76px auto; width: 100%; z-index: 20; } }
.panel-tabs { display: flex; border-bottom: 2px solid var(--line); }
.panel-tabs button { flex: 1; border: 0; background: none; padding: .75rem; font: inherit; font-weight: 800; color: var(--muted); cursor: pointer; }
.panel-tabs button[aria-selected="true"] { color: var(--purple-deep); box-shadow: inset 0 -3px 0 var(--yellow); }
.panel-tabs .x { flex: 0 0 auto; }
.panel-body { flex: 1; overflow: auto; padding: .8rem; }
.chat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.chat-list li { background: #fff; border-radius: 12px; padding: .45rem .7rem; border: 1px solid var(--line); }
.chat-list li.me { background: var(--purple-tint); align-self: flex-end; }
.chat-list .who { font-weight: 800; font-size: .78rem; color: var(--purple); }
.chat-list .when { font-size: .7rem; color: var(--muted); margin-left: .3rem; }
.chat-list .sys { background: none; border: 0; text-align: center; color: var(--muted); font-size: .8rem; }
.chat-form { display: flex; gap: .4rem; padding: .6rem; border-top: 2px solid var(--line); }
.chat-form input { flex: 1; min-height: 44px; }
.people h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: .6rem 0 .3rem; }
.people ul { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; align-items: center; gap: .5rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.people .av { width: 32px; height: 32px; border-radius: 50%; background: var(--purple); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .8rem; flex: 0 0 auto; }
.people .nm { flex: 1; min-width: 0; font-weight: 700; }
.people .tag { font-size: .7rem; font-weight: 800; background: var(--yellow); color: var(--purple-deep); border-radius: 6px; padding: 0 .35rem; margin-left: .3rem; }
.people .hand { font-size: 1.1rem; }
.people .acts { display: flex; gap: .25rem; }
.people .acts button { border: 0; background: var(--purple-tint); border-radius: 8px; padding: .3rem .45rem; cursor: pointer; font-size: .8rem; font-weight: 700; }
.host-bar { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.room-bar { display: flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem; background: #241838; flex-wrap: wrap; }
.room-bar .sep { width: 1px; align-self: stretch; background: #3d2c5c; margin: 0 .2rem; }
.hand-toast { position: absolute; top: .8rem; left: 50%; transform: translateX(-50%); background: var(--yellow); color: var(--purple-deep); font-weight: 800;
  padding: .45rem .9rem; border-radius: 999px; z-index: 30; box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.lobby-card { margin: auto; max-width: 460px; text-align: center; background: #241838; border: 2px solid #3d2c5c; border-radius: 20px; padding: 2rem 1.4rem; }
.lobby-card h2 { color: var(--yellow); }
.lobby-dots span { display: inline-block; width: 10px; height: 10px; margin: 0 4px; border-radius: 50%; background: var(--yellow); animation: dot 1.2s infinite ease-in-out; }
.lobby-dots span:nth-child(2) { animation-delay: .2s; } .lobby-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: none; } }
.badge-count { background: var(--yellow); color: var(--purple-deep); border-radius: 999px; padding: 0 .4rem; font-size: .7rem; font-weight: 900; margin-left: .25rem; }
.chat-form[hidden] { display: none; }

/* Scientific calculator */
.calc { position: fixed; right: 16px; bottom: 92px; width: 320px; max-width: calc(100vw - 16px); z-index: 60; display: none; background: #241838; color: #fff;
  border: 2px solid var(--yellow); border-radius: 18px; box-shadow: 0 18px 50px rgba(0,0,0,.45); padding: .6rem; font-family: inherit; }
.calc.is-open { display: block; }
.calc-head { display: flex; align-items: center; gap: .5rem; cursor: move; padding: .1rem .2rem .45rem; touch-action: none; }
.calc-head strong { flex: 1; color: var(--yellow); }
.calc-mode { font-size: .7rem; font-weight: 900; background: #35264f; border-radius: 6px; padding: .1rem .4rem; }
.calc-x { border: 0; background: none; color: #fff; font-size: 1rem; cursor: pointer; }
.calc-hist { max-height: 70px; overflow: auto; display: flex; flex-direction: column; align-items: flex-end; }
.calc-hist button { background: none; border: 0; color: #bfaee0; font: inherit; font-size: .75rem; cursor: pointer; padding: 0; }
.calc-in { width: 100%; background: #140d20; color: #fff; border: 0; border-radius: 10px; padding: .55rem .6rem; font-size: 1.05rem; font-family: ui-monospace, Menlo, monospace; min-height: 0; }
.calc-out { text-align: right; font-size: 1.7rem; font-weight: 800; padding: .25rem .2rem .45rem; color: var(--yellow); font-variant-numeric: tabular-nums; overflow-x: auto; white-space: nowrap; }
.calc-out.err { color: #ff9db0; font-size: 1rem; }
.calc-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.calc-keys button { border: 0; border-radius: 10px; padding: .55rem 0; background: #35264f; color: #fff; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; }
.calc-keys button.num { background: #4a3770; }
.calc-keys button.eq { background: var(--yellow); color: var(--purple-deep); }
.calc-keys button.clr { background: #6b2a4a; }
.calc-keys button.on { background: var(--yellow); color: var(--purple-deep); }
.calc-keys button:active { transform: scale(.96); }

/* Whiteboard */
.wb { position: relative; display: flex; flex: 1; min-height: 0; width: 100%; background: #2a1d40; }
.wb-tools { display: flex; flex-direction: column; gap: 4px; padding: 6px; background: #241838; overflow-y: auto; }
.wb-tools button, .wb-top button { border: 0; background: #35264f; color: #fff; border-radius: 10px; min-width: 40px; height: 40px; font-size: 1.1rem; cursor: pointer; }
.wb-tools button.on, .wb-top button.on { background: var(--yellow); color: var(--purple-deep); }
.wb-tools button:focus-visible, .wb-top button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 1px; }
.wb-sep { height: 2px; background: #3d2c5c; margin: 3px 0; }
.wb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wb-top { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 6px; background: #241838; border-bottom: 1px solid #3d2c5c; }
.wb-top button { height: 34px; min-width: 34px; font-size: .95rem; padding: 0 .5rem; }
.wb-colors { display: flex; gap: 4px; }
.wb-colors .sw { width: 26px; min-width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff3; padding: 0; }
.wb-colors .sw.on { outline: 3px solid var(--yellow); outline-offset: 1px; }
.wb-size { width: 80px; accent-color: var(--yellow); }
.wb-bg { min-height: 34px; width: auto; padding: .2rem .4rem; border-radius: 8px; font-size: .85rem; }
.wb-pages { display: inline-flex; align-items: center; gap: 3px; color: #fff; font-weight: 800; font-size: .85rem; }
.wb-lock { color: var(--yellow); font-weight: 800; font-size: .85rem; }
.wb-canvas-wrap { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px; }
.wb-canvas-wrap canvas { max-width: 100%; max-height: 100%; aspect-ratio: 16/10; background: #fffdf7; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.35); touch-action: none; }
.wb-text { position: absolute; min-width: 160px; min-height: 2.2em; background: rgba(255,255,255,.95); border: 2px dashed var(--purple); border-radius: 6px; font-family: Nunito, sans-serif; padding: 2px 4px; z-index: 5; }
.wb.locked .wb-tools, .wb.locked .wb-top > :not(.wb-pages):not(.wb-lock):not([data-act="png"]) { opacity: .45; pointer-events: none; }
.wb-pop { position: absolute; left: 60px; top: 50px; z-index: 40; max-width: min(760px, calc(100% - 70px)); max-height: calc(100% - 60px); overflow: auto; background: #f9f5ff; color: var(--ink);
  border: 3px solid var(--yellow); border-radius: 16px; padding: .8rem 1rem; box-shadow: 0 18px 50px rgba(0,0,0,.4); }
.wb-pop h4 { margin: .3rem 0 .5rem; color: var(--purple-deep); }
.wb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.wb-grid button, .wb-stamps button { border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: .5rem; font: inherit; font-weight: 700; cursor: pointer; text-align: left; }
.wb-grid button:hover, .wb-stamps button:hover { border-color: var(--purple); }
.wb-stamps { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.wb-stamps button { display: flex; flex-direction: column; align-items: center; text-align: center; font-size: .72rem; text-transform: capitalize; }
.ptable { display: grid; grid-template-columns: repeat(18, minmax(30px, 1fr)); gap: 2px; min-width: 620px; }
.ptable button { border: 1px solid #0002; border-radius: 4px; padding: 2px 0 3px; font: inherit; font-weight: 800; font-size: .78rem; cursor: pointer; line-height: 1.05; }
.ptable button small { display: block; font-size: .55rem; font-weight: 600; opacity: .7; }
.ptable button:hover { outline: 2px solid var(--purple); }
.pt-gap { height: 8px; }
.wb-inline { display: inline-flex; gap: .4rem; align-items: center; font-weight: 700; margin-bottom: .5rem; }
.wb-plot label { display: block; font-weight: 800; margin-bottom: .4rem; }
.wb-plot input { min-height: 40px; }
.wb-row { display: flex; gap: .6rem; } .wb-row label { flex: 1; }
@media (max-width: 760px) {
  .wb { flex-direction: column-reverse; }
  .wb-tools { flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .wb-sep { width: 2px; height: auto; margin: 0 3px; }
  .wb-pop { left: 6px; right: 6px; top: 50px; max-width: none; }
  .room.board-on .room-meet { height: 110px; }
}

/* Recorder */
.rec-bar { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; align-items: center; gap: .6rem; background: #fff; color: var(--ink);
  border: 3px solid #c7334d; border-radius: 999px; padding: .35rem .5rem .35rem .9rem; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #c7334d; animation: recp 1.2s infinite; }
.rec-bar.paused .rec-dot { animation: none; background: #999; }
.rec-t { font-variant-numeric: tabular-nums; font-weight: 800; }
@keyframes recp { 50% { opacity: .3; } }
.rec-modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(20,12,32,.75); padding: 1rem; }
.rec-card { width: min(640px, 100%); max-height: 100%; overflow: auto; background: #fff; color: var(--ink); border-radius: 20px; padding: 1.2rem; border: 3px solid var(--yellow); }
.rec-card video { width: 100%; border-radius: 12px; background: #000; margin-bottom: .8rem; max-height: 300px; }
.rec-prog-bar { height: 12px; background: var(--purple-tint); border-radius: 999px; overflow: hidden; }
.rec-prog-bar span { display: block; height: 100%; width: 0; background: var(--purple); transition: width .3s; }
