/* ─────────────────────────────────────────────────────────────────────────
   Speeqr — meeting UI styled after speeqr.com / product screenshot:
   light textured canvas, black accents, dark chat column, black bottom
   toolbar, transparent rounded room boxes, green speaking glow.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  --bg:        #f5f2ec;
  --ink:       #141414;
  --ink-soft:  #4b4b4b;
  --card:      #ffffff;
  --line:      rgba(0, 0, 0, .08);
  --good:      #7cc243;
  --warn:      #f0b429;
  --bad:       #e05d5d;
  --rose:      #ef8080;
  --chat-bg-0: #191919;
  --chat-bg-1: #0c0c0c;
  --salmon:    #e2795d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: 'Baloo 2', 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  /* Subtle hand-drawn squiggle texture, self-contained data-URI. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23000000' stroke-opacity='0.028' stroke-width='1.4' stroke-linecap='round'%3E%3Cpath d='M10 18c6-6 12 6 18 0M64 12c6-6 12 6 18 0M96 44c6-6 12 6 18 0M28 58c6-6 12 6 18 0M78 72c6-6 12 6 18 0M12 92c6-6 12 6 18 0M56 104c6-6 12 6 18 0'/%3E%3Ccircle cx='44' cy='30' r='2'/%3E%3Ccircle cx='100' cy='94' r='2'/%3E%3Ccircle cx='20' cy='74' r='2'/%3E%3C/g%3E%3C/svg%3E");
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input  { font-family: inherit; }

/* ───────────────────────── Join screen ───────────────────────── */

.join {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.join-card {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 34px 30px 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .10);
}
.logo { font-size: 34px; font-weight: 800; letter-spacing: -.5px; }
.tagline { color: var(--ink-soft); margin: 2px 0 22px; font-size: 14px; }

.field {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 14px;
}
.field input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  font-size: 15px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fbfaf7;
  outline: none;
  transition: border-color .15s;
}
.field input:focus { border-color: var(--ink); }

.synthetic {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 4px 0 16px;
}
.synthetic input[type="number"] {
  width: 70px;
  padding: 4px 8px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
}

.primary {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: var(--ink);
  border-radius: 16px;
  transition: transform .1s, opacity .15s;
}
.primary:hover { opacity: .9; }
.primary:active { transform: scale(.985); }

.err    { color: var(--bad); font-size: 13px; margin-top: 12px; min-height: 18px; }
.status { color: var(--ink-soft); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* DSP panel (join screen) */
.dsp-panel {
  border: 1.5px solid var(--line);
  border-radius: 16px;
  margin-bottom: 18px;
  overflow: hidden;
}
.dsp-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  font-size: 13.5px;
  font-weight: 700;
}
.dsp-caret { color: var(--ink-soft); }
.dsp-settings { padding: 0 14px 10px; }
.dsp-settings.dsp-collapsed { display: none; }
.dsp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.dsp-row-disabled { opacity: .45; }
.dsp-info { display: flex; flex-direction: column; }
.dsp-name { font-size: 13px; font-weight: 600; }
.dsp-desc { font-size: 11px; color: var(--ink-soft); }

.toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex: 0 0 auto; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
  position: absolute; inset: 0;
  background: #d6d2c9;
  border-radius: 22px;
  transition: background .15s;
}
.toggle .slider::before {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s;
}
.toggle input:checked + .slider { background: var(--good); }
.toggle input:checked + .slider::before { transform: translateX(18px); }

/* ───────────────────────── App shell ───────────────────────── */

.app {
  display: grid;
  grid-template-columns: 1fr 370px;
  grid-template-rows: 1fr auto;
  height: 100vh;
  overflow: hidden;
}
.app:not(.chat-show) { grid-template-columns: 1fr 0; }
.app:not(.chat-show) .chat { display: none; }
.app.chat-show .chat-fab { display: none; }

.main {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  overflow-y: auto;
  padding: 26px 34px 120px;
}

/* ── Topbar ── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 34px;
  flex-wrap: wrap;
}
.tb-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.lock-badge {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  background: var(--ink);
  color: #fff;
  border-radius: 16px;
  flex: 0 0 auto;
}
.meeting-title {
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 600;
  letter-spacing: -.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tb-right { display: flex; align-items: center; gap: 22px; }
.timer-pill {
  background: var(--ink);
  color: #fff;
  font-size: 19px;
  padding: 10px 30px;
  border-radius: 999px;
  letter-spacing: 1px;
}
.tb-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  color: var(--good);
}
.tb-stat-lbl { font-size: 12px; color: var(--ink-soft); line-height: 1; }
.tb-stat-top { display: flex; align-items: center; gap: 6px; }
.tb-stat-val { font-size: 13px; font-weight: 600; color: var(--ink); }

/* Sliders button + floating DSP options panel ("tablet"). */
.dsp-btn {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  flex: 0 0 auto;
}
.dsp-float {
  position: absolute;
  right: 34px;
  top: 96px;
  width: 330px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .16);
  padding: 6px 16px 8px;
  z-index: 15;
}
.dsp-float .dsp-row:first-child { border-top: none; }
.profile-chip { flex: 0 0 auto; }
.me-avatar {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}

/* ── Stage / rooms ── */
.stage { min-height: 40vh; }
.rooms {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  align-items: flex-start;
}

/* Each room: a transparent box with fully rounded (circular) edges.
   Members of the same room live inside the same box. */
.room-card {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, .42);
  border: 1.5px solid rgba(0, 0, 0, .07);
  border-radius: 34px;
  padding: 14px 22px 16px;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.room-card.own-room { border-color: rgba(0, 0, 0, .18); }
.rc-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
}
.rc-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--good);
}
.rc-name { font-size: 12.5px; color: var(--ink-soft); }
.rc-name strong { color: var(--ink); }
.rc-body {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
}

/* Participant tile */
.participant {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  width: 96px;
}
.pava-wrap { position: relative; }
.pava {
  width: 88px; height: 88px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  transition: box-shadow .18s ease;
}
.pname {
  font-size: 14.5px;
  font-weight: 500;
  max-width: 96px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

/* GCC + chirp + all sync factors done → round green circle around member. */
.participant.ready .pava {
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--good);
}
/* Speaking → the member emits green light. */
.participant.speaking .pava {
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--good),
              0 0 26px 8px rgba(124, 194, 67, .65);
}

/* Small mic badge (bottom-right of avatar) — shows the room-mute state. */
.pava-mic {
  position: absolute;
  right: 2px; bottom: 2px;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  border: 2px solid var(--bg);
}
.pava-mic.muted { background: var(--bad); }
.pava-online { display: none; }

/* ── QR card ── */
.qr-card {
  position: absolute;
  left: 34px;
  bottom: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .10);
  padding: 12px 14px 10px;
  text-align: center;
  z-index: 5;
}
.qr-card img { width: 92px; height: 92px; display: block; }
.qr-code { font-size: 13px; font-weight: 700; letter-spacing: 1px; margin-top: 6px; }
.qr-copy {
  position: absolute;
  top: -10px; right: -10px;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: var(--ink);
  color: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .2);
}

/* ── Chat column ── */
.chat {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--chat-bg-0), var(--chat-bg-1));
  color: #fff;
  min-width: 0;
}
.chat-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 22px 12px;
}
.chat-title { font-size: 19px; font-weight: 500; }
.chat-menu { color: #fff; opacity: .9; }
.chat-msgs {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px 22px;
}
.chat-line {
  font-size: 13.5px;
  line-height: 1.45;
  margin: 5px 0;
  color: #eee;
  overflow-wrap: anywhere;
}
.cl-name { color: var(--salmon); font-weight: 700; margin-right: 4px; }

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 16px;
  background: rgba(255, 255, 255, .05);
}
.ci-notes {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, .10);
  color: #fff;
  flex: 0 0 auto;
}
.ci-field {
  position: relative;
  flex: 1;
  min-width: 0;
}
.ci-field input {
  width: 100%;
  padding: 11px 34px 11px 16px;
  font-size: 14px;
  color: #fff;
  background: rgba(255, 255, 255, .10);
  border: none;
  border-radius: 999px;
  outline: none;
}
.ci-field input::placeholder { color: rgba(255, 255, 255, .45); }
.ci-at {
  position: absolute;
  right: 13px; top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, .55);
  font-size: 15px;
}
.ci-send {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  flex: 0 0 auto;
}

/* ── Bottom toolbar ── */
.toolbar {
  grid-column: 1 / 3;
  grid-row: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #0b0b0b;
  padding: 12px 26px;
  z-index: 6;
}
.tb-group { display: flex; align-items: center; gap: 34px; }
.tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: #fff;
  opacity: .95;
}
.tool:hover { opacity: .75; }
.tool-ico { display: grid; place-items: center; }
.tb-lbl { font-size: 12px; }
.tool.off .tool-ico { color: var(--bad); }
.tb-exit {
  background: var(--rose);
  color: #fff;
  font-size: 15.5px;
  font-weight: 600;
  padding: 12px 34px;
  border-radius: 999px;
  margin-left: 10px;
  transition: opacity .15s;
}
.tb-exit:hover { opacity: .88; }

/* ── Chat FAB (chat collapsed) ── */
.chat-fab {
  position: fixed;
  right: 22px;
  bottom: 96px;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
  z-index: 20;
}

/* ── Toast ── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 104px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  padding: 10px 20px;
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
  z-index: 30;
}

/* ───────────────────────── Mobile ───────────────────────── */

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr !important; }

  .main { padding: 16px 16px 130px; }
  .topbar { margin-bottom: 20px; }
  .timer-pill { font-size: 15px; padding: 8px 18px; }
  .tb-right { gap: 14px; }
  .meeting-title { font-size: 21px; }
  .lock-badge { width: 42px; height: 42px; border-radius: 13px; }
  .me-avatar { width: 44px; height: 44px; font-size: 15px; }

  .qr-card { position: static; display: inline-block; margin-top: 18px; }
  .dsp-float { right: 12px; left: 12px; width: auto; top: 120px; }

  /* Chat becomes a full-screen overlay above the toolbar. */
  .chat {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: none;
  }
  .app.chat-show .chat { display: flex; }
  .app.chat-show .chat-fab { display: none; }
  .chat-fab { display: grid; }

  .toolbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 14px;
  }
  .tb-group { gap: 20px; }
  .tb-exit { padding: 10px 22px; }

  .pava { width: 72px; height: 72px; font-size: 22px; }
  .participant { width: 80px; }
  .room-card { padding: 12px 16px 14px; border-radius: 26px; }
}
