:root {
  --bg: #0d1117;
  --panel: #151b24;
  --panel-2: #1c2532;
  --line: #263041;
  --text: #e7edf5;
  --dim: #93a1b5;
  --teal: #1fb8a6;
  --teal-dark: #159082;
  --red: #e0525f;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--teal); }

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  padding: 11px 18px;
  background: var(--panel-2);
  color: var(--text);
  transition: background .15s ease, opacity .15s ease;
}
button:hover { background: #26313f; }
button.primary { background: var(--teal); color: #06221f; font-weight: 600; }
button.primary:hover { background: var(--teal-dark); }
button.danger { background: var(--red); color: #fff; }
button.off { background: var(--red); color: #fff; }

input, textarea {
  font: inherit;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0f1520;
  color: var(--text);
}
input:focus, textarea:focus { outline: 2px solid var(--teal); border-color: transparent; }

/* ---------- landing ---------- */
.landing {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.card {
  width: 100%;
  max-width: 440px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px;
}
.card h1 { margin: 0 0 6px; font-size: 26px; }
.card p.sub { margin: 0 0 22px; color: var(--dim); font-size: 15px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--dim); margin-bottom: 6px; }
.card button.primary { width: 100%; margin-top: 6px; }
.note { margin-top: 18px; font-size: 12.5px; color: var(--dim); line-height: 1.6; }

/* ---------- room ---------- */
.room { display: flex; flex-direction: column; height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.topbar .title { font-weight: 600; }
.topbar .count { color: var(--dim); font-size: 13px; }
.topbar .spacer { flex: 1; }
.topbar button { padding: 8px 14px; font-size: 14px; }

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

.stage {
  flex: 1;
  padding: 14px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: center;
  min-width: 0;
}
.stage.solo { grid-template-columns: minmax(0, 1fr); }

.tile {
  position: relative;
  background: #0a0f16;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 10;
  cursor: pointer;
}
.tile video { width: 100%; height: 100%; object-fit: cover; background: #0a0f16; display: block; }
.tile .tag {
  position: absolute; left: 10px; bottom: 10px;
  background: rgba(0,0,0,.6); padding: 4px 10px;
  border-radius: 20px; font-size: 12.5px;
}
.tile .waiting {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--dim); font-size: 14px;
}
.tile .fs {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px; display: grid; place-items: center;
  background: rgba(0,0,0,.55); border-radius: 9px; color: #fff;
  pointer-events: none; opacity: 0; transition: opacity .15s ease;
}
.tile:hover .fs, .tile:active .fs { opacity: 1; }
.tile:fullscreen, .tile video:fullscreen { cursor: default; }
.tile:fullscreen .fs { display: none; }

.chat {
  width: 320px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  display: flex; flex-direction: column;
}
.chat h2 { margin: 0; padding: 14px 16px; font-size: 15px; border-bottom: 1px solid var(--line); }
.messages { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { font-size: 14px; line-height: 1.45; }
.msg .who { display: block; font-size: 12px; color: var(--teal); margin-bottom: 2px; }
.msg .bubble { background: var(--panel-2); padding: 8px 12px; border-radius: 10px; display: inline-block; max-width: 100%; word-break: break-word; }
.msg.me .who { color: var(--dim); }
.msg.me .bubble { background: #1d3a3a; }
.msg.system { color: var(--dim); font-size: 12.5px; text-align: center; }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.composer input { flex: 1; }

.controls {
  display: flex; justify-content: center; gap: 10px;
  padding: 12px; border-top: 1px solid var(--line); background: var(--panel);
}

.banner {
  padding: 10px 16px; background: #3a2a12; color: #ffd9a0; font-size: 13.5px; display: none;
}
.banner.show { display: block; }

@media (max-width: 860px) {
  .main { flex-direction: column; }
  .chat { width: auto; border-left: 0; border-top: 1px solid var(--line); height: 40vh; }
  /* On phones: small member tiles in a vertical list you scroll through. */
  .stage {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    overflow-y: auto;
    grid-template-columns: none;
  }
  .stage.solo { grid-template-columns: none; }
  .tile {
    aspect-ratio: auto;
    width: 100%;
    height: 132px;
    flex: 0 0 auto;
  }
  .tile .fs { opacity: .9; }
  .tile .tag { font-size: 12px; }
}
