:root {
  color-scheme: dark;
  --bg: #101214;
  --panel: #191d21;
  --panel-strong: #20262b;
  --line: #313941;
  --text: #f5f7f8;
  --muted: #aab4bd;
  --green: #37c980;
  --blue: #4da3ff;
  --red: #ff5c7a;
  --amber: #ffc857;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(120deg, rgba(77, 163, 255, 0.12), transparent 38%),
    linear-gradient(300deg, rgba(55, 201, 128, 0.1), transparent 42%),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.shell {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.home {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 48px;
  padding: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--green);
  color: #07120c;
}

.brand.compact .brand-mark {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

.hero {
  align-self: center;
  max-width: 920px;
  padding-bottom: 8vh;
}

.eyebrow,
.intro,
.room-code,
.status {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 12px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
}

h1 {
  max-width: 850px;
  margin: 0;
  font-size: clamp(44px, 8vw, 92px);
  line-height: 0.96;
  letter-spacing: 0;
}

.intro {
  max-width: 660px;
  margin: 28px 0;
  font-size: 20px;
  line-height: 1.55;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.primary,
.secondary,
.control {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 18px;
  color: var(--text);
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.primary {
  background: var(--green);
  border-color: var(--green);
  color: #07120c;
  font-weight: 800;
}

.secondary:hover,
.control:hover {
  border-color: #52606c;
}

.join-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input {
  width: min(340px, 76vw);
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

input:focus {
  border-color: var(--blue);
}

.room {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.room-code {
  margin: 6px 0 0 46px;
  font-size: 14px;
}

.invite {
  display: flex;
  gap: 8px;
}

.invite input {
  width: min(420px, 44vw);
}

.stage {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  grid-auto-rows: minmax(220px, 1fr);
  gap: 12px;
  min-height: 0;
}

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

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

.tile.local video {
  transform: scaleX(-1);
}

.tile.screen video {
  object-fit: contain;
  transform: none;
}

.tile-label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 8px;
  padding: 6px 9px;
  background: rgba(0, 0, 0, 0.62);
  color: var(--text);
  font-size: 13px;
}

.tile-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
}

.avatar {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--panel-strong);
  color: var(--green);
  font-size: 34px;
}

.controls {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 29, 33, 0.86);
}

.control.active {
  border-color: var(--green);
  color: var(--green);
}

.control.off {
  border-color: var(--amber);
  color: var(--amber);
}

.control.accent.active {
  border-color: var(--red);
  color: var(--red);
}

.control.danger {
  background: rgba(255, 92, 122, 0.12);
  border-color: rgba(255, 92, 122, 0.42);
}

.status {
  position: fixed;
  right: 18px;
  bottom: 86px;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(25, 29, 33, 0.94);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

.status:empty {
  display: none;
}

@media (max-width: 720px) {
  .home,
  .room {
    padding: 14px;
  }

  h1 {
    font-size: 43px;
  }

  .topbar,
  .invite {
    align-items: stretch;
    flex-direction: column;
  }

  .invite input {
    width: 100%;
  }

  .stage {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(210px, 42vh);
  }
}
