/* ================================================================
   LIVE CLASS  (js/tools/LiveClassManager.js + js/tools/live/*)
   teacher: top-bar button · slim student dock · minimised pill · settings sheet
   student: live pill · write blocker · raise hand · activity overlay · join banner
   ================================================================ */

/* ---------- tokens ---------- */
.lc-panel, .lc-dock, .lc-dock-pill, .lc-student-pill, .lc-join-banner {
    --lc-bg: #ffffff;
    --lc-fg: #0f172a;
    --lc-muted: #64748b;
    --lc-line: #e2e8f0;
    --lc-soft: #f1f5f9;
    --lc-accent: #4f46e5;
    --lc-live: #ef4444;
    --lc-ok: #10b981;
    --lc-hand: #f59e0b;
    font-family: 'Outfit', 'Inter', 'Cairo', sans-serif;
    color: var(--lc-fg);
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}
.lc-panel *, .lc-dock *, .lc-dock *::before, .lc-dock *::after { box-sizing: border-box; }
.lc-panel button, .lc-dock button, .lc-join-banner button { font: inherit; cursor: pointer; touch-action: manipulation; }
.lc-panel :focus-visible, .lc-dock :focus-visible { outline: 3px solid rgba(79, 70, 229, 0.5); outline-offset: 2px; }

/* ---------- shared bits ---------- */
.lc-dot {
    width: 10px; height: 10px; flex: none;
    border-radius: 50%;
    background: var(--lc-live, #ef4444);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
    animation: lc-pulse 1.6s infinite;
}
.lc-dot.lc-dot--warn { background: var(--lc-hand, #f59e0b); animation: lc-pulse-warn 1.2s infinite; }
@keyframes lc-pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); }
    70% { box-shadow: 0 0 0 9px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
@keyframes lc-pulse-warn {
    0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); }
    70% { box-shadow: 0 0 0 9px rgba(245, 158, 11, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}
.lc-icon-btn {
    width: 44px; height: 44px; flex: none;
    display: inline-grid; place-items: center;
    border: none; border-radius: 14px;
    background: var(--lc-soft); color: var(--lc-fg);
    font-size: 1rem;
    transition: background 0.15s, transform 0.12s;
}
.lc-icon-btn:hover { background: var(--lc-line); }
.lc-icon-btn:active { transform: scale(0.94); }
.lc-icon-btn:disabled { opacity: 0.35; cursor: default; }
.lc-btn {
    min-height: 48px; padding: 0 18px;
    border: none; border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-weight: 700; font-size: 0.95rem;
    transition: background 0.15s, transform 0.12s;
}
.lc-btn:active { transform: scale(0.97); }
.lc-btn--primary { background: var(--lc-accent); color: #fff; }
.lc-btn--danger { background: #fef2f2; color: #dc2626; }
.lc-btn--danger:hover { background: #fee2e2; }
.lc-btn--hands { width: 100%; background: #fef3c7; color: #92400e; }

/* avatar: initials on a pastel disc, online pip, hand badge, "wrote on this slide" pip */
.lc-av {
    --h: 262;
    width: 40px; height: 40px; flex: none;
    border-radius: 50%;
    display: inline-grid; place-items: center;
    font-weight: 800; font-size: 0.82rem; letter-spacing: 0.02em;
    color: hsl(var(--h) 60% 28%);
    background: hsl(var(--h) 85% 92%);
    border: 2px solid #fff;
    position: relative;
    padding: 0;
}
.lc-av::after {
    content: ''; position: absolute; right: -1px; bottom: -1px;
    width: 11px; height: 11px; border-radius: 50%;
    background: #cbd5e1; border: 2px solid #fff;
}
.lc-av.is-on::after { background: var(--lc-ok, #10b981); }
.lc-av.is-writing { box-shadow: 0 0 0 3px hsl(var(--h) 80% 60%); animation: lc-ink 1s ease-in-out infinite alternate; }
@keyframes lc-ink { to { box-shadow: 0 0 0 5px hsl(var(--h) 80% 70% / 0.5); } }
.lc-av--sm { width: 30px; height: 30px; font-size: 0.68rem; }
.lc-av--sm::after { width: 9px; height: 9px; }
.lc-work-dot { position: absolute; left: -3px; top: -3px; width: 11px; height: 11px; border-radius: 50%; background: var(--lc-accent); border: 2px solid #fff; display: none; }
.lc-av.has-work .lc-work-dot { display: block; animation: lc-pip 0.35s cubic-bezier(0.34, 1.8, 0.64, 1); }
@keyframes lc-pip { from { transform: scale(0); } to { transform: scale(1); } }
.lc-hand-badge {
    position: absolute; right: -8px; top: -10px;
    width: 24px; height: 24px; border-radius: 50%;
    display: none; place-items: center;
    background: var(--lc-hand, #f59e0b); border: 2px solid #fff;
    font-size: 0.78rem; font-style: normal; line-height: 1;
    box-shadow: 0 3px 8px rgba(245, 158, 11, 0.45);
    animation: lc-wave 1.2s ease-in-out infinite;
}
.lc-av.has-hand .lc-hand-badge { display: grid; }
.lc-av.has-hand { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--lc-hand, #f59e0b); }
@keyframes lc-wave { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 75% { transform: rotate(10deg); } }

/* ---------- top-bar Live button ---------- */
#btn-live-class { position: relative; }
#btn-live-class.lc-hidden { display: none !important; }
#btn-live-class i { color: #ef4444; }
#btn-live-class.is-live { background: #ef4444 !important; }
#btn-live-class.is-live i { color: #fff; animation: lc-blink 1.6s infinite; }
@keyframes lc-blink { 50% { opacity: 0.55; } }
.lc-live-badge {
    position: absolute; top: -6px; right: -6px;
    min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: 999px;
    background: #fff; color: #ef4444;
    font: 800 0.66rem/20px 'Outfit', 'Inter', sans-serif;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    text-align: center;
}
.lc-live-badge[hidden] { display: none !important; }

/* ---------- raise hand (students see ✋ only while a live class is on) ---------- */
body.is-student:not(.lc-live-student) #btn-raise-hand { display: none !important; }
#btn-raise-hand.is-raised { background: #f59e0b !important; color: #fff !important; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.35); }
#btn-raise-hand.is-raised i { color: #fff !important; animation: lc-wave 1.2s ease-in-out infinite; transform-origin: 70% 90%; }

/* ================================================================
   TEACHER — the student dock: one slim, fixed-size row
   [ LIVE 0:42 · 5/12 online ] [ ‹ avatars… › ] [ settings · minimise ]
   ================================================================ */
.lc-dock {
    --lc-line: rgba(15, 23, 42, 0.08); --lc-soft: rgba(15, 23, 42, 0.05);
    position: fixed;
    left: 50%;
    bottom: calc(82px + env(safe-area-inset-bottom));
    z-index: 2147482900;
    display: flex; align-items: center; gap: 6px;
    width: min(760px, calc(100% - 20px));
    height: 60px;
    padding: 0 6px 0 8px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.86);
    -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 10px 34px rgba(15, 23, 42, 0.16), 0 0 0 1px var(--lc-line);
    transform: translate(-50%, 18px) scale(0.98); opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.3, 0.64, 1), opacity 0.2s, box-shadow 0.25s;
}
.lc-dock.show { transform: translate(-50%, 0) scale(1); opacity: 1; }
.lc-dock.is-viewing { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 10px 34px rgba(79, 70, 229, 0.22), 0 0 0 2px rgba(79, 70, 229, 0.55); }
/* minimising: the bar shrinks into the pill at the same spot, so it never seems to vanish */
.lc-dock.lc-shrinking { transform: translate(-50%, 6px) scale(0.6, 0.7); opacity: 0; transition: transform 0.22s ease-in, opacity 0.2s ease-in; }

/* left: live status, or the student whose page is open */
.lc-dock-lead { display: flex; align-items: center; gap: 8px; flex: 0 0 176px; width: 176px; min-width: 0; height: 40px; padding-inline-end: 8px; border-inline-end: 1px solid var(--lc-line); }
.lc-dock-lead.lc-swap { animation: lc-swap 0.28s ease; }
@keyframes lc-swap { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.lc-live-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: 999px; background: rgba(239, 68, 68, 0.1); color: var(--lc-live); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.1em; }
.lc-live-chip.is-down { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.lc-live-chip .lc-dot { width: 7px; height: 7px; }
.lc-live-chip .lc-clock { color: var(--lc-live); opacity: 0.75; font-weight: 700; letter-spacing: 0; font-size: 0.72rem; flex: none; font-variant-numeric: tabular-nums; }
.lc-lead-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.lc-lead-txt b { font-size: 0.86rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-lead-txt small { font-size: 0.7rem; color: var(--lc-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-dock.is-viewing .lc-lead-txt small { color: var(--lc-accent); font-weight: 600; }
.lc-on-count { color: #059669; font-weight: 800; }
.lc-of { color: var(--lc-muted); font-weight: 600; }

/* middle: arrows page through the class; they never move, only dim at the ends */
.lc-dock-mid { display: flex; align-items: center; gap: 2px; flex: 1 1 0; min-width: 0; }
.lc-dock-arrow {
    width: 26px; height: 40px; flex: none;
    border: none; border-radius: 10px;
    background: transparent; color: var(--lc-muted);
    display: grid; place-items: center; font-size: 0.8rem;
    transition: background 0.15s, color 0.15s;
}
.lc-dock-arrow:hover { background: var(--lc-soft); color: var(--lc-fg); }
.lc-dock-arrow:disabled { opacity: 0.25; cursor: default; background: transparent !important; }
.lc-strip {
    flex: 1; min-width: 0;
    display: flex; justify-content: flex-start; gap: 2px;
    overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    padding: 6px 2px;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%);
}
.lc-strip::-webkit-scrollbar { display: none; }
.lc-strip-empty { display: flex; align-items: center; gap: 7px; height: 40px; padding: 0 10px; color: var(--lc-muted); font-size: 0.78rem; white-space: nowrap; }
.lc-stu {
    position: relative; overflow: visible;
    flex: none; width: 50px;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 2px 0 0;
    border: none; border-radius: 12px; background: transparent; color: var(--lc-fg);
    will-change: transform;
}
.lc-stu .lc-av { width: 34px; height: 34px; font-size: 0.72rem; border-width: 2px; transition: transform 0.2s cubic-bezier(0.34, 1.6, 0.64, 1), box-shadow 0.25s, filter 0.3s, opacity 0.3s; }
.lc-stu .lc-av::after { width: 9px; height: 9px; right: -2px; bottom: -2px; transition: background 0.3s; }
.lc-stu .lc-hand-badge { width: 18px; height: 18px; right: -7px; top: -8px; font-size: 0.6rem; }
.lc-stu .lc-av.has-hand .lc-hand-badge { animation: lc-hand-in 0.45s cubic-bezier(0.34, 1.8, 0.64, 1), lc-wave 1.4s 0.45s ease-in-out infinite; }
@keyframes lc-hand-in { from { transform: scale(0) rotate(-30deg); } to { transform: scale(1); } }
.lc-stu:hover .lc-av { transform: translateY(-2px); }
.lc-stu:active .lc-av { transform: scale(0.9); }
.lc-stu-name { max-width: 48px; font-size: 0.62rem; font-weight: 700; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.3s; }
/* selected: lifted avatar + underline */
.lc-stu.is-cur .lc-av { transform: translateY(-3px) scale(1.06); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--lc-accent), 0 6px 14px rgba(79, 70, 229, 0.35); }
.lc-stu.is-cur .lc-stu-name { color: var(--lc-accent); }
.lc-stu::after { content: ''; position: absolute; left: 50%; bottom: -5px; width: 0; height: 3px; border-radius: 3px; background: var(--lc-accent); transform: translateX(-50%); transition: width 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); }
.lc-stu.is-cur::after { width: 18px; }
/* offline */
.lc-stu.is-away .lc-av { filter: grayscale(1); opacity: 0.5; border-style: dashed; border-color: #cbd5e1; }
.lc-stu.is-away .lc-av::after { background: #cbd5e1; }
.lc-stu.is-away .lc-stu-name { color: #94a3b8; font-weight: 600; }
/* motion */
.lc-stu.lc-enter { animation: lc-enter 0.38s cubic-bezier(0.34, 1.5, 0.64, 1); }
@keyframes lc-enter { from { opacity: 0; transform: scale(0.5) translateY(8px); } to { opacity: 1; transform: none; } }
.lc-av.lc-came-online { animation: lc-online 0.8s ease-out; }
@keyframes lc-online { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); transform: scale(0.9); } 40% { transform: scale(1.08); } 100% { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); transform: scale(1); } }
.lc-av.lc-hand-up { animation: lc-handup 0.7s cubic-bezier(0.34, 1.6, 0.64, 1); }
@keyframes lc-handup { 0% { transform: translateY(0); } 35% { transform: translateY(-6px); } 100% { transform: translateY(0); } }
.lc-stu.lc-tap::before {
    content: ''; position: absolute; left: var(--rx, 50%); top: var(--ry, 50%);
    width: 8px; height: 8px; border-radius: 50%;
    background: rgba(79, 70, 229, 0.35);
    transform: translate(-50%, -50%) scale(0);
    animation: lc-ripple 0.5s ease-out forwards;
    pointer-events: none;
}
@keyframes lc-ripple { to { transform: translate(-50%, -50%) scale(9); opacity: 0; } }

/* right: compact tools (Done pill while viewing a student) */
.lc-dock-tools { display: flex; align-items: center; justify-content: flex-end; gap: 4px; flex: 0 0 auto; width: 176px; height: 40px; padding-inline-start: 6px; border-inline-start: 1px solid var(--lc-line); }
.lc-tool {
    width: 36px; height: 36px;
    border: none; border-radius: 11px;
    background: transparent; color: var(--lc-muted);
    display: grid; place-items: center; font-size: 0.88rem;
    transition: background 0.15s, color 0.15s, transform 0.12s;
}
.lc-tool:hover { background: var(--lc-soft); color: var(--lc-fg); }
.lc-tool:active { transform: scale(0.9); }
.lc-tool--hand { background: #fef3c7; }
.lc-done {
    display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 14px;
    border: none; border-radius: 11px;
    background: var(--lc-accent); color: #fff;
    font-weight: 700; font-size: 0.82rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
    transition: transform 0.12s, background 0.15s;
}
.lc-done:hover { background: #4338ca; }
.lc-done:active { transform: scale(0.95); }

/* minimised: a LIVE pill where the bar was (bottom centre), never hidden in a corner */
.lc-dock-pill {
    position: fixed;
    left: 50%;
    bottom: calc(82px + env(safe-area-inset-bottom));
    z-index: 2147483300;
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 42px; padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.7); border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2), 0 0 0 1px rgba(15, 23, 42, 0.08);
    color: var(--lc-fg);
    font-size: 0.84rem; font-weight: 700; white-space: nowrap;
    cursor: pointer; touch-action: manipulation;
    transform: translate(-50%, 10px) scale(0.85); opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.2s, box-shadow 0.25s;
}
.lc-dock-pill.show { transform: translate(-50%, 0) scale(1); opacity: 1; }
.lc-dock-pill:hover { transform: translate(-50%, -2px) scale(1.03); }
.lc-dock-pill:active { transform: translate(-50%, 0) scale(0.96); }
.lc-dock-pill b { color: var(--lc-live); letter-spacing: 0.1em; font-size: 0.74rem; }
.lc-dock-pill i { color: var(--lc-muted); }
.lc-dock-pill .lc-dot { width: 8px; height: 8px; }
.lc-dock-pill .lc-pill-sep { width: 1px; height: 16px; background: rgba(15, 23, 42, 0.12); }
.lc-dock-pill .lc-pill-up { margin-inline-start: 2px; color: var(--lc-accent); }
.lc-dock-pill .lc-pill-hand { color: #b45309; font-weight: 800; }
.lc-dock-pill.has-hand { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.5), 0 10px 30px rgba(15, 23, 42, 0.2); }

@media (max-width: 640px) {
    .lc-dock { bottom: calc(74px + env(safe-area-inset-bottom)); height: 56px; padding: 0 4px 0 6px; width: calc(100% - 12px); }
    .lc-dock-lead { flex: 0 0 auto; width: auto; max-width: 130px; padding-inline-end: 6px; }
    .lc-dock:not(.is-viewing) .lc-lead-txt { display: none; }
    .lc-dock.is-viewing .lc-lead-txt b { max-width: 78px; }
    .lc-lead-txt small { display: none; }
    .lc-live-chip { padding: 0 8px; }
    .lc-live-chip .lc-clock { display: none; }
    .lc-dock-arrow { width: 22px; }
    .lc-dock-tools { width: auto; min-width: 0; padding-inline-start: 4px; }
    .lc-tool { width: 32px; height: 32px; }
    .lc-done { padding: 0 11px; }
    .lc-done span { display: none; }
    .lc-dock-pill { bottom: calc(74px + env(safe-area-inset-bottom)); }
}

/* ================================================================
   TEACHER — settings sheet (switches · class code + QR · lower hands · end)
   ================================================================ */
.lc-panel {
    position: fixed;
    right: 16px;
    bottom: calc(230px + env(safe-area-inset-bottom));
    z-index: 2147483000;
    width: 340px;
    max-width: calc(100% - 32px);
    max-height: calc(var(--app-vh, 100vh) - 180px);
    overflow-y: auto;
    padding: 14px;
    border-radius: 24px;
    background: var(--lc-bg);
    border: 1px solid var(--lc-line);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
    display: flex; flex-direction: column; gap: 12px;
    transform: translateY(16px) scale(0.98); opacity: 0;
    transition: transform 0.25s cubic-bezier(0.34, 1.3, 0.64, 1), opacity 0.2s;
}
.lc-panel.show { transform: none; opacity: 1; }
.lc-head { display: flex; align-items: center; gap: 10px; padding: 2px 2px 0 6px; }
.lc-head b { font-size: 0.85rem; letter-spacing: 0.12em; color: var(--lc-live); }
.lc-head .lc-clock { font-variant-numeric: tabular-nums; color: var(--lc-muted); font-weight: 600; font-size: 0.9rem; flex: 1; }

.lc-toggles { display: flex; flex-direction: column; gap: 8px; }
.lc-toggle {
    display: flex; align-items: center; gap: 12px;
    width: 100%; min-height: 60px; padding: 8px 12px;
    border: 1px solid var(--lc-line); border-radius: 16px;
    background: var(--lc-bg); color: var(--lc-fg); text-align: start;
    transition: border-color 0.15s, background 0.15s;
}
.lc-toggle.is-on { border-color: rgba(79, 70, 229, 0.35); background: #eef2ff; }
.lc-toggle-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--lc-soft); color: var(--lc-muted); flex: none; }
.lc-toggle.is-on .lc-toggle-ic { background: var(--lc-accent); color: #fff; }
.lc-toggle-txt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.lc-toggle-txt b { font-size: 0.92rem; }
.lc-toggle-txt small { font-size: 0.75rem; color: var(--lc-muted); line-height: 1.3; }
.lc-switch { width: 50px; height: 30px; border-radius: 999px; background: #cbd5e1; position: relative; flex: none; transition: background 0.2s; }
.lc-switch span { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1); }
.lc-toggle.is-on .lc-switch { background: var(--lc-accent); }
.lc-toggle.is-on .lc-switch span { transform: translateX(20px); }
[dir="rtl"] .lc-toggle.is-on .lc-switch span { transform: translateX(-20px); }

.lc-code { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 14px; background: var(--lc-soft); font-size: 0.8rem; color: var(--lc-muted); }
.lc-qr { width: 92px; height: 92px; flex: none; padding: 4px; border-radius: 12px; background: #fff; cursor: zoom-in; display: grid; place-items: center; border: 1px solid var(--lc-line); }
.lc-qr img, .lc-qr canvas { width: 84px !important; height: 84px !important; }
.lc-code-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lc-code-txt b { font-size: 1.2rem; letter-spacing: 0.25em; color: var(--lc-fg); font-variant-numeric: tabular-nums; }
.lc-code-txt small { font-size: 0.72rem; color: var(--lc-muted); }
.lc-code .lc-icon-btn { background: #fff; width: 40px; height: 40px; }
.lc-end { width: 100%; }

@media (max-width: 640px) {
    .lc-panel {
        left: 0; right: 0; bottom: 0;
        width: 100%; max-width: none;
        border-radius: 24px 24px 0 0;
        padding-bottom: calc(14px + env(safe-area-inset-bottom));
        max-height: 75vh;
    }
}

/* ================================================================
   STUDENT — live pill · write lock · activity · join banner
   ================================================================ */
.lc-student-pill {
    position: fixed;
    top: calc(64px + env(safe-area-inset-top));
    left: 50%;
    z-index: 2147482000;
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.88);
    color: #fff;
    font-size: 0.82rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    white-space: nowrap;
    max-width: calc(100% - 24px);
    transform: translate(-50%, -16px); opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}
.lc-student-pill.show { transform: translate(-50%, 0); opacity: 1; }
.lc-student-pill.has-action { pointer-events: auto; }
.lc-student-pill b { letter-spacing: 0.06em; color: #fecaca; }
.lc-student-pill.is-down b { color: #fde68a; }
.lc-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); font-weight: 600; }
.lc-chip--off { background: rgba(245, 158, 11, 0.25); color: #fde68a; }
.lc-chip--rejoin { border: none; cursor: pointer; background: #4f46e5; color: #fff; font: inherit; font-weight: 700; }
@media (max-width: 520px) { .lc-chip { font-size: 0.72rem; } }

/* writing paused: transparent sheet over the board + dimmed drawing tools */
.lc-write-blocker { position: absolute; inset: 0; z-index: 50; cursor: not-allowed; background: transparent; touch-action: none; }
body.lc-write-off #mainToolbar .tool-btn:not(#tool-select):not(#tool-pan):not(.mini) { opacity: 0.4; }

/* an activity inside the live lesson (iframe only, no header) */
.lc-activity {
    position: fixed; top: 0; left: 0;
    width: var(--app-vw, 100vw); height: var(--app-vh, 100vh);
    z-index: 2147483400;
    display: flex; flex-direction: column;
    background: #0f172a;
    opacity: 0; transform: translateY(14px);
    transition: opacity 0.2s, transform 0.25s;
}
.lc-activity.show { opacity: 1; transform: none; }
.lc-act-frame { flex: 1; width: 100%; height: 100%; border: 0; background: #fff; }
body.lc-in-activity .lc-student-pill, body.lc-in-activity #lc-write-blocker { display: none !important; }

/* "Your teacher is live — Join" (library / another lesson) */
.lc-join-banner {
    position: fixed;
    left: 50%; bottom: calc(18px + env(safe-area-inset-bottom));
    z-index: 2147483300;
    width: min(440px, calc(100% - 32px));
    display: flex; align-items: center; gap: 12px;
    padding: 12px 12px 12px 16px;
    border-radius: 20px;
    background: #0f172a; color: #fff;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    transform: translate(-50%, 140%);
    transition: transform 0.4s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.lc-join-banner.show { transform: translate(-50%, 0); }
.lc-jb-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.lc-jb-text b { font-size: 0.98rem; color: #fff; }
.lc-jb-text small { color: #cbd5e1; font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .lc-dot, .lc-av.is-writing, .lc-hand-badge, #btn-live-class.is-live i, #btn-raise-hand.is-raised i,
    .lc-stu, .lc-stu .lc-av, .lc-dock-lead, .lc-av.has-hand .lc-hand-badge { animation: none !important; transition: none !important; }
    .lc-panel, .lc-dock, .lc-dock-pill, .lc-join-banner, .lc-student-pill, .lc-activity { transition: none; }
}
