:root {
  --bg: #2f3136;
  --bg-2: #383b41;
  --ink: #e7eaef;
  --muted: #b6bdc9;
  --line: #4d5158;
  --btn: #65967b;
  --btn-hover: #587f69;
  --panel: #3a3d43;
}

*,
*::before,
*::after { box-sizing: border-box; border: none !important; }

body {
  margin: 0;
  font-family: 'Manrope', sans-serif;
  background: var(--bg);
  color: var(--ink);
}

h1, h2, h3, h4 {
  margin: 0 0 12px;
  font-family: 'Space Grotesk', sans-serif;
}

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.center-shell {
  width: min(520px, 96vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}

.sub {
  color: var(--muted);
  margin-top: -2px;
}

.menu-grid {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.menu-btn,
.link-btn {
  display: inline-block;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg-2);
}

.form-card {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 5px;
  font-size: 14px;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  background: #2a2c31;
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 12px;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
  background: var(--btn);
  color: #fff;
}

button:hover {
  background: var(--btn-hover);
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.status {
  margin-top: 14px;
  background: #26282d;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.hidden { display: none !important; }

.room-body {
  height: 100vh;
  overflow: hidden;
  background: #2f3136;
}

.room-topbar {
  height: 56px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: #2a2c31;
}

.room-main {
  display: grid;
  grid-template-columns: 1fr auto;
  height: calc(100vh - 56px);
}

.stage {
  position: relative;
  padding: 10px 10px 86px;
  overflow: hidden;
}

#stageVideo {
  width: 100%;
  height: calc(100vh - 152px);
  object-fit: contain;
  border-radius: 10px;
  background: #111;
}

#stagePlaceholder {
  height: calc(100vh - 152px);
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: transparent;
}

.video-grid {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 90px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 220px));
  justify-content: center;
  gap: 10px;
  pointer-events: none;
}

.video-card {
  pointer-events: auto;
  border: 1px solid var(--line);
  background: #1f2125;
  border-radius: 10px;
  padding: 8px;
  transition: background-color 1s ease, box-shadow 1s ease, color 1s ease;
}

.video-card.speaking {
  background: #deae00 !important;
  box-shadow: inset 0 0 0 2px #deae00;
  color: #111;
}

.video-card header {
  font-size: 12px;
  margin-bottom: 6px;
  color: #d5dbe6;
}

.video-card video {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  background: #000;
}

.chat-side {
  width: min(360px, 92vw);
  border-left: 1px solid var(--line);
  background: #31343a;
  padding: 10px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 10px;
}

.participants-side {
  position: fixed;
  left: 0;
  top: 56px;
  height: calc(100vh - 56px);
  width: min(330px, 92vw);
  border-right: 1px solid var(--line);
  background: #2f3238;
  padding: 10px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  z-index: 23;
}

.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-log {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #272a30;
  padding: 8px;
  overflow: auto;
}

.chat-item {
  border-bottom: 1px solid #424854;
  padding: 6px 0;
  font-size: 14px;
}

.chat-item:last-child { border-bottom: 0; }
.chat-item a { color: #c4e2ff; }

.chat-inputs {
  display: grid;
  gap: 8px;
}

.participants-box {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

#participantsList,
#pendingRequestsList {
  display: grid;
  gap: 7px;
}

.participant-row,
.request-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
}

.controls-bottom {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 20;
  background: rgba(0, 0, 0, 0.38);
  padding: 8px;
  border-radius: 14px;
  border: 1px solid #555;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  padding: 0;
  font-size: 20px;
  display: grid;
  place-items: center;
  background: var(--btn);
}

.icon-glyph {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-toggle {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  font-size: 18px;
  display: grid;
  place-items: center;
  padding: 0;
}

.room-status {
  position: fixed;
  top: 66px;
  left: 12px;
  margin-top: 0;
  z-index: 20;
  max-width: 420px;
}

.prejoin-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.56);
  z-index: 30;
}

.prejoin-card {
  width: min(440px, 92vw);
  background: #3a3d43;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  gap: 10px;
}

.toast-wrap {
  position: fixed;
  top: 16px;
  right: 16px;
  display: grid;
  gap: 8px;
  z-index: 40;
}

.toast {
  background: #1f2125;
  border: 1px solid #616978;
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 260px;
  max-width: 360px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
}

@media (max-width: 900px) {
  .chat-side {
    position: fixed;
    right: 0;
    top: 56px;
    height: calc(100vh - 56px);
    z-index: 22;
  }

  .participants-side {
    position: fixed;
    left: 0;
    top: 56px;
    height: calc(100vh - 56px);
    z-index: 23;
  }

  #stageVideo,
  #stagePlaceholder {
    height: calc(100vh - 170px);
  }
}
