:root {
  --dm-bg: #08060c;
  --dm-panel: rgba(21, 15, 25, 0.82);
  --dm-panel-strong: rgba(31, 22, 34, 0.94);
  --dm-line: rgba(255, 255, 255, 0.11);
  --dm-text: #f7f3ef;
  --dm-muted: rgba(247, 243, 239, 0.62);
  --dm-blue: #4db6ff;
  --dm-red: #f05b5b;
  --dm-green: #45d37d;
  --dm-gold: #f0a050;
}

html,
body.ls-page-moderator {
  min-height: 100%;
  height: auto !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

body.ls-page-moderator {
  padding: 72px clamp(10px, 2vw, 24px) 92px;
  background:
    linear-gradient(rgba(8, 6, 12, 0.72), rgba(8, 6, 12, 0.92)),
    url("img/lobby-bg.jpg") center / cover fixed,
    radial-gradient(circle at 50% 0%, rgba(77, 182, 255, 0.18), transparent 48%),
    var(--dm-bg);
  color: var(--dm-text);
}

.dm-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  grid-template-areas:
    "stage queue"
    "workbench queue"
    "actions actions";
  gap: 16px;
}

.dm-stage,
.dm-queue-panel,
.dm-workbench > div,
.dm-bottom-actions {
  border: 1px solid var(--dm-line);
  background: var(--dm-panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.dm-stage {
  grid-area: stage;
  position: relative;
  overflow: hidden;
  min-height: 570px;
  border-radius: 10px;
  padding: clamp(18px, 2.6vw, 36px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dm-stage-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(77, 182, 255, 0.08), transparent 18%, transparent 82%, rgba(240, 91, 91, 0.08)),
    radial-gradient(circle at 50% 48%, rgba(77, 182, 255, 0.18), transparent 32%);
  opacity: 0.9;
}

.dm-stage > * {
  position: relative;
  z-index: 1;
}

.dm-stage-head,
.dm-panel-head,
.dm-tool-head,
.dm-bottom-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dm-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dm-brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(77, 182, 255, 0.95), rgba(92, 208, 224, 0.55));
  color: #061019;
  font-weight: 1000;
  letter-spacing: 0.04em;
  box-shadow: 0 0 28px rgba(77, 182, 255, 0.28);
}

.dm-brand strong,
.dm-panel-head strong,
.dm-tool-head strong {
  display: block;
  font-size: 1.02rem;
  font-weight: 900;
}

.dm-brand span:not(.dm-brand-mark),
.dm-panel-head span,
.dm-tool-head span,
.dm-topic-strip span,
.dm-time-stepper span {
  display: block;
  color: var(--dm-muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.dm-room-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
}

.dm-room-picker select,
.dm-add-row input,
.dm-speaker-row input,
.dm-time-stepper input {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(4, 3, 8, 0.72);
  color: var(--dm-text);
  min-height: 48px;
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
  font-weight: 800;
}

.dm-topic-strip {
  margin-top: 22px;
  padding: 14px 16px;
  border: 1px solid rgba(77, 182, 255, 0.2);
  border-radius: 10px;
  background: rgba(77, 182, 255, 0.08);
}

.dm-topic-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dm-topic-meta b {
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(240, 160, 80, 0.14);
  color: #ffd2a2;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.dm-topic-strip strong {
  display: block;
  margin-top: 5px;
  font-size: clamp(1.1rem, 2.6vw, 2.1rem);
  line-height: 1.1;
}

.dm-timer-wrap {
  text-align: center;
  padding: clamp(20px, 4vw, 46px) 0;
}

.dm-speaker-line {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--dm-muted);
}

.dm-speaker-line span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(240, 160, 80, 0.12);
  color: #ffd2a2;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.dm-speaker-line strong {
  font-size: clamp(1rem, 1.8vw, 1.35rem);
}

.dm-timer {
  font-size: clamp(5.2rem, 17vw, 16rem);
  line-height: 0.95;
  font-weight: 1000;
  letter-spacing: 0;
  color: var(--dm-blue);
  text-shadow: 0 0 32px rgba(77, 182, 255, 0.5);
  font-variant-numeric: tabular-nums;
}

.dm-timer.is-warn {
  color: #ffc857;
  text-shadow: 0 0 30px rgba(255, 200, 87, 0.45);
}

.dm-timer.is-done {
  color: var(--dm-red);
  text-shadow: 0 0 36px rgba(240, 91, 91, 0.5);
}

.dm-progress {
  width: min(760px, 84%);
  height: 9px;
  margin: 16px auto 0;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.dm-progress i {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--dm-green), var(--dm-blue));
}

.dm-fast-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.dm-turn-btn,
.dm-primary,
.dm-secondary,
.dm-format-row button,
.dm-tool-actions button,
.dm-add-row button,
.dm-source-quick button,
.dm-bottom-actions button,
.dm-person-actions button,
.dm-topic-list button,
.dm-source-list button,
.dm-time-stepper button,
.dm-open-room,
.dm-panel-head a,
.dm-tool-head a {
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: var(--dm-text);
  background: rgba(255, 255, 255, 0.06);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
}

.dm-turn-btn {
  padding: 14px;
  text-align: left;
}

.dm-turn-btn span,
.dm-turn-btn strong {
  display: block;
}

.dm-turn-btn span {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 4px;
}

.dm-turn-btn strong {
  font-size: clamp(1rem, 2vw, 1.35rem);
}

.dm-turn-rebut { background: linear-gradient(135deg, rgba(77, 182, 255, 0.92), rgba(32, 111, 185, 0.92)); }
.dm-turn-speak { background: linear-gradient(135deg, rgba(240, 91, 91, 0.95), rgba(172, 36, 48, 0.95)); }
.dm-turn-long { background: linear-gradient(135deg, rgba(240, 160, 80, 0.95), rgba(111, 70, 187, 0.95)); }

.dm-control-deck {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
}

.dm-time-stepper {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 12px;
}

.dm-time-stepper > div {
  display: grid;
  grid-template-columns: 48px minmax(64px, 1fr) 48px;
  gap: 8px;
}

.dm-time-stepper span {
  grid-column: 1 / -1;
  text-align: center;
}

.dm-time-stepper b {
  align-self: center;
  color: var(--dm-blue);
  font-size: 2rem;
}

.dm-time-stepper input {
  text-align: center;
  font-size: 1.25rem;
}

.dm-speaker-row,
.dm-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  margin-top: 14px;
}

.dm-primary {
  background: linear-gradient(135deg, rgba(69, 211, 125, 0.94), rgba(34, 151, 88, 0.94));
  color: #06120d;
}

.dm-secondary {
  background: rgba(255, 255, 255, 0.12);
}

.dm-format-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.dm-format-row button.active {
  border-color: rgba(77, 182, 255, 0.7);
  background: rgba(77, 182, 255, 0.18);
}

.dm-queue-panel {
  grid-area: queue;
  border-radius: 10px;
  padding: 18px;
  min-height: 570px;
  background: var(--dm-panel-strong);
}

.dm-panel-head a,
.dm-tool-head a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
}

.dm-next-btn {
  width: 100%;
  margin: 16px 0;
}

.dm-list-block {
  padding: 14px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.dm-list-block h2 {
  margin: 0 0 10px;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.72);
}

.dm-person-list,
.dm-topic-list,
.dm-source-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.dm-person-list li,
.dm-topic-list li,
.dm-source-list li {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.045);
}

.dm-person-list li {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.dm-person-rank {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(77, 182, 255, 0.14);
  color: var(--dm-blue);
  font-weight: 1000;
}

.dm-person-meta strong,
.dm-topic-list strong,
.dm-source-list strong {
  display: block;
  overflow-wrap: anywhere;
}

.dm-person-meta span,
.dm-topic-list span,
.dm-source-list span,
.dm-empty {
  color: var(--dm-muted);
  font-size: 0.84rem;
}

.dm-person-actions,
.dm-row-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dm-person-actions button,
.dm-row-actions button,
.dm-topic-list button,
.dm-source-list button {
  min-height: 38px;
  padding: 0 10px;
}

.dm-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.82);
  font-weight: 800;
}

.dm-toggle input {
  width: 22px;
  height: 22px;
}

.dm-workbench {
  grid-area: workbench;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.dm-workbench > div {
  border-radius: 10px;
  padding: 18px;
}

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

.dm-add-row {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 12px;
}

.dm-topic-list li.is-current {
  border-color: rgba(77, 182, 255, 0.5);
  background: rgba(77, 182, 255, 0.1);
}

.dm-source-list a {
  color: #9ddcff;
  overflow-wrap: anywhere;
}

.dm-source-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.dm-source-quick button {
  min-height: 38px;
  padding: 0 10px;
}

.dm-bottom-actions {
  grid-area: actions;
  border-radius: 10px;
  padding: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.dm-bottom-actions button {
  min-width: 150px;
  padding: 0 14px;
}

.dm-shell.is-minimal {
  grid-template-columns: 1fr;
  grid-template-areas:
    "stage"
    "actions";
}

.dm-shell.is-minimal .dm-queue-panel,
.dm-shell.is-minimal .dm-workbench {
  display: none;
}

.dm-shell.is-minimal .dm-stage {
  min-height: calc(100vh - 184px);
}

.dm-shell.is-minimal .dm-timer {
  font-size: clamp(7rem, 24vw, 21rem);
}

body.vr-mode .dm-shell {
  width: min(1680px, 100%);
}

body.vr-mode .dm-stage,
body.vr-mode .dm-queue-panel,
body.vr-mode .dm-workbench > div {
  border-width: 2px;
}

body.vr-mode .dm-turn-btn,
body.vr-mode .dm-primary,
body.vr-mode .dm-secondary,
body.vr-mode .dm-format-row button,
body.vr-mode .dm-add-row button,
body.vr-mode .dm-room-picker select,
body.vr-mode .dm-add-row input,
body.vr-mode .dm-speaker-row input {
  min-height: 60px;
  font-size: 1.15rem;
}

@media (max-width: 1080px) {
  .dm-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "stage"
      "queue"
      "workbench"
      "actions";
  }

  .dm-stage,
  .dm-queue-panel {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  body.ls-page-moderator {
    padding: 62px 8px 86px;
  }

  .dm-stage {
    padding: 14px;
  }

  .dm-stage-head,
  .dm-panel-head,
  .dm-tool-head {
    align-items: stretch;
    flex-direction: column;
  }

  .dm-room-picker {
    width: 100%;
  }

  .dm-room-picker select {
    flex: 1;
  }

  .dm-fast-actions,
  .dm-workbench,
  .dm-format-row {
    grid-template-columns: 1fr;
  }

  .dm-time-stepper {
    grid-template-columns: 1fr;
  }

  .dm-time-stepper b {
    display: none;
  }

  .dm-speaker-row,
  .dm-add-row {
    grid-template-columns: 1fr;
  }

  .dm-bottom-actions button {
    flex: 1 1 140px;
  }
}
