:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #191c22;
  --panel-2: #20242c;
  --line: #323844;
  --text: #f2f4f8;
  --muted: #9da6b7;
  --teal: #2dd4bf;
  --teal-2: #0f766e;
  --coral: #fb7185;
  --amber: #fbbf24;
  --green: #22c55e;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
  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(180deg, rgba(45, 212, 191, 0.08), transparent 240px),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #111318;
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12);
}

.hidden {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 88px;
  padding: 18px clamp(18px, 4vw, 42px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar h1,
.stage h2,
.sidebar h2,
.create-form h3,
.chat h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.session {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.auth-shell {
  display: grid;
  min-height: calc(100vh - 88px);
  place-items: center;
  padding: 24px;
}

.auth-box {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 28, 34, 0.96);
  box-shadow: var(--shadow);
}

.auth-box label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111318;
}

.tab {
  background: transparent;
  color: var(--muted);
}

.tab.active {
  background: var(--panel-2);
  color: var(--text);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  min-height: calc(100vh - 88px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 22px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(16, 17, 20, 0.62);
}

.side-head,
.stage-head,
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.icon-btn,
.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.icon-btn {
  width: 42px;
  padding: 0;
  font-size: 20px;
}

.primary {
  background: var(--teal);
  color: #06211e;
  font-weight: 800;
}

.wide {
  width: 100%;
}

.stream-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.stream-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stream-card.active {
  border-color: var(--teal);
}

.stream-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.stream-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.stream-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.stream-actions {
  display: flex;
  gap: 8px;
}

.stream-actions button,
.invite-form button,
.message-form button,
.create-form button {
  padding: 0 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  color: #101114;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.private {
  background: var(--coral);
}

.badge.public {
  background: var(--green);
}

.badge.muted {
  background: #555d6b;
  color: var(--text);
}

.create-form {
  display: grid;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.check input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--teal);
}

.stage {
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto minmax(180px, 260px);
  gap: 18px;
  min-width: 0;
  padding: 22px;
}

.stage-head {
  min-height: 58px;
}

#roomTitle {
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.video-frame {
  position: relative;
  display: grid;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050608;
  box-shadow: var(--shadow);
}

video {
  width: 100%;
  height: 100%;
  min-height: 300px;
  object-fit: contain;
  background: #050608;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
  pointer-events: none;
}

.room-tools {
  min-height: 46px;
}

.invite-form,
.message-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.invite-form button,
.message-form button {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.chat {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.messages {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.message {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel);
}

.message strong {
  display: inline-block;
  margin-right: 8px;
  color: var(--amber);
}

.message span {
  overflow-wrap: anywhere;
}

.error {
  min-height: 20px;
  margin: 0;
  color: var(--coral);
  font-weight: 700;
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .stage {
    grid-template-rows: auto minmax(240px, 44vh) auto minmax(180px, 260px);
  }
}
