:root {
  --bg: #eef1fb;
  --surface: #ffffff;
  --border: #e2e6f3;
  --text: #1a1c2b;
  --muted: #6b7194;
  --brand: #6c4ff6;
  --brand-dark: #5a3ee0;
  --danger: #f0563f;
  --ok: #2bbf6a;
  --warn: #e8a33d;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(26, 28, 43, 0.06), 0 8px 24px rgba(26, 28, 43, 0.06);
}

* { box-sizing: border-box; }

/* The view containers below set display:flex/grid, and any author rule beats
   the user-agent [hidden] rule — so toggling .hidden in JS did nothing and the
   lobby stayed on screen with the call view stacked underneath it. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }

/* --------------------------------- shared -------------------------------- */

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand-mark { font-size: 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn.ghost:hover { background: #f4f6fd; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #d8452f; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }

.field { display: block; margin-bottom: 11px; }
.field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.input {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  outline: none;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(108, 79, 246, 0.12); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.alert {
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 14px;
}
.alert.error { background: #fdecea; color: #a3271a; }
.alert.ok { background: #e7f7ee; color: #14713f; }
.alert.info { background: #eef1fb; color: #3d4468; }

.hint { font-size: 13px; color: var(--muted); }
.empty { padding: 34px; text-align: center; color: var(--muted); }

/* Marks anything that is a played-back clip rather than a live person. */
.rec-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(240, 86, 63, 0.12);
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.rec-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
}

/* ---------------------------------- auth --------------------------------- */

.auth-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card { width: 100%; max-width: 380px; padding: 30px; }
.auth-card h1 { margin: 14px 0 4px; font-size: 21px; }
.auth-card p.sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }

/* --------------------------------- panel --------------------------------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 18px 18px 48px; }

.grid2 { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

.panel-section { padding: 16px; margin-bottom: 16px; }
.panel-section h2 {
  margin: 0 0 3px;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.panel-section .sub { margin: 0 0 14px; font-size: 12.5px; color: var(--muted); }

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid var(--border);
}

/* Square icon buttons keep the action cluster on one line. */
.icon-btn {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.13s, border-color 0.13s;
}
.icon-btn:hover { background: #f4f6fd; border-color: #cdd4ec; }
.icon-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.icon-btn.primary:hover { background: var(--brand-dark); }
.icon-btn.danger:hover { background: #fdecea; border-color: #f3c2ba; }
.icon-btn.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.icon-row { display: flex; gap: 6px; flex: none; align-items: center; }
.row:first-of-type { border-top: none; }
.row .grow { flex: 1; min-width: 0; }
.row strong { display: block; }

.linkbox {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 7px;
}
.linkbox input {
  flex: 1;
  min-width: 0;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8f9fe;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: var(--muted);
}
.linkbox select { padding: 6px 9px !important; font-size: 12.5px !important; }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: #f0f2fa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.tag.live { background: #e7f7ee; color: var(--ok); }
.tag.expired { background: #fdecea; color: var(--danger); }

.thumb {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: #12131c;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  flex: none;
}

/* --------------------------------- studio --------------------------------- */

.studio { border-color: #d9d2ff; box-shadow: 0 1px 2px rgba(26,28,43,.06), 0 10px 30px rgba(108,79,246,.10); }

.studio-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.studio-head-right { display: flex; align-items: center; gap: 9px; flex: none; }

.onair {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #f0f2fa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.onair::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.onair.live { background: rgba(240,86,63,.12); color: var(--danger); }
.onair.live::before { background: var(--danger); animation: rec-pulse 1.6s ease-in-out infinite; }

.studio-now {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfaff;
  margin-bottom: 20px;
}
.studio-now-title { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }

.scrub {
  height: 8px;
  border-radius: 999px;
  background: #e4e7f4;
  cursor: pointer;
  overflow: hidden;
}
.scrub > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #8b6dff);
  transition: width 0.25s linear;
}

.studio-times {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0 14px;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.transport { display: flex; gap: 8px; flex-wrap: wrap; }
.transport .btn { padding: 8px 13px; font-size: 13px; }

.studio-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 13px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.studio-loop { display: flex; align-items: center; gap: 6px; cursor: pointer; }

.studio-sub { margin: 0 0 2px; font-size: 14px; }

.clip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}
.clip:first-child { border-top: none; }
.clip .grow { flex: 1; min-width: 0; }
.clip strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip.on { background: #f5f2ff; border-radius: 10px; padding: 11px 12px; border-top-color: transparent; }

.tag.playing { background: rgba(240,86,63,.12); color: var(--danger); }
.tag.completed { background: #e7f7ee; color: var(--ok); }
.tag.partial { background: #fff5e6; color: var(--warn); }

.uploader {
  border: 1.5px dashed var(--border);
  border-radius: 11px;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.uploader:hover, .uploader.drag { border-color: var(--brand); background: #f7f5ff; }

.bar {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  margin-top: 12px;
}
.bar > i { display: block; height: 100%; background: var(--brand); width: 0; transition: width 0.2s; }

/* ---------------------------------- room --------------------------------- */

/* Pinned to the viewport rather than laid out in the document: otherwise
   focusing the chat input scrolls the whole page on a phone and drags the
   header and tiles out of view. dvh tracks the real viewport as mobile browser
   chrome hides and shows; vh is the fallback. */
.room-body {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.room-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex: none;
}
.room-title { display: flex; align-items: baseline; gap: 10px; }
.room-title .name { color: var(--muted); font-size: 14px; }

.timer {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #f0f2fa;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 14px;
}
.timer::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}

/* positioned so the chat rail can overlay it on small screens instead of
   escaping to the page and shoving the header out of the way */
.room-main { flex: 1; display: flex; min-height: 0; position: relative; }

.stage {
  flex: 1;
  display: grid;
  place-content: center;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  padding: 22px;
  overflow: auto;
  align-content: center;
}
.stage.count-1 { grid-template-columns: minmax(280px, 760px); }
.stage.count-2 { grid-template-columns: repeat(2, minmax(260px, 1fr)); }
@media (max-width: 820px) {
  .stage, .stage.count-1, .stage.count-2 { grid-template-columns: 1fr; }
}

.tile {
  position: relative;
  background: #0d0e16;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  box-shadow: var(--shadow);
}
/* A grid item stretches by default, which flattened portrait clips into a
   sliver. Centring it lets the width derive from the height via the ratio. */
.tile.portrait {
  aspect-ratio: 9 / 16;
  /* Kept near the height of a 16:9 tile so a portrait clip sitting beside
     landscape webcams doesn't stretch its grid row way out of line. */
  height: min(56vh, 440px);
  width: auto;
  max-width: 100%;
  justify-self: center;
  align-self: center;
}
.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #0d0e16;
}
/* Portrait clips are letterboxed rather than cropped so nothing is cut off. */
.tile.portrait video, .tile.contain video { object-fit: contain; }
.tile.mirror video { transform: scaleX(-1); }

/* ---------------------- spotlight (phone-call) layout --------------------- */

/* Phones only. On a wide screen there's room to show everyone side by side, so
   the stage stays a grid there and these rules never apply — layout() still
   tags the tiles, the styling just doesn't kick in until the viewport is
   narrow. */
@media (max-width: 900px) {

.stage.spotlight {
  display: block;
  position: relative;
  padding: 0;
  overflow: hidden;
  --float-w: 148px;
  --float-h: 198px;
}

/* The person (or clip) you're here to see fills the whole area. */
.stage.spotlight .tile.primary {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  border-radius: 0;
  box-shadow: none;
  aspect-ratio: auto;
}
.stage.spotlight .tile.primary video { object-fit: cover; }
/* A recording is never cropped — letterbox it instead of cutting the frame. */
.stage.spotlight .tile.primary.portrait video,
.stage.spotlight .tile.primary.contain video { object-fit: contain; }

/* You, and any extra participants, stack up from the bottom-right corner. */
.stage.spotlight .tile.self-float,
.stage.spotlight .tile.secondary {
  position: absolute;
  right: 14px;
  bottom: calc(14px + var(--slot, 0) * (var(--float-h) + 10px));
  width: var(--float-w);
  height: var(--float-h);
  max-width: none;
  aspect-ratio: auto;
  border-radius: 13px;
  box-shadow: 0 6px 22px rgba(13, 14, 22, 0.4);
  z-index: 4;
}
.stage.spotlight .tile.self-float video,
.stage.spotlight .tile.secondary video { object-fit: cover; }

.stage.spotlight .tile.self-float .tile-label,
.stage.spotlight .tile.secondary .tile-label {
  font-size: 11px;
  padding: 3px 7px;
  left: 7px;
  bottom: 7px;
}
.stage.spotlight .tile.self-float .avatar,
.stage.spotlight .tile.secondary .avatar { width: 46px; height: 46px; font-size: 17px; }
.stage.spotlight .tile.self-float .tile-placeholder,
.stage.spotlight .tile.secondary .tile-placeholder { font-size: 11px; gap: 6px; padding: 8px; }

} /* end spotlight — phones only */

.tile-label {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 8px;
  background: rgba(13, 14, 22, 0.72);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(6px);
  /* Truncate rather than wrap — a long clip name used to cover the tile. */
  max-width: calc(100% - 24px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tile-label .mic-off { color: #ff8f7d; }

.tile-rec {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(240, 86, 63, 0.92);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.tile-rec::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: rec-pulse 1.6s ease-in-out infinite;
}
@keyframes rec-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.tile-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #6a708f;
  font-size: 13px;
  gap: 10px;
  text-align: center;
  padding: 20px;
}
.avatar {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: #232637;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 27px;
  font-weight: 600;
}

/* ------------------------------- chat rail ------------------------------- */

.rail {
  width: 330px;
  flex: none;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.rail.hidden { display: none; }
.rail-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rail-scroll { flex: 1; overflow-y: auto; padding: 14px 18px; }

.msg { margin-bottom: 14px; }
.msg .who { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.msg .body {
  background: #f4f6fd;
  padding: 8px 12px;
  border-radius: 12px;
  border-top-left-radius: 3px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.msg.mine .who { text-align: right; }
.msg.mine .body {
  background: var(--brand);
  color: #fff;
  border-top-left-radius: 12px;
  border-top-right-radius: 3px;
}
.msg.sys {
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  background: #f8f9fe;
  padding: 6px 10px;
  border-radius: 8px;
}

.rail-form {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}
.rail-form input {
  flex: 1;
  min-width: 0;
  padding: 11px 15px;
  border: 1px solid var(--border);
  border-radius: 999px;
  outline: none;
}
.rail-form input:focus { border-color: var(--brand); }
.rail-form button {
  width: 42px;
  height: 42px;
  flex: none;
  border: none;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

/* ------------------------------ control dock ----------------------------- */

.dock {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  position: relative;
}
.dock-btn {
  width: 54px;
  height: 54px;
  border: none;
  border-radius: 50%;
  background: #f0f2fa;
  font-size: 20px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, transform 0.1s;
}
.dock-btn:hover { transform: translateY(-1px); }
.dock-btn.on { background: var(--brand); color: #fff; }
.dock-btn.off { background: #fdecea; }
.dock-btn.leave { background: var(--danger); color: #fff; }

.host-dock {
  position: absolute;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fbfbff;
}
/* ------------------------------- responsive ------------------------------ */

/* Tablet / small laptop: the host transport can't stay pinned to the right. */
@media (max-width: 1024px) {
  .host-dock { position: static; }
}

/* Phones. The rail overlays the video area (its ancestor is positioned), the
   dock stays a single row, and tiles get a sane portrait size. */
@media (max-width: 640px) {
  .room-top { padding: 10px 14px; }
  .room-title { gap: 7px; flex-wrap: wrap; }
  .room-title .name { font-size: 13px; }
  .timer { padding: 4px 10px; font-size: 13px; }

  .stage { padding: 12px; gap: 12px; align-content: start; }
  .stage.spotlight { padding: 0; --float-w: 96px; --float-h: 132px; }
  .stage.spotlight .tile.self-float,
  .stage.spotlight .tile.secondary { right: 10px; bottom: calc(10px + var(--slot, 0) * (var(--float-h) + 8px)); }
  .tile { border-radius: 13px; }
  .tile.portrait { height: min(52vh, 420px); }
  .tile-label { font-size: 12px; padding: 4px 9px; left: 9px; bottom: 9px; }
  .tile-rec { font-size: 11px; padding: 4px 9px; top: 9px; left: 9px; }
  .avatar { width: 58px; height: 58px; font-size: 21px; }

  .rail { position: absolute; inset: 0; width: auto; z-index: 20; border-left: none; }
  .rail-head { padding: 13px 15px; }
  .rail-scroll { padding: 12px 15px; }
  .rail-form { padding: 11px 15px; }

  .dock { gap: 9px; padding: 10px 12px; flex-wrap: nowrap; }
  .dock-btn { width: 48px; height: 48px; font-size: 18px; }
  /* Icon-only transport so the row still fits beside the call controls. */
  .host-dock { gap: 5px; padding: 5px 7px; margin-left: 4px; }
  .host-dock .rec-badge { display: none; }
  .host-dock .btn { padding: 6px 9px; font-size: 12px; }

  .wrap { padding: 16px 13px 44px; }
  .panel-section { padding: 16px; }
  .top { padding: 12px 14px; }

  /* Stack each room's details above its action buttons instead of squeezing. */
  .row { flex-wrap: wrap; }
  .row .grow { flex-basis: 100%; }
  .row > div:last-child { flex-direction: row !important; width: 100%; }
  .row > div:last-child > * { flex: 1; }

  .lobby { padding: 18px; }
  .auth-card { padding: 22px; }
  .notice { padding: 11px 12px; font-size: 13px; }
}

/* Phone held sideways: very little height, so shrink the chrome and let the
   tiles sit side by side. */
@media (max-height: 480px) and (orientation: landscape) {
  .room-top { padding: 6px 14px; }
  .stage { padding: 8px; gap: 8px; }
  .tile.portrait { height: min(70vh, 300px); }
  .dock { padding: 6px; gap: 8px; }
  .dock-btn { width: 40px; height: 40px; font-size: 16px; }
}

/* Touch devices don't hover; the lift on tap just looks like a glitch. */
@media (hover: none) {
  .dock-btn:hover { transform: none; }
}

/* --------------------------------- lobby --------------------------------- */

.lobby-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.lobby { width: 100%; max-width: 860px; padding: 26px; }
.lobby-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 26px; align-items: center; }
@media (max-width: 760px) { .lobby-grid { grid-template-columns: 1fr; } }

.preview {
  position: relative;
  background: #0d0e16;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }

.notice {
  display: flex;
  gap: 11px;
  padding: 13px 15px;
  border-radius: 12px;
  background: #fff7ed;
  border: 1px solid #f6dfc0;
  color: #8a5a1b;
  font-size: 13.5px;
  line-height: 1.5;
  margin: 16px 0;
}
.notice .ico { font-size: 16px; line-height: 1.3; }

/* ---------------------------- monitoring notice --------------------------- */

/* Deliberately loud and not dismissible — it is the only signal a participant
   has that their camera is being previewed from the panel. */
.monitor-banner {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  background: #fff4e5;
  border-bottom: 1px solid #f3ddba;
  color: #8a5a1b;
  font-size: 13.5px;
  line-height: 1.4;
}
.monitor-banner .eye { font-size: 16px; flex: none; }
@media (max-width: 640px) {
  .monitor-banner { padding: 8px 12px; font-size: 12.5px; gap: 8px; }
}

/* ------------------------------- clip picker ------------------------------ */

.clip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(94px, 1fr));
  gap: 7px;
  max-height: 230px;
  overflow-y: auto;
  padding: 3px;
}
.clip-card {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 7px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: border-color .13s, background .13s;
  min-width: 0;
}
.clip-card:hover { border-color: #c3c9e8; background: #fafbff; }
.clip-card.sel { border-color: var(--brand); background: #f5f2ff; }
.clip-card .ratio {
  display: block;
  border-radius: 6px;
  background: #12131c;
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  text-align: center;
  padding: 9px 0;
  margin-bottom: 5px;
}
.clip-card .nm {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clip-card .mt { display: block; font-size: 10.5px; color: var(--muted); }

/* --------------------------------- paging --------------------------------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
}
.pager-btns { display: flex; gap: 6px; }

.toolbar { display: flex; gap: 7px; align-items: center; margin-bottom: 12px; }
.toolbar input {
  flex: 1;
  min-width: 0;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  font-size: 13px;
}
.toolbar input:focus { border-color: var(--brand); }

.room-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pinned-mark { color: var(--brand); flex: none; }

/* ------------------------------ live preview ------------------------------ */

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.pv {
  position: relative;
  border-radius: 9px;
  overflow: hidden;
  background: #12131c;
  aspect-ratio: 16 / 9;
}
.pv img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv .nm {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 3px 6px;
  background: linear-gradient(transparent, rgba(13,14,22,.85));
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pv .waiting {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #6a708f;
  font-size: 10.5px;
  text-align: center;
  padding: 6px;
}
.pv-note {
  margin-top: 9px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: flex-start;
  gap: 7px;
}
