:root {
  color-scheme: dark;
  --bg: #101113;
  --panel: #181a1f;
  --panel-2: #20242b;
  --text: #f6f4ee;
  --muted: #a7adb8;
  --line: #343944;
  --accent: #35d0a2;
  --accent-2: #f2c94c;
  --danger: #ff5f56;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 15%, rgba(53, 208, 162, 0.14), transparent 28rem),
    linear-gradient(135deg, #101113 0%, #15171c 48%, #101113 100%);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.lobby {
  width: min(100% - 32px, 760px);
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  padding: 48px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 18px;
}

.brand.compact {
  font-size: 16px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #07130f;
  font-size: 14px;
  letter-spacing: 0;
}

.lobby-copy {
  max-width: 660px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
}

h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 84px);
  line-height: 0.96;
  letter-spacing: 0;
}

.lobby-copy p:last-child {
  max-width: 560px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.join-form {
  padding: 24px;
  background: rgba(24, 26, 31, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: #111318;
  color: var(--text);
  border-radius: 8px;
  padding: 14px 15px;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(53, 208, 162, 0.14);
}

.lobby-actions,
.topbar-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.primary,
.ghost,
.danger {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 800;
}

.primary {
  background: var(--accent);
  color: #07130f;
}

.ghost {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.danger {
  background: rgba(255, 95, 86, 0.14);
  color: #ffb2ad;
  border: 1px solid rgba(255, 95, 86, 0.34);
}

.error {
  min-height: 20px;
  margin: 0;
  color: #ffb2ad;
}

.call {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 17, 19, 0.78);
  backdrop-filter: blur(14px);
}

.room-label {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.icon-button,
.round-control {
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  background: var(--panel-2);
  color: var(--text);
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 8px;
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.call-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
}

.stage {
  min-width: 0;
  min-height: 0;
  padding: 20px;
}

.video-grid {
  height: 100%;
  min-height: 360px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr));
  grid-auto-rows: minmax(220px, 1fr);
  gap: 14px;
}

.tile {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  background: #0b0c0f;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tile video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #0b0c0f;
}

.tile .avatar {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  font-size: 42px;
  font-weight: 900;
  background: linear-gradient(135deg, #1d2630, #15161a 55%, #18241f);
}

.tile.no-video .avatar {
  display: grid;
}

.tile.no-video video {
  opacity: 0;
}

.tile-meta {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tile-name,
.tile-badges {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.58);
  color: var(--text);
  font-weight: 800;
  font-size: 13px;
}

.tile-badges {
  color: var(--accent-2);
}

.side-panel {
  min-width: 0;
  border-left: 1px solid var(--line);
  background: rgba(24, 26, 31, 0.82);
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.capacity {
  color: var(--muted);
  font-weight: 800;
}

.participants {
  list-style: none;
  margin: 18px 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.participants li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.participant-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.participant-state {
  color: var(--muted);
  white-space: nowrap;
}

.status {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: rgba(16, 17, 19, 0.88);
}

.round-control {
  width: 56px;
  height: 56px;
  border-radius: 999px;
}

.round-control.off {
  background: rgba(255, 95, 86, 0.15);
  color: #ffb2ad;
  border-color: rgba(255, 95, 86, 0.34);
}

@media (max-width: 860px) {
  .call-layout {
    grid-template-columns: 1fr;
  }

  .side-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .topbar {
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .lobby {
    width: min(100% - 24px, 760px);
  }

  h1 {
    font-size: 42px;
  }

  .join-form {
    padding: 18px;
  }

  .topbar {
    padding: 14px;
  }

  .stage {
    padding: 12px;
  }

  .video-grid {
    grid-auto-rows: 260px;
  }
}
