/* =========================================================
   数字媒体技术及动画专业 · 作品展示墙
   深色画廊风格 · 横向长墙 + 分组网格 + 届展主题切换
   ========================================================= */

:root {
  --bg-0: #07080d;
  --bg-1: #0d1018;
  --bg-2: #141925;
  --ink: #eef2ff;
  --ink-dim: #9aa6c4;
  --ink-faint: #5d6685;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.18);
  --accent: #6ea8ff;
  --accent-2: #c08bff;
  --accent-warm: #ffb86b;
  --cell-w: 230px;
  --cell-h: 315px;
  --gap: 24px;
  --topbar-h: 76px;              /* 顶部栏实际高度：由 main.js 运行时回写（移动端会折行变高） */
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

/* hidden 属性必须优先于组件自身的 display 声明 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  height: 100dvh;                  /* 移动端：按可视视口取高，避免地址栏导致底部被裁 */
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  position: relative;
  z-index: 30;
  height: 76px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  background: linear-gradient(180deg, rgba(20, 25, 37, 0.96), rgba(13, 16, 24, 0.88));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 13px; flex: 0 0 auto; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center;
  font-weight: 800; letter-spacing: 0.5px; color: #07080d;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px rgba(110, 168, 255, 0.35);
}
.brand-text h1 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: 0.4px; white-space: nowrap; }
.brand-text p { margin: 2px 0 0; font-size: 11.5px; color: var(--ink-dim); letter-spacing: 1.4px; white-space: nowrap; }

/* 主题（届展）切换：可横向滚动 */
.topic-bar {
  flex: 1 1 auto;
  min-width: 0;                       /* 关键：允许在 flex 中收缩，否则不会出现滚动 */
  display: flex; align-items: center; gap: 6px;
}

.t-nav {
  flex: 0 0 auto;
  width: 26px; height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink-dim);
  font-size: 17px; line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
  transition: all 0.16s ease;
}
.t-nav:hover { color: var(--ink); background: rgba(255, 255, 255, 0.1); border-color: var(--line-strong); }
.t-nav[disabled] { opacity: 0.25; cursor: default; }
.t-nav[disabled]:hover { color: var(--ink-dim); background: rgba(255, 255, 255, 0.03); border-color: var(--line); }
.t-nav[hidden] { display: none !important; }

.topics {
  flex: 1 1 auto;
  min-width: 0;
  display: flex; align-items: center; gap: 8px;
  overflow-x: auto; overflow-y: hidden;
  padding: 6px 2px;
  scroll-behavior: smooth;
  scrollbar-width: none;              /* 隐藏滚动条，靠箭头/滚轮/拖拽横移 */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
  cursor: grab;
}
.topics.dragging { cursor: grabbing; scroll-behavior: auto; }
.topics.dragging .topic-chip { pointer-events: none; }
.topics::-webkit-scrollbar { height: 0; display: none; }

.topic-chip {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 1px;
  padding: 7px 15px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--ink-dim);
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
  line-height: 1.25;
}
.topic-chip:hover { color: var(--ink); border-color: var(--line-strong); background: rgba(255,255,255,0.06); }
.topic-chip.active {
  color: var(--ink);
  border-color: transparent;
  background: linear-gradient(135deg, rgba(110,168,255,0.28), rgba(192,139,255,0.28));
  box-shadow: 0 6px 20px rgba(110,168,255,0.25), inset 0 1px 0 rgba(255,255,255,0.15);
}
.topic-chip .t-name { font-size: 13px; font-weight: 700; white-space: nowrap; }
.topic-chip .t-year { font-size: 10.5px; opacity: 0.75; letter-spacing: 1px; }
.topic-chip .t-del {
  position: absolute; margin: -6px 0 0 0;
  opacity: 0;
}
.topic-chip { position: relative; }
body.admin .topic-chip:hover .t-del { opacity: 1; }
.topic-chip .t-del {
  top: 4px; right: 4px;
  width: 18px; height: 18px; border-radius: 6px;
  border: none; background: rgba(0,0,0,0.5); color: #ffd0d0;
  font-size: 11px; line-height: 1; cursor: pointer;
}
.topic-chip .t-del:hover { background: #c0392b; color: #fff; }

.hud {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--ink-dim);
  padding: 8px 15px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
}
.hud-sep { opacity: 0.4; }
.hud-item { color: var(--ink); font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.controls { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 15px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.18s ease; white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.1); transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn .dot { width: 9px; height: 9px; border-radius: 50%; background: #4fd1a5; box-shadow: 0 0 10px #4fd1a5; }
.btn.admin .dot { background: var(--accent-warm); box-shadow: 0 0 10px var(--accent-warm); }
.btn.ghost { background: transparent; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #07080d; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }

/* ---------- 视口 / 相机 ---------- */
.viewport {
  position: relative;
  /* 用实测的顶部栏高度，而不是写死 76px：移动端顶部栏会折行变高 */
  height: calc(100% - var(--topbar-h, 76px) - 46px);
  /* 纵向兜底滚动：极端小视口（矮屏 / 横屏手机）下分组仍可能装不下，
     此时允许纵向滚动，而不是让 body{overflow:hidden} 把作品直接裁掉。 */
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(1200px 600px at 18% -10%, rgba(110, 168, 255, 0.10), transparent 60%),
    radial-gradient(1000px 600px at 92% 112%, rgba(192, 139, 255, 0.10), transparent 60%),
    var(--bg-0);
  cursor: grab;
}
.viewport.dragging { cursor: grabbing; }

.wall {
  position: absolute; top: 0; left: 0;
  /* min-height 而非 height：内容装得下时铺满视口，装不下时撑高交给 .viewport 滚动 */
  min-height: 100%; height: auto;
  /* flex-start 而非 stretch：分组高度由内容决定（不再被强行拉伸到视口高）。
     这样某个分组内容偏高时，墙体自然长高、交给 .viewport 纵向滚动，
     而不是被 .group{overflow:hidden} 把底部作品裁掉。 */
  display: flex; align-items: flex-start; gap: 56px;
  padding: 40px 64px;
  will-change: transform;
}

/* ---------- 分组面板 ---------- */
.group {
  position: relative; flex: 0 0 auto;
  display: flex; flex-direction: column;
  padding: 22px 24px 26px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
  overflow: hidden;                    /* 兜底：任何情况下都不让海报溢出分组边框 */
}
.group::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  border-radius: 22px 22px 0 0;
  background: var(--g-accent, linear-gradient(90deg, var(--accent), var(--accent-2)));
  opacity: 0.9;
}
.group-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.group-title {
  font-size: 19px; font-weight: 700; letter-spacing: 0.5px;
  outline: none; border-radius: 8px; padding: 2px 6px;
}
.group-title[contenteditable="true"] { background: rgba(110, 168, 255, 0.15); box-shadow: 0 0 0 2px rgba(110,168,255,0.4); }
.group-count { font-size: 12px; color: var(--ink-dim); }
.group-del {
  margin-left: auto; width: 28px; height: 28px; border-radius: 8px;
  border: 1px solid var(--line); background: transparent; color: var(--ink-dim);
  cursor: pointer; font-size: 15px; line-height: 1; display: none; place-items: center;
}
.group-del:hover { color: #ff8080; border-color: rgba(255,128,128,0.5); }
body.admin .group-del { display: grid; }

.grid {
  display: grid;
  /* 显式列数：auto-fill 在宽度不定的容器里只会解析出 1 列，导致多格海报失效 */
  grid-template-columns: repeat(var(--cols, 3), var(--cell-w));
  grid-auto-rows: var(--cell-h);
  grid-auto-flow: row dense;
  gap: var(--gap);
  align-content: start;
}

/* ---------- 海报卡片 ---------- */
.poster {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: var(--bg-2); box-shadow: var(--shadow); cursor: pointer;
  transition: transform 0.28s cubic-bezier(.2,.8,.2,1), box-shadow 0.28s;
  grid-column: span var(--w, 1); grid-row: span var(--h, 1);
  border: 1px solid var(--line);
}
.poster:hover { transform: translateY(-8px) scale(1.012); box-shadow: 0 28px 64px rgba(0,0,0,0.65); }
.poster .art { position: absolute; inset: 0; background: var(--bg-2); }
.poster .art img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  /* 画面在格内的相对位置（管理态拖动红色手柄之外的图片区域调整） */
  object-position: calc(50% + var(--img-x, 0) * 1%) calc(50% + var(--img-y, 0) * 1%);
  transition: transform 0.6s cubic-bezier(.2,.8,.2,1), filter 0.4s;
  filter: saturate(1.02) brightness(0.98);
}
.poster:hover .art img { transform: scale(1.06); filter: saturate(1.08) brightness(1.02); }
.poster .art::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(7,8,13,0.05) 0%, rgba(7,8,13,0) 35%, rgba(5,6,12,0.85) 100%);
}
.poster .meta {
  position: absolute; inset: auto 0 0 0; padding: 15px 15px 14px; z-index: 2;
  background: linear-gradient(0deg, rgba(5,6,12,0.94) 8%, rgba(5,6,12,0.55) 62%, transparent);
}
.poster .cat {
  display: inline-block; font-size: 10.5px; letter-spacing: 1px;
  padding: 3px 9px; border-radius: 999px; margin-bottom: 8px;
  background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.22);
  backdrop-filter: blur(4px);
}
.poster .title { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.3; text-shadow: 0 1px 6px rgba(0,0,0,0.5); }
.poster .author { margin: 4px 0 0; font-size: 11.5px; color: var(--ink-dim); }
.poster .badge {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  padding: 4px 8px; border-radius: 8px;
  background: rgba(7,8,13,0.66); color: var(--ink); border: 1px solid var(--line-strong);
  opacity: 0; transition: opacity 0.2s;
}
body.admin .poster .badge { opacity: 1; }

.poster-del {
  position: absolute; top: 8px; left: 8px; z-index: 5;
  width: 24px; height: 24px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: rgba(7,8,13,0.6); color: #ffd0d0;
  font-size: 14px; line-height: 1; cursor: pointer;
  display: none; place-items: center; opacity: 0; transition: opacity 0.2s;
}
body.admin .poster:hover .poster-del { display: grid; opacity: 1; }
.poster-del:hover { color: #fff; background: #c0392b; border-color: #c0392b; }

/* 空分组 */
.group.empty .grid { min-height: var(--cell-h); min-width: 270px; }
.group.empty .grid::after {
  content: "点「＋ 新增作品」添加作品，或「＋ 分组」新建分组";
  grid-column: 1 / -1; color: var(--ink-faint); font-size: 13px;
  padding: 30px; text-align: center; opacity: 0.7;
}

.add-group {
  flex: 0 0 auto; width: 200px; border-radius: 22px;
  border: 1px dashed var(--line-strong); background: rgba(255,255,255,0.02);
  color: var(--ink-dim); font-size: 14px; font-weight: 600;
  cursor: pointer; display: none; place-items: center; transition: all 0.2s;
}
body.admin .add-group { display: grid; }
.add-group:hover { color: var(--ink); border-color: var(--accent); background: rgba(110,168,255,0.06); }

/* 分组内「＋ 新增作品」入口（仅管理态，grid 内的格子） */
.add-work {
  display: none; place-items: center;
  grid-column: span 1; grid-row: span 1;
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
  background: rgba(255,255,255,0.02); color: var(--ink-dim);
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s;
  min-height: var(--cell-h);
}
body.admin .add-work { display: grid; }
.add-work:hover { color: var(--ink); border-color: var(--accent); background: rgba(110,168,255,0.07); transform: translateY(-3px); }

/* 详情编辑：上传控件 */
.edit-upload { margin: 4px 0 12px; }
.edit-file { display: block; font-size: 12px; color: var(--ink-dim); letter-spacing: 0.5px; }
.edit-file input[type="file"] {
  display: block; width: 100%; margin-top: 6px; padding: 9px 12px;
  border-radius: 10px; border: 1px solid var(--line-strong);
  background: rgba(0,0,0,0.3); color: var(--ink-dim); font-size: 12.5px; cursor: pointer;
}
.edit-file input[type="file"]::file-selector-button {
  margin-right: 12px; padding: 6px 12px; border-radius: 8px; border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #07080d;
  font-size: 12px; font-weight: 700; cursor: pointer;
}
.edit-img-prev {
  display: block; max-width: 140px; max-height: 140px; margin-top: 8px;
  border-radius: 10px; border: 1px solid var(--line-strong); object-fit: cover;
}
.edit-file-name { display: inline-block; margin-top: 6px; font-size: 12px; color: var(--accent); }
.edit-hint { margin: 2px 0 10px; font-size: 11.5px; line-height: 1.6; color: var(--ink-faint); }

/* ---------- 提示 / 加载 ---------- */
.hint, .admin-hint {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 18px;
  padding: 10px 18px; border-radius: 999px;
  background: rgba(13,16,24,0.72); border: 1px solid var(--line);
  color: var(--ink-dim); font-size: 12.5px; letter-spacing: 0.3px;
  backdrop-filter: blur(8px); z-index: 20; pointer-events: none; white-space: nowrap;
}
.admin-hint { color: var(--ink); }
.admin-hint b { color: var(--accent-warm); }

/* 自动巡览状态点 */
.auto-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 7px; vertical-align: middle;
  background: #7b839c;
}
.auto-dot.on { background: #4fd1a5; box-shadow: 0 0 9px #4fd1a5; animation: autoPulse 1.8s ease-in-out infinite; }
.auto-dot.off { background: #7b839c; box-shadow: none; animation: none; }
/* 自动巡览开关按钮 */
#btnAuto .dot { background: #4fd1a5; box-shadow: 0 0 10px #4fd1a5; }
#btnAuto.off .dot { background: #7b839c; box-shadow: none; }
#btnAuto.off { color: var(--ink-dim); }
@keyframes autoPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.82); }
}
kbd {
  display: inline-block; padding: 1px 7px; margin: 0 2px; border-radius: 6px;
  background: rgba(255,255,255,0.08); border: 1px solid var(--line-strong);
  font-family: var(--font); font-size: 11px;
}
.loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--ink-dim); font-size: 14px; letter-spacing: 2px; z-index: 25;
  background: rgba(7,8,13,0.6);
}
.loading[hidden] { display: none; }

/* ---------- 底部进度条 ---------- */
.progress {
  position: relative; z-index: 30; height: 46px;
  display: flex; align-items: center; gap: 16px; padding: 0 26px;
  background: linear-gradient(0deg, rgba(20,25,37,0.96), rgba(13,16,24,0.88));
  border-top: 1px solid var(--line);
}
.progress-track { flex: 1; height: 6px; border-radius: 999px; background: rgba(255,255,255,0.08); position: relative; overflow: hidden; }
.progress-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px; transition: width 0.08s linear;
}
.progress-label { font-size: 12px; color: var(--ink-dim); width: 42px; text-align: right; }

/* ---------- 密码弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: rgba(4, 6, 11, 0.66);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.18s ease;
}
.modal[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: min(420px, 92vw);
  padding: 28px 28px 24px;
  border-radius: 20px;
  background: linear-gradient(180deg, #171c28, #12161f);
  border: 1px solid var(--line-strong);
  box-shadow: 0 40px 90px rgba(0,0,0,0.7);
  animation: pop 0.2s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop { from { transform: translateY(10px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-card h3 { margin: 0 0 6px; font-size: 18px; }
.modal-sub { margin: 0 0 18px; font-size: 12.5px; color: var(--ink-dim); line-height: 1.6; }
.modal-card input {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: rgba(0,0,0,0.28);
  color: var(--ink); font-size: 15px; letter-spacing: 2px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.modal-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(110,168,255,0.25); }
.modal-err { margin: 10px 0 0; font-size: 12.5px; color: #ff8f8f; }
.modal-err[hidden] { display: none; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal-tip { margin: 14px 0 0; font-size: 11.5px; color: var(--ink-faint); line-height: 1.6; }
.modal-tip[hidden] { display: none; }
.shake { animation: shake 0.35s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-8px); } 40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); } 80% { transform: translateX(3px); }
}

/* ---------- 管理态轻微高亮 ---------- */
body.admin .group { border-color: rgba(110,168,255,0.25); }
body.admin .poster { cursor: grab; touch-action: none; }   /* 触摸拖动改尺寸/画面，不触发页面手势 */

/* ---------- 管理态：四边红色缩放手柄 ---------- */
.rh {
  position: absolute; z-index: 6; display: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #ff7a7a, #e23b3b);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  touch-action: none;
}
body.admin .rh { display: block; }
.rh-left   { left: 10px;  top: 50%; transform: translate(-50%, -50%); cursor: ew-resize; }
.rh-right  { right: 10px; top: 50%; transform: translate(50%, -50%);  cursor: ew-resize; }
.rh-top    { top: 10px;  left: 50%; transform: translate(-50%, -50%); cursor: ns-resize; }
.rh-bottom { bottom: 10px; left: 50%; transform: translate(-50%, 50%); cursor: ns-resize; }
.rh:hover { background: radial-gradient(circle at 50% 38%, #ff9a9a, #ff4d4d); }

/* ---------- 管理态：按住海报拖动 → 组内换位 ---------- */
body.admin .poster { user-select: none; -webkit-user-select: none; }
body.admin .poster.repositioning {
  transform: translate(var(--drag-dx, 0), var(--drag-dy, 0));
  transition: none; opacity: 0.55; z-index: 12; cursor: grabbing;
  box-shadow: 0 34px 80px rgba(0, 0, 0, 0.75);
}
/* 插入位置指示线 */
.poster.drop-before::after, .poster.drop-after::after {
  content: ""; position: absolute; top: 6px; bottom: 6px; width: 3px;
  background: var(--accent); border-radius: 3px; box-shadow: 0 0 12px var(--accent); z-index: 13;
}
.poster.drop-before::after { left: -13px; }
.poster.drop-after::after { right: -13px; }

/* ---------- 作品详情弹窗 ---------- */
.detail {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  padding: 30px;
  background: rgba(4, 6, 11, 0.74);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.18s ease;
}
.detail[hidden] { display: none !important; }

.detail-card {
  position: relative;
  width: min(1080px, 96vw);
  /* 用确定高度而非 max-height：这样媒体区里的 max-height:100% 才能解析，
     否则媒体会无限增高、把底部标签栏顶出视口 */
  height: min(760px, 92vh);
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 0;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(180deg, #171c28, #10141c);
  border: 1px solid var(--line-strong);
  box-shadow: 0 50px 110px rgba(0, 0, 0, 0.72);
  animation: pop 0.22s cubic-bezier(.2,.9,.3,1.1);
}

.detail-close {
  position: absolute; top: 12px; right: 12px; z-index: 3;
  width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: rgba(7,8,13,0.55);
  color: var(--ink); font-size: 19px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; transition: all 0.16s;
}
.detail-close:hover { background: rgba(255,255,255,0.14); }

/* 左侧媒体区 */
.detail-media {
  position: relative;
  background: #0a0c12;
  display: flex; align-items: center; justify-content: center;
  min-height: 0;                                   /* 关键：允许收缩，媒体用 max-height 自适应 */
  padding: 34px 26px 62px;
}
.detail-media img,
.detail-media video {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  background: #000;
}
.detail-media video { display: none; }
.detail-media.show-video img { display: none; }
.detail-media.show-video video { display: block; }

/* 外部平台录屏（B站 / YouTube…）：嵌入式播放器 */
.dt-frame {
  display: none;
  width: 100%; height: auto;
  aspect-ratio: 16 / 9;
  max-width: 100%; max-height: 100%;
  border: 0; border-radius: 14px;
  background: #000;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}
.detail-media.show-video .dt-frame { display: block; }

/* 外链无法内嵌播放时的兜底卡片 */
.detail-extCard {
  display: none;
  flex-direction: column; align-items: center; gap: 13px;
  max-width: 330px; padding: 26px 28px;
  text-align: center;
  border-radius: 16px; border: 1px solid var(--line);
  background: rgba(255,255,255,0.045);
}
.detail-media.show-video .detail-extCard { display: flex; }
.extCard-icon {
  display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 50%;
  font-size: 16px; color: #07080d;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.extCard-tip { margin: 0; color: var(--ink-dim); font-size: 13px; line-height: 1.65; }

/* 有外链时常驻的「外部原片」快捷入口（右下角，避开居中 tab） */
.detail-extOpen {
  position: absolute; right: 14px; bottom: 16px; z-index: 2;
  padding: 6px 13px; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--ink-dim);
  text-decoration: none;
  background: rgba(255,255,255,0.06); border: 1px solid var(--line);
  transition: color 0.16s, background 0.16s;
}
.detail-extOpen:hover { color: var(--ink); background: rgba(255,255,255,0.13); }
.detail-noVideo {
  position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%);
  color: var(--ink-dim); font-size: 13px;
}
.detail-tabs {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  display: flex; gap: 4px; padding: 4px;
  border-radius: 999px; background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
}
.dt-tab {
  padding: 7px 18px; border-radius: 999px; border: none;
  background: transparent; color: var(--ink-dim);
  font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all 0.16s;
}
.dt-tab:hover { color: var(--ink); }
.dt-tab.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #07080d; }

/* 右侧信息区 */
.detail-info {
  padding: 34px 34px 30px;
  overflow-y: auto;
  min-height: 0;                                   /* 关键：让 overflow-y 生效 */
  border-left: 1px solid var(--line);
}
.detail-info .cat {
  display: inline-block; font-size: 11px; letter-spacing: 1px;
  padding: 4px 11px; border-radius: 999px; margin-bottom: 12px;
  background: rgba(110,168,255,0.16); border: 1px solid rgba(110,168,255,0.34);
}
.detail-info h2 { margin: 0 0 6px; font-size: 25px; line-height: 1.3; letter-spacing: 0.4px; }
.detail-author { margin: 0 0 22px; font-size: 13px; color: var(--ink-dim); }

.detail-block { margin-bottom: 22px; }
.detail-block h4 {
  margin: 0 0 10px; font-size: 12px; font-weight: 700;
  letter-spacing: 2px; color: var(--accent);
}
.member-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.member-chips span {
  padding: 6px 13px; border-radius: 999px; font-size: 13px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--line-strong);
}
.member-chips .empty { color: var(--ink-faint); border-style: dashed; background: transparent; }
.detail-desc { margin: 0; font-size: 14px; line-height: 1.85; color: #cfd7ea; white-space: pre-wrap; }
.detail-desc.empty { color: var(--ink-faint); }

/* 编辑表单（管理态） */
.detail-edit {
  margin-top: 26px; padding-top: 22px;
  border-top: 1px dashed var(--line-strong);
}
.detail-edit label {
  display: block; margin-bottom: 12px;
  font-size: 12px; color: var(--ink-dim); letter-spacing: 0.5px;
}
.detail-edit input, .detail-edit textarea {
  display: block; width: 100%; margin-top: 6px;
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: rgba(0,0,0,0.3);
  color: var(--ink); font-size: 13.5px; font-family: var(--font);
  outline: none; resize: vertical;
}
.detail-edit input:focus, .detail-edit textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(110,168,255,0.2); }
.detail-edit-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  position: sticky; bottom: 0;                      /* 始终贴着信息栏底部，长表单也能直接保存 */
  margin-top: 10px; padding-top: 14px;
  background: linear-gradient(180deg, rgba(16,20,28,0) 0%, #10141c 45%);
}
.edit-msg { font-size: 12.5px; color: #4fd1a5; }

@media (max-width: 900px) {
  .hud { display: none; }
  .brand-text p { display: none; }
  :root { --cell-w: 158px; --cell-h: 216px; --gap: 14px; }
  .detail { padding: 12px; }
  .detail-card {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 0.85fr) minmax(0, 1.15fr);
    height: 94vh;
  }
  .detail-media { min-height: 0; padding: 18px 18px 58px; }
  .detail-info { border-left: none; border-top: 1px solid var(--line); padding: 20px; }
}
