* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  color: #18202a;
  background: #f4f6f8;
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
select {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

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

.join-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid #d7dde5;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 35px rgba(24, 32, 42, 0.08);
}

.join-panel h1,
.session-header h1,
.section-title h2,
.panel-block h2 {
  margin: 0;
}

.version,
#sessionStatus,
.section-title span {
  margin: 0;
  color: #5f6b7a;
  font-size: 13px;
}

.error {
  display: none;
  padding: 10px 12px;
  border-radius: 6px;
  color: #ffffff;
  background: #b42318;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #c9d2dd;
  border-radius: 6px;
  padding: 8px 10px;
  color: #18202a;
  background: #ffffff;
}

label {
  display: grid;
  gap: 6px;
  color: #4a5563;
  font-size: 13px;
}

button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 8px 13px;
  color: #ffffff;
}

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

.primary {
  background: #0b66c3;
}

.secondary {
  background: #334155;
}

.secondary.active {
  background: #0f766e;
}

.leave {
  background: #b42318;
}

.session {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 14px;
}

.session-header,
.section-title,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.session-header {
  padding: 12px 14px;
  border: 1px solid #d7dde5;
  border-radius: 8px;
  background: #ffffff;
}

.pill {
  border-radius: 999px;
  padding: 6px 10px;
  color: #ffffff;
  background: #64748b;
  font-size: 13px;
  white-space: nowrap;
}

.pill.ok {
  background: #0f766e;
}

.pill.warn {
  background: #b45309;
}

.main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  min-height: 0;
}

.video-section,
.share-section,
.side-panel,
.panel-block {
  border: 1px solid #d7dde5;
  border-radius: 8px;
  background: #ffffff;
}

.video-section,
.share-section {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
}

.share-section {
  min-height: 260px;
}

.video-grid,
.share-grid,
.self-video-container {
  width: 100%;
  min-height: 260px;
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
  align-content: start;
}

.self-video-panel {
  display: block;
}

.self-video-container {
  min-height: 0;
  grid-template-columns: minmax(0, 360px);
}

.self-video-container video-player {
  border-radius: 0;
  background: transparent;
}

video-player {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  overflow: hidden;
  border-radius: 8px;
  background: #000000;
}

.share-grid video-player {
  min-height: 240px;
}

.empty-state {
  position: absolute;
  inset: 56px 12px 12px;
  display: grid;
  place-items: center;
  border: 1px dashed #c9d2dd;
  border-radius: 8px;
  color: #5f6b7a;
  background: #f8fafc;
  pointer-events: none;
}

.local-share-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.local-share-preview video,
.local-share-preview canvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: none;
  border-radius: 8px;
  background: #000000;
}

.local-share-preview .active {
  display: block;
}

.side-panel {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 12px;
}

.panel-block {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.participant-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.participant-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  background: #f4f6f8;
}

.captions #captionDisplay {
  min-height: 54px;
  color: #18202a;
  font-size: 14px;
  line-height: 1.4;
}

.stats pre {
  max-height: 240px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border-radius: 6px;
  color: #dbeafe;
  background: #111827;
  font: 12px/1.45 Consolas, Monaco, monospace;
  white-space: pre-wrap;
}

.toolbar {
  flex-wrap: wrap;
  justify-content: center;
  padding: 10px;
  border: 1px solid #d7dde5;
  border-radius: 8px;
  background: #ffffff;
}

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

  .side-panel {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .session {
    padding: 8px;
  }

  .session-header,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .video-grid,
  .share-grid {
    grid-template-columns: 1fr;
  }

  .toolbar button {
    flex: 1 1 130px;
  }
}
