/* =========================================================
   无人房 · 编辑面板与编辑态
   只在“编辑模式”下出现的界面元素
   ========================================================= */

/* 左下角常驻入口 */
.edit-fab {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 55;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px 0 8px;
  border-radius: 999px;
  font-size: var(--t-xs);
  color: var(--text-2);
  background: var(--surface);
  box-shadow: var(--sh-out);
  cursor: pointer;
  transition: transform .18s, color .2s;
}
.edit-fab:hover { transform: translateY(-2px); color: var(--accent); }
.edit-fab:active { transform: scale(.96); box-shadow: var(--sh-in); }
.edit-fab__mark {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
}

body.is-editing .edit-fab { display: none; }

/* 可编辑文字 */
body.is-editing [data-edit] {
  outline: 1px dashed var(--accent-soft-2);
  outline-offset: 3px;
  border-radius: 4px;
  cursor: text;
  transition: background-color .15s, outline-color .15s;
  min-width: 1ch;
}
body.is-editing [data-edit]:hover { background: var(--accent-soft); outline-color: var(--accent); }
body.is-editing [data-edit]:focus {
  outline: 2px solid var(--accent);
  background: var(--accent-soft);
}
body.is-editing [data-edit]:empty::before {
  content: "点此输入";
  color: var(--text-3);
}

/* 编辑态下按钮不再触发跳转，方便点击文字 */
body.is-editing [data-action] { cursor: default; }

/* 列表条目的删除按钮 */
.item-del {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 3;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: none;
  place-items: center;
  font-size: var(--t-base);
  line-height: 1;
  color: #fff;
  background: var(--danger);
  box-shadow: 0 4px 10px rgba(255, 82, 82, .35);
}
body.is-editing [data-item] { position: relative; }
body.is-editing [data-item] > .item-del { display: grid; }
.item-del:hover { transform: scale(1.08); }

/* =========================================================
   编辑抽屉
   ========================================================= */
.editor {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 80;
  width: min(386px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--sh-out);
  border: 1px solid transparent;
  transform: translateX(calc(100% + 28px));
  transition: transform .36s cubic-bezier(.2, .75, .2, 1);
  overflow: hidden;
}
[data-skin="glass"] .editor {
  border-color: var(--glass-border);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  backdrop-filter: blur(24px) saturate(150%);
}
.editor.is-open { transform: none; }

.editor__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--divider);
}
.editor__head strong { display: block; font-size: var(--t-xl); }
.editor__head small { display: block; margin-top: 2px; font-size: var(--t-2xs); color: var(--text-2); }
.editor__head-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.editor__head-actions .mini-btn { white-space: nowrap; }

.editor__body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 18px 24px;
  scrollbar-width: thin;
}

.ed-note--top {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-in);
  color: var(--text-2);
  font-size: var(--t-2xs);
  line-height: 1.6;
}

.ed-group { padding: 16px 0; border-bottom: 1px dashed var(--divider); }
.ed-group:last-child { border-bottom: 0; }
.ed-group__title {
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--text-2);
  margin-bottom: 12px;
  text-transform: uppercase;
}

.ed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: var(--t-sm);
}
.ed-row:first-of-type { margin-top: 0; }
.ed-row__label { color: var(--text-2); }

.ed-seg {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-in);
  box-shadow: var(--sh-in);
}
.ed-seg button {
  height: 30px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: var(--t-2xs);
  color: var(--text-2);
  transition: color .2s, background-color .2s, box-shadow .2s;
}
.ed-seg button[aria-pressed="true"] {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-soft);
  box-shadow: var(--sh-out);
}

.swatches { display: flex; align-items: center; gap: 8px; }
.swatches button {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
  transition: transform .18s, box-shadow .18s;
}
.swatches button[aria-pressed="true"] {
  transform: scale(1.12);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--c);
}
.swatches input[type="color"] {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.swatches input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.swatches input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }

.ed-slider { margin-top: 12px; }
.ed-slider__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: var(--t-2xs);
  color: var(--text-2);
  margin-bottom: 4px;
}
.ed-slider__top output { color: var(--accent); font-weight: 600; }
.ed-slider .range { height: 10px; margin: 6px 0 2px; }
.ed-slider .range::-webkit-slider-thumb { width: 20px; height: 20px; }
.ed-slider .range::-moz-range-thumb { width: 20px; height: 20px; }

/* 版块顺序 */
.order-list { display: flex; flex-direction: column; gap: 6px; }
.order-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px 7px 12px;
  border-radius: 12px;
  font-size: var(--t-sm);
  background: var(--surface-in);
}
.order-list .order__label { flex: 1; min-width: 0; }
.order-list .order__label[data-hidden="true"] { color: var(--text-3); text-decoration: line-through; }
.mini-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: var(--t-2xs);
  color: var(--text-2);
  background: var(--surface);
  box-shadow: var(--sh-out);
  transition: color .2s, transform .15s;
}
.mini-icon:hover { color: var(--accent); }
.mini-icon:active { transform: scale(.92); }
.mini-icon:disabled { opacity: .35; pointer-events: none; }

.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 11px;
  font-size: var(--t-2xs);
  color: var(--text-2);
  background: var(--surface);
  box-shadow: var(--sh-out);
  transition: color .2s, transform .16s, box-shadow .2s;
}
.mini-btn:hover { color: var(--accent); transform: translateY(-1px); }
.mini-btn:active { transform: scale(.96); box-shadow: var(--sh-in); }
.mini-btn--danger { color: var(--danger); }
.mini-btn--danger:hover { color: var(--danger); }

.ed-note {
  margin-top: 10px;
  font-size: var(--t-2xs);
  line-height: 1.7;
  color: var(--text-3);
}
.ed-note code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-in);
  font-size: .95em;
}

#saveState { margin-top: 10px; }
#saveState[data-tone="ok"] { color: var(--success); }
#saveState[data-tone="err"] { color: var(--danger); }
#saveState[data-tone="warn"] { color: #C88700; }
#saveState[data-tone="busy"] { color: var(--text-2); }

/* 移动端：抽屉变成全宽底板 */
@media (max-width: 520px) {
  .editor {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: 78vh;
    transform: translateY(calc(100% + 20px));
  }
  .editor.is-open { transform: none; }
  .edit-fab { left: 12px; bottom: 12px; }
}

/* 编辑态下打印/导出时隐藏界面 */
@media print {
  .edit-fab, .editor, .item-del { display: none !important; }
  body.is-editing [data-edit] { outline: 0 !important; background: none !important; }
}
