.stream-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.stream-toolbar > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stream-toolbar span,
.group-runtime span {
  color: var(--muted);
  font-size: 9px;
}

.stream-toolbar select {
  min-width: 190px;
  padding: 9px 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: 600 11px inherit;
}

.stream-toolbar p {
  margin: 0;
  color: #476f5d;
  font-size: 10px;
  font-weight: 700;
}

.group-runtime b {
  display: block;
  margin-top: 7px;
  font-size: 11px;
}

.group-list .group-card {
  grid-template-columns: 1fr 145px minmax(180px, 1.2fr) 1fr auto;
}

.group-list .subtitle-input {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid #dfe4de;
  border-radius: 9px;
  font: 12px inherit;
}

@media (max-width: 1180px) {
  .group-list .group-card { grid-template-columns: 1fr 1fr; }
}

.source-card.onair {
  border-color: #3f8b68;
  box-shadow: 0 0 0 2px #dceee5;
}

.source-image {
  position: relative;
  overflow: hidden;
}

.source-image::after,
.replay-cover::after {
  position: absolute;
  inset: 35% 0 0;
  background: linear-gradient(transparent, rgba(8, 18, 13, .82));
  content: "";
  pointer-events: none;
}

.live-chip {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 5px 8px;
  color: #fff;
  background: #24684f;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 800;
  z-index: 2;
}

.source-card.preparing {
  border-color: #d3a34a;
  box-shadow: 0 0 0 2px #f7ead0;
}

.preparing-chip {
  background: #9a6519;
}

.source-status {
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 8px;
  padding: 5px 8px;
  color: #fff;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 800;
  backdrop-filter: blur(5px);
}

.source-status.online { background: rgba(32, 125, 82, .9); }
.source-status.checking { background: rgba(166, 101, 22, .88); }
.source-status.updating { background: rgba(166, 101, 22, .88); }
.source-status.unknown { background: rgba(65, 71, 68, .8); }
.source-status.offline { background: rgba(65, 71, 68, .8); }

.source-card .source-name {
  position: absolute;
  z-index: 2;
  right: 10px;
  bottom: 9px;
  left: 10px;
  overflow: hidden;
  color: #fff;
  font-size: 11px;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .75);
  white-space: nowrap;
}

.source-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.source-action {
  width: 100%;
  margin: 0;
  padding: 9px;
  color: #25634a;
  background: #e9f3ee;
  border: 0;
  border-radius: 8px;
  font: 700 10px inherit;
  cursor: pointer;
}

.replay-action {
  width: 100%;
  padding: 9px;
  color: #315f9c;
  background: #e9f0f9;
  border: 0;
  border-radius: 8px;
  font: 700 10px inherit;
  cursor: pointer;
}

.replay-action:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.source-action.stop {
  color: #a44039;
  background: #f8e8e6;
}

.source-action:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.local-note {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.local-note > span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--green);
  background: var(--mint);
  border-radius: 11px;
  font-size: 20px;
}

.local-note b { font-size: 12px; }
.local-note small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.local-note button {
  padding: 9px 12px;
  color: var(--green);
  background: #edf5f1;
  border: 0;
  border-radius: 8px;
  font: 700 10px inherit;
  cursor: pointer;
}

.local-folder-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.local-folder {
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.local-folder.active { border-color: #3f8b68; box-shadow: 0 0 0 2px #dceee5; }
.local-folder h3 { margin: 0 0 6px; font-size: 13px; }
.local-folder p { margin: 0 0 15px; color: var(--muted); font-size: 10px; }
.local-folder button { width: 100%; }

@media (max-width: 1050px) { .local-folder-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) {
  .local-folder-grid { grid-template-columns: repeat(2, 1fr); }
  .local-note { grid-template-columns: auto 1fr; }
  .local-note button { grid-column: 1 / -1; }
}

.back-button {
  margin: 0 0 14px;
  padding: 0;
  color: var(--green);
  background: none;
  border: 0;
  font: 700 11px inherit;
  cursor: pointer;
}

.replay-calendar {
  margin-bottom: 14px;
}

.replay-calendar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.replay-calendar-heading b { font-size: 12px; }
.replay-calendar-heading small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.replay-calendar-heading button {
  padding: 7px 11px;
  color: var(--green);
  background: #edf5f1;
  border: 0;
  border-radius: 8px;
  font: 700 10px inherit;
  cursor: pointer;
}

.date-tabs {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.date-button {
  flex: 0 0 auto;
  padding: 9px 13px;
  color: #5f6978;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 750 11px inherit;
  cursor: pointer;
}

.date-button.active { color: #fff; background: var(--green); border-color: var(--green); }
.no-replay-dates { color: var(--muted); font-size: 10px; }

.download-task-menu { position: relative; }
.download-task-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  color: var(--green);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  font: 750 11px inherit;
  cursor: pointer;
}
.download-task-trigger b {
  min-width: 20px;
  padding: 3px 6px;
  color: #fff;
  background: #9da7a1;
  border-radius: 999px;
  font-size: 9px;
  text-align: center;
}
.download-task-trigger.has-active b { background: var(--green); }
.download-task-trigger i { font-size: 13px; font-style: normal; transition: transform .2s ease; }
.download-task-trigger[aria-expanded="true"] i { transform: rotate(180deg); }
.download-task-dropdown {
  position: absolute;
  z-index: 15;
  top: calc(100% + 9px);
  right: 0;
  width: min(430px, calc(100vw - 28px));
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(25, 45, 35, .16);
}
.replay-download-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.replay-download-heading b { font-size: 12px; }
.replay-download-heading small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.replay-download-heading > span { color: var(--green); font-size: 10px; font-weight: 750; }
.replay-download-list { display: grid; gap: 8px; max-height: min(65vh, 560px); margin-top: 13px; overflow-y: auto; overscroll-behavior: contain; }
.download-empty { padding: 10px 0 2px; color: var(--muted); font-size: 10px; text-align: center; }
.replay-download-job {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px 12px;
  background: #f7f9f6;
  border: 1px solid #e8ece7;
  border-radius: 9px;
}
.download-job-main { display: flex; align-items: center; gap: 9px; min-width: 0; }
.download-job-main b { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.download-job-main time { color: var(--muted); font-size: 9px; white-space: nowrap; }
.download-job-main strong { margin-left: auto; color: var(--green); font-size: 9px; white-space: nowrap; }
.replay-download-job.failed .download-job-main strong { color: var(--red); }
.replay-download-job.completed .download-job-main strong { color: #315f9c; }
.download-job-progress,
.replay-card-progress > div { height: 6px; overflow: hidden; background: #e4e9e5; border-radius: 999px; }
.download-job-progress i,
.replay-card-progress i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #2b7558, #67b88e); border-radius: inherit; transition: width .35s ease; }
.replay-download-job.failed .download-job-progress i { background: var(--red); }
.replay-download-job > small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.replay-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.replay-list > .empty { grid-column: 1 / -1; }

.replay-item {
  display: block;
  overflow: hidden;
  padding: 0;
}

.replay-cover {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #e8ece8;
}

.replay-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.replay-cover b,
.replay-cover time,
.replay-duration {
  position: absolute;
  z-index: 2;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .75);
}

.replay-cover b {
  right: 82px;
  bottom: 9px;
  left: 10px;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.replay-cover time {
  right: 10px;
  bottom: 9px;
  font-size: 8px;
}

.replay-duration {
  top: 8px;
  right: 8px;
  padding: 4px 7px;
  background: rgba(20, 33, 27, .74);
  border-radius: 999px;
  font-size: 8px;
  font-style: normal;
}

.replay-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
}

.replay-body small {
  color: var(--muted);
  font-size: 9px;
}

.replay-body .primary {
  padding: 8px 11px;
  white-space: nowrap;
}

.replay-card-progress { padding: 0 10px 10px; }
.replay-card-progress span { display: block; margin-top: 5px; color: var(--green); font-size: 8px; text-align: right; }

.replay-buttons { display: flex; align-items: center; gap: 7px; }
.preview-replay {
  padding: 8px 11px;
  color: #315f9c;
  background: #e9f0f9;
  border: 0;
  border-radius: 8px;
  font: 700 10px inherit;
  white-space: nowrap;
  cursor: pointer;
}
.preview-replay:disabled { opacity: .5; cursor: wait; }

.player-card {
  width: min(920px, 96vw);
  position: relative;
  padding: 22px;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.player-card h2 { margin-bottom: 14px; }
.player-card video { width: 100%; max-height: 72vh; display: block; background: #000; border-radius: 10px; }
.player-close {
  position: absolute;
  top: 13px;
  right: 14px;
  width: 34px;
  height: 34px;
  color: #59645d;
  background: #eef1ed;
  border: 0;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
}
.player-tip { min-height: 18px; margin: 10px 0 0; color: var(--red); font-size: 10px; }

@media (max-width: 760px) {
  .stream-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .stream-toolbar > div,
  .stream-toolbar select {
    width: 100%;
  }

  .group-list .group-card { grid-template-columns: 1fr; }
  .replay-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .replay-body { align-items: flex-start; flex-direction: column; }
  .replay-buttons { width: 100%; }
  .replay-buttons button { flex: 1; }
  .download-task-trigger > span { display: none; }
  .download-task-dropdown { position: fixed; top: 86px; right: 14px; left: 14px; width: auto; }
  .replay-download-heading { align-items: flex-start; }
  .replay-download-job { grid-template-columns: 1fr; gap: 8px; }
  .download-job-main { flex-wrap: wrap; }
  .download-job-main strong { margin-left: 0; }
}
