:root {
  --bg: #fff5f9;
  --panel: #ffffff;
  --panel-2: #fff2f7;
  --line: #f2bcd4;          /* decorative borders */
  --line-strong: #d06f99;    /* input / interactive borders (>=3:1 on white) */
  --text: #5a3546;
  --muted: #8f5f75;          /* AA contrast on white / panel-2 */
  --accent: #ff5fa2;
  --accent-2: #c62868;       /* deeper pink: readable as text/link/table header */
  --accent-soft: #ffe3ef;
  --danger: #bf3237;
  --ok: #1f7d52;
  --warn: #8f5606;
  --shadow: 0 10px 30px rgba(233, 122, 170, .18);
  /* theme-able surfaces & accents (light values) */
  --surface: #fff;
  --stage-bg: #1b0f16;
  --topbar-bg: rgba(255, 255, 255, .9);
  --thumb-bg: #ffe6f0;
  --cover-1: #ffe1ef;
  --cover-2: #ffc2dd;
  --glow-1: rgba(255, 205, 226, .75);
  --glow-2: rgba(255, 226, 240, .85);
  --dot-c: rgba(255, 187, 215, .55);
  --scrim: rgba(120, 60, 90, .4);
  --ok-soft: #f1fbf6;
  --ok-line: #bfe6d3;
  --warn-soft: #fff9ee;
  --notice-bg: #fff6e6;
  --warn-line: #f4dcae;
  --warn-text: #8a6415;
  --danger-soft: #fff3f3;
  --danger-line: #f5c3c5;
  --off-dot: #b9b9c2;
  --hover: #fffafc;
}

/* ===== 深色模式（深色粉）：跟随系统或手动切换 =====
   主题偏好存在 localStorage.vidsite-theme（system|light|dark），
   由 app.js 提前写入 <html data-theme>，避免首屏闪烁。 */
html[data-theme="dark"] {
  --bg: #150d12;
  --panel: #201620;
  --panel-2: #291b25;
  --line: #3f2736;
  --line-strong: #a35c7f;
  --text: #f7eaf0;
  --muted: #c8a3b5;
  --accent: #ff5fa2;
  --accent-2: #ff9ac4;
  --accent-soft: #3a2130;
  --danger: #ff8f93;
  --ok: #6fd6a3;
  --warn: #f0c274;
  --shadow: 0 12px 34px rgba(0, 0, 0, .5);
  --surface: #251a22;
  --stage-bg: #0b0709;
  --topbar-bg: rgba(21, 13, 18, .88);
  --thumb-bg: #2b1c26;
  --cover-1: #3a2130;
  --cover-2: #4b2a41;
  --glow-1: rgba(255, 95, 162, .16);
  --glow-2: rgba(160, 80, 140, .14);
  --dot-c: rgba(255, 154, 196, .18);
  --scrim: rgba(0, 0, 0, .62);
  --ok-soft: rgba(111, 214, 163, .13);
  --ok-line: rgba(111, 214, 163, .42);
  --warn-soft: rgba(240, 194, 116, .13);
  --notice-bg: rgba(240, 194, 116, .13);
  --warn-line: rgba(240, 194, 116, .42);
  --warn-text: #f0c274;
  --danger-soft: rgba(255, 143, 147, .13);
  --danger-line: rgba(255, 143, 147, .42);
  --off-dot: #5c4552;
  --hover: rgba(255, 255, 255, .045);
}
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] select option { background: var(--panel); color: var(--text); }
/* 深色下玻璃顶栏的模糊底色更实一点，避免内容透出 */
html[data-theme="dark"] .topbar { background: var(--topbar-bg); }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  color: var(--text);
  font: 14px/1.6 -apple-system, "Segoe UI", "Noto Sans SC", "Microsoft YaHei", Roboto, sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 18% 8%, var(--glow-1) 0, transparent 38%),
    radial-gradient(circle at 85% 0%, var(--glow-2) 0, transparent 34%),
    radial-gradient(var(--dot-c) 1.2px, transparent 1.2px);
  background-size: auto, auto, 24px 24px;
  background-attachment: fixed;
}
/* falling sakura petals: decorative, never blocks clicks, sits behind content */
#sakura {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}
a { color: var(--accent-2); }
button, input, select, textarea { font: inherit; color: inherit; }
button {
  background: linear-gradient(135deg, #d92e7a, #b21f5f);
  border: 0; color: #fff; padding: 9px 16px;
  border-radius: 999px; cursor: pointer; font-weight: 600;
  box-shadow: 0 4px 12px rgba(178, 31, 95, .28);
  transition: filter .15s, transform .1s;
}
button:hover { filter: brightness(1.12); }
button:active { transform: translateY(1px); }
button.ghost { background: var(--surface); border: 1.5px solid var(--line-strong); color: var(--accent-2); box-shadow: none; }
button.ghost:hover { background: var(--panel-2); }
button.danger { background: linear-gradient(135deg, #c9343a, #a3242a); box-shadow: 0 4px 12px rgba(163, 36, 42, .25); }
button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
button:focus-visible, a:focus-visible, .thumb:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent-2); outline-offset: 2px;
}
input, select, textarea {
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 12px;
  padding: 9px 11px; width: 100%; color: var(--text);
}
/* keyboard focus keeps a visible outline; mouse focus just gets the soft glow */
input:focus, select:focus, textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input:focus:not(:focus-visible), select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) { outline: none; }
input[type=file] { padding: 6px; }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
label { display: block; margin: 10px 0 4px; color: var(--muted); font-size: 12px; }
h1, h2, h3 { margin: 0 0 12px; letter-spacing: .3px; }
h1 { font-size: 21px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.pink { color: var(--accent-2); }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 12px 20px;
  background: var(--topbar-bg);
  border-bottom: 2px dashed var(--line);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 30;
}
.brand { font-weight: 800; letter-spacing: .5px; font-size: 16px; }
a.brand { text-decoration: none; color: inherit; cursor: pointer; }
a.brand:hover { filter: brightness(1.08); }
.pill {
  background: var(--panel-2); border: 1.5px solid var(--line); border-radius: 999px;
  padding: 3px 12px; font-size: 12px; color: var(--accent-2); font-weight: 600;
}
.container { max-width: 1280px; margin: 0 auto; padding: 20px; position: relative; z-index: 1; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; position: relative; z-index: 1; }
.card {
  background: var(--panel); border: 2px solid var(--line); border-radius: 20px;
  padding: 22px; box-shadow: var(--shadow);
}
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { text-align: center; margin-bottom: 6px; }

/* media grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.vcard {
  background: var(--panel); border: 2px solid var(--line); border-radius: 18px;
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s;
}
.vcard:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(233, 122, 170, .26); }
.thumb {
  position: relative; aspect-ratio: 16/9; background: var(--thumb-bg) center/cover no-repeat;
  cursor: pointer;
}
.thumb .play {
  position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px;
  color: #fff; opacity: .95;
}
.thumb .play > span {
  display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%;
  background: rgba(120, 40, 80, .45); text-shadow: 0 2px 8px rgba(60, 15, 40, .7);
  backdrop-filter: blur(2px);
}
.vcard .body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.vcard .title { font-weight: 700; word-break: break-word; }
.badge { font-size: 11px; padding: 2px 10px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); }
.pill, .badge { white-space: nowrap; }
/* media table: let it scroll horizontally instead of squeezing columns together */
#videoTable { min-width: 1040px; }
#videoTable th, #videoTable td { white-space: nowrap; }
#videoTable td:nth-child(4) { white-space: normal; min-width: 200px; max-width: 360px; overflow-wrap: anywhere; }
.badge.ready { color: var(--ok); border-color: var(--ok-line); background: var(--ok-soft); }
.badge.watched { color: var(--ok); border-color: var(--ok-line); background: var(--ok-soft); }
.badge.unwatched { color: var(--accent-2); border-color: var(--line-strong); background: var(--panel-2); }
.badge.processing { color: var(--warn); border-color: var(--warn-line); background: var(--warn-soft); }
.badge.failed { color: var(--danger); border-color: var(--danger-line); background: var(--danger-soft); }
.progress { height: 8px; background: var(--accent-soft); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #ffa9cc, #ff4f99); width: 0; transition: width .4s; }

/* modals */
.modal {
  position: fixed; inset: 0; background: var(--scrim); z-index: 100;
  display: grid; place-items: center; padding: 16px; backdrop-filter: blur(3px);
}
.modal-box {
  width: min(1080px, 96vw); background: var(--panel); border: 2px solid var(--line);
  border-radius: 20px; overflow: hidden; display: flex; flex-direction: column;
  max-height: 94vh; box-shadow: 0 20px 60px rgba(214, 110, 160, .35);
}
.modal-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 2px dashed var(--line); background: var(--panel-2);
}
.stage {
  position: relative; background: var(--stage-bg); line-height: 0; overflow: hidden;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
.stage video { width: 100%; max-height: 70vh; display: block; background: var(--stage-bg); }
/* photos: block long-press / drag / right-click save; download only via button */
.stage img {
  width: 100%; max-height: 74vh; display: block; background: var(--stage-bg); object-fit: contain;
  pointer-events: none; -webkit-user-drag: none; -webkit-touch-callout: none;
  -webkit-user-select: none; user-select: none;
}
.stage-photo { display: grid; place-items: center; min-height: 200px; }
.wm-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
/* watermark = several very transparent white texts floating upward like balloons */
.wm-float {
  position: absolute; top: 100%; left: 0; white-space: nowrap;
  color: #fff; font-weight: 700; letter-spacing: .5px;
  text-shadow: 0 0 8px rgba(255, 255, 255, .28);
  pointer-events: none; will-change: transform;
  animation-name: wmRise; animation-timing-function: linear; animation-iteration-count: infinite;
}
.wm-sway {
  display: inline-block; animation-name: wmSway; animation-timing-function: ease-in-out;
  animation-iteration-count: infinite; animation-direction: alternate;
}
@keyframes wmRise {
  from { transform: translateY(0); }
  to   { transform: translateY(calc(-1 * var(--rise, 120vh))); }
}
@keyframes wmSway {
  from { transform: translateX(-12px); }
  to   { transform: translateX(12px); }
}
.collection-head {
  display: flex; align-items: baseline; gap: 10px;
  margin: 20px 0 10px; padding-bottom: 6px; border-bottom: 2px dashed var(--line);
}
.collection-head h2 { margin: 0; font-size: 16px; color: var(--accent-2); }
.upload-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.upload-row {
  display: flex; gap: 10px; align-items: center;
  background: var(--panel-2); border: 1.5px solid var(--line); border-radius: 12px; padding: 6px 10px;
}
.upload-row .fname { flex: 0 0 34%; font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-row input { flex: 1; }
.upload-row .st { flex: 0 0 auto; font-size: 11px; color: var(--muted); min-width: 52px; text-align: right; }
.dropzone {
  position: relative; border: 2.5px dashed var(--line-strong); border-radius: 16px;
  padding: 22px; text-align: center; color: var(--muted); transition: .15s; margin-top: 8px;
  background: var(--panel-2);
}
.dropzone.drag { border-color: var(--accent-2); background: var(--accent-soft); color: var(--text); }
.dropzone input[type=file] {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
}
.modal-foot { padding: 12px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border-top: 2px dashed var(--line); }
.notice { background: var(--notice-bg); border: 1.5px solid var(--warn-line); color: var(--warn-text); padding: 8px 12px; border-radius: 12px; font-size: 12px; }

/* admin */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { background: var(--surface); border: 1.5px solid var(--line); color: var(--muted); box-shadow: none; }
.tabs button.active { background: linear-gradient(135deg, #fb6ba6, #e02f7d); color: #fff; border-color: transparent; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 12px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--accent-2); font-weight: 700; font-size: 12px; background: var(--panel-2); }
tbody tr:hover { background: var(--hover); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
/* narrow phones: let the top bar wrap instead of overflowing horizontally */
@media (max-width: 620px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .brand { font-size: 15px; }
  .container { padding: 12px; }
  .modal-box { border-radius: 16px; }
  .toast { width: max-content; max-width: 92vw; text-align: center; }
}
/* empty-state row used by the admin tables */
td.empty, .empty-row { color: var(--muted); text-align: center; padding: 18px 10px; }
.perm-list { max-height: 240px; overflow: auto; border: 1.5px solid var(--line); border-radius: 12px; padding: 8px; background: var(--panel-2); }
.perm-list label { display: flex; gap: 8px; align-items: center; margin: 4px 0; color: var(--text); }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 2px solid var(--line); padding: 10px 18px;
  border-radius: 999px; z-index: 200; box-shadow: var(--shadow); color: var(--accent-2); font-weight: 600;
}
.small-btn { padding: 5px 11px; font-size: 12px; border-radius: 999px; }
tbody tr:hover { background: var(--panel-2); }

/* link styled as a ghost button (avoids invalid <a><button> nesting) */
.btn-link {
  display: inline-block; background: var(--surface); border: 1.5px solid var(--line-strong);
  color: var(--accent-2); padding: 9px 16px; border-radius: 999px; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.btn-link:hover { background: var(--panel-2); }

/* modal header stays on one line on narrow screens */
.modal-head { flex-wrap: nowrap; }
.modal-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-head > button, .modal-head > a { flex: 0 0 auto; }
.collection-head { flex-wrap: wrap; }

/* lock background scrolling while a modal is open (modern browsers) */
body:has(.modal:not(.hidden)) { overflow: hidden; }

/* narrow phones: let the upload rows wrap instead of squeezing the title box */
@media (max-width: 620px) {
  .upload-row { flex-wrap: wrap; }
  .upload-row .fname { flex: 1 1 100%; }
  .upload-row input { flex: 1 1 100%; }
}

/* respect the OS "reduce motion" setting */
@media (prefers-reduced-motion: reduce) {
  #sakura { display: none; }
  .wm-float, .wm-sway { animation: none !important; }
  .vcard { transition: none; }
  body { background-attachment: scroll; }
}

/* notification bell + unread badge */
#notifBtn { position: relative; }
.dot {
  display: inline-block; background: var(--danger); color: #fff; font-size: 10px;
  line-height: 1; border-radius: 999px; padding: 2px 5px; margin-left: 4px; vertical-align: top;
}
.dot.hidden { display: none !important; }

/* message board */
.board-body { padding: 14px 16px; max-height: 74vh; overflow: auto; }
.board-compose { background: var(--panel-2); border: 1.5px solid var(--line); border-radius: 14px; padding: 10px; }
.board-compose textarea { resize: vertical; }
.board-list { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.msg { background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.msg.reply { background: var(--panel-2); border-radius: 12px; margin-top: 8px; }
/* 管理员撤回：保留占位、弱化显示 */
.msg.recalled { background: var(--panel-2); border-style: dashed; opacity: .75; }
.msg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.msg-content { white-space: pre-wrap; word-break: break-word; }
.msg-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.msg-replies { margin-top: 8px; border-left: 2px dashed var(--line); padding-left: 10px; }

/* notifications list */
.notif {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px;
  margin-bottom: 8px; cursor: pointer; background: var(--surface);
}
.notif.unread { background: var(--accent-soft); border-color: var(--line-strong); }
.notif .msg-head { margin-bottom: 4px; }

/* collection tiles on the home page */
.col-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.col-card {
  position: relative; background: var(--panel); border: 2px solid var(--line);
  border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.col-card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(233, 122, 170, .26); }
.col-cover {
  position: relative; aspect-ratio: 16/10;
  background: linear-gradient(135deg, var(--cover-1), var(--cover-2)) center/cover no-repeat;
}
.col-badge {
  position: absolute; right: 8px; bottom: 8px; background: rgba(120, 40, 80, .55);
  color: #fff; font-size: 11px; padding: 2px 9px; border-radius: 999px;
}
.col-body { padding: 10px 12px; }
.col-title { font-weight: 700; word-break: break-word; }
.col-detail { position: absolute; top: 8px; right: 8px; }


/* ---- avatars + role-coloured names (message board / topbar / admin) ---- */
.avatar {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: 0 0 auto;
  background: linear-gradient(135deg, #ffd0e4, #ff9ec4); color: #fff;
  font-weight: 700; font-size: 15px; object-fit: cover;
}
.avatar:not(.has-img)::after { content: attr(data-initial); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { width: 26px; height: 26px; font-size: 12px; }
.avatar.lg { width: 72px; height: 72px; font-size: 28px; }
.profile-btn { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; max-width: 46vw; }
.profile-btn b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-name { font-weight: 700; }
.notif-to { width: auto; }
#notifTargets label { display: flex; align-items: center; gap: 8px; }
#notifTargets input { width: auto; }

/* ===================== mobile polish ===================== */
button, a, .col-card, .vcard .thumb, .dropzone, input[type=file] {
  touch-action: manipulation;
}
button, .btn-link, a { -webkit-tap-highlight-color: transparent; }
button, .btn-link { min-height: 38px; }

@media (max-width: 620px) {
  /* iOS zooms the page when a field under 16px gets focus; 16px keeps the
     layout stable while pinch-zoom still works (we never set user-scalable=no) */
  input, select, textarea { font-size: 16px; }
  button, .btn-link { min-height: 42px; padding: 10px 16px; }
  .small-btn { min-height: 34px; padding: 7px 12px; font-size: 13px; }

  /* top bar: no dangling spacer, wrap the buttons, respect the notch */
  .topbar { flex-wrap: wrap; gap: 6px; padding: 8px 10px;
            padding-top: calc(8px + env(safe-area-inset-top)); }
  .topbar .spacer { display: none; }
  .topbar button, .topbar .btn-link { padding: 8px 12px; }
  .profile-btn { padding: 4px 10px; }

  .container { padding: 10px 10px calc(16px + env(safe-area-inset-bottom)); }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .col-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .col-cover { aspect-ratio: 4 / 3; }

  .modal { padding: 8px; }
  .modal-box { width: 100%; max-height: 92dvh; border-radius: 16px; }
  .modal-head { padding: 10px 12px; }
  .board-body { max-height: 72dvh; padding: 10px 12px; }
  .dropzone { padding: 18px 12px; }
  .toast { bottom: calc(16px + env(safe-area-inset-bottom)); }
  .stage video { max-height: 58dvh; }
  .stage img { max-height: 62dvh; }

  .tabs { gap: 6px; }
  .tabs button { padding: 8px 12px; }
  #videoTable, #userTable, #lockTable, #logTable, #roleTable, #collectionTable {
    -webkit-overflow-scrolling: touch;
  }
}
@media (max-width: 380px) {
  .brand { font-size: 14px; }
  .topbar button, .topbar .btn-link, .profile-btn { padding: 7px 10px; font-size: 13px; }
}

/* Hide the inline native fullscreen button (fullscreen would drop the dynamic
   watermark) and the native PiP button; PiP is offered by our own 小窗 button on
   mobile, whose mini window can only return / pause / close. */
.stage video::-webkit-media-controls-fullscreen-button,
.stage video::-webkit-media-controls-picture-in-picture-button { display: none !important; }

/* external player controls (native controls removed to block iOS fullscreen) */
.player-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: var(--panel); border-top: 1.5px solid var(--line);
}
.player-bar #seek { flex: 1; min-width: 60px; accent-color: var(--accent-2); }
.player-bar .pbtn { flex: 0 0 auto; }
.player-bar .pbtn.pip-on { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.player-bar span { flex: 0 0 auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 620px) {
  .player-bar { flex-wrap: wrap; row-gap: 6px; padding: 8px 10px; }
  .player-bar #seek { order: 10; flex: 1 1 100%; }
}

/* site AI assistant (admin panel) */
.assistant-log {
  display: flex; flex-direction: column; gap: 10px;
  min-height: 180px; max-height: 46vh; overflow: auto;
  padding: 12px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--panel-2);
}
.assistant-msg { max-width: 82%; display: flex; flex-direction: column; gap: 2px; }
.assistant-msg.admin { align-self: flex-end; align-items: flex-end; }
.assistant-msg.assistant { align-self: flex-start; align-items: flex-start; }
.assistant-msg .assistant-meta { font-size: 12px; color: var(--muted); }
.assistant-msg .assistant-body {
  padding: 9px 13px; border-radius: 14px; white-space: pre-wrap;
  overflow-wrap: anywhere; line-height: 1.55; box-shadow: var(--shadow);
}
.assistant-msg.admin .assistant-body {
  background: linear-gradient(135deg, #e0417f, #b21f5f); color: #fff;
  border-bottom-right-radius: 4px;
}
.assistant-msg.assistant .assistant-body {
  background: var(--panel); border: 1.5px solid var(--line);
  border-bottom-left-radius: 4px;
}
.assistant-msg.pending .assistant-body { opacity: .75; font-style: italic; }
/* 助手回复里轻量 Markdown 的渲染样式 */
.assistant-msg .assistant-body b { font-weight: 700; }
.assistant-msg .assistant-body code {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 1px 5px; font-size: .92em; overflow-wrap: anywhere;
}
.assistant-msg .assistant-body code.md-block {
  display: block; margin: 6px 0; padding: 8px 10px; overflow-x: auto; white-space: pre-wrap;
}
.assistant-msg .assistant-body a { color: var(--accent-2); }
.assistant-msg.admin .assistant-body code {
  background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .35);
}
.assistant-msg.admin .assistant-body a { color: #fff; text-decoration: underline; }
.assistant-msg .assistant-time {
  font-size: 12px; color: var(--muted); padding: 0 4px;
}
.assistant-msg .assistant-think {
  max-width: 100%; font-size: 12.5px; color: var(--muted);
  background: var(--panel); border: 1px dashed var(--line);
  border-radius: 10px; padding: 6px 10px;
}
.assistant-msg .assistant-think summary { cursor: pointer; user-select: none; }
.assistant-msg .assistant-think pre {
  margin: 8px 0 2px; max-height: 280px; overflow: auto;
  white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5;
  font: inherit; color: var(--text);
}

/* ---------- 背景音乐小组件（网易云歌单 -> 本地播放库） ---------- */
.bgm-widget {
  position: fixed; left: 16px; bottom: 16px; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 8px; border-radius: 22px;
  background: var(--panel); border: 1.5px solid var(--line);
  box-shadow: var(--shadow); color: var(--text);
  width: min(92vw, 520px); max-width: min(92vw, 520px);
}
.bgm-widget.hidden { display: none; }
.bgm-btn {
  flex: 0 0 auto; width: 56px; height: 56px; border-radius: 50%; border: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; line-height: 1; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 12px rgba(255, 95, 162, .35);
}
.bgm-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.bgm-title {
  display: flex; align-items: center; gap: 4px; width: 100%; min-width: 0; max-width: 100%;
  border: 0; background: transparent; color: var(--text); cursor: pointer;
  padding: 0; font: inherit; text-align: left;
  box-shadow: none; border-radius: 8px;   /* 清掉全局 button 的胶囊阴影，避免出现"浮在框外"的假框 */
}
.bgm-title:hover .bgm-name { color: var(--accent-2); }
.bgm-name {
  flex: 1 1 auto;
  font-size: 13px; font-weight: 600; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bgm-caret { flex: 0 0 auto; font-size: 11px; color: var(--muted); }
.bgm-sub {
  font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bgm-bar { display: flex; align-items: center; gap: 6px; }
.bgm-time {
  flex: 0 0 auto; font-size: 10px; color: var(--muted); min-width: 30px;
  text-align: center; font-variant-numeric: tabular-nums;
}
.bgm-bar input[type="range"] {
  flex: 1 1 auto; min-width: 0; height: 4px; margin: 0; cursor: pointer;
  accent-color: var(--accent-2);
}
.bgm-next {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid var(--line); background: var(--panel-2);
  color: var(--accent-2); cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.bgm-next svg { display: block; width: 20px; height: 20px; }
.bgm-next:hover { background: var(--panel); }
#bgm { display: none; }

/* 播放列表面板（点标题打开） */
.bgm-list {
  position: fixed; left: 16px; bottom: 94px; z-index: 61;
  width: min(92vw, 520px); max-height: min(60vh, 460px);
  display: flex; flex-direction: column;
  background: var(--panel); border: 1.5px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); overflow: hidden;
}
.bgm-list.hidden { display: none; }
.bgm-list-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
}
.bgm-list-body { overflow-y: auto; padding: 6px; }
.bgm-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 0; background: transparent; color: var(--text); cursor: pointer;
  padding: 8px 10px; border-radius: 10px; text-align: left;
  font: inherit; font-size: 13px;
}
.bgm-item:hover { background: var(--panel-2); }
.bgm-item.active { background: var(--panel-2); color: var(--accent-2); font-weight: 600; }
.bgm-item.pending { opacity: .6; }
.bgm-item-name {
  flex: 1 1 auto; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bgm-item-tag {
  flex: 0 0 auto; font-size: 10px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 6px;
}

/* ---------- 放大视频暂停键（手机端与电脑端） ---------- */
.player-bar #ppBtn {
  min-width: 56px; min-height: 48px; font-size: 24px;
  padding: 8px 16px; border-radius: 14px;
}
@media (max-width: 640px) {
  .player-bar #ppBtn { min-width: 66px; min-height: 58px; font-size: 28px; }
  .bgm-widget { left: 8px; right: 8px; bottom: 8px; width: auto; max-width: none; }
  .bgm-btn { width: 60px; height: 60px; font-size: 26px; }
  .bgm-next { width: 38px; height: 38px; }
  .bgm-auto { font-size: 10px; padding: 3px 6px; }
  .bgm-list { left: 8px; right: 8px; bottom: 88px; width: auto; max-width: none; }
  .bgm-time { display: none; }
}

/* ---------- 背景音乐：自动播放开关 ---------- */
.bgm-auto {
  flex: 0 0 auto; white-space: nowrap; cursor: pointer;
  font-size: 11px; padding: 4px 9px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--panel-2);
  color: var(--muted); font-weight: 600;
}
.bgm-auto.on { color: var(--accent-2); border-color: var(--line-strong); }

/* ---------- 留言板：在线状态小灯 ---------- */
.online-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-left: 2px; vertical-align: middle; flex: 0 0 auto;
}
.online-dot.on { background: var(--ok); box-shadow: 0 0 0 2px rgba(46, 204, 113, .18); }
.online-dot.off { background: var(--off-dot); }
.online-text { font-size: 11px; color: var(--muted); }
.online-text.on { color: var(--ok); font-weight: 600; }

/* ---------- 留言板：@ 选择器 ---------- */
.board-compose { position: relative; }
.mention-box {
  position: absolute; left: 10px; right: 10px; z-index: 20;
  margin-top: 4px; max-height: 190px; overflow-y: auto;
  background: var(--panel); border: 1.5px solid var(--line-strong);
  border-radius: 10px; box-shadow: var(--shadow); padding: 4px;
}
.mention-box.hidden { display: none; }
.mention-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 13px; padding: 7px 10px; border-radius: 8px;
}
.mention-item:hover, .mention-item.active { background: var(--accent-soft); color: var(--accent-2); }

/* ---------- 主题切换按钮（登录页浮动在右上角；顶栏里的按钮用 .ghost） ---------- */
.theme-fab {
  position: fixed; top: 14px; right: 14px; z-index: 50;
  padding: 7px 13px; font-size: 12.5px; border-radius: 999px; min-height: 34px;
}
[data-theme-toggle] { white-space: nowrap; }
@media (max-width: 620px) {
  .theme-fab { top: calc(10px + env(safe-area-inset-top)); right: 10px; }
}

/* ---------- 主题细节：选中高亮与占位文字跟随主题 ---------- */
::selection { background: var(--accent); color: #fff; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }

/* ---------- 媒体点赞、评论区与查看器翻页 ---------- */
.media-like.liked, button.liked {
  color: var(--accent-2); border-color: var(--accent-2);
  background: var(--accent-soft);
}
.social {
  border-top: 2px dashed var(--line);
  padding: 10px 16px 14px;
  max-height: 42vh; background: var(--panel);
  display: flex; flex-direction: column; gap: 8px; overflow: hidden;
}
.social .comments-list {
  flex: 1 1 auto; overflow: auto; min-height: 40px;
  display: flex; flex-direction: column; gap: 8px;
}
.social .comment {
  background: var(--panel-2); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 8px 10px;
}
.social .comment.reply {
  margin-top: 6px; margin-left: 10px; border-left: 3px solid var(--line-strong);
}
.social .comment.recalled { border-style: dashed; opacity: .75; }
.social .comment .msg-head { margin-bottom: 2px; align-items: center; }
.social .comment-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.social-compose { margin-top: 2px; }
.social-compose textarea { resize: vertical; }
.ph-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 46px; height: 68px; padding: 0; border: 0; border-radius: 12px;
  font-size: 28px; line-height: 1; color: #fff;
  background: rgba(120, 40, 80, .45);
  opacity: .82; box-shadow: none;
}
.ph-nav:hover { opacity: 1; }
.ph-nav:disabled { opacity: .25; cursor: default; }
.ph-nav.prev { left: 10px; }
.ph-nav.next { right: 10px; }
@media (max-width: 620px) {
  .ph-nav { width: 38px; height: 54px; font-size: 22px; }
  .social { max-height: 38vh; padding: 8px 10px 12px; }
}

/* ---------- 用户资料卡与可点头像 ---------- */
#userCardModal { z-index: 130; }   /* 需要浮在留言板 / 查看器之上 */
.avatar-link { cursor: pointer; }
.avatar-link:hover, .avatar-link:focus-visible {
  filter: brightness(1.08); box-shadow: 0 0 0 2px var(--accent-soft);
}
.usercard-bio {
  white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6;
  background: var(--panel-2); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 10px 12px; min-height: 48px;
}

/* ===================== 移动端紧凑布局 ===================== */
/* 顶栏「更多」：桌面平铺，窄屏收进 ☰ 下拉 */
.more-wrap { display: contents; position: relative; }
.more-btn { display: none; }
.more-menu { display: flex; align-items: center; gap: 14px; }

@media (max-width: 720px) {
  .more-wrap { display: block; position: static; }
  .more-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 42px; min-height: 42px; padding: 8px 12px; font-size: 18px; line-height: 1;
  }
  .more-menu {
    position: absolute; top: calc(100% + 8px); right: 14px; z-index: 95;
    display: none; flex-direction: column; align-items: stretch; gap: 8px;
    min-width: 172px; padding: 10px;
    background: var(--panel); border: 2px solid var(--line);
    border-radius: 16px; box-shadow: var(--shadow);
  }
  .more-menu.open { display: flex; }
  .more-menu > * { width: 100%; text-align: center; }

  /* 后台标签：横向滑动而不是换行堆叠 */
  .tabs {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 4px; scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: 0 0 auto; }
}

/* BGM 小播放器：移动端折叠成一个 ♪ 圆钮，点开才展开 */
.bgm-mini { display: none; }
@media (max-width: 620px) {
  .bgm-widget {
    left: auto; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
    width: auto; max-width: none; padding: 6px; border-radius: 999px; gap: 6px;
  }
  .bgm-widget .bgm-main,
  .bgm-widget .bgm-next,
  .bgm-widget .bgm-auto { display: none; }
  .bgm-widget.expanded {
    width: min(92vw, 420px); max-width: min(92vw, 420px);
    border-radius: 22px; padding: 8px 12px 8px 8px; gap: 10px;
  }
  .bgm-widget.expanded .bgm-main { display: flex; }
  .bgm-widget.expanded .bgm-next { display: flex; }
  .bgm-widget.expanded .bgm-auto { display: inline-block; }
  .bgm-btn { width: 48px; height: 48px; font-size: 20px; }
  .bgm-mini {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; padding: 0; border: 1.5px solid var(--line-strong);
    border-radius: 50%; background: var(--panel-2); color: var(--accent-2);
    font-size: 15px; line-height: 1; box-shadow: none;
  }
  .bgm-widget.expanded .bgm-mini { background: transparent; }
}

/* ---- 等级试看：锁定项与试看项 ---- */
.badge.locked { color: var(--warn); border-color: var(--warn-line); background: var(--warn-soft); }
.badge.preview { color: var(--accent-2); border-color: var(--line-strong); background: var(--panel-2); }
.col-lock {
  position: absolute; left: 8px; top: 8px; background: rgba(70, 25, 45, .72);
  color: #ffd666; font-size: 11px; padding: 2px 9px; border-radius: 999px;
  max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis;
}
.vcard.locked .thumb { cursor: default; }

/* ---- 留言板未读：小铃铛 + 数字 ---- */
.board-badge { display: inline-flex; align-items: center; gap: 2px; margin-left: 3px; font-size: 12px; }
.board-badge i {
  font-style: normal; font-weight: 700; font-size: 10px; line-height: 1;
  background: #e53935; color: #fff; border-radius: 999px;
  padding: 2px 5px; min-width: 15px; text-align: center;
}
