/* ============================================================
 * xuewei-sketch.css — 点穴示意图 · 样式
 * UI chrome 沿用罗盘现行主题（深棕黑底 + 赭金），画布区纯白（底图规格）。
 * 颜色基准取自线上 bundle：bg #1a1108 / gold #d4a557 / cream #e8d9b8。
 * ============================================================ */

.xs-root {
  --xs-bg: #171009;
  --xs-panel: #1f1509;
  --xs-panel-2: #221809;
  --xs-line: #3a2c17;
  --xs-gold: #d4a557;
  --xs-gold-2: #bba679;
  --xs-cream: #e8d9b8;
  --xs-cream-dim: #a89a78;
  --xs-mute: #8a8170;
  --xs-danger: #e05c4f;
  --xs-zhu: #C8102E;
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: var(--xs-bg);
  color: var(--xs-cream);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.xs-root * { box-sizing: border-box; margin: 0; padding: 0; }
.xs-root button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }

.xs-view { display: flex; flex-direction: column; height: 100%; }

/* ---------- 头部 ---------- */
.xs-head {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 52px;
  padding: 0 8px;
  background: var(--xs-panel);
  border-bottom: 1px solid var(--xs-line);
  flex: none;
}
.xs-head-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #f5e6c8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
}
.xs-head-title.xs-rename { cursor: pointer; }
.xs-head-title.xs-rename:active { color: var(--xs-gold); }
.xs-hbtn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--xs-gold);
  flex: none;
}
.xs-hbtn:active { background: rgba(212, 165, 87, 0.16); }
.xs-export-btn {
  width: auto;
  flex-direction: row;
  gap: 5px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: #1a1108;
  background: var(--xs-gold);
  border-radius: 999px;
}
.xs-export-btn:active { background: var(--xs-gold-2); }
.xs-ic { display: inline-flex; line-height: 0; }
.xs-ic svg { width: 21px; height: 21px; }
.xs-export-btn .xs-ic svg { width: 17px; height: 17px; }

/* ---------- 草稿箱列表 ---------- */
.xs-list-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 96px;
  -webkit-overflow-scrolling: touch;
}
.xs-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--xs-panel-2);
  border: 1px solid #33240f;
  border-radius: 14px;
  margin-bottom: 10px;
  cursor: pointer;
}
.xs-item:active { background: #2b1e0d; }
.xs-item-thumb {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  background: #f5f0e6;
  border: 1px solid var(--xs-line);
  flex: none;
}
.xs-item-thumb-ph { display: block; }
.xs-item-main { flex: 1; min-width: 0; }
.xs-item-name {
  font-size: 15px;
  color: #f5e6c8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.xs-item-time { font-size: 12px; color: var(--xs-mute); margin-top: 4px; }
.xs-item-more {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--xs-cream-dim);
  flex: none;
}
.xs-item-more:active { background: rgba(212, 165, 87, 0.14); }

.xs-empty { text-align: center; padding: 72px 24px; color: var(--xs-mute); }
.xs-empty p { font-size: 13.5px; line-height: 1.9; }
.xs-empty-seal {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border: 2px solid var(--xs-zhu);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--xs-zhu);
  font-family: "STSong", "SimSun", serif;
  font-size: 30px;
  transform: rotate(-4deg);
  opacity: 0.9;
}

.xs-fab {
  position: absolute;
  right: 16px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  height: 48px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--xs-gold);
  color: #1a1108;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  z-index: 5;
}
.xs-fab:active { background: var(--xs-gold-2); }
.xs-fab .xs-ic svg { width: 18px; height: 18px; }

/* ---------- 编辑器 ---------- */
.xs-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #0f0a05;
  min-height: 0;
}
.xs-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #ffffff;
  touch-action: none; /* 指针手势自管，禁浏览器滚动/缩放抢占 */
}

.xs-bar {
  flex: none;
  background: var(--xs-panel);
  border-top: 1px solid var(--xs-line);
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.xs-bar-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;      /* lp_fix3_1022 问题3：360px 窄屏换行，选项全部在屏可点 */
  overflow-x: auto;
  scrollbar-width: none;
}
.xs-bar-row::-webkit-scrollbar { display: none; }
.xs-bar-gap { flex: 1; }

.xs-tbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 44px;
  padding: 5px 5px;
  border-radius: 12px;
  color: var(--xs-cream-dim);
  font-size: 11px;
  flex: 1 1 44px;       /* 窄屏均分：第一行 4 工具+3 操作 360px 全在屏 */
}
.xs-tbtn:active { background: rgba(212, 165, 87, 0.12); }
.xs-tbtn.on { color: #1a1108; background: var(--xs-gold); font-weight: 600; }
.xs-tbtn:disabled { opacity: 0.32; pointer-events: none; }

.xs-opt-group { display: flex; align-items: center; gap: 6px; flex: none; }
.xs-opt-label { font-size: 11px; color: var(--xs-mute); flex: none; }
.xs-opt-hint { font-size: 11px; color: var(--xs-mute); padding-left: 2px; width: 100%; }

.xs-seg {
  display: flex;
  border: 1px solid var(--xs-line);
  border-radius: 999px;
  overflow: hidden;
}
.xs-seg button {
  padding: 5px 10px;
  font-size: 12px;
  color: var(--xs-cream-dim);
  background: transparent;
}
.xs-seg button.on { background: var(--xs-gold); color: #1a1108; font-weight: 600; }

.xs-colors { display: flex; gap: 8px; }
.xs-cdot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--c);
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  flex: none;
}
.xs-cdot.on { border-color: #f5e6c8; }

/* ---------- 文字弹层 ---------- */
.xs-textpop {
  position: absolute;
  width: 268px;
  background: rgba(34, 24, 9, 0.96);
  border: 1px solid var(--xs-line);
  border-radius: 14px;
  padding: 12px;
  z-index: 6;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
  animation: xs-pop 0.18s ease-out;
}
@keyframes xs-pop {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}
.xs-textpop-title { font-size: 13px; font-weight: 600; color: #f5e6c8; margin-bottom: 8px; }
.xs-words { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.xs-word {
  padding: 7px 2px;
  border-radius: 8px;
  background: var(--xs-bg);
  border: 1px solid var(--xs-line);
  color: var(--xs-cream);
  font-size: 13px;
  font-family: "STSong", "SimSun", serif;
}
.xs-word:active { border-color: var(--xs-gold); color: var(--xs-gold); }
.xs-textpop .xs-colors { margin: 10px 0 4px; }
.xs-textpop-btns { display: flex; gap: 8px; margin-top: 10px; }
.xs-textpop-btns .xs-btn { padding: 8px 0; font-size: 13px; }

.xs-textpop-input,
.xs-modal-input {
  width: 100%;
  background: var(--xs-bg);
  border: 1px solid var(--xs-line);
  border-radius: 10px;
  padding: 10px 12px;
  color: #f5e6c8;
  font-size: 15px;
  outline: none;
  user-select: text;
}
.xs-textpop-input:focus,
.xs-modal-input:focus { border-color: var(--xs-gold); }
.xs-textpop-input { margin: 8px 0 2px; font-size: 14px; }

/* ---------- 弹层：底部抽屉 / 模态 / toast ---------- */
.xs-sheet { position: absolute; inset: 0; z-index: 20; }
.xs-sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.24s ease;
}
.xs-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--xs-panel-2);
  border-radius: 18px 18px 0 0;
  border-top: 1px solid var(--xs-line);
  padding: 8px 12px calc(14px + env(safe-area-inset-bottom));
  transform: translateY(102%);
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.25, 1.05);
}
.xs-sheet.on .xs-sheet-mask { opacity: 1; }
.xs-sheet.on .xs-sheet-panel { transform: translateY(0); }
.xs-sheet-item {
  display: block;
  width: 100%;
  padding: 14px 10px;
  border-radius: 10px;
  color: var(--xs-cream);
  font-size: 15px;
  text-align: center;
}
.xs-sheet-item:active { background: rgba(212, 165, 87, 0.12); }
.xs-sheet-item.xs-danger { color: var(--xs-danger); }

.xs-modal { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; }
.xs-modal-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); }
.xs-modal-panel {
  position: relative;
  width: min(86vw, 340px);
  background: var(--xs-panel-2);
  border: 1px solid var(--xs-line);
  border-radius: 16px;
  padding: 18px;
  animation: xs-pop 0.16s ease-out;
}
.xs-modal-title { font-size: 16px; font-weight: 600; color: #f5e6c8; margin-bottom: 10px; }
.xs-modal-body p { font-size: 13px; color: var(--xs-cream-dim); line-height: 1.75; }
.xs-modal-btns { display: flex; gap: 10px; margin-top: 16px; }

.xs-btn {
  flex: 1;
  padding: 10px 0;
  border-radius: 10px;
  border: 1px solid var(--xs-line);
  background: transparent;
  color: var(--xs-cream-dim);
  font-size: 14px;
}
.xs-btn:active { background: rgba(212, 165, 87, 0.12); }
.xs-btn-gold { background: var(--xs-gold); border-color: var(--xs-gold); color: #1a1108; font-weight: 600; }
.xs-btn-gold:active { background: var(--xs-gold-2); }
.xs-btn-danger { color: var(--xs-danger); border-color: rgba(224, 92, 79, 0.45); }

.xs-toast {
  background: rgba(26, 17, 8, 0.94);
  color: #f5e6c8;
  border: 1px solid var(--xs-line);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
  animation: xs-toast-in 0.18s ease-out;
}
@keyframes xs-toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .xs-root * { animation-duration: 0.01s !important; transition-duration: 0.01s !important; }
}
