/* eResonate — meet.css · the meeting room
   ────────────────────────────────────────────────────────────────────────
   A call takes the whole screen. Not a modal over the feed: the moment a
   person is on camera, everything behind it is a distraction and a privacy
   hazard — a DM arriving over someone's shoulder while they're being watched
   by nine people.

   The grid sizes itself off a tile count the script writes onto the stage
   (data-n), rather than auto-fit, because a call wants tiles that get SMALLER
   as people arrive, not a second row of half-empty columns. */

body.mt-open { overflow: hidden; }

.mt-room {
  position: fixed; inset: 0; z-index: 900;
  display: flex; flex-direction: column;
  background: #05070F;
  color: var(--text, #F2F4FC);
  font-family: 'DM Sans', system-ui, sans-serif;
}

/* ── the bar ── */
.mt-bar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.02);
  flex: none;
}
.mt-title { min-width: 0; flex: 1; }
.mt-title b {
  display: block; font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 0.98rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mt-count { font-size: 0.74rem; color: var(--text-muted, #8A90B8); }
.mt-clock {
  font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted, #8A90B8);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 7px;
  padding: 0.2rem 0.55rem; flex: none;
}
/* The last two minutes are the only time this needs to be noticed. */
.mt-clock.mt-low { color: #FFC773; border-color: rgba(255, 199, 115, 0.45); background: rgba(255, 199, 115, 0.08); }

/* ── a shared screen ── */
.mt-screen { position: relative; flex: 1 1 62%; min-height: 0; background: #000; }
.mt-screen video { width: 100%; height: 100%; object-fit: contain; display: block; }
.mt-sharer {
  position: absolute; left: 12px; bottom: 12px;
  font-size: 0.72rem; font-weight: 600;
  background: rgba(0, 0, 0, 0.6); color: #E6ECFA;
  padding: 0.22rem 0.6rem; border-radius: 6px;
}

/* ── the grid ── */
.mt-stage {
  flex: 1 1 auto; min-height: 0;
  display: grid; gap: 8px; padding: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: center;
}
.mt-stage[data-n="1"] { grid-template-columns: minmax(0, 1fr); }
.mt-stage[data-n="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mt-stage[data-n="3"], .mt-stage[data-n="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mt-stage[data-n="5"], .mt-stage[data-n="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mt-stage[data-n="7"], .mt-stage[data-n="8"], .mt-stage[data-n="9"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mt-stage[data-n="10"], .mt-stage[data-n="11"], .mt-stage[data-n="12"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* While a screen is up the people shrink to a strip along the bottom. */
.mt-room .mt-screen:not([hidden]) ~ .mt-stage {
  flex: 0 0 132px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 180px));
  align-content: start; justify-content: center;
  overflow-x: auto;
}

.mt-tile {
  position: relative; min-width: 0; min-height: 0;
  border-radius: 13px; overflow: hidden;
  background: #0B1020;
  border: 1px solid rgba(255, 255, 255, 0.07);
  aspect-ratio: 16 / 10;
  transition: border-color 0.18s, box-shadow 0.18s;
}
/* Who is talking, without a badge shouting about it. */
.mt-tile.mt-speaking {
  border-color: rgba(62, 224, 140, 0.75);
  box-shadow: 0 0 0 1px rgba(62, 224, 140, 0.4);
}
.mt-tile video.mt-cam {
  width: 100%; height: 100%; object-fit: cover; display: block;
  /* Your own picture is mirrored, everyone else's is not. Seeing yourself
     un-mirrored is quietly unsettling; seeing someone else mirrored makes
     their text backwards. */
  background: #0B1020;
}
.mt-tile.mt-me video.mt-cam { transform: scaleX(-1); }
.mt-tile.mt-nocam video.mt-cam { display: none; }

.mt-face {
  position: absolute; inset: 0; margin: auto;
  width: 64px; height: 64px; border-radius: 50%;
  display: none; place-items: center;
  font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 1.3rem; color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.mt-tile.mt-nocam .mt-face { display: grid; }

.mt-name {
  position: absolute; left: 8px; bottom: 8px; right: 8px;
  display: flex; align-items: center; gap: 5px;
  font-size: 0.74rem; font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}
.mt-name b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-hand { flex: none; }

/* A thin loudness bar under each tile — legible at a glance, and it keeps
   working for someone who cannot hear the call. */
.mt-level { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: transparent; }
.mt-level i {
  display: block; height: 100%; background: var(--money, #3EE08C);
  transform: scaleX(0); transform-origin: left; transition: transform 0.12s linear;
}

.mt-kick {
  position: absolute; top: 7px; right: 7px;
  width: 24px; height: 24px; border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(0, 0, 0, 0.5);
  color: #FF9E92; font-size: 0.7rem; cursor: pointer; opacity: 0;
  transition: opacity 0.15s;
}
.mt-tile:hover .mt-kick, .mt-kick:focus-visible { opacity: 1; }

/* ── controls ── */
.mt-controls {
  flex: none; display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.02);
  flex-wrap: wrap;
}
.mt-btn {
  min-width: 46px; height: 46px; padding: 0 0.85rem;
  border-radius: 12px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text, #F2F4FC);
  font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1rem;
  display: grid; place-items: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.mt-btn:hover { background: rgba(255, 255, 255, 0.12); }
.mt-btn:focus-visible { outline: 2px solid var(--accent, #2E5CFF); outline-offset: 2px; }
/* Off is drawn as a warning, not as "unselected": a person needs to know at a
   glance that the room cannot hear them. */
.mt-btn.mt-off {
  background: rgba(255, 68, 56, 0.16);
  border-color: rgba(255, 68, 56, 0.5);
  color: #FF9E92;
}
.mt-btn.mt-on {
  background: rgba(46, 92, 255, 0.22);
  border-color: rgba(46, 92, 255, 0.6);
  color: #BFD2FF;
}
.mt-btn.mt-c-end { color: #FF9E92; }
.mt-btn.mt-c-leave {
  font-size: 0.85rem; letter-spacing: 0.01em;
  background: linear-gradient(92deg, #C6303A, #9E2029);
  border-color: transparent; color: #fff;
}

@media (max-width: 640px) {
  .mt-stage { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; padding: 7px; gap: 6px; }
  .mt-stage[data-n="1"] { grid-template-columns: minmax(0, 1fr) !important; }
  .mt-controls { gap: 0.4rem; padding-left: 0.5rem; padding-right: 0.5rem; }
  .mt-btn { min-width: 38px; height: 42px; padding: 0 0.45rem; font-size: 0.92rem; }
  .mt-btn.mt-c-leave { padding: 0 0.7rem; }
  .mt-room .mt-screen:not([hidden]) ~ .mt-stage { flex-basis: 96px; }
}

/* ══════════════════════════════════════════════════════════════════════
   Scheduling — the group's meetings list, and the gate's own states.
   ══════════════════════════════════════════════════════════════════════ */

.gm-wrap { margin-top: 1.1rem; }
.gm-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.7rem;
}
.gm-head h3 {
  font-family: 'Outfit', sans-serif; font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted, #8A90B8); margin: 0;
}
.gm-list { border: 1px solid var(--border); border-radius: var(--radius, 12px); background: var(--bg-card); overflow: hidden; }
.gm-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.75rem 0.9rem; }
.gm-row + .gm-row { border-top: 1px solid var(--border); }
.gm-when {
  flex: none; width: 58px; text-align: center;
  font-family: 'Outfit', sans-serif; line-height: 1.15;
}
.gm-when b { display: block; font-size: 1.15rem; font-weight: 800; }
.gm-when span { display: block; font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.gm-body { flex: 1; min-width: 0; }
.gm-title { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 0.92rem; }
.gm-meta { font-size: 0.74rem; color: var(--text-muted); margin-top: 0.1rem; }
.gm-live {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: 'Outfit', sans-serif; font-size: 0.58rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: #FF6B5E; background: rgba(255, 107, 94, 0.12);
  padding: 0.1rem 0.4rem; border-radius: 4px; margin-left: 0.4rem;
}
.gm-live i { width: 5px; height: 5px; border-radius: 50%; background: #FF6B5E; animation: gmPulse 1.6s infinite; }
@keyframes gmPulse { 0%, 100% { opacity: 1 } 50% { opacity: 0.25 } }
@media (prefers-reduced-motion: reduce) { .gm-live i { animation: none } }
.gm-acts { flex: none; display: flex; gap: 0.35rem; }
.gm-btn {
  font-family: 'Outfit', sans-serif; font-size: 0.72rem; font-weight: 700;
  padding: 0.35rem 0.7rem; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(46, 92, 255, 0.45); background: rgba(46, 92, 255, 0.14); color: #C9D8FF;
}
.gm-btn:hover { background: rgba(46, 92, 255, 0.3); }
.gm-btn.gm-go { background: linear-gradient(92deg, var(--accent, #2E5CFF), var(--accent-hover, #1E44D8)); color: #fff; border-color: transparent; }
.gm-btn.gm-quiet { background: transparent; border-color: var(--border); color: var(--text-muted); }

.gm-empty { padding: 1rem; text-align: center; font-size: 0.82rem; color: var(--text-muted); }

/* The gate, as a member sees it. */
.gm-gate {
  border: 1px solid var(--border); border-radius: var(--radius, 12px);
  background: var(--bg-card); padding: 1rem 1.1rem;
}
.gm-gate b { font-family: 'Outfit', sans-serif; font-size: 0.92rem; display: block; margin-bottom: 0.3rem; }
.gm-gate p { font-size: 0.8rem; color: var(--text-muted); margin: 0 0 0.7rem; }
.gm-gate .gm-note {
  font-size: 0.76rem; color: var(--text-muted);
  border-left: 2px solid var(--border); padding-left: 0.6rem; margin-bottom: 0.7rem;
}
.gm-pill {
  display: inline-block; font-family: 'Outfit', sans-serif; font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; padding: 0.14rem 0.45rem; border-radius: 5px;
  margin-bottom: 0.5rem;
}
.gm-pill.waiting { color: #FFC773; background: rgba(255, 199, 115, 0.12); }
.gm-pill.no { color: var(--text-muted); background: rgba(255, 255, 255, 0.06); }
.gm-pill.yes { color: #9BEFC4; background: rgba(62, 224, 140, 0.12); }

/* The scheduler. */
.gm-form { display: grid; gap: 0.6rem; margin-top: 0.7rem; }
.gm-form label { font-size: 0.74rem; color: var(--text-muted); display: grid; gap: 0.25rem; }
.gm-form input, .gm-form textarea, .gm-form select {
  font-family: inherit; font-size: 0.85rem; color: var(--text);
  background: var(--bg-dark, #060A15); border: 1px solid var(--border); border-radius: 9px;
  padding: 0.5rem 0.6rem; width: 100%;
}
.gm-form textarea { resize: vertical; min-height: 58px; }
.gm-form .gm-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.gm-cap { font-size: 0.72rem; color: var(--text-dim, #5A6089); }

/* ══════════════════════════════════════════════════════════════════════
   The editor — one meeting, everything about it.
   A sheet rather than a page: a host is usually adjusting one field, and
   losing the group behind them to do it is a worse trade than the room it
   would buy. On a phone it becomes a full-height sheet, because at that size
   a centred dialog is a page anyway.
   ══════════════════════════════════════════════════════════════════════ */
.gme-back {
  position: fixed; inset: 0; z-index: 880;
  background: rgba(4, 7, 15, 0.72);
  display: grid; place-items: center;
  padding: 1rem;
  overflow-y: auto;
}
.gme {
  width: min(520px, 100%);
  background: var(--bg-card, #0D1428);
  border: 1px solid var(--border, rgba(255,255,255,.1));
  border-radius: 16px;
  display: flex; flex-direction: column;
  max-height: min(88vh, 760px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}
.gme-head {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.9rem 1rem; border-bottom: 1px solid var(--border); flex: none;
}
.gme-t {
  flex: 1; min-width: 0;
  font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gme-x {
  flex: none; width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
}
.gme-x:hover { background: rgba(255,255,255,.06); color: var(--text); }
.gme-body { padding: 1rem; overflow-y: auto; display: grid; gap: 0.7rem; }
.gme-body label { font-size: 0.74rem; color: var(--text-muted); display: grid; gap: 0.25rem; }
.gme-body input, .gme-body select, .gme-body textarea {
  font-family: inherit; font-size: 0.85rem; color: var(--text);
  background: var(--bg-dark, #060A15); border: 1px solid var(--border);
  border-radius: 9px; padding: 0.5rem 0.6rem; width: 100%;
}
.gme-body input:disabled, .gme-body select:disabled { opacity: 0.55; }
.gme-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.gme-sec {
  display: flex; align-items: baseline; gap: 0.5rem;
  font-family: 'Outfit', sans-serif; font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted);
  margin-top: 0.35rem;
}

/* guests */
.gme-guests { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.gme-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.78rem;
  background: rgba(255,255,255,.05); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.22rem 0.5rem 0.22rem 0.25rem;
}
.gme-chip i {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-style: normal;
  font-size: 0.62rem; font-weight: 700; color: #fff;
}
.gme-chip button {
  background: none; border: 0; cursor: pointer; padding: 0 0.1rem;
  color: var(--text-dim, #5A6089); font-size: 0.7rem;
}
.gme-chip button:hover { color: #FF9E92; }

/* the add box */
.gme-add { position: relative; }
.gme-hits {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 2;
  background: var(--bg-dark, #060A15); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; max-height: 210px; overflow-y: auto;
}
.gme-hit {
  display: flex; align-items: center; gap: 0.5rem; width: 100%;
  padding: 0.45rem 0.6rem; background: none; border: 0; cursor: pointer;
  color: var(--text); font-family: inherit; font-size: 0.82rem; text-align: left;
}
.gme-hit:hover { background: rgba(255,255,255,.06); }
.gme-hit i {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-style: normal;
  font-size: 0.65rem; font-weight: 700; color: #fff;
}

.gme-link { display: flex; gap: 0.4rem; }
.gme-link input { font-size: 0.76rem; }

.gme-foot {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  padding: 0.85rem 1rem; border-top: 1px solid var(--border); flex: none;
}
/* Start is the button a host reaches for most; cancelling sits at the far end
   so the two are never next to each other under a thumb. */
.gme-foot .gme-now { flex: 1 1 auto; }
.gme-foot .gme-kill { margin-left: auto; color: #FF9E92; border-color: rgba(255,122,107,.35); }

@media (max-width: 560px) {
  .gme-back { padding: 0; place-items: end stretch; }
  .gme { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
}
