
/* ============================================================================
 * 子地图系统（submap） —— 2026-09-23 新增
 * 流程：大地图图标 → 弹框显示各层缩略图 → 点击放大 → 点热区 → 角色立绘
 * ========================================================================== */

/* ---------- 弹框内的「子地图楼层选择」区 ---------- */
.sm-floors {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 14px; margin-top: 6px; padding-top: 12px;
  border-top: 1px dashed rgba(185, 138, 90, .45);
  max-height: 40vh; overflow-y: auto;
}
.sm-floors::-webkit-scrollbar { width: 6px; }
.sm-floors::-webkit-scrollbar-thumb { background: rgba(185, 138, 90, .4); border-radius: 3px; }

/* 单个楼层卡片：上方标题、中间缩略图、下方角色名 */
.sm-floor {
  width: 190px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  gap: 5px; transition: transform .18s;
}
.sm-floor:hover { transform: translateY(-3px); }
.sm-floor-title {
  font-family: 'KaiTi', 'STKaiti', '楷体', 'Kaiti SC', serif;
  font-size: 16px; color: #4a2c17; letter-spacing: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.sm-floor-thumb {
  width: 100%; height: 96px;
  object-fit: cover;
  border: 1px solid rgba(140, 105, 65, .45);
  border-radius: 3px;
  background: rgba(60, 45, 30, .18);
  filter: sepia(0.18) saturate(0.94) brightness(0.98);
  box-shadow: 2px 3px 6px rgba(74, 58, 40, .14);
  image-rendering: pixelated;
}
.sm-floor-chars {
  font-size: 11.5px; color: #8a7558; line-height: 1.5;
  text-align: center; min-height: 17px;
  max-width: 100%;
}
.sm-floor-chars .none { color: #b8ad99; }

/* ---------- 放大后的子地图视图：铺满整个屏幕 ---------- */
.sm-zoom {
  position: fixed; inset: 0;
  z-index: 1100;
  display: flex; flex-direction: column;
  background: #f5ecd8;
  opacity: 0; transition: opacity .32s;
  overflow: hidden;
}
.sm-zoom.show { opacity: 1; }
.sm-zoom-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px 8px;
  border-bottom: 1px dashed rgba(185, 138, 90, .45);
  flex: 0 0 auto;
  background: #f5ecd8;
}
.sm-zoom-title {
  flex: 1;
  font-family: 'KaiTi', 'STKaiti', '楷体', 'Kaiti SC', serif;
  font-size: 24px; color: #4a2c17; letter-spacing: 3px;
}
.sm-zoom-body {
  position: relative; flex: 1; overflow: hidden;
  margin: 6px 12px 12px;
  border: 1px solid rgba(140, 105, 65, .35);
  border-radius: 3px;
  background: rgba(60, 45, 30, .16);
}
/* 地图图片：可拖动（手机端），默认填满 */
.sm-zoom-img {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
  image-rendering: pixelated;
  cursor: grab; user-select: none; -webkit-user-drag: none;
  touch-action: none;
}
.sm-zoom-img:active { cursor: grabbing; }

/* 热区：只有一个点 + 地名（无外圈） */
.sm-spot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 16px; height: 16px;
  border: none; background: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
/* 中心点 */
.sm-spot::after {
  content: '';
  width: 9px; height: 9px; border-radius: 50%;
  background: #ffd020;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .6), 0 0 5px rgba(255, 208, 32, .55);
  transition: transform .15s, background .15s, box-shadow .15s;
}
/* 有人：绿点 + 呼吸光晕 */
.sm-spot.has-char::after {
  background: #50dc78;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .6), 0 0 5px rgba(80, 220, 120, .6);
}
.sm-spot.has-char { animation: sm-pulse 2s ease-in-out infinite; }
@keyframes sm-pulse {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(80, 220, 120, .5)); }
  50%      { filter: drop-shadow(0 0 7px rgba(80, 220, 120, .95)); }
}
@media (prefers-reduced-motion: reduce) {
  .sm-spot.has-char { animation: none; }
}
/* 跳转热区（楼梯等）：蓝色小方块（旋转 45°），区别于圆点 */
.sm-spot.is-trans::after {
  border-radius: 2px;
  background: #6db8e8;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .6), 0 0 6px rgba(109, 184, 232, .7);
  transform: rotate(45deg);
}
.sm-spot.is-trans:hover::after {
  transform: rotate(45deg) scale(1.35);
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .6), 0 0 10px rgba(109, 184, 232, 1);
}
.sm-spot.is-trans .sm-spot-label { color: #d8f0ff; }
.sm-spot:hover::after {
  transform: scale(1.35);
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .6), 0 0 9px rgba(255, 208, 32, .9);
}

/* 地名标签：白字黑描边，紧贴点的正上方（同标注工具） */
.sm-spot-label {
  position: absolute; left: 50%; bottom: 50%;
  transform: translate(-50%, -10px);
  font-size: 15px; font-weight: 700; color: #fff;
  white-space: nowrap;
  letter-spacing: 0.5px;
  paint-order: stroke;
  -webkit-text-stroke: 3.5px #000;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
  pointer-events: none;
  transition: transform .16s ease-out;
  transform-origin: center bottom;
}
.sm-spot:hover .sm-spot-label {
  transform: translate(-50%, -12px) scale(1.18);
}
.sm-spot.has-char .sm-spot-label { font-size: 14px; }

/* 返回大地图按钮：固定浮层，不随地图拖动（手机端适配） */
.sm-back-btn {
  position: absolute; left: 10px; top: 10px; z-index: 20;
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: 1px solid rgba(140, 105, 65, .55);
  border-radius: 6px;
  background: rgba(255, 248, 234, .92);
  color: #4a2c17; font-size: 14px; font-family: inherit;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(74, 58, 40, .18);
}
.sm-back-btn:hover { background: #fff8ea; }
.sm-back-btn:active { background: #e8dcc0; transform: scale(.96); }
.sm-back-btn::before { content: '←'; font-size: 16px; }

/* ---------- 角色立绘浮层 ---------- */
.sm-portrait {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(30, 18, 8, .78);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .28s;
}
.sm-portrait.show { opacity: 1; }
.sm-portrait-box {
  position: relative;                 /* 让关闭按钮 × 相对盒子定位 */
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 26px 34px 24px;
  background: #f5ecd8;
  border: 1px solid rgba(140, 105, 65, .45);
  border-radius: 6px;
  max-height: 92vh; overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .45);
}
.sm-portrait-box img {
  height: min(62vh, 520px); width: auto; object-fit: contain;
  border-radius: 3px;
  background: url('../assets/input-paper.webp') repeat;
  filter: sepia(0.18) saturate(0.92) brightness(0.99);
  box-shadow: 2px 3px 8px rgba(74, 58, 40, .18);
}
.sm-portrait-name {
  font-family: 'KaiTi', 'STKaiti', '楷体', 'Kaiti SC', serif;
  font-size: 26px; color: #4a2c17; letter-spacing: 3px;
}
.sm-portrait-ep { font-size: 14px; color: #9b8468; }
.sm-portrait-actions { display: flex; gap: 10px; margin-top: 4px; }
.sm-portrait-actions button:active { transform: scale(.96); background: #e8dcc0; }
/* 立绘关闭按钮：确保在最上层且可点 */
.sm-portrait-box .pm-close {
  z-index: 2; position: absolute; top: 8px; right: 12px;
  font-size: 26px; line-height: 1;
}
.sm-portrait-box .pm-close:active { transform: scale(.9); }

/* 手机端适配 */
@media (max-width: 700px) {
  .sm-floor { width: 142px; }
  .sm-floor-thumb { height: 74px; }
  .sm-zoom-title { font-size: 19px; letter-spacing: 1px; }
  .sm-spot-label { font-size: 10.5px; }
  .sm-portrait-box img { height: min(48vh, 380px); }
}
