:root {
  --chrome-bg: #d9d9d9;
  --panel-bg: #f4f4f4;
  --panel-border: #a4a4a4;
  --stage-bg: #ffffff;
  --text: #2f2f2f;
  --accent: #1f8cc8;
  --success: #3b8d46;
  --danger: #a03f3f;
  --shadow: rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--chrome-bg);
}

body {
  min-height: 100vh;
}

.viewer-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 10px;
  border-bottom: 1px solid var(--panel-border);
  background: linear-gradient(#fdfdfd, #e2e2e2);
}

.brand-box {
  border: 1px solid #979797;
  background: #fff;
  color: #333;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  line-height: 1;
  padding: 2px 10px 4px;
}

.topnav {
  display: flex;
  gap: 18px;
  font-size: 14px;
}

.status-strip {
  margin-left: auto;
  min-width: 180px;
  text-align: right;
  font-size: 13px;
  color: #4b4b4b;
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  min-height: 0;
}

.stage-area {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
}

.connection-card,
.video-stage,
.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: 0 1px 2px var(--shadow);
}

.connection-card {
  margin: 12px 12px 8px;
  padding: 14px;
}

.connection-card h1 {
  margin: 0 0 12px;
  font-size: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.form-grid label {
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.form-grid input,
.form-grid select,
.button-row button {
  font: inherit;
}

.form-grid input,
.form-grid select {
  border: 1px solid #8d8d8d;
  background: #fff;
  padding: 6px 8px;
}

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

.button-row button {
  border: 1px solid #8d8d8d;
  background: linear-gradient(#ffffff, #e7e7e7);
  padding: 7px 12px;
  cursor: pointer;
}

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

.manifest-output {
  margin: 12px 0 0;
  min-height: 180px;
  max-height: 260px;
  overflow: auto;
  padding: 12px;
  border: 1px solid #c2c2c2;
  background: #fff;
  font-size: 12px;
}

.video-stage {
  margin: 0 12px 12px;
  padding: 12px;
  min-height: 0;
  background: linear-gradient(#fefefe, #efefef);
}

.video-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 14px;
}

.video-grid {
  min-height: 420px;
  height: calc(100% - 28px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  align-content: start;
}

.video-placeholder {
  display: grid;
  place-items: center;
  min-height: 360px;
  border: 1px dashed #a0a0a0;
  background: rgba(255, 255, 255, 0.75);
  text-align: center;
  padding: 20px;
}

.video-tile {
  display: grid;
  grid-template-rows: 34px 1fr;
  min-height: 230px;
  border: 1px solid #7f7f7f;
  background: #fff;
  box-shadow: 0 2px 6px var(--shadow);
}

.video-tile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  border-bottom: 1px solid #a3a3a3;
  background: linear-gradient(#fbfbfb, #dcdcdc);
  font-size: 13px;
}

.video-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef6fb;
  color: #2b5f79;
}

.video-slot {
  position: relative;
  background: #090909;
}

.video-slot video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #090909;
}

.empty-tile {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #d0d0d0;
  font-size: 13px;
  text-align: center;
  padding: 16px;
}

.sidebar {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  padding: 12px 12px 12px 0;
  min-height: 0;
}

.panel {
  padding: 10px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.panel h2 {
  margin: 0 0 8px;
  font-size: 15px;
}

.participant-list,
.event-log {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: auto;
}

.participant-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid #ddd;
  font-size: 13px;
}

.participant-role {
  color: #666;
}

.event-log {
  display: grid;
  gap: 6px;
  align-content: start;
}

.event-entry {
  padding: 7px 8px;
  border: 1px solid #d7d7d7;
  background: #fff;
  font-size: 12px;
}

.event-entry strong {
  display: block;
  margin-bottom: 2px;
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 0 12px 12px;
  }

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

/* Temporary room-core layout override for webcam sizing */
.video-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)) !important;
}

.video-tile {
  height: 320px !important;
  min-height: 320px !important;
}

.video-slot {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  min-height: 286px !important;
  background: #090909 !important;
}

.video-slot video {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  background: #090909 !important;
}

/* Strong temporary webcam preview override v2 */
.video-grid {
  display: block !important;
}

.video-tile {
  display: flex !important;
  flex-direction: column !important;
  width: 520px !important;
  min-height: 0 !important;
  height: auto !important;
  overflow: hidden !important;
  background: #ffffff !important;
}

.video-tile-header {
  flex: 0 0 34px !important;
}

.video-slot {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 520px !important;
  height: 390px !important;
  min-height: 390px !important;
  max-height: 390px !important;
  overflow: hidden !important;
  background: #000000 !important;
}

.video-slot video {
  display: block !important;
  width: 520px !important;
  height: 390px !important;
  min-width: 520px !important;
  min-height: 390px !important;
  max-width: 520px !important;
  max-height: 390px !important;
  object-fit: contain !important;
  background: #000000 !important;
}

/* Strong temporary webcam preview override v2 */
.video-grid {
  display: block !important;
}

.video-tile {
  display: flex !important;
  flex-direction: column !important;
  width: 520px !important;
  min-height: 0 !important;
  height: auto !important;
  overflow: hidden !important;
  background: #ffffff !important;
}

.video-tile-header {
  flex: 0 0 34px !important;
}

.video-slot {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 520px !important;
  height: 390px !important;
  min-height: 390px !important;
  max-height: 390px !important;
  overflow: hidden !important;
  background: #000000 !important;
}

.video-slot video {
  display: block !important;
  width: 520px !important;
  height: 390px !important;
  min-width: 520px !important;
  min-height: 390px !important;
  max-width: 520px !important;
  max-height: 390px !important;
  object-fit: contain !important;
  background: #000000 !important;
}
