/* ═══════════════════════════════════════════════════════════════
   ACADEMIST Live — lobby, pre-join and room
   ═══════════════════════════════════════════════════════════════ */

/* ══════════════ LOBBY ══════════════ */
.join-row {
  display: flex; gap: 10px; max-width: 520px;
  margin-top: 26px; position: relative; z-index: 2;
}
.join-row .input {
  background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.24);
  color: #fff; font-family: var(--mono); letter-spacing: .04em; font-size: .86rem;
}
.join-row .input::placeholder { color: rgba(255,255,255,.55); font-family: var(--font); letter-spacing: 0; }
.join-row .input:focus {
  background: rgba(255,255,255,.18); border-color: var(--su);
  box-shadow: 0 0 0 3px rgba(250,204,21,.2);
}

.meet-cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 36px; align-items: start; }
@media (max-width: 900px) { .meet-cols { grid-template-columns: 1fr; } }

.host-actions { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .host-actions { grid-template-columns: 1fr; } }

.host-card {
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--r-lg); padding: 22px; text-align: left;
  cursor: pointer; font-family: var(--font);
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.host-card:hover { transform: translateY(-3px); box-shadow: var(--sh-lg); border-color: var(--ac); }
.host-card .el { margin-bottom: 14px; }
.host-card b { display: block; font-size: .95rem; font-weight: 800; margin-bottom: 5px; }
.host-card span { font-size: .79rem; color: var(--muted); line-height: 1.5; }

.meeting-row {
  display: flex; align-items: center; gap: 13px;
  padding: 14px; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--surface); margin-bottom: 10px;
}
.meeting-row .m-info { flex: 1; min-width: 0; }
.meeting-row .m-info b { display: block; font-size: .86rem; font-weight: 800; }
.meeting-row .m-info span { font-size: .73rem; color: var(--muted); }
.meeting-row .m-actions { display: flex; gap: 6px; flex-shrink: 0; }
@media (max-width: 560px) {
  .meeting-row { flex-wrap: wrap; }
  .meeting-row .m-actions { width: 100%; }
  .meeting-row .m-actions .btn { flex: 1; }
}

.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li {
  font-size: .8rem; color: var(--ink-2); padding: 7px 0 7px 24px;
  position: relative; line-height: 1.5;
}
.check-list li::before {
  content: '✓'; position: absolute; left: 0; top: 6px;
  color: var(--mg); font-weight: 900; font-size: .84rem;
}

.test-video {
  width: 100%; aspect-ratio: 16/9; background: #111827;
  border-radius: var(--r); object-fit: cover; transform: scaleX(-1);
}
.mic-meter {
  height: 8px; background: var(--surface-2); border-radius: 4px;
  overflow: hidden; margin-top: 12px;
}
.mic-meter div {
  height: 100%; width: 0; background: linear-gradient(90deg, var(--mg), var(--su), var(--io));
  transition: width .08s linear;
}

/* ══════════════ PRE-JOIN ══════════════ */
.room-body { background: #0B1120; min-height: 100vh; }

.prejoin {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 26px 18px; background:
    radial-gradient(900px 480px at 18% -10%, rgba(124,58,237,.28), transparent 62%),
    radial-gradient(760px 420px at 88% 108%, rgba(20,184,166,.2), transparent 60%),
    #0B1120;
}
.prejoin.hidden { display: none; }

.prejoin-card {
  width: 100%; max-width: 430px; background: #131C2E;
  border: 1px solid rgba(255,255,255,.1); border-radius: var(--r-xl);
  padding: 28px; color: #fff; box-shadow: 0 30px 70px rgba(0,0,0,.5);
}
.prejoin-brand {
  display: flex; align-items: center; gap: 10px; margin-bottom: 22px;
  color: rgba(255,255,255,.85); font-weight: 800; letter-spacing: .05em; font-size: .92rem;
}
.prejoin-brand b { color: var(--su); font-weight: 800; }
.prejoin-card h1 { font-size: 1.3rem; font-weight: 800; margin: 0 0 5px; line-height: 1.25; }
.prejoin-card .muted { color: rgba(255,255,255,.55) !important; }
.prejoin-card .field label { color: rgba(255,255,255,.72); }
.prejoin-card .input, .prejoin-card .select {
  background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.16); color: #fff;
}
.prejoin-card .input::placeholder { color: rgba(255,255,255,.35); }
.prejoin-card .input:focus, .prejoin-card .select:focus {
  border-color: var(--dy); box-shadow: 0 0 0 3px rgba(124,58,237,.28);
}
.prejoin-card .spinner { border-color: rgba(255,255,255,.16); border-top-color: var(--dy); }

.pj-preview {
  position: relative; aspect-ratio: 16/10; border-radius: var(--r);
  overflow: hidden; background: #0B1120; margin: 18px 0;
}
.pj-preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.pj-off {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  background: #0B1120; color: rgba(255,255,255,.6);
}
.pj-off.hidden { display: none; }
.pj-toggles {
  position: absolute; bottom: 11px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 9px;
}

/* ══════════════ THE ROOM ══════════════ */
.room {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh; background: #0B1120; color: #fff;
}
.room.hidden { display: none; }

.room-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 11px clamp(12px, 3vw, 22px);
  background: #131C2E; border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.room-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.room-id strong {
  display: block; font-size: .88rem; font-weight: 800;
  max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.code-copy {
  background: none; border: 0; color: rgba(255,255,255,.5);
  font-size: .7rem; cursor: pointer; padding: 2px 0;
  font-family: var(--mono); letter-spacing: .03em;
}
.code-copy:hover { color: var(--su); }
.room-top-right { display: flex; align-items: center; gap: 8px; }
.room-timer { font-size: .78rem; color: rgba(255,255,255,.55); margin-right: 4px; }

.rbtn {
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12);
  color: #fff; border-radius: 11px; cursor: pointer;
  font-family: var(--font); font-size: .95rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  width: 44px; height: 44px; position: relative;
  transition: background .15s, border-color .15s;
}
.rbtn:hover { background: rgba(255,255,255,.19); }
.rbtn.off { background: var(--danger); border-color: var(--danger); }
.rbtn.on  { background: var(--dy); border-color: var(--dy); }
.rbtn.rbtn-sm { width: 40px; height: 40px; font-size: .88rem; }
.rbtn.rbtn-lg {
  width: 62px; height: 54px; flex-direction: column; gap: 2px; border-radius: 13px;
}
.rbtn.rbtn-lg small { font-size: .55rem; font-weight: 700; letter-spacing: .04em; opacity: .8; }
.rbtn.rbtn-lg span { font-size: 1.05rem; line-height: 1; }
.rbtn-count {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px;
  border-radius: 9px; background: var(--io); color: #fff;
  font-size: .6rem; font-weight: 800; display: flex;
  align-items: center; justify-content: center; padding: 0 4px;
}
.rbtn.recording { background: var(--danger); border-color: var(--danger); animation: pulse 1.5s infinite; }

.room-main { flex: 1; display: flex; min-height: 0; }

.stage { flex: 1; padding: 12px; min-width: 0; position: relative; overflow: hidden; }

.video-grid {
  display: grid; gap: 10px; height: 100%;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-content: center;
}
.video-grid.solo { grid-template-columns: minmax(0, 1fr); }
.video-grid.many { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.video-grid.spotlight { grid-template-columns: 1fr; grid-auto-rows: minmax(0, 1fr); }

.tileit {
  position: relative; background: #131C2E; border-radius: var(--r);
  overflow: hidden; aspect-ratio: 16/9; min-height: 0;
  border: 2px solid transparent; transition: border-color .2s;
}
.tileit.speaking { border-color: var(--mg); }
.tileit.pinned { grid-column: 1 / -1; aspect-ratio: auto; min-height: 46vh; }
.tileit video { width: 100%; height: 100%; object-fit: cover; display: block; background: #0B1120; }
.tileit video.mirror { transform: scaleX(-1); }
.tileit.sharing video { object-fit: contain; background: #05080F; }

.tile-off {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 9px; background: #131C2E;
}
.tile-name {
  position: absolute; left: 8px; bottom: 8px; right: 8px;
  display: flex; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 700;
  background: rgba(11,17,32,.72); backdrop-filter: blur(6px);
  padding: 4px 9px; border-radius: 7px; width: fit-content; max-width: calc(100% - 16px);
}
.tile-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-badges { position: absolute; top: 8px; right: 8px; display: flex; gap: 5px; }
.tile-badges span {
  width: 25px; height: 25px; border-radius: 7px;
  background: rgba(11,17,32,.75); display: flex;
  align-items: center; justify-content: center; font-size: .72rem;
}
.tile-badges span.warn { background: var(--danger); }
.tile-connecting {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(11,17,32,.7); font-size: .74rem; color: rgba(255,255,255,.7); gap: 8px;
}

.net-warning {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: var(--io); color: #fff; padding: 8px 16px; border-radius: 100px;
  font-size: .74rem; font-weight: 700; box-shadow: var(--sh-lg); z-index: 5;
}
.net-warning.hidden { display: none; }

/* ── Side panel ───────────────────────────────────────────────── */
.side-panel {
  width: 312px; flex-shrink: 0; background: #131C2E;
  border-left: 1px solid rgba(255,255,255,.08);
  display: none; flex-direction: column; min-height: 0;
}
.side-panel.open { display: flex; }
@media (max-width: 780px) {
  .side-panel.open {
    position: fixed; inset: 56px 0 82px 0; width: auto; z-index: 40;
    border-left: 0; border-top: 1px solid rgba(255,255,255,.08);
  }
}

.side-tabs {
  display: flex; align-items: center; gap: 2px; padding: 8px;
  border-bottom: 1px solid rgba(255,255,255,.08); flex-shrink: 0;
}
.side-tab {
  flex: 1; background: none; border: 0; color: rgba(255,255,255,.5);
  padding: 9px; border-radius: 8px; cursor: pointer;
  font-family: var(--font); font-size: .76rem; font-weight: 700;
}
.side-tab.on { background: rgba(255,255,255,.1); color: #fff; }
.side-close {
  background: none; border: 0; color: rgba(255,255,255,.45);
  cursor: pointer; font-size: .9rem; width: 32px; height: 32px; border-radius: 8px;
}
.side-close:hover { background: rgba(255,255,255,.1); color: #fff; }

.side-body { flex: 1; overflow-y: auto; padding: 12px; min-height: 0; }
.side-body.hidden { display: none; }
.side-body h5 {
  font-size: .64rem; font-weight: 800; letter-spacing: .14em;
  text-transform: uppercase; color: rgba(255,255,255,.4); margin: 18px 0 9px;
}

.person {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 9px; margin-bottom: 3px;
}
.person:hover { background: rgba(255,255,255,.06); }
.person .p-name { flex: 1; min-width: 0; }
.person .p-name b {
  display: block; font-size: .78rem; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.person .p-name span { font-size: .65rem; color: rgba(255,255,255,.45); }
.person .p-icons { display: flex; gap: 4px; font-size: .74rem; flex-shrink: 0; }
.person .p-menu {
  background: rgba(255,255,255,.1); border: 0; color: #fff;
  width: 26px; height: 26px; border-radius: 7px; cursor: pointer; font-size: .7rem;
}

.waiting-card {
  background: rgba(250,204,21,.12); border: 1px solid rgba(250,204,21,.3);
  border-radius: 10px; padding: 11px; margin-bottom: 9px;
}
.waiting-card b { font-size: .78rem; display: block; margin-bottom: 7px; }
.waiting-card .btn { flex: 1; }

.host-tools {
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.host-tools.hidden { display: none; }
.host-tools .btn-ghost {
  background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.14); color: #fff;
}
.host-tools .btn-ghost:hover { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.25); }

/* ── Chat ─────────────────────────────────────────────────────── */
#panelChat { display: flex; flex-direction: column; padding: 0; }
.chat-log { flex: 1; overflow-y: auto; padding: 12px; min-height: 0; }
.chat-msg { margin-bottom: 13px; }
.chat-msg .c-head {
  display: flex; align-items: baseline; gap: 7px; margin-bottom: 3px;
}
.chat-msg .c-head b { font-size: .73rem; font-weight: 800; }
.chat-msg .c-head time { font-size: .62rem; color: rgba(255,255,255,.35); }
.chat-msg p {
  margin: 0; font-size: .8rem; line-height: 1.5;
  color: rgba(255,255,255,.85); word-break: break-word;
}
.chat-msg.mine .c-head b { color: var(--ca); }
.chat-sys {
  text-align: center; font-size: .68rem; color: rgba(255,255,255,.38);
  margin: 9px 0; font-style: italic;
}
.chat-form {
  display: flex; gap: 7px; padding: 11px;
  border-top: 1px solid rgba(255,255,255,.08); flex-shrink: 0;
}
.chat-form .input {
  background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.14);
  color: #fff; padding: 10px 12px; font-size: .8rem;
}
.chat-form .input::placeholder { color: rgba(255,255,255,.35); }

/* ── Control bar ──────────────────────────────────────────────── */
.room-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 11px clamp(12px, 3vw, 22px);
  padding-bottom: max(11px, env(safe-area-inset-bottom));
  background: #131C2E; border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.bar-group { display: flex; gap: 8px; flex: 1; justify-content: center; flex-wrap: wrap; }
@media (max-width: 560px) {
  .rbtn.rbtn-lg { width: 54px; height: 48px; }
  .rbtn.rbtn-lg small { display: none; }
  .room-bar { gap: 8px; }
}

/* ── Ended screen ─────────────────────────────────────────────── */
.ended-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px;
}
.ended-stats div {
  background: rgba(255,255,255,.06); border-radius: 10px; padding: 13px;
}
.ended-stats b { display: block; font-size: 1.2rem; font-weight: 900; }
.ended-stats span { font-size: .66rem; color: rgba(255,255,255,.5); text-transform: uppercase; letter-spacing: .1em; }
