.dm-panel,
.dm-overlay,
.dm-overlay * {
  box-sizing: border-box;
}

.dm-panel {
  margin: 1.25rem 0;
  padding: clamp(1.1rem, 2.5vw, 1.7rem);
  border: 1px solid #cbd5f5;
  border-radius: 22px;
  background: linear-gradient(125deg, #f8f6ff 0%, #eef5ff 100%);
  color: #172044;
  box-shadow: 0 12px 32px rgba(30, 36, 88, .08);
}

.dm-panel-top,
.dm-panel-actions,
.dm-header,
.dm-header-right,
.dm-section-head,
.dm-call-actions,
.dm-media-controls,
.dm-comment-form > div,
.dm-comment-header {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.dm-panel-top,
.dm-header,
.dm-section-head,
.dm-comment-form > div {
  justify-content: space-between;
}

.dm-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: .35rem .65rem;
  border-radius: 999px;
  background: #e4dfff;
  color: #4530ae;
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .1em;
}

.dm-panel h2 {
  margin: .75rem 0 .25rem;
  color: #172044;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.12;
}

.dm-panel-summary {
  margin: .3rem 0;
  font-weight: 650;
}

.dm-panel-detail {
  margin: .35rem 0 1rem;
  color: #5b6483;
  font-size: .93rem;
}

.dm-panel-clock,
.dm-time {
  color: #293665;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.dm-participant-count {
  color: #58617a;
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
}

.dm-panel-actions,
.dm-call-actions,
.dm-media-controls {
  flex-wrap: wrap;
}

.dm-button,
.dm-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: .65rem 1rem;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-size: .88rem;
  font-weight: 750;
  line-height: 1.1;
  cursor: pointer;
  transition: transform .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.dm-button:hover:not(:disabled),
.dm-icon-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.dm-button:focus-visible,
.dm-icon-button:focus-visible,
.dm-field select:focus-visible,
.dm-comment-form textarea:focus-visible {
  outline: 3px solid #9e90fb;
  outline-offset: 2px;
}

.dm-button:disabled,
.dm-icon-button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.dm-button-primary {
  background: #5841ca;
  color: #fff;
  box-shadow: 0 5px 14px rgba(88, 65, 202, .2);
}

.dm-button-primary:hover:not(:disabled) {
  background: #4934b2;
}

.dm-button-quiet {
  border-color: #ccd3ee;
  background: #fff;
  color: #283365;
}

.dm-button-quiet:hover:not(:disabled) {
  background: #f2f3ff;
}

.dm-button-danger {
  border-color: #ecb9bf;
  background: #fff5f5;
  color: #a62239;
}

.dm-button-danger:hover:not(:disabled) {
  background: #ffe7e9;
}

.dm-field {
  display: grid;
  gap: .4rem;
  margin-bottom: .9rem;
  color: #36426c;
  font-size: .82rem;
  font-weight: 750;
}

.dm-field select {
  width: min(100%, 36rem);
  min-height: 42px;
  padding: .55rem .7rem;
  border: 1px solid #cbd3ea;
  border-radius: 11px;
  background: #fff;
  color: #202b52;
  font: inherit;
  font-weight: 500;
}

.dm-error {
  margin: .85rem 0 0;
  padding: .65rem .8rem;
  border: 1px solid #f3c0c5;
  border-radius: 10px;
  background: #fff4f4;
  color: #9b1834;
  font-size: .84rem;
  line-height: 1.4;
}

body.dm-modal-open {
  overflow: hidden;
}

.dm-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: clamp(.4rem, 2vw, 1.3rem);
  background: rgba(13, 17, 47, .78);
  color: #1b2447;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.dm-window {
  display: flex;
  flex-direction: column;
  width: min(100%, 1480px);
  height: min(100%, 980px);
  min-height: 0;
  overflow: hidden;
  border: 1px solid #d8ddf3;
  border-radius: 22px;
  background: #f4f6fc;
  box-shadow: 0 24px 84px rgba(4, 8, 35, .36);
}

.dm-header {
  flex: 0 0 auto;
  padding: .95rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid #e1e5f2;
}

.dm-header h2 {
  margin: .25rem 0 0;
  font-size: 1.25rem;
  line-height: 1.1;
}

.dm-header-right {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dm-live-pill {
  padding: .32rem .65rem;
  border-radius: 999px;
  background: #e6f8ee;
  color: #177849;
  font-size: .75rem;
  font-weight: 800;
}

.dm-icon-button {
  width: 40px;
  min-width: 40px;
  padding: 0;
  border-color: #dfe3f1;
  background: #fff;
  color: #30375d;
  font-size: 1.65rem;
  font-weight: 400;
}

.dm-overlay-error {
  flex: 0 0 auto;
  margin: .5rem 1rem 0;
}

.dm-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 320px);
  gap: 1rem;
  flex: 1 1 auto;
  min-height: 0;
  padding: 1rem;
}

.dm-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
  overflow: auto;
}

.dm-video-card { flex: 0 0 auto; }
.dm-question-card { flex: 1 0 260px; }

.dm-card {
  min-width: 0;
  min-height: 0;
  padding: 1rem;
  border: 1px solid #e0e5f4;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(28, 38, 91, .04);
}

.dm-section-head {
  margin-bottom: .8rem;
  align-items: baseline;
}

.dm-section-head h3 {
  margin: 0;
  font-size: 1rem;
  color: #1d274b;
}

.dm-section-head span {
  color: #66708e;
  font-size: .75rem;
  text-align: right;
}

.dm-video-card,
.dm-question-card,
.dm-comments {
  display: flex;
  flex-direction: column;
}

.dm-video-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: .5rem;
}

.dm-video-grid:empty { display: none; }

.dm-learner-strip { flex: 0 0 auto; }

.dm-learner-strip .dm-section-head { margin-bottom: .55rem; }

.dm-teacher-area { margin-top: .9rem; }

.dm-teacher-area .dm-section-head { margin-bottom: .55rem; }

.dm-teacher-stage {
  position: relative;
  height: clamp(180px, 30vh, 300px);
  margin: 0;
  overflow: hidden;
  border-radius: 12px;
  background: #101735;
}

.dm-teacher-stage video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dm-teacher-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  color: #fff;
  font-size: .9rem;
  text-align: center;
}

.dm-teacher-stage figcaption {
  position: absolute;
  bottom: .65rem;
  left: .65rem;
  padding: .3rem .6rem;
  border-radius: 7px;
  background: rgba(6, 10, 27, .7);
  color: #fff;
  font-size: .78rem;
}

.dm-audio-container { display: none; }

.dm-gallery-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  flex: 0 0 auto;
  margin-top: .7rem;
  font-size: .78rem;
  font-weight: 700;
  text-align: center;
}

.dm-gallery-nav .dm-button { min-height: 36px; padding: .5rem .65rem; }

.dm-tile {
  position: relative;
  margin: 0;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 12px;
  background: #101735;
}

.dm-tile video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dm-tile-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  color: #fff;
  font-size: .82rem;
  text-align: center;
}

.dm-tile figcaption {
  position: absolute;
  bottom: .5rem;
  left: .5rem;
  max-width: calc(100% - 1rem);
  overflow: hidden;
  padding: .25rem .5rem;
  border-radius: 7px;
  background: rgba(6, 10, 27, .7);
  color: #fff;
  font-size: .74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-video-empty {
  display: grid;
  place-items: center;
  min-height: 56px;
  margin: 0;
  padding: 1rem;
  border: 1px dashed #cbd3ee;
  border-radius: 12px;
  background: #f7f8ff;
  color: #67718f;
  text-align: center;
  font-size: .86rem;
}

.dm-call-message {
  margin: .7rem 0 .5rem;
  color: #525d7e;
  font-size: .8rem;
}

.dm-call-actions {
  flex: 0 0 auto;
}

.dm-teacher-tools {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: .7rem;
  margin-bottom: .8rem;
}

.dm-teacher-tools .dm-field {
  flex: 1 1 auto;
  margin: 0;
}

.dm-question-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  color: #2c3558;
  line-height: 1.5;
}

.dm-question-content img,
.dm-question-content video,
.dm-question-content canvas,
.dm-question-content iframe {
  max-width: 100%;
}

.dm-comment-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: .2rem;
}

.dm-comment-empty,
.dm-comments-inactive {
  color: #75809c;
  font-size: .85rem;
}

.dm-comment {
  margin: 0 0 .8rem;
  padding: .7rem .75rem;
  border: 1px solid #e4e8f4;
  border-radius: 12px;
  background: #f8f9fe;
}

.dm-comment-header {
  flex-wrap: wrap;
  gap: .3rem .5rem;
  font-size: .74rem;
}

.dm-comment-header strong { color: #27335b; }
.dm-comment-header span { color: #5748af; }
.dm-comment-header time { margin-left: auto; color: #8790a9; }

.dm-comment p {
  margin: .35rem 0 0;
  color: #394463;
  font-size: .84rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.dm-comment-form {
  flex: 0 0 auto;
  padding-top: .85rem;
  border-top: 1px solid #e6eaf4;
}

.dm-comment-form label {
  display: block;
  margin-bottom: .35rem;
  color: #344066;
  font-size: .78rem;
  font-weight: 750;
}

.dm-comment-form textarea {
  display: block;
  width: 100%;
  min-height: 72px;
  padding: .65rem .75rem;
  resize: vertical;
  border: 1px solid #cdd4e9;
  border-radius: 10px;
  background: #fff;
  color: #242e51;
  font: inherit;
  font-size: .85rem;
}

.dm-comment-form > div { margin-top: .5rem; }
.dm-comment-form small { color: #8390a9; font-size: .72rem; }

.dm-panel [hidden],
.dm-overlay [hidden],
.dm-panel[hidden],
.dm-overlay[hidden] {
  display: none !important;
}

@media (max-width: 800px) {
  .dm-overlay { padding: 0; }
  .dm-window { width: 100%; height: 100%; border: 0; border-radius: 0; }
  .dm-layout { display: block; overflow: auto; padding: .7rem; }
  .dm-main { display: block; overflow: visible; }
  .dm-main > .dm-card, .dm-comments { margin-bottom: .7rem; }
  .dm-video-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dm-teacher-stage { height: clamp(170px, 23vh, 220px); }
  .dm-question-card { min-height: 300px; }
  .dm-question-content { max-height: 55vh; }
  .dm-comments { min-height: 320px; }
  .dm-comment-list { max-height: 260px; }
}

@media (max-width: 520px) {
  .dm-header { align-items: start; padding: .7rem .8rem; }
  .dm-header h2 { font-size: 1.05rem; }
  .dm-header-right { gap: .35rem; }
  .dm-live-pill { display: none; }
  .dm-time { font-size: .75rem; }
  .dm-card { padding: .75rem; }
  .dm-teacher-tools { display: block; }
  .dm-teacher-tools .dm-button { margin-top: .6rem; }
  .dm-panel-actions .dm-button { flex: 1 1 auto; }
  .dm-gallery-nav { flex-wrap: wrap; justify-content: center; }
  .dm-gallery-nav [data-dm-gallery-page] { order: -1; flex-basis: 100%; }
}

/* Match DISCO's black-and-white controls; reserve red for live status and end. */
.dm-panel {
  border-color: #d8d8d8;
  background: #fff;
  color: #111;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .07);
}
.dm-panel h2,
.dm-section-head h3 { color: #111; }
.dm-panel-detail,
.dm-section-head span,
.dm-call-message,
.dm-comment-empty,
.dm-comments-inactive,
.dm-comment-form small { color: #555; }
.dm-panel-clock,
.dm-time { color: #b10f33; }
.dm-participant-count { color: #555; }
.dm-kicker {
  background: #111;
  color: #fff;
}
.dm-button:focus-visible,
.dm-icon-button:focus-visible,
.dm-field select:focus-visible,
.dm-comment-form textarea:focus-visible { outline-color: #111; }
.dm-button-primary,
.dm-button-primary:hover:not(:disabled) {
  border-color: #111;
  background: #111;
  color: #fff;
  box-shadow: none;
}
.dm-button-quiet,
.dm-button-quiet:hover:not(:disabled) {
  border-color: #111;
  background: #fff;
  color: #111;
}
.dm-button-danger,
.dm-button-danger:hover:not(:disabled) {
  border-color: #b10f33;
  background: #fff;
  color: #b10f33;
}
.dm-field,
.dm-comment-form label,
.dm-comment-header strong,
.dm-comment p { color: #222; }
.dm-field select,
.dm-comment-form textarea {
  border-color: #bdbdbd;
  background: #fff;
  color: #111;
}
.dm-overlay { background: rgba(0, 0, 0, .85); color: #111; }
.dm-window { border-color: #ddd; background: #f5f5f5; }
.dm-header,
.dm-card { border-color: #ddd; background: #fff; }
.dm-live-pill { background: #b10f33; color: #fff; }
.dm-icon-button { border-color: #bbb; background: #fff; color: #111; }
.dm-tile { background: #111; }
.dm-tile figcaption { background: rgba(0, 0, 0, .72); }
.dm-teacher-stage { background: #111; }
.dm-teacher-stage figcaption { background: rgba(0, 0, 0, .72); }
.dm-video-empty { border-color: #bbb; background: #f7f7f7; color: #555; }
.dm-question-content { color: #111; }
.dm-comment { border-color: #ddd; background: #f7f7f7; }
.dm-comment-header span { color: #555; }
.dm-comment-header time { color: #777; }
.dm-comment-form { border-color: #ddd; }
