:root {
  color-scheme: dark;
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1d242e;
  --border: #262d38;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #4f9cf9;
  --live: #3fb950;
  --grace: #d29922;
  --danger: #f85149;
  --radius: 12px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

.studio {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.bar__status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
}

.bar__time {
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  font-size: 14px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  flex: none;
}

.dot[data-state="active"] {
  background: var(--live);
  box-shadow: 0 0 0 4px rgb(63 185 80 / 18%);
}

.dot[data-state="grace"] {
  background: var(--grace);
  box-shadow: 0 0 0 4px rgb(210 153 34 / 18%);
}

.bar__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn:hover { border-color: #3b4654; }

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #06121f;
}

.btn--ghost {
  background: transparent;
}

.btn--danger {
  background: transparent;
  border-color: rgb(248 81 73 / 45%);
  color: #ffb4ad;
}

.btn--danger:hover {
  border-color: var(--danger);
}

.btn--danger-armed {
  background: var(--danger);
  border-color: var(--danger);
  color: #2a0b09;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ------------------------------------------------------------- playlist --- */

.songs {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.songs__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.songs__head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.songs__count {
  color: var(--text-dim);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.songs__actions {
  display: flex;
  gap: 8px;
}

.songs__hint {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

.songs__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.songs__empty,
.songs__more {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
}

.song {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--surface-2);
}

.song__pos {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-dim);
  text-align: right;
}

.song__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.song__title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song__by {
  font-size: 12px;
  color: var(--text-dim);
}

/* Copies the bare title: the host pastes it into a player search box. */
.song__copy {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.song__copy:hover {
  border-color: #3b4654;
  color: var(--text);
}

.song__copy:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.song__copy--done {
  border-color: var(--live);
  color: var(--live);
}

@media (max-width: 520px) {
  /* On a phone the row wraps rather than squeezing the title to nothing. */
  .song {
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .song__copy {
    grid-column: 2;
    justify-self: start;
  }
}

.song--next {
  background: rgb(79 156 249 / 12%);
}

.song--next .song__pos,
.song--next .song__title {
  color: var(--accent);
}

.notice {
  margin: 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgb(248 81 73 / 12%);
  border: 1px solid rgb(248 81 73 / 35%);
  color: #ffb4ad;
  font-size: 14px;
}

.preview {
  flex: 1;
  min-height: 360px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #0a0d12;
  position: relative;
}

#overlay-frame {
  width: 100%;
  height: 100%;
  min-height: 360px;
  border: 0;
  display: block;
}

.placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 6px;
  padding: 24px;
}

.placeholder__title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.placeholder__hint {
  margin: 0;
  font-size: 14px;
  color: var(--text-dim);
}

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-dim);
}

code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 12px;
}

@media (max-width: 640px) {
  .studio { padding: 12px; }
  .bar { padding: 12px; }
}
