/* =========================================================================
   网页编辑器（管理员）样式  ·  只有登录后才出现
   普通访客看不到任何这里的元素（元素本身也不渲染）
   ========================================================================= */

/* ---------------- 底部管理条（固定，始终可见） ---------------- */
.adm-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: none;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 9px clamp(12px, 3.5vw, 28px);
  background: rgba(21, 22, 26, .94);
  border-top: 1px solid rgba(194, 169, 112, .38);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, .45);
  text-shadow: none;
  font-size: 12.5px;
}
body.is-admin .adm-bar { display: flex; }
body.is-admin { padding-bottom: 62px; }
.adm-bar .who { color: #dcc48d; font-weight: 700; }
.adm-bar .dotsep { color: rgba(255, 255, 255, .3); }
.adm-bar .spacer { flex: 1 1 auto; }
.adm-bar .dirty { color: #ffd76e; }

/* ---------------- 条上的「浓度 / 速度」滑块 ----------------
   整条 .adm-bar 只有登录后才存在，所以访客看不到也拖不到。 */
.adm-slide {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 2px 9px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(255, 255, 255, .08);
  font-size: 11.5px;
  text-shadow: none;
}
.adm-slide .lb { color: rgba(255, 255, 255, .6); letter-spacing: .05em; }
.adm-slide b {
  min-width: 30px;
  text-align: right;
  color: #dcc48d;
  font-size: 11px;
  font-weight: 700;
}
.adm-slide input[type=range] {
  width: 92px;
  height: 14px;
  margin: 0;
  cursor: pointer;
  accent-color: #c2a970;
}
/* 弹窗里的滑块占满一行，比条上的宽一些好拖 */
.adm-range {
  width: 100%;
  height: 20px;
  margin: 2px 0 0;
  cursor: pointer;
  accent-color: #c2a970;
}
.adm-label b { color: #dcc48d; font-size: 12px; }

/* ---------------- 按钮 ---------------- */
.adm-btn {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  text-shadow: none;
  white-space: nowrap;
  transition: .15s ease;
}
.adm-btn:hover { background: rgba(255, 255, 255, .22); border-color: #dcc48d; }
.adm-btn.primary {
  background: #c2a970;
  color: #221d12;
  border-color: #dcc48d;
  font-weight: 700;
}
.adm-btn.primary:hover { background: #dcc48d; }
.adm-btn.primary[disabled] {
  opacity: .45;
  cursor: default;
  background: rgba(255, 255, 255, .3);
  color: #fff;
  border-color: rgba(255, 255, 255, .3);
}
.adm-btn.danger { border-color: rgba(255, 140, 140, .6); color: #ffd0d0; }
.adm-btn.danger:hover { background: rgba(255, 90, 90, .3); border-color: #ff9a9a; }
/* 危险操作的确认按钮：实心红，和"取消"拉开距离 */
.adm-btn.dangerfill {
  background: #b4544f;
  color: #fff;
  border-color: #cf6a64;
  font-weight: 700;
}
.adm-btn.dangerfill:hover { background: #c9635d; border-color: #e0837d; }

/* 自绘确认框正文 */
.adm-confirm { font-size: 13.5px; line-height: 1.85; color: #e8e6e1; }
.adm-confirm-detail {
  display: block;
  margin-top: 11px;
  padding: 9px 12px;
  border-radius: 7px;
  background: rgba(0, 0, 0, .26);
  border: 1px solid rgba(255, 255, 255, .13);
  font-weight: 700;
  color: #dcc48d;
  word-break: break-word;
}
.adm-btn.sm { padding: 3px 9px; font-size: 11.5px; }
.adm-btn.icon { padding: 3px 8px; font-size: 12px; }

/* ---------------- 开关 ---------------- */
.adm-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  color: #fff;
}
.adm-switch input { display: none; }
.adm-switch .track {
  width: 38px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .2);
  border: 1px solid rgba(255, 255, 255, .3);
  position: relative;
  transition: .2s ease;
}
.adm-switch .track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: .2s ease;
}
.adm-switch input:checked + .track { background: #c2a970; border-color: #dcc48d; }
.adm-switch input:checked + .track::after { left: 20px; }

/* ---------------- 编辑模式下的层级控件 ---------------- */
.adm-tierctl {
  display: none;
  gap: 5px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 6px 8px;
  border-radius: 3px;
  background: rgba(44, 53, 66, .78);
  border: 1px dashed rgba(194, 169, 112, .55);
  text-shadow: none;
}
body.is-editing .adm-tierctl { display: flex; }

/* 层级拖动把手：按住这里拖 = 换层级顺序 */
.adm-tierhandle {
  display: inline-flex;
  align-items: center;
  align-self: center;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px dashed rgba(194, 169, 112, .62);
  color: #dcc48d;
  font-size: 11.5px;
  cursor: grab;
  user-select: none;
  white-space: nowrap;
}
.adm-tierhandle:hover { background: rgba(194, 169, 112, .18); }
.adm-tierhandle:active { cursor: grabbing; }

/* 拖动中的层级（变淡，表示"正在搬它"） */
.tier-row.tier-dragging { opacity: .5; }
/* 松手后会与它互换的那一层 */
.tier-row.tier-drop {
  box-shadow: inset 0 0 0 2px #9be7a0;
  background: rgba(155, 231, 160, .07);
}
body.is-tier-dragging { cursor: grabbing; }
.adm-tierctl .tname {
  color: #dcc48d;
  font-size: 12px;
  font-weight: 700;
  align-self: center;
  margin-right: 4px;
}
.adm-tierctl .spacer { flex: 1 1 auto; }

.adm-addtier { display: none; text-align: center; margin: 26px 0 10px; }
body.is-editing .adm-addtier { display: block; }

/* ---------------- 编辑模式下的卡片 ---------------- */
body.is-editing .card {
  cursor: pointer;
  outline: 1px dashed rgba(185, 160, 106, .55);
  outline-offset: 2px;
}
body.is-editing .card:hover { outline-color: #dcc48d; }
body.is-editing .card .cthumb { pointer-events: none; }

/* 正在拖的那张：亮起来（原来只是变淡，太不明显） */
body.is-editing .card.dragging {
  opacity: 1;
  cursor: grabbing;
  outline: 2px solid #ffd76e;
  outline-offset: 2px;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .6), 0 0 0 7px rgba(255, 215, 110, .12);
  position: relative;
  z-index: 2;
}
/* 松手后会被换走的那一张：换一种颜色亮起来，一眼看出「这两张要互换」 */
body.is-editing .card.drop-target {
  outline: 2px solid #9be7a0;
  outline-offset: 2px;
  box-shadow: 0 0 0 7px rgba(155, 231, 160, .14), var(--shadow-lift);
  background:
    linear-gradient(180deg, rgba(155, 231, 160, .16), rgba(155, 231, 160, .05)),
    linear-gradient(180deg, var(--panel-2) 0%, var(--panel) 100%);
}
.cards.drop-empty {
  min-height: 46px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 2px #ffd76e;
}
/* 拖到某一层的空白处 / 右栏叙述区 = 放到这一层末尾 */
.tier-row.drop-row {
  box-shadow: inset 0 0 0 2px #ffd76e;
  background: rgba(255, 215, 110, .05);
}

/* ---------------- 详情页里的「本页」工具条（只在编辑模式出现） ---------------- */
.adm-pagebar { display: none; }
body.is-editing .adm-pagebar {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  padding: 9px clamp(14px, 2.6vw, 24px);
  border-bottom: 1px dashed rgba(194, 169, 112, .45);
  background: rgba(194, 169, 112, .055);
  text-shadow: none;
}
.adm-pagebar .pname {
  color: #dcc48d;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  max-width: 38%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.adm-pagebar .pkind {
  font-size: 10.5px;
  letter-spacing: .1em;
  color: rgba(255, 255, 255, .42);
}
.adm-pagebar .spacer { flex: 1 1 auto; }

/* ---------------- 模块行上的小控件 ----------------
   放右下角 —— 四角要让给缩放手柄，右上角留给那个 "›"。 */
.adm-blkctl {
  display: none;
  position: absolute;
  right: 7px;
  bottom: 7px;
  z-index: 4;
  gap: 3px;
}
body.is-editing .adm-blkctl { display: flex; }
/* 底部要给这排按钮腾出高度，否则会压住模块标题 */
body.is-editing .dblk { padding-bottom: 34px; cursor: pointer; }

/* ---------------- 模块块：四角缩放手柄 ----------------
   只在编辑模式下、且鼠标停在这一块上时出现（拖动中一直显示）。 */
.adm-blkhandle {
  display: none;
  position: absolute;
  z-index: 5;
  width: 13px;
  height: 13px;
  border-radius: 2px;
  background: rgba(12, 12, 15, .82);
  border: 1px solid var(--brass-dim);
}
body.is-editing .dblk-row:hover > .adm-blkhandle,
.dblk-row.is-resizing > .adm-blkhandle { display: block; }
.adm-blkhandle[data-corner="nw"] { left: -6px;   top: -6px;    cursor: nwse-resize; }
.adm-blkhandle[data-corner="ne"] { right: -6px;  top: -6px;    cursor: nesw-resize; }
.adm-blkhandle[data-corner="sw"] { left: -6px;   bottom: -6px; cursor: nesw-resize; }
.adm-blkhandle[data-corner="se"] { right: -6px;  bottom: -6px; cursor: nwse-resize; }
.adm-blkhandle:hover { background: var(--brass); border-color: var(--brass); }

/* 拖动时把这一行抬起来，免得角上的手柄被相邻模块盖住 */
.dblk-row.is-resizing { z-index: 6; }

/* 拖动时在网格容器上铺一层列线，一眼看出"会吸附到哪一列" */
.dblk-list.is-measuring {
  background-image: linear-gradient(90deg, rgba(194, 169, 112, .2) 1px, transparent 1px);
  background-size: calc(100% / 12) 100%;
}

/* 跟着鼠标走的尺寸提示：6 / 12 列　高 120px */
.adm-blkbadge {
  position: fixed;
  z-index: 9999;
  padding: 3px 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  color: #221d12;
  background: var(--brass);
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
}

/* 拖动中别把文字选蓝了 */
body.is-blk-resizing { user-select: none; }

/* 编辑模式才放开「子页面 · N」那行（访客端是隐藏的） */
body.is-editing .dblk-head { display: flex; }

/* ---------------- 卡片上的「编辑词条信息」按钮 ----------------
   编辑模式下点卡片本体 = 进详情页，所以「改信息」单独收在这一颗 ✎ 上，
   否则卡片就只剩「编辑」一个出口，进不去自己的页面。 */
.adm-cardedit {
  display: none;
  position: absolute;
  right: 6px;
  top: 6px;
  z-index: 5;              /* 要压过「已复活」的折角，编辑时操作优先 */
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
  font-size: 11px;
  line-height: 1;
  color: #dcc48d;
  background: rgba(12, 12, 15, .74);
  border: 1px solid var(--line-3);
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
  transition: color .14s ease, border-color .14s ease, background .14s ease;
}
body.is-editing .adm-cardedit { display: flex; }
.adm-cardedit:hover {
  color: #fff;
  border-color: var(--brass);
  background: rgba(194, 169, 112, .2);
}
/* ✎ 占了右上角，把原来那个 "›" 让开，并给标题留出宽度 */
body.is-editing .card .cm { display: none; }
body.is-editing .card { padding-right: 34px; }

/* ---------------- 弹窗 ---------------- */
.adm-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(12, 13, 16, .82);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  text-shadow: none;
}
.adm-modal.is-on { display: flex; }

.adm-box {
  width: min(620px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: #25262c;
  border: 1px solid rgba(194, 169, 112, .32);
  box-shadow: 0 28px 70px rgba(0, 0, 0, .65);
  color: #e8e6e1;
  font-size: 13px;
}
.adm-box.narrow { width: min(420px, 96vw); }

.adm-head {
  padding: 13px 18px;
  font-size: 14.5px;
  font-weight: 800;
  background: rgba(255, 255, 255, .06);
  border-bottom: 1px solid rgba(194, 169, 112, .22);
  flex: none;
}
.adm-body {
  padding: 16px 18px;
  overflow: auto;
  flex: 1 1 auto;
}
.adm-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 12px 18px;
  background: rgba(0, 0, 0, .16);
  border-top: 1px solid rgba(194, 169, 112, .22);
  flex: none;
}
.adm-foot .spacer { flex: 1 1 auto; }

/* ---------------- 表单 ---------------- */
.adm-field { display: block; margin-bottom: 13px; }
.adm-label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  color: #dcc48d;
  font-weight: 700;
}
.adm-hint { font-size: 11.5px; color: rgba(255, 255, 255, .55); line-height: 1.7; margin-top: 4px; }
.adm-input,
.adm-textarea {
  width: 100%;
  padding: 8px 11px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(0, 0, 0, .26);
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.adm-input:focus,
.adm-textarea:focus { border-color: #c2a970; box-shadow: 0 0 0 3px rgba(194, 169, 112, .18); }
.adm-textarea { resize: vertical; min-height: 72px; line-height: 1.7; }
.adm-input::placeholder, .adm-textarea::placeholder { color: rgba(255, 255, 255, .35); }

.adm-row { display: flex; gap: 8px; }
.adm-row > * { flex: 1 1 0; min-width: 0; }
.adm-row.tight { flex: none; }

/* 标签选择 */
.adm-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.adm-tags .tk {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  color: #fff;
  background: rgba(255, 255, 255, .1);
  border: 1px solid var(--tc, rgba(255, 255, 255, .3));
}
.adm-tags .tk.on { background: var(--tc, #fff); color: #221d12; font-weight: 700; }

/* 新建标签那一行的取色器（观感同标签管理里的 input[type=color]） */
.adm-colorpick {
  flex: none;
  width: 38px;
  height: 32px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(0, 0, 0, .26);
  cursor: pointer;
}

/* ---------------- 「已复活」开关 ---------------- */
.adm-switch {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}
.adm-switch input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}
.adm-switch .sw {
  position: relative;
  flex: none;
  width: 38px;
  height: 21px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .4);
  border: 1px solid rgba(255, 255, 255, .18);
  transition: background .16s ease, border-color .16s ease;
}
.adm-switch .sw::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .6);
  transition: left .16s ease, background .16s ease;
}
.adm-switch input:checked + .sw {
  background: rgba(194, 169, 112, .36);
  border-color: var(--brass);
}
.adm-switch input:checked + .sw::after {
  left: 20px;
  background: var(--brass);
}
.adm-switch input:focus-visible + .sw { outline: 2px solid var(--brass); outline-offset: 2px; }
.adm-switch .tx { font-size: 12.5px; color: var(--fg-2); }
.adm-switch input:checked ~ .tx { color: var(--brass-2); font-weight: 700; }

/* 图片预览 */
.adm-imgprev {
  margin-top: 8px;
  max-width: 100%;
  max-height: 170px;
  border-radius: 8px;
  display: none;
  background: rgba(255, 255, 255, .08);
}
.adm-imgprev.on { display: block; }

/* 标签管理行 */
.adm-tagrow {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 7px;
}
.adm-tagrow .adm-input { flex: 1 1 auto; }
.adm-tagrow input[type="color"] {
  flex: none;
  width: 38px;
  height: 32px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(0, 0, 0, .26);
  cursor: pointer;
}

/* ---------------- 提示条 ---------------- */
.adm-toast {
  position: fixed;
  left: 50%;
  bottom: 76px;
  transform: translateX(-50%) translateY(14px);
  z-index: 400;
  max-width: min(560px, 92vw);
  padding: 11px 20px;
  border-radius: 999px;
  background: rgba(25, 26, 31, .96);
  border: 1px solid rgba(194, 169, 112, .45);
  color: #e8e6e1;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .55);
  opacity: 0;
  visibility: hidden;
  transition: .22s ease;
  text-shadow: none;
}
.adm-toast.is-on { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.adm-toast.ok { border-color: rgba(140, 240, 180, .6); }
.adm-toast.err { border-color: rgba(255, 130, 130, .7); background: rgba(58, 12, 18, .96); }

/* ---------------- 外观样式表单 ---------------- */
.stbox {
  margin: 0 0 13px;
  padding: 10px 12px 12px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 9px;
  background: rgba(0, 0, 0, .16);
}
.stbox:last-child { margin-bottom: 0; }
.sthead {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 12px;
  font-weight: 700;
  color: #dcc48d;
}
.sthead .stnote { font-weight: 400; font-size: 11px; color: rgba(255, 255, 255, .5); }

.stgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 7px 14px;
}
.strow { display: flex; align-items: center; gap: 8px; }
.strow .stlabel {
  flex: none;
  width: 68px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, .62);
}
.stnum { display: inline-flex; align-items: center; gap: 4px; flex: 1 1 auto; min-width: 0; }
.stnum em { font-style: normal; font-size: 10.5px; color: rgba(255, 255, 255, .38); flex: none; }
.stcolor { display: inline-flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; }
.stpick {
  flex: none;
  width: 30px; height: 28px;
  padding: 1px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(0, 0, 0, .26);
  cursor: pointer;
}
.sthex { flex: 1 1 auto; min-width: 0; font-family: ui-monospace, Consolas, monospace; }
.sthex.on { border-color: #c2a970; }
.strow .adm-input { padding: 5px 8px; font-size: 12px; }

/* 单条覆盖：默认折叠，免得弹窗太长 */
.stdetails > summary {
  cursor: pointer;
  padding: 2px 0;
  font-size: 12px;
  font-weight: 700;
  color: #dcc48d;
  list-style: none;
}
.stdetails > summary::-webkit-details-marker { display: none; }
.stdetails > summary::before { content: "▸ "; }
.stdetails[open] > summary::before { content: "▾ "; }
.stdetails[open] > summary { margin-bottom: 9px; }

/* ---------------- 多选模式 ---------------- */
.adm-selbar {
  position: fixed;
  left: 50%;
  bottom: 70px;
  transform: translateX(-50%) translateY(10px);
  z-index: 88;
  display: none;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: min(760px, 94vw);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(21, 22, 26, .96);
  border: 1px solid rgba(255, 215, 110, .5);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-shadow: none;
  font-size: 12.5px;
  opacity: 0;
  visibility: hidden;
  transition: .18s ease;
}
body.is-selecting .adm-selbar {
  display: flex;
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.adm-selbar .sc { color: #ffd76e; font-weight: 700; padding: 0 4px; white-space: nowrap; }
.adm-selbar .adm-btn[disabled] { opacity: .4; cursor: default; }

/* 管理条上的「☑ 多选」按钮，开启时点亮 */
#adm-select.on {
  background: #ffd76e;
  color: #221d12;
  border-color: #ffe6a8;
  font-weight: 700;
}

/* 被选中的卡片 */
body.is-selecting .card { cursor: pointer; }
body.is-selecting .card.is-sel {
  outline: 2px solid #ffd76e;
  outline-offset: 2px;
  box-shadow: 0 0 0 7px rgba(255, 215, 110, .12), var(--shadow-lift);
  background:
    linear-gradient(180deg, rgba(255, 215, 110, .17), rgba(255, 215, 110, .05)),
    linear-gradient(180deg, var(--panel-2) 0%, var(--panel) 100%);
}
body.is-selecting .card.is-sel::after {
  content: "✓";
  position: absolute;
  top: 5px;
  right: 7px;
  font-size: 12px;
  font-weight: 700;
  color: #ffd76e;
  line-height: 1;
}
body.is-selecting .card.is-sel .cm { display: none; }

/* ---------------- 登录触发按钮（藏在页脚，只做兜底） ---------------- */
.adm-lock {
  display: inline-block;
  margin-left: 6px;
  opacity: .35;
  cursor: pointer;
  font-size: 11px;
  vertical-align: middle;
}
.adm-lock:hover { opacity: 1; }

@media (max-width: 560px) {
  .adm-bar { top: 0; position: relative; }
  .adm-box { max-height: 94vh; }
}
