/* ==========================================================================
   老实人小黄的字幕站 · 仿 B 站布局样式
   主色取 B 站粉 #FB7299，辅色天蓝 #00AEEC，浅灰底 #F1F2F3
   ========================================================================== */

:root {
  --pink: #FB7299;
  --pink-h: #FC8BAB;
  --pink-soft: #FFF1F5;
  --pink-text: #C4405F;
  --blue: #00AEEC;
  --bg: #F1F2F3;
  --card: #FFFFFF;
  --t1: #18191C;
  --t2: #61666D;
  --t3: #9499A0;
  --line: #E3E5E7;
  --fill: #F1F2F3;
  --fill-h: #E3E5E7;
  --radius: 6px;
  --radius-lg: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .18);
  --header-h: 64px;
}

* { box-sizing: border-box; }

/* 作者样式里给按钮/卡片设了 display，会盖掉 hidden 的 UA 默认值，这里统一兜住 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  color: var(--t1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p { margin: 0; }
button { font-family: inherit; }
a { color: inherit; }

/* --------------------------------------------------------------- 顶栏 */

.b-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .05), 0 2px 8px rgba(0, 0, 0, .04);
}

.b-header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--header-h);
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px;
}

.b-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex: none;
}

.b-logo-mark {
  display: block;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(24, 25, 28, .06);
}

.b-logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .3px;
  color: var(--t1);
}

.b-search {
  position: relative;
  flex: 1 1 320px;
  max-width: 500px;
}

.b-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--t3);
  pointer-events: none;
}

.b-search input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 36px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: var(--fill);
  color: var(--t1);
  font-size: 14px;
  outline: none;
  transition: background .15s, border-color .15s;
  appearance: none;
}

.b-search input::placeholder { color: var(--t3); }

.b-search input:focus {
  background: #fff;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(251, 114, 153, .12);
}

.b-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex: none;
}

/* --------------------------------------------------------------- 按钮 */

.b-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}

.b-btn svg { width: 16px; height: 16px; flex: none; }

.b-btn:disabled,
.b-btn[disabled] { opacity: .45; cursor: not-allowed; }

.b-btn-pink { background: var(--pink); color: #fff; }
.b-btn-pink:hover:not(:disabled) { background: var(--pink-h); }

.b-btn-pink-outline {
  background: #fff;
  color: var(--pink);
  border-color: var(--pink);
}
.b-btn-pink-outline:hover { background: var(--pink-soft); }

.b-btn-line {
  background: #fff;
  color: var(--t1);
  border-color: var(--line);
}
.b-btn-line:hover { background: #F6F7F8; border-color: #C9CCD0; }

.b-btn-text {
  background: transparent;
  color: var(--t2);
}
.b-btn-text:hover { background: var(--fill); color: var(--t1); }

.b-btn-lg { height: 40px; padding: 0 26px; font-size: 15px; }
.b-btn-block { display: flex; width: calc(100% - 32px); margin: 10px 16px 0; }

.b-badge {
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--pink-soft);
  color: var(--pink);
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
}

.b-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(24, 25, 28, .06);
  flex: none;
  user-select: none;
}

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

.b-avatar-lg { width: 40px; height: 40px; font-size: 16px; }

/* --------------------------------------------------------------- 页面骨架 */

.b-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  align-items: start;
  gap: 16px;
  max-width: 1440px;
  margin: 16px auto 48px;
  padding: 0 20px;
}

.b-main { min-width: 0; }

.b-page { flex: 1 0 auto; }

/* 页脚声明：半透明、不抢视线 */
.b-footer {
  flex: none;
  padding: 26px 16px 30px;
  padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  user-select: none;
}

.b-footer p {
  font-size: 12px;
  line-height: 1.7;
  letter-spacing: .3px;
  color: var(--t3);
  opacity: .45;
}

/* --------------------------------------------------------------- 播放器 */

.b-player-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.b-empty {
  display: grid;
  place-items: center;
  min-height: 380px;
  padding: 44px 24px;
  border: 2px dashed transparent;
  border-radius: var(--radius);
  transition: border-color .15s, background .15s;
}

.b-empty.dragging {
  border-color: var(--pink);
  background: var(--pink-soft);
}

.b-empty-inner { text-align: center; max-width: 460px; }

.b-empty-illus { color: #D8DBE0; margin-bottom: 4px; }
.b-empty-illus svg { width: 96px; height: 64px; }

.b-empty-inner h2 {
  margin: 10px 0 10px;
  font-size: 17px;
  font-weight: 600;
  color: var(--t1);
}

.b-empty-inner p {
  margin: 0 auto 22px;
  max-width: 380px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--t2);
}

.b-empty-tip {
  margin-top: 14px !important;
  font-size: 12px !important;
  color: var(--t3) !important;
}

.player {
  background: #000;
  position: relative;
}

.frame-holder {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 74vh;
  background: #000;
  overflow: hidden;
}

.video-frame {
  position: relative;
  background: #000;
  line-height: 0;
  max-width: 100%;
  max-height: 100%;
}

.video-frame video {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  object-fit: contain;
}

.video-frame .sub-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.drop-overlay,
.render-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(0, 0, 0, .58);
  color: #fff;
  font-size: 13px;
  line-height: 1;
}

.drop-overlay[hidden],
.render-overlay[hidden] { display: none; }

.drop-overlay span {
  padding: 10px 18px;
  border: 1px dashed rgba(255, 255, 255, .6);
  border-radius: var(--radius-lg);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* 缺少字体提示（仅管理员可见，由 JS 控制显隐） */
.b-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--pink-soft);
  border-top: 1px solid #FBDCE6;
  color: var(--pink-text);
  font-size: 12.5px;
}

.b-notice[hidden] { display: none; }
.b-notice svg { width: 16px; height: 16px; flex: none; }

.b-notice-link {
  margin-left: auto;
  padding: 3px 10px;
  border: 1px solid currentColor;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-size: 12px;
  cursor: pointer;
}

.b-notice-link:hover { background: rgba(196, 64, 95, .08); }

/* --------------------------------------------------------------- 控制条 */

.b-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 12px;
  background: transparent;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .75);
  transition: opacity .18s ease, transform .18s ease;
}

.player:not(.immersive).controls-hidden .b-controls {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.ctrl-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  flex: none;
}

.ctrl-btn:hover { background: rgba(255, 255, 255, .14); }
.ctrl-btn svg { width: 20px; height: 20px; fill: currentColor; }
.ctrl-btn .i-play, .ctrl-btn .i-pause { fill: currentColor; }
.ctrl-btn.paused .i-pause { display: none; }
.ctrl-btn:not(.paused) .i-play { display: none; }
.ctrl-btn.muted .i-vol { opacity: .35; }

.b-time {
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, .92);
  flex: none;
}

.b-time-sep { opacity: .45; }

.seek-wrap {
  position: relative;
  flex: 1;
  height: 34px;
  min-width: 60px;
  touch-action: none;
}

.seek-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .24);
}

.seek-buffered,
.seek-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  border-radius: 2px;
}

.seek-buffered { background: rgba(255, 255, 255, .34); }
.seek-fill { background: var(--pink); }
.seek-knob { display: none; }

.seek {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  touch-action: none;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}

.seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.b-ctrl-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.chip-btn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  flex: none;
}

.chip-btn:hover { background: rgba(255, 255, 255, .14); }

.b-rate { position: relative; flex: none; }
.b-rate-btn { min-width: 48px; font-variant-numeric: tabular-nums; }

.rate-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 88px;
  padding: 4px;
  border-radius: 8px;
  background: rgba(24, 26, 31, .96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .5);
}

.rate-menu button {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, .84);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.rate-menu button:hover { background: rgba(255, 255, 255, .13); color: #fff; }
.rate-menu button[aria-selected="true"] { color: var(--pink); font-weight: 600; }
.chip-btn.off { color: rgba(255, 255, 255, .5); border-color: rgba(255, 255, 255, .16); }

.b-delay {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 28px;
  padding: 0 4px;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #fff;
  flex: none;
}

.b-delay #delayLabel { min-width: 40px; text-align: center; }

.mini-btn {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.mini-btn:hover { background: rgba(255, 255, 255, .18); }

/* --------------------------------------------------------------- 视频信息 */

.b-info {
  margin-top: 12px;
  padding: 16px 20px 20px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.b-title {
  font-size: 20px;
  line-height: 1.5;
  font-weight: 600;
  color: var(--t1);
  word-break: break-word;
  margin-bottom: 10px;
}

.b-metabar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.b-metas {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--t3);
}

.b-meta { display: inline-flex; align-items: center; gap: 4px; }
.b-meta b { font-weight: 500; color: var(--t2); }

.b-meta + .b-meta::before {
  content: "·";
  margin: 0 8px;
  color: #C9CCD0;
}

.b-tools { display: flex; align-items: center; gap: 8px; }

.b-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--fill);
  color: var(--t2);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.b-tool:hover { background: var(--fill-h); color: var(--t1); }
.b-tool.is-disabled { opacity: .45; pointer-events: none; }

.b-desc {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #F7F8FA;
}

.b-up { display: flex; align-items: center; gap: 10px; }
.b-up-info { flex: 1; min-width: 0; }
.b-up-name { font-size: 14px; font-weight: 600; color: var(--t1); }
.b-up-sub { margin-top: 2px; font-size: 12px; color: var(--t3); }

.b-desc-text {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--t2);
}

.b-desc-edit {
  margin-top: 10px;
  padding: 4px 10px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  background: transparent;
  font-size: 12px;
  color: var(--t3);
  cursor: pointer;
}
.b-desc-edit:hover { border-color: var(--pink); color: var(--pink); }

/* --------------------------------------------------------------- 侧栏 */

.b-side-card {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow: auto;
  padding: 12px 0 8px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.b-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 16px 10px;
}

.b-side-head h2 { font-size: 15px; font-weight: 600; color: var(--t1); }

.b-count {
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--fill);
  color: var(--t3);
  font-size: 12px;
  line-height: 18px;
}

.sub-list { counter-reset: subItem; }

/* 录播选集 */
.b-rec-section { position: static; }
.rec-search {
  display: block;
  width: calc(100% - 24px);
  margin: 0 12px 10px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--fill);
  color: var(--t1);
  font-size: 12px;
  outline: none;
}
.rec-search:focus { border-color: var(--pink); }
.rec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 12px;
}
.rec-card {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--t1);
}
.rec-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: #111;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .14);
}
.rec-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.rec-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .28);
  opacity: 0;
  transition: opacity .15s ease;
}
.rec-card:hover .rec-play, .rec-card.active .rec-play { opacity: 1; }
.rec-play svg { width: 30px; height: 30px; fill: #fff; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5)); }
.rec-title {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rec-meta { display: block; margin-top: 2px; color: var(--t3); font-size: 11px; }
.rec-card.active .rec-title { color: var(--pink); }
.rec-more { width: calc(100% - 24px); margin: 12px 12px 4px; }

.sub-item {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 0 8px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background .12s;
}

.sub-item::before {
  counter-increment: subItem;
  content: counter(subItem);
  grid-row: 1 / span 3;
  color: var(--t3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.sub-item h3 {
  grid-column: 2;
  padding-right: 24px;
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--t1);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sub-item .sub-meta {
  grid-column: 2;
  margin-top: 4px;
  font-size: 12px;
  color: var(--t3);
}

.sub-item .sub-tags {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.tag {
  padding: 1px 6px;
  border-radius: 4px;
  background: #E8F7FD;
  color: var(--blue);
  font-size: 11px;
  line-height: 16px;
  white-space: nowrap;
}

.sub-item:hover { background: #F6F7F8; }
.sub-item.active { background: var(--pink-soft); }
.sub-item.active h3 { color: var(--pink); }
.sub-item.active::before { color: var(--pink); }

.sub-del {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--t3);
  opacity: 0;
  cursor: pointer;
  transition: opacity .12s, background .12s, color .12s;
}

.sub-del svg { width: 15px; height: 15px; fill: currentColor; }
.sub-item:hover .sub-del, .sub-item.active .sub-del { opacity: 1; }
.sub-del:hover { background: #FDECEC; color: #F56C6C; }

.side-empty { padding: 28px 16px 32px; text-align: center; }
.side-empty p { font-size: 13px; color: var(--t2); }
.side-empty span { display: block; margin-top: 4px; font-size: 12px; color: var(--t3); }

/* 字体库（仅管理员） */
.b-font-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.b-font-hint {
  padding: 0 16px;
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--t3);
}

.font-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
}

.font-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12.5px;
}

.font-row:hover { background: #F6F7F8; }

.fname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--t2);
}

.fsize { color: var(--t3); font-size: 11.5px; flex: none; }

.font-del {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--t3);
  cursor: pointer;
  flex: none;
}

.font-del svg { width: 14px; height: 14px; fill: currentColor; }
.font-del:hover { background: #FDECEC; color: #F56C6C; }

/* --------------------------------------------------------------- 弹窗 */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, .45);
}

.modal[hidden] { display: none; }

.modal-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 20px;
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-lg);
}

.modal-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--t2);
  cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .12s ease;
}
.modal-x svg { width: 18px; height: 18px; display: block; }
.modal-x:hover { background: #FDEFF4; color: var(--pink); border-color: rgba(251, 114, 153, .2); }
.modal-x:active { transform: scale(.92); }
.modal-x:focus-visible { outline: 2px solid rgba(251, 114, 153, .5); outline-offset: 2px; }

.modal-card > h3 { padding-right: 34px; }

.modal-sm { max-width: 380px; }

.modal-card h3 { font-size: 16px; font-weight: 600; color: var(--t1); }

.modal-sub {
  margin: 6px 0 16px;
  font-size: 12.5px;
  color: var(--t3);
  line-height: 1.7;
}

.modal-card input[type="text"],
.modal-card input[type="password"],
.modal-card textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  color: var(--t1);
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.modal-card textarea {
  height: auto;
  padding: 10px 12px;
  line-height: 1.7;
  resize: vertical;
  font-family: inherit;
}

.modal-card input[type="text"]:focus,
.modal-card input[type="password"]:focus,
.modal-card textarea:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(251, 114, 153, .12);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--t2);
  line-height: 1.6;
  cursor: pointer;
}

.check-row input {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--pink);
  cursor: pointer;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.modal-ver {
  margin-right: auto;
  font-size: 11.5px;
  color: var(--t3);
  letter-spacing: .02em;
}

.form-error { margin-top: 8px; font-size: 12.5px; color: #F56C6C; }
.form-error[hidden] { display: none; }

.file-drop {
  padding: 22px 16px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-lg);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.file-drop:hover,
.file-drop.dragging { border-color: var(--pink); background: var(--pink-soft); }

.file-drop-inner { display: flex; flex-direction: column; gap: 6px; }
.file-drop-title { font-size: 13.5px; color: var(--t1); }
.file-drop-name { font-size: 12px; color: var(--t3); }

.sub-preview {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #F7F8FA;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--t2);
}

.sub-preview[hidden] { display: none; }

.field { display: block; margin-top: 14px; }
.field span { display: block; margin-bottom: 6px; font-size: 12.5px; color: var(--t3); }

.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.field-head span { margin-bottom: 6px; }
.field-link {
  padding: 0;
  border: 0;
  background: none;
  font-size: 12px;
  color: var(--pink);
  cursor: pointer;
}
.field-link:hover { text-decoration: underline; }

/* --------------------------------------------------------------- 浮层 */

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  z-index: 80;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: var(--radius-lg);
  background: rgba(24, 25, 28, .92);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  max-width: calc(100vw - 32px);
}

.toast.err { background: #F56C6C; }
.toast[hidden] { display: none; }

.hotspot {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 40;
  width: 34px;
  height: 34px;
  background: transparent;
}

/* --------------------------------------------------------------- 响应式 */

@media (max-width: 1100px) {
  .b-page { grid-template-columns: minmax(0, 1fr) 300px; }
}

@media (max-width: 900px) {
  .b-page {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin: 12px auto 32px;
    padding: 0 12px;
  }

  .b-header-inner {
    height: auto;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 8px 12px;
  }

  .b-search { order: 3; flex: 1 1 100%; max-width: none; }
  .b-logo-text { font-size: 16px; }
  .b-side-card { position: static; max-height: none; }
  .b-title { font-size: 17px; margin-bottom: 8px; }
  .b-info { padding: 14px 14px 16px; }
  .frame-holder { aspect-ratio: 16 / 9; max-height: 60vh; }
  .b-empty { min-height: 260px; padding: 32px 16px; }
  .b-empty-inner h2 { font-size: 16px; }
}

@media (max-width: 560px) {
  .b-btn { height: 32px; padding: 0 12px; font-size: 13px; gap: 5px; }
  .b-btn svg { width: 15px; height: 15px; }
  .b-avatar { width: 28px; height: 28px; font-size: 13px; }
  .b-actions { gap: 5px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
  .b-actions .b-btn { height: 30px; padding: 0 9px; font-size: 12.5px; }
  /* 管理员徽标在窄屏隐藏，身份由粉色描边头像体现，给操作按钮让位 */
  .b-actions .b-badge { display: none; }
  /* 站名左侧已有圆形 logo，窄屏不再重复一个头像 */
  #headerAvatar { display: none; }
  .modal-x { top: 10px; right: 10px; width: 36px; height: 36px; }
  .modal-x svg { width: 20px; height: 20px; }
  .b-logo-mark { width: 30px; height: 30px; }
  .b-logo-text { font-size: 16px; }
  .b-actions .b-btn-pink { padding: 0 10px; }
  .b-header-inner { gap: 6px 10px; }

  /* 窄屏控制条改两行：播放+时间+进度一行，右侧按钮一行，进度条才拖得动 */
  .b-controls { gap: 5px; padding: 6px 8px 8px; height: auto; flex-wrap: wrap; row-gap: 2px; }
  .b-ctrl-right { flex: 1 0 100%; justify-content: flex-end; gap: 6px; }
  .seek-wrap { height: 30px; }
  .ctrl-btn { width: 28px; height: 28px; }
  .ctrl-btn svg { width: 17px; height: 17px; }
  .b-time { font-size: 10.5px; gap: 2px; }
  .seek-wrap { min-width: 26px; }
  .chip-btn { padding: 0 7px; font-size: 11px; }
  .b-delay { padding: 0 1px; font-size: 11px; }
  .b-delay #delayLabel { min-width: 28px; }
  .mini-btn { width: 17px; height: 17px; font-size: 13px; }
  .b-ctrl-right { gap: 4px; }

  .b-metas { gap: 12px; font-size: 12px; }
  .b-tools { margin-left: auto; }
  .b-metabar { gap: 10px; }
  .b-desc { padding: 10px 12px; }
  .b-desc-text { font-size: 12.5px; }
  .sub-item { padding: 9px 14px; }
  .b-side-head { padding: 0 14px 8px; }
  .modal-card { padding: 16px; }
}

@media (hover: none) {
  .sub-del { opacity: 1; }
}

/* --------------------------------------------------------------- 全屏 */

.player:fullscreen,
.player:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  background: #000;
}

.player:fullscreen .frame-holder,
.player:-webkit-full-screen .frame-holder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  max-height: none;
}

.player:fullscreen .video-frame,
.player:-webkit-full-screen .video-frame,
.player.immersive .video-frame {
  max-width: none;
  max-height: none;
}

.player:fullscreen .video-frame video,
.player:-webkit-full-screen .video-frame video,
.player.immersive .video-frame video {
  object-fit: cover;
}

/* 触屏设备整屏时按视频原比例居中，避免横屏裁切画面与字幕 */
@media (hover: none), (pointer: coarse) {
  .player:fullscreen .video-frame video,
  .player:-webkit-full-screen .video-frame video,
  .player.immersive .video-frame video {
    object-fit: contain;
  }
}

.player:fullscreen .b-controls,
.player:-webkit-full-screen .b-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  height: auto;
  min-height: 56px;
  padding: 30px 16px calc(10px + env(safe-area-inset-bottom));
  background: transparent;
}

.player:fullscreen .b-controls .seek-wrap,
.player:-webkit-full-screen .b-controls .seek-wrap { height: 40px; }

.player:fullscreen .b-notice,
.player:-webkit-full-screen .b-notice { margin: 0; }

.player:fullscreen .b-controls,
.player:-webkit-full-screen .b-controls { padding-bottom: env(safe-area-inset-bottom); }

/* --------------------------------------------------------------- 沉浸式播放 */

body.immersive-open { overflow: hidden; }

.player.immersive {
  position: fixed;
  inset: 0;
  z-index: 900;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #000;
}

.player.immersive .frame-holder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  aspect-ratio: auto;
}

.player.immersive .video-frame { max-width: none; max-height: none; }
.player.immersive .b-notice { display: none; }

.immersive-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 31;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 34px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .42), rgba(0, 0, 0, 0));
  color: #fff;
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.player:not(.immersive) .immersive-top { display: none; }

.immersive-title {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.has-netlify-badge .player.immersive .b-controls {
  bottom: var(--netlify-badge-h, 44px);
}

/* 原生全屏时徽标不在全屏层里，控制条贴回底部 */
body.has-netlify-badge .player:fullscreen .b-controls,
body.has-netlify-badge .player:-webkit-full-screen .b-controls { bottom: 0; }

.player.immersive .b-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  height: auto;
  min-height: 0;
  flex-wrap: wrap;
  gap: 8px;
  padding: 30px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 0;
  background: transparent;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.player.immersive.controls-visible .b-controls,
.player.immersive.controls-visible .immersive-top {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.player.immersive .b-ctrl-right { flex: 1 0 100%; justify-content: flex-end; }
.player.immersive .ctrl-btn { width: 40px; height: 40px; }
.player.immersive .ctrl-btn svg { width: 23px; height: 23px; }
.player.immersive .ctrl-seek { width: 52px; }
.player.immersive .seek-label { font-size: 12px; }
.player.immersive .seek-wrap { height: 40px; }
.player.immersive .b-time { font-size: 12px; }

@media (min-width: 561px) {
  .player.immersive .b-controls { flex-wrap: nowrap; }
  .player.immersive .b-ctrl-right { flex: 0 0 auto; }
}

@media (max-width: 560px) {
  .player.immersive .b-controls { gap: 6px 4px; padding-left: 8px; padding-right: 8px; }
  .player.immersive .ctrl-btn { width: 36px; height: 36px; }
  .player.immersive .ctrl-btn svg { width: 21px; height: 21px; }
  .player.immersive .ctrl-seek { width: 46px; }
  .player.immersive .seek-label { font-size: 11px; }
  .player.immersive .b-time { font-size: 11px; }
}

/* ------------------------------------------- 快进快退 / 文件夹 / 编辑 */

.ctrl-seek { width: 42px; }
.seek-label {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -.3px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.seek-arrow { font-size: 8px; opacity: .85; }

.side-add {
  margin-left: auto;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--pink);
  font-size: 11.5px;
  line-height: 16px;
  cursor: pointer;
  white-space: nowrap;
}
.side-add:hover { background: var(--pink-soft); border-color: rgba(251, 114, 153, .35); }

.folder-tree {
  padding: 0 8px 6px;
  border-bottom: 1px solid var(--line);
}
.folder-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--t2);
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
}
.folder-row:hover { background: #F6F7F8; }
.folder-row.active { background: var(--pink-soft); color: var(--pink); font-weight: 600; }
.folder-row.drag-over { background: #E8F7FD; outline: 1px dashed var(--blue); }
.folder-row .folder-ico { width: 14px; height: 14px; flex: none; fill: currentColor; opacity: .75; }
.folder-row .folder-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-row .folder-count { color: var(--t3); font-size: 11px; font-variant-numeric: tabular-nums; }
.folder-row .folder-remove {
  display: none;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--t3);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.folder-row:hover .folder-remove { display: inline-block; }
.folder-row .folder-remove:hover { color: #F56C6C; }

.sub-item[draggable="true"] { cursor: grab; }
.sub-item.dragging { opacity: .4; }
.sub-actions {
  position: absolute;
  top: 8px;
  right: 34px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity .12s;
}
.sub-item:hover .sub-actions,
.sub-item.active .sub-actions { opacity: 1; }
.sub-act {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--t3);
  cursor: pointer;
}
.sub-act svg { width: 14px; height: 14px; fill: currentColor; }
.sub-act:hover { background: var(--pink-soft); color: var(--pink); }
.sub-actions .sub-del { position: static; opacity: 1; }
.sub-actions .sub-del:hover { background: #FDECEC; color: #F56C6C; }

.modal-lg { max-width: 720px; }
.modal-card select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  color: var(--t1);
  font-size: 14px;
  outline: none;
}
.modal-card select:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(251, 114, 153, .12); }
.code-area {
  min-height: 260px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace !important;
  font-size: 12px !important;
  line-height: 1.55 !important;
  white-space: pre;
  tab-size: 2;
}
.edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}
@media (max-width: 560px) {
  .edit-grid { grid-template-columns: 1fr; }
  .ctrl-seek { width: 38px; }
  .seek-label { font-size: 10px; }
}

