:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #6b7280;
  --brand: #2f6fed;
  --brand-dark: #1f4fc0;
  --danger: #e0414b;
  --line: #e5e7eb;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(20, 30, 60, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 18px; margin: 0; }
.top-actions { display: flex; gap: 14px; align-items: center; }
.admin-link {
  font-size: 14px;
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}
.admin-link:active { color: var(--brand-dark); }

.container { max-width: 880px; margin: 0 auto; padding: 16px; }

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filters select,
.filters input {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  background: var(--card);
  color: var(--text);
}
.filters input[type="search"] { flex: 1; min-width: 160px; }
.filters button {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.loading, .empty { color: var(--muted); padding: 24px 0; text-align: center; }

.subject { margin-bottom: 22px; }
.subject > h2 {
  font-size: 16px;
  margin: 0 0 8px;
  padding-left: 4px;
  border-left: 4px solid var(--brand);
}
.date-group { margin: 10px 0 0 8px; }
.date-group > h3 {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 8px;
  font-weight: 600;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease;
}
.card:active { transform: scale(0.98); }
.thumb {
  position: relative;
  height: 96px;
  background: linear-gradient(135deg, #2f6fed, #6aa0ff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  overflow: hidden;
}
.thumb .cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thumb .play {
  position: relative;
  z-index: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  padding-left: 3px;
}
.thumb .dur {
  position: absolute;
  z-index: 1;
  right: 6px;
  bottom: 6px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 6px;
}
.meta { padding: 10px; }
.meta .t {
  font-size: 14px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.meta .s { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* 播放弹窗 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 30, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal.hidden { display: none; }
.modal-box {
  background: #000;
  border-radius: var(--radius);
  max-width: 720px;
  width: 100%;
  position: relative;
  overflow: hidden;
}
.modal-box h3 { color: #fff; font-size: 14px; margin: 0; padding: 10px 14px; }
.modal-box .close {
  position: absolute;
  top: 6px;
  right: 10px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border: none;
  font-size: 22px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
}
.modal-box video { width: 100%; display: block; max-height: 75vh; background: #000; }

/* 上传后台 */
.upload-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.upload-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}
.upload-form input {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  color: var(--text);
  background: #fff;
}
.upload-form .hint { font-size: 12px; color: var(--muted); }
.upload-form button[type="submit"] {
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.upload-form button[type="submit"]:disabled { opacity: 0.6; }
.cover-preview {
  width: 160px;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.cover-preview.hidden { display: none; }

.progress {
  height: 10px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progress.hidden { display: none; }
.progress .bar {
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width 0.2s ease;
}
.msg { font-size: 13px; margin: 0; min-height: 18px; }
.msg:not(:empty) { color: var(--brand-dark); }

.admin-list { margin-top: 8px; }
.admin-list .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 14px;
}
.admin-list .del {
  border: 1px solid var(--danger);
  color: var(--danger);
  background: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  flex: none;
}

/* 登录页 */
.login-wrap {
  min-height: calc(100dvh - 0px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 22px;
  text-align: center;
}
.login-card h1 { font-size: 20px; margin: 0 0 6px; }
.login-card .muted { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card input {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  text-align: center;
}
.login-card button {
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.login-card button:disabled { opacity: 0.6; }
.muted { color: var(--muted); }

/* 批量上传队列 */
.overall { display: flex; flex-direction: column; gap: 6px; }
.overall-text { font-size: 13px; color: var(--muted); }
.queue { display: flex; flex-direction: column; gap: 10px; }
.up-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--card);
}
.up-row.failed { border-color: var(--danger); }
.up-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.up-name {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.up-pct { font-size: 13px; color: var(--brand); font-weight: 600; flex: none; }
.up-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.up-stat { font-size: 12px; color: var(--muted); }
.retry {
  flex: none;
  border: 1px solid var(--brand);
  color: var(--brand);
  background: #fff;
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
}
.hidden { display: none; }

/* 播放失败/超时提示 */
.player-err {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #4a1f1f;
  border: 1px solid #a33;
  color: #ffd9d9;
  font-size: 13px;
  line-height: 1.5;
}
