/* 全景盒子 · 管理后台样式 */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
:root {
  --bg: #080a10;
  --bg-2: #0d1018;
  --bg-3: #12161f;
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .16);
  --fg: #eef2fa;
  --dim: rgba(226, 234, 250, .55);
  --dim-2: rgba(226, 234, 250, .34);
  --accent: #5b9dff;
  --accent-2: #8f6bff;
  --danger: #ff6b6b;
}

body { color: var(--fg); }

.admin-body {
  height: 100vh; height: 100dvh; overflow: hidden;
  display: flex; flex-direction: column;
  background:
    radial-gradient(800px 400px at 88% -10%, rgba(120, 90, 255, .13), transparent 70%),
    radial-gradient(700px 380px at 4% -6%, rgba(91, 157, 255, .12), transparent 72%),
    var(--bg);
}

/* ---------- 登录 ---------- */
.login-wrap { flex: 1; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(380px, 100%); padding: 30px 28px 24px; border-radius: 20px;
  background: rgba(16, 20, 30, .82); border: 1px solid var(--line);
  box-shadow: 0 40px 90px -40px #000; backdrop-filter: blur(18px);
}
.login-logo { display: flex; gap: 14px; align-items: center; margin-bottom: 24px; }
.login-logo svg { width: 42px; height: 42px; }
.login-logo h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: .3px; }
.login-logo p { margin: 3px 0 0; font-size: 12px; color: var(--dim-2); }
.login-back { display: block; text-align: center; margin-top: 16px; font-size: 12.5px; color: var(--dim-2); }
.login-back:hover { color: var(--fg); }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 56px; flex: 0 0 56px; display: flex; align-items: center; gap: 14px;
  padding: 0 18px; border-bottom: 1px solid var(--line);
  background: rgba(9, 12, 18, .72); backdrop-filter: blur(14px); z-index: 20;
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 650; letter-spacing: .3px; }
.brand svg { width: 26px; height: 26px; }
.crumb { font-size: 12.5px; color: var(--dim-2); padding-left: 14px; border-left: 1px solid var(--line); }
.top-actions { margin-left: auto; display: flex; gap: 8px; }

.app { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---------- 通用控件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 9px; cursor: pointer; font-size: 13px;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, .05); color: var(--fg);
  transition: background .16s, border-color .16s, transform .1s, filter .16s;
  white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .28); }
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 12px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.danger { color: #ffb4b4; border-color: rgba(255, 107, 107, .3); background: rgba(255, 107, 107, .08); }
.btn.danger:hover { background: rgba(255, 107, 107, .16); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.mini {
  background: transparent; border: 0; color: var(--accent); cursor: pointer;
  font-size: 12px; padding: 2px 6px; border-radius: 6px;
}
.mini:hover { background: rgba(91, 157, 255, .12); }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; color: var(--dim); margin-bottom: 6px; letter-spacing: .2px; }
.field input[type=text], .field input[type=password], .field textarea, select, .input-prefix input {
  width: 100%; padding: 9px 12px; font-size: 13px; font-family: inherit;
  background: rgba(255, 255, 255, .04); color: var(--fg);
  border: 1px solid var(--line-2); border-radius: 9px; outline: none;
  transition: border-color .16s, background .16s;
}
.field input:focus, .field textarea:focus, select:focus, .input-prefix input:focus {
  border-color: rgba(91, 157, 255, .75); background: rgba(91, 157, 255, .06);
}
.field textarea { resize: vertical; line-height: 1.6; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-prefix { display: flex; align-items: center; gap: 0; }
.input-prefix em {
  font-style: normal; font-size: 12px; color: var(--dim-2); padding: 9px 8px 9px 11px;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--line-2); border-right: 0;
  border-radius: 9px 0 0 9px; white-space: nowrap;
}
.input-prefix input { border-radius: 0 9px 9px 0; }
.switch-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--dim); cursor: pointer; }
.switch-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.formerr { min-height: 18px; font-size: 12.5px; color: #ff9b9b; }

/* ---------- 列表 ---------- */
.view { flex: 1; overflow: auto; min-height: 0; }
#editView { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding: 28px 28px 18px;
}
.page-head h2 { margin: 0 0 5px; font-size: 21px; font-weight: 650; letter-spacing: .2px; }
.page-head p { margin: 0; font-size: 12.5px; color: var(--dim-2); }

.proj-grid {
  display: grid; gap: 16px; padding: 4px 28px 40px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
.proj-card {
  border-radius: 15px; overflow: hidden; background: var(--bg-2);
  border: 1px solid var(--line); transition: border-color .2s, transform .2s;
  display: flex; flex-direction: column;
}
.proj-card:hover { border-color: rgba(120, 170, 255, .4); transform: translateY(-2px); }
.proj-cover { position: relative; aspect-ratio: 16/9; background: #0a0d14; overflow: hidden; }
.proj-cover img { width: 100%; height: 100%; object-fit: cover; }
.proj-cover .empty { display: grid; place-items: center; height: 100%; color: var(--dim-2); font-size: 12px; }
.proj-tags { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; }
.tag {
  font-size: 10.5px; padding: 3px 8px; border-radius: 999px; letter-spacing: .3px;
  background: rgba(6, 9, 14, .7); border: 1px solid var(--line-2); backdrop-filter: blur(6px);
}
.tag.warn { color: #ffd08a; border-color: rgba(255, 200, 130, .3); }
.tag.off { color: #b9c0cf; }
.proj-main { padding: 12px 14px 8px; }
.proj-main h3 { margin: 0; font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-main .meta { margin-top: 5px; font-size: 11.5px; color: var(--dim-2); display: flex; gap: 10px; flex-wrap: wrap; }
.proj-ops { display: flex; gap: 6px; padding: 6px 12px 12px; flex-wrap: wrap; }
.proj-ops .btn { flex: 1; min-width: 0; padding: 7px 4px; font-size: 12px; }
.new-tile {
  border: 1px dashed rgba(255, 255, 255, .18); border-radius: 15px;
  display: grid; place-items: center; gap: 8px; min-height: 200px; cursor: pointer;
  color: var(--dim); font-size: 13px; background: rgba(255, 255, 255, .015);
  transition: border-color .2s, background .2s, color .2s;
}
.new-tile:hover { border-color: rgba(120, 170, 255, .5); background: rgba(91, 157, 255, .05); color: var(--fg); }
.new-tile b { font-size: 26px; font-weight: 300; }

/* ---------- 编辑器 ---------- */
.edit-head {
  height: 56px; flex: 0 0 56px; display: flex; align-items: center; gap: 12px;
  padding: 0 16px; border-bottom: 1px solid var(--line); background: rgba(11, 14, 21, .5);
}
.edit-head .back { flex: 0 0 auto; }
.title-input {
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  color: var(--fg); font-size: 15px; font-weight: 600; padding: 7px 10px;
  min-width: 160px; max-width: 340px; flex: 1; outline: none; font-family: inherit;
}
.title-input:hover { border-color: var(--line); }
.title-input:focus { border-color: rgba(91, 157, 255, .6); background: rgba(91, 157, 255, .06); }
.pill { font-size: 11px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--dim); white-space: nowrap; }
.pill.on { color: #9be3b0; border-color: rgba(120, 230, 160, .3); background: rgba(90, 220, 140, .1); }
.pill.off { color: #ffc48a; border-color: rgba(255, 190, 120, .3); background: rgba(255, 180, 100, .1); }
.edit-actions { margin-left: auto; display: flex; gap: 8px; }

.edit-body {
  flex: 1; min-height: 0; display: grid;
  grid-template-columns: 268px minmax(0, 1fr) 312px;
}
.panel { min-height: 0; overflow: auto; background: rgba(10, 13, 19, .55); }
.scenes-panel { border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 0 0 10px; }
.insp-panel { border-left: 1px solid var(--line); }
.panel-head {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px; font-size: 12.5px; color: var(--dim); letter-spacing: .3px;
  background: rgba(10, 13, 19, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.panel-head b { color: var(--fg); font-weight: 600; }
.upload-btn {
  font-size: 12px; padding: 5px 10px; border-radius: 7px; cursor: pointer;
  background: rgba(91, 157, 255, .14); color: #a8c8ff; border: 1px solid rgba(91, 157, 255, .3);
}
.upload-btn:hover { background: rgba(91, 157, 255, .24); }

.scene-list { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.scene-item {
  display: flex; gap: 9px; padding: 7px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; transition: background .16s, border-color .16s;
}
.scene-item:hover { background: rgba(255, 255, 255, .04); }
.scene-item.on { background: rgba(91, 157, 255, .12); border-color: rgba(91, 157, 255, .38); }
.si-thumb {
  width: 64px; height: 40px; border-radius: 6px; overflow: hidden; background: #0b0e15;
  flex: 0 0 auto; display: grid; place-items: center; position: relative;
}
.si-thumb img { width: 100%; height: 100%; object-fit: cover; }
.si-thumb .spin {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .18); border-top-color: var(--accent);
  animation: rot .8s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }
.si-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.si-title { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.si-meta { font-size: 10.5px; color: var(--dim-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.si-meta.err { color: #ff9b9b; }
.si-bar { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.si-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s; }
.si-ops { display: flex; flex-direction: column; gap: 2px; opacity: 0; transition: opacity .16s; }
.scene-item:hover .si-ops { opacity: 1; }
.si-ops button {
  width: 20px; height: 16px; border: 0; border-radius: 4px; cursor: pointer;
  background: rgba(255, 255, 255, .07); color: var(--dim); font-size: 9px; line-height: 1;
  display: grid; place-items: center;
}
.si-ops button:hover { background: rgba(255, 255, 255, .16); color: var(--fg); }

.dropzone {
  margin: 4px 10px 0; padding: 16px 12px; border-radius: 11px; cursor: pointer;
  border: 1px dashed rgba(255, 255, 255, .16); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--dim); font-size: 12px; transition: border-color .18s, background .18s, color .18s;
}
.dropzone svg { width: 20px; height: 20px; opacity: .7; }
.dropzone small { color: var(--dim-2); font-size: 10.5px; }
.dropzone:hover, .dropzone.over { border-color: rgba(91, 157, 255, .6); background: rgba(91, 157, 255, .08); color: var(--fg); }

.stage-wrap { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #05070b; }
.stage-box { position: relative; flex: 1; min-height: 0; }
.ed-player { position: absolute; inset: 0; }
.pick-hint {
  position: absolute; left: 50%; top: 16px; transform: translate(-50%, -10px);
  padding: 8px 16px; border-radius: 999px; font-size: 12.5px; z-index: 50;
  background: rgba(91, 157, 255, .18); border: 1px solid rgba(91, 157, 255, .55);
  color: #cfe0ff; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  backdrop-filter: blur(8px); white-space: nowrap;
}
.pick-hint.on { opacity: 1; transform: translate(-50%, 0); }

.viewbar { flex: 0 0 auto; border-top: 1px solid var(--line); padding: 10px 16px 12px; background: rgba(10, 13, 19, .6); }
.vb-row { display: grid; grid-template-columns: 40px 1fr 52px; align-items: center; gap: 10px; margin-bottom: 6px; }
.vb-row label { font-size: 11.5px; color: var(--dim-2); }
.vb-row output { font-size: 11.5px; color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; }
.vb-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.saveflag { font-size: 11.5px; color: #8fdcab; opacity: 0; transition: opacity .25s; }
.saveflag.on { opacity: 1; }

input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 3px; border-radius: 2px;
  background: rgba(255, 255, 255, .14); outline: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%;
  background: #dce8ff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); cursor: grab;
}
input[type=range]::-moz-range-thumb {
  width: 13px; height: 13px; border: 0; border-radius: 50%; background: #dce8ff;
}

.insp-body { padding: 14px; }
.insp-empty { padding: 40px 20px; text-align: center; color: var(--dim-2); font-size: 12.5px; line-height: 1.8; }
.insp-meta { font-size: 11px; color: var(--dim-2); margin: -6px 0 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.sect { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.sect-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--dim); margin-bottom: 8px; }
.sect.danger { border-top-color: rgba(255, 107, 107, .18); }
.hot-form { display: grid; gap: 7px; margin-bottom: 10px; padding: 10px; border-radius: 9px; background: rgba(91, 157, 255, .06); border: 1px solid rgba(91, 157, 255, .22); }
.hot-form select, .hot-form input { padding: 7px 9px; font-size: 12px; }
.hot-form-actions { display: flex; gap: 6px; }
.hot-form-actions .btn { flex: 1; }
.hot-list { display: flex; flex-direction: column; gap: 6px; }
.hot-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px;
  background: rgba(255, 255, 255, .035); border: 1px solid var(--line); font-size: 12px;
}
.hot-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; box-shadow: 0 0 8px var(--accent); }
.hot-item .txt { flex: 1; min-width: 0; }
.hot-item .txt b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hot-item .txt small { color: var(--dim-2); font-size: 10.5px; }
.hot-item button { background: transparent; border: 0; color: var(--dim-2); cursor: pointer; font-size: 13px; padding: 2px 4px; }
.hot-item button:hover { color: #ff9b9b; }
.hot-empty { font-size: 11.5px; color: var(--dim-2); padding: 4px 0 2px; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
  background: rgba(3, 5, 9, .68); backdrop-filter: blur(6px);
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(600px, 100%); max-height: 88vh; display: flex; flex-direction: column;
  border-radius: 18px; background: #0e121a; border: 1px solid var(--line-2);
  box-shadow: 0 40px 100px -30px #000; overflow: hidden;
}
.modal-card.narrow { width: min(400px, 100%); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 620; }
.iconbtn { background: transparent; border: 0; color: var(--dim); cursor: pointer; font-size: 15px; padding: 4px 8px; border-radius: 7px; }
.iconbtn:hover { background: rgba(255, 255, 255, .08); color: var(--fg); }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: rgba(0, 0, 0, .2); }
.cover-row { display: flex; align-items: center; gap: 12px; }
.cover-prev {
  width: 148px; height: 83px; border-radius: 8px; overflow: hidden; background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line); display: grid; place-items: center; font-size: 11px; color: var(--dim-2);
}
.cover-prev img { width: 100%; height: 100%; object-fit: cover; }
.link-preview {
  margin-top: 6px; padding: 10px 12px; border-radius: 9px; font-size: 11.5px; color: var(--dim);
  background: rgba(91, 157, 255, .06); border: 1px solid rgba(91, 157, 255, .18);
  word-break: break-all; line-height: 1.6;
}
.link-preview b { color: #a8c8ff; font-weight: 500; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 12px);
  padding: 10px 20px; border-radius: 999px; font-size: 13px; z-index: 200;
  background: rgba(18, 24, 34, .95); border: 1px solid var(--line-2); color: var(--fg);
  opacity: 0; pointer-events: none; transition: opacity .24s, transform .24s;
  box-shadow: 0 18px 40px -18px #000; max-width: 80vw; text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(255, 107, 107, .45); color: #ffc0c0; }

/* ---------- 窄屏 ---------- */
@media (max-width: 1180px) {
  .edit-body { grid-template-columns: 232px minmax(0, 1fr) 272px; }
}
@media (max-width: 960px) {
  .edit-body { grid-template-columns: 1fr; grid-template-rows: auto 320px auto; overflow: auto; }
  .scenes-panel, .insp-panel { border: 0; border-top: 1px solid var(--line); }
  .scenes-panel { order: 2; max-height: 300px; }
  .stage-wrap { order: 1; }
  .insp-panel { order: 3; }
  .edit-head { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
  .edit-actions { width: 100%; }
  .field-row { grid-template-columns: 1fr; }
  .page-head { padding: 20px 16px 14px; }
  .proj-grid { padding: 0 16px 30px; }
  #editView { overflow: auto; }
}
